/* =====================================================
   QuickStand – Create Modal (Bottom Sheet)
   Ziel: kompakt, modern, iOS-safe, responsive für jede Größe
===================================================== */

.qs-create-modal{
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: none;
}
.qs-create-modal.is-open{ display: block; }

.qs-create-backdrop{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.38);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: opacity 180ms ease;
  touch-action: none;
}

/* ====== Bottom Sheet (Mobile/Tablet bis 1023px) ====== */
.qs-create-sheet{
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;

  width: auto;
  max-width: 100%;
  margin: 0;

  background: #fff;
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -14px 40px rgba(0,0,0,.20);

  /* kompakter, damit es nicht "zu groß" wirkt */
  padding: 10px 14px calc(12px + env(safe-area-inset-bottom));
  box-sizing: border-box;

  /* responsive max-height: nie riesig, nie zu klein */
  max-height: clamp(190px, 40vh, 320px);

  display: flex;
  flex-direction: column;
  overflow: hidden;

  --qs-sheet-y: 0px;
  transform: translateY(var(--qs-sheet-y));
  transition: transform 220ms ease;
}

/* iOS: svh verhindert "zu groß" wegen Safari Address-Bar */
@supports (height: 100svh){
  .qs-create-sheet{
    max-height: clamp(190px, 40svh, 320px);
  }
}

/* Sehr kleine Geräte: noch etwas kompakter */
@media (max-width: 360px){
  .qs-create-sheet{
    padding: 9px 12px calc(11px + env(safe-area-inset-bottom));
    max-height: clamp(180px, 44vh, 300px);
  }
  @supports (height: 100svh){
    .qs-create-sheet{ max-height: clamp(180px, 44svh, 300px); }
  }
}

/* Landscape / kleine Höhe: noch kompakter, damit nix "drüber" wirkt */
@media (max-height: 520px){
  .qs-create-sheet{
    padding: 8px 12px calc(10px + env(safe-area-inset-bottom));
    max-height: clamp(170px, 58vh, 280px);
  }
  @supports (height: 100svh){
    .qs-create-sheet{ max-height: clamp(170px, 58svh, 280px); }
  }
}

/* Handle */
.qs-create-handle{
  flex: 0 0 auto;
  width: 44px;
  height: 5px;
  border-radius: 999px;
  background: rgba(0,0,0,.18);
  margin: 2px auto 8px;
  touch-action: none;
}

/* Header */
.qs-create-header{
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;

  padding-bottom: 10px;
  border-bottom: 1px solid rgba(0,0,0,.06);
}

.qs-create-title{
  font-size: 20px;
  font-weight: 800;
  letter-spacing: .2px;
  color: #0b2a4a;
}

/* Close Button (mit close.png) */
.qs-create-close{
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;

  border-radius: 999px;
  border: 1px solid rgba(0,0,0,.10);

  /* WICHTIG: nicht "background:" verwenden, sondern background-color */
  background-color: rgba(0,0,0,.03);

  /* Icon */
  background-image: url("/assets/icons/close.png");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 18px 18px;

  /* Das "×" im HTML bleibt als Fallback, wird aber unsichtbar */
  color: transparent;
  font-size: 0;
  line-height: 0;

  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;

  transition: transform 120ms ease, background-color 120ms ease, border-color 120ms ease;
}

.qs-create-close:hover{
  background-color: rgba(0,0,0,.06);
  border-color: rgba(0,0,0,.14);
}

.qs-create-close:active{
  transform: scale(0.96);
  background-color: rgba(0,0,0,.08);
}

.qs-create-close:focus-visible{
  outline: 2px solid rgba(11,42,74,.35);
  outline-offset: 2px;
}

/* Content: scrollt nur wenn’s mal mehr Einträge werden */
.qs-create-actions{
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 10px;

  display: flex;
  flex-direction: column;
  gap: 10px;

  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-bottom: 2px;
}

/* Buttons (etwas kompakter & moderner) */
.qs-create-action{
  height: 52px;
  border-radius: 16px;
  border: 1px solid rgba(0,0,0,.08);
  background: #fff;

  display: flex;
  align-items: center;
  justify-content: center;

  text-decoration: none;
  font-weight: 800;
  font-size: 17px;
  color: #0b2a4a;

  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.qs-create-action.primary{
  border: 0;
  background: linear-gradient(180deg, #0b2a4a, #071d33);
  color: #fff;
}

.qs-create-action:not([disabled]):active{
  transform: scale(0.99);
}

.qs-create-action:disabled,
.qs-create-action[disabled]{
  opacity: .45;
}

/* Body-Lock (JS ergänzt das iOS-feste Locking) */
html.qs-modal-open,
body.qs-modal-open{
  height: 100%;
  overflow: hidden;
}

/* ====== Desktop: Center-Dialog erst ab 1024px ====== */
@media (min-width: 1024px){
  .qs-create-sheet{
    left: 50%;
    top: 50%;
    right: auto;
    bottom: auto;

    width: min(520px, calc(100vw - 32px));
    max-width: none;

    border-radius: 18px;
    padding: 18px;

    max-height: min(80vh, 560px);
    overflow: hidden;

    transform: translate(-50%, -50%) translateY(var(--qs-sheet-y));
  }

  .qs-create-handle{ display: none; }

  .qs-create-header{
    padding-bottom: 12px;
  }

  .qs-create-title{
    font-size: 22px;
  }
}
