/* ============================================================
   <pb-sort-menu> — the "Sortieren" dropdown
   ------------------------------------------------------------
   Gleiche Sprache wie die Beruf-/Ort-Filter-Popover (13.08.,
   Wunsch Mathias): dasselbe Panel (surface, r-xl, shadow-lg,
   gleicher Eintritt) und dieselben Zeilen wie `.alt .lp-row`
   (konzentrischer Radius, fill-hover, aktiv = fett +
   Häkchen — keine Füllung). Eigene Keyframes-Kopie, damit das
   Menü nicht am Stylesheet des Location-Pickers hängt.
   ============================================================ */

.sortpop {
  position: fixed;
  z-index: var(--z-popover);
  min-width: 13rem;
  max-width: calc(100vw - 1rem);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: none;
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  padding: 0.5rem;                       /* wie .lp-list */
  text-align: left;
  animation: sortpop-in 0.16s var(--ease);
}
@keyframes sortpop-in {
  from { opacity: 0; transform: translateY(-0.25rem) scale(0.985); }
  to   { opacity: 1; transform: none; }
}
/* Öffnet das Menü nach OBEN, wächst es aus der Unterkante. */
.sortpop.up { transform-origin: bottom left; }

/* ---- Option rows — wie .alt .lp-row ------------------------ */
.sort-opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  font-family: var(--font-body);
  font-size: var(--fs-body);
  color: var(--text);
  background: transparent;
  border: none;
  border-radius: calc(var(--r-xl) - 0.5rem);   /* konzentrisch zum Panel */
  /* Pop-out-Grammatik (Review Memorisely-Regeln 11.10.2026): Zeilen 40px, Rand 12px im 4px-Raster
     (vorher 9/13px) — gleich in Sortieren, Merken, ⋮-Menü und Ort */
  min-height: 2.5rem;
  padding: 0 0.75rem;
  cursor: pointer;
  white-space: nowrap;
  text-align: left;
  transition: background var(--dur) var(--ease);
}
.sort-opt:hover { background: var(--fill-hover); }
.sort-opt.on .sort-opt-t { font-weight: 600; }
.sort-opt-t { flex: 1; }

/* The check reserves its slot on every row (kept invisible) so the
   labels stay aligned; it appears only on the active row. */
.sort-opt-ck {
  flex: none;
  display: grid;
  place-items: center;
  color: var(--text);
  opacity: 0;
}
.sort-opt.on .sort-opt-ck { opacity: 1; }
.sort-opt-ck svg { width: 14px; height: 14px; }
/* Gesperrte Zeilen (Tagessatz ohne Berechtigung): ausgegraut + Schloss.
   Seit 03.10.2026 klickbar (Tooltip, Klick öffnet den Tarif) — Zeiger
   statt Pfeil, kein Hover-Fill: die Zeile bleibt sichtbar gesperrt. */
.sort-opt.locked { color: var(--text-faint); cursor: pointer; }
.sort-opt.locked:hover { background: transparent; color: var(--text-faint); }
.sort-opt-lock {
  flex: none;
  display: grid;
  place-items: center;
  /* Schloss-Sprache: warn wie die Tagessatz-Pille (30.08., Mathias) */
  color: var(--warn);
}
.sort-opt-lock svg { width: 12px; height: 12px; }

/* ---- Handy (15.10.2026, Mathias: wie die Osmo-Vault, Sortier-Pop-over
   „Newest“ bei 390px gemessen) ----
   Grundgröße 16px bei 390px (calc(1rem × 8/7), wie Handymenü und
   Kontomenü); Karte mit 1px heller Kante (Text 10 %), Radius 22px
   (1.375em), Innenrand 8px, kaum Schatten; Zeilen als Pillen 30px
   (0 10 0 14px) mit 2px Abstand, 16px normal im leisen Grau, die gewählte
   hell auf einer Fläche (Text 5,5 %) mit Häkchen; öffnet in 0,3 s mit der
   Osmo-Kurve. Abweichung: die übrigen Zeilen in --text-soft statt des
   Vault-Graus — das läge bei rund 3 : 1 (hell) bzw. 3,7 : 1 (dunkel), unter
   WCAG AA. Werte: DESIGN-SYSTEM → Osmo-Standard → Handyansicht. */
@media (max-width: 767.98px) {
  .sortpop {
    font-size: calc(1rem * 8 / 7);
    border: 1px solid color-mix(in srgb, var(--text) 10%, transparent);
    border-radius: 1.375em;
    box-shadow: 0 4px 8px rgb(0 0 0 / 0.04);
    padding: 0.5em;
    gap: 2px;
    animation: pop-in-m 0.3s cubic-bezier(0.625, 0.05, 0, 1);
  }
  .sort-opt {
    min-height: 1.875em;
    padding: 0 0.625em 0 0.875em;
    border-radius: var(--r-pill);
    font-size: 1em;
    font-weight: 400;
    letter-spacing: -0.01em;
    color: var(--text-soft); /* Text: WCAG AA (Vault-Grau läge bei rund 3 : 1) */
  }
  .sort-opt.on {
    background: color-mix(in srgb, var(--text) 5.5%, transparent);
    color: var(--text);
  }
  .sort-opt.on .sort-opt-t { font-weight: 400; }
}
@keyframes pop-in-m { from { opacity: 0; transform: translateY(-0.5em); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .sortpop { animation: none; }
}
