/*
 * search-palette.css — Globale Such-Palette (BC-Style Command-Palette).
 * Modul: docs/reference/design-system/modules.md#search-palette
 * Markup baut gs-palette.js (window.LoDGlobalSearch). Overlay oben angedockt,
 * auf <600px Vollbild. Z-Index aus tokens.css (--z-gs-*), unter Toast/Error.
 */

/* ── Backdrop (oben angedockt, nicht zentriert) ─────────────────────── */
.app-scope .gs-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-gs-backdrop);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
  padding-left: 16px;
  padding-right: 16px;
  /* Premium: leichter Schleier + Frosted-Blur statt Voll-Verdunkelung —
     der Kontext bleibt sichtbar (Spotlight-Feel). */
  background: color-mix(in srgb, var(--lod-darkblue-900) 18%, transparent);
  -webkit-backdrop-filter: blur(5px) saturate(115%);
  backdrop-filter: blur(5px) saturate(115%);
  animation: app-drawerFade var(--duration-medium) var(--lod-ease) both;
}

/* ── Panel ──────────────────────────────────────────────────────────── */
.app-scope .gs-palette {
  position: relative;
  z-index: var(--z-gs-panel);
  width: 100%;
  max-width: 820px; /* breiter fuer das zweispaltige Layout (Ergebnisse + Vorschau) */
  max-height: 70vh;
  display: flex;
  flex-direction: row; /* linke Spalte (gs-main) + rechte Vorschau-Spalte (gs-preview) */
  background: var(--lod-white);
  border: 1px solid var(--lod-gray-200);
  border-radius: var(--lod-radius-lg);
  box-shadow: var(--lod-shadow-lg);
  overflow: hidden;
  animation: app-modalPop var(--duration-flow) var(--lod-ease) both;
}

/* ── Eingabe-Zeile ──────────────────────────────────────────────────── */
.app-scope .gs-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--lod-gray-100);
  flex-shrink: 0;
}
.app-scope .gs-input-host {
  flex: 1;
  min-width: 0;
}
/* Schliessen-Button: einziger Touch-Ausgang der Vollbild-Palette auf Mobile.
   >=600px versteckt (dort schliessen ESC + Backdrop-Tap), s. Mobile-Block unten. */
.app-scope .gs-close-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
}
.app-scope .gs-close-btn:active { background: var(--lod-gray-100); }

/* ── Scope-Filter-Pills ─────────────────────────────────────────────── */
.app-scope .gs-scopes {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  padding: 0 10px 8px;
  overflow-x: auto;
  /* Scrollbar ausblenden + weiche Ausblendung am rechten Rand: angeschnittene
     Pills faden sauber aus statt hart zu zerschneiden (signalisiert "scrollen"). */
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent 100%);
          mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent 100%);
}
.app-scope .gs-scopes::-webkit-scrollbar { display: none; }
.app-scope .gs-scopes:empty { display: none; }
.app-scope .gs-scope-pill {
  flex-shrink: 0;
  border: 1px solid var(--lod-gray-200);
  background: var(--lod-white);
  color: var(--lod-muted);
  border-radius: var(--radius-circular);
  padding: 3px 11px;
  font-size: var(--font-size-sm);
  font-family: var(--lod-font-body);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--duration-snap) var(--lod-ease), color var(--duration-snap) var(--lod-ease);
}
.app-scope .gs-scope-pill:hover { background: var(--color-bg-subtle); color: var(--lod-fg-1); }
.app-scope .gs-scope-pill.is-active {
  background: var(--brand-default);
  border-color: transparent;
  color: var(--lod-white);
}

/* ── Linke Spalte: Eingabe + Pills + Ergebnisse + Footer (gleiche Breite) ─ */
.app-scope .gs-main {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
}

/* ── Ergebnisliste ──────────────────────────────────────────────────── */
.app-scope .gs-results {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  padding: 8px;
}

/* ── Vorschau-Panel ─────────────────────────────────────────────────── */
.app-scope .gs-preview {
  flex: 0 0 300px;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
  border-left: 1px solid var(--lod-gray-100);
  background: var(--lod-bg-soft);
}
.app-scope .gs-preview-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 100%;
  text-align: center;
  color: var(--lod-muted);
  font-size: var(--fs-body);
}
.app-scope .gs-preview-empty .ui-ico img { width: 28px; height: auto; opacity: 0.4; }
.app-scope .gs-preview-head {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 14px;
}
.app-scope .gs-preview-ico {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  background: var(--lod-white);
  border: 1px solid var(--lod-gray-200);
}
.app-scope .gs-preview-headmain { min-width: 0; }
.app-scope .gs-preview-title {
  font-weight: var(--fw-semibold);
  font-size: 15px;
  line-height: 1.3;
  color: var(--lod-fg-1);
  overflow-wrap: anywhere;
}
.app-scope .gs-preview-type {
  font-size: var(--font-size-sm);
  color: var(--lod-muted);
  margin-top: 2px;
}
.app-scope .gs-preview-fields {
  margin: 0 0 16px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 12px;
}
.app-scope .gs-preview-fields dt {
  font-size: var(--font-size-sm);
  color: var(--lod-muted);
}
.app-scope .gs-preview-fields dd {
  margin: 0;
  font-size: var(--fs-body);
  color: var(--lod-fg-1);
  min-width: 0; /* sonst sprengt ein langer Wert die 1fr-Spalte → horizontaler Overflow */
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-scope .gs-preview-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.app-scope .gs-preview-btn {
  border: 1px solid var(--lod-gray-200);
  background: var(--lod-white);
  border-radius: var(--radius-lg);
  padding: 6px 12px;
  font-size: var(--font-size-sm);
  font-family: var(--lod-font-body);
  color: var(--lod-fg-1);
  cursor: pointer;
}
.app-scope .gs-preview-btn:hover { background: var(--color-bg-subtle); }
.app-scope .gs-preview-btn--primary {
  background: var(--brand-default);
  border-color: transparent;
  color: var(--lod-white);
}
.app-scope .gs-preview-btn--primary:hover { background: var(--brand-hover, var(--brand-default)); }
/* Hilfe-/Befehls-Modus: keine Vorschau → Liste nutzt die volle Breite. */
.app-scope .gs-palette.gs-mode-help .gs-preview { display: none; }
.app-scope .gs-group + .gs-group {
  margin-top: 6px;
}
.app-scope .gs-group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: var(--fs-badge);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--lod-muted);
  padding: 8px 10px 4px;
}

.app-scope .gs-group-count {
  font-weight: var(--fw-semibold);
  letter-spacing: 0;
  text-transform: none;
  color: var(--brand-primary);
  white-space: nowrap;
}

/* Kunden-Pivot: "alles zur Firma X" — optisch abgesetzter Block (das intelligente Feature). */
.app-scope .gs-pivot {
  margin-top: 10px;
  padding: 6px 0 2px;
  border-top: 1px solid var(--lod-border, #e0e0e0);
}
.app-scope .gs-pivot-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px 4px;
  font-size: var(--font-size-sm);
  font-weight: var(--fw-bold);
  color: var(--brand-primary);
}
.app-scope .gs-pivot-head .ui-ico,
.app-scope .gs-pivot-head .ui-ico img {
  width: 16px;
  height: 16px;
}
.app-scope .gs-pivot-group + .gs-pivot-group { margin-top: 2px; }

/* Trennlabel ueber den flachen "Weitere Treffer", wenn ein Pivot darueber steht. */
.app-scope .gs-section-label {
  margin-top: 12px;
  padding: 6px 10px 2px;
  border-top: 1px solid var(--lod-border, #e0e0e0);
  font-size: var(--fs-badge);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--lod-muted);
}

.app-scope .gs-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 9px 10px;
  border-radius: var(--radius-lg);
  cursor: pointer;
  color: var(--lod-fg-1);
  font-family: var(--lod-font-body);
  font-size: var(--font-size-base);
  text-decoration: none;
  transition: background var(--duration-fast, 0.1s) var(--lod-ease);
}
/* Hover + Tastatur-Aktiv: klar sichtbarer, premium Brand-Ton (wie Dropdown-Items),
   nicht das blasse Grau. GsListNav synct Active mit Maus-Hover. */
.app-scope .gs-item.is-active,
.app-scope .gs-item:hover {
  background: var(--brand-light);
}
/* Icon in einer dezenten Kachel (Spotlight/Raycast-Premium). */
.app-scope .gs-item-ico {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  background: var(--lod-gray-50);
}
.app-scope .gs-item.is-active .gs-item-ico,
.app-scope .gs-item:hover .gs-item-ico {
  background: var(--lod-white);
}
.app-scope .gs-item-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.app-scope .gs-item-title {
  font-weight: var(--fw-medium);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.app-scope .gs-item-title mark {
  background: var(--rating-warm-bg);
  color: inherit;
  border-radius: var(--radius-xxs);
  padding: 0 1px;
}
.app-scope .gs-item-sub {
  font-size: var(--font-size-sm);
  color: var(--lod-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.app-scope .gs-item-badge {
  flex-shrink: 0;
  font-size: var(--fs-badge);
  color: var(--lod-muted);
  border: 1px solid var(--lod-gray-200);
  border-radius: var(--radius-circular);
  padding: 1px 8px;
}
/* Pro-Treffer Quick-Action (Link kopieren) — erscheint bei Aktiv/Hover. */
.app-scope .gs-item-action {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: var(--radius-md);
  opacity: 0;
  cursor: pointer;
  transition: opacity var(--duration-fast, 0.1s) var(--lod-ease), background var(--duration-fast, 0.1s) var(--lod-ease);
}
.app-scope .gs-item-action img { width: 15px; height: auto; opacity: 0.7; }
.app-scope .gs-item.is-active .gs-item-action,
.app-scope .gs-item:hover .gs-item-action { opacity: 1; }
.app-scope .gs-item-action:hover { background: var(--lod-gray-100); }

.app-scope .gs-hint {
  padding: 24px 16px;
  text-align: center;
  color: var(--lod-muted);
  font-size: var(--fs-body);
}
.app-scope .gs-hint--warn { color: var(--tone-warn-text); }

/* ── How-To-Banner (Hilfe-Modus) ─────────────────────────────────────── */
.app-scope .gs-howto {
  margin: 4px 6px 8px;
  padding: 8px 12px;
  border-radius: var(--radius-lg);
  background: var(--tone-info-soft);
  color: var(--tone-info-text);
  font-size: var(--font-size-sm);
  line-height: 1.5;
}
.app-scope .gs-howto kbd {
  font-family: var(--lod-font-mono);
  border: 1px solid color-mix(in srgb, var(--tone-info-text) 25%, transparent);
  border-radius: var(--radius-sm);
  padding: 0 4px;
  margin: 0 1px;
}

/* ── Befehls-Zeilen-Extras ───────────────────────────────────────────── */
.app-scope .gs-item--static { cursor: default; }
.app-scope .gs-item--static:hover { background: transparent; }
.app-scope .gs-item.is-disabled { opacity: 0.5; }
.app-scope .gs-cmd-keys {
  flex-shrink: 0;
  display: inline-flex;
  gap: 3px;
}
.app-scope .gs-cmd-keys kbd {
  font-family: var(--lod-font-mono);
  font-size: var(--fs-badge);
  border: 1px solid var(--lod-gray-200);
  border-radius: var(--radius-sm);
  padding: 1px 5px;
  background: var(--lod-gray-50);
  color: var(--lod-fg-1);
}
.app-scope .gs-cmd-go {
  flex-shrink: 0;
  font-family: var(--lod-font-mono);
  color: var(--lod-muted);
  opacity: 0;
  transition: opacity var(--duration-fast, 0.1s) var(--lod-ease);
}
.app-scope .gs-item.is-active .gs-cmd-go { opacity: 0.8; }

/* ── Fuss-Zeile (Toggle + Tastatur-Hinweise) ─────────────────────────── */
.app-scope .gs-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
  padding: 6px 10px;
  border-top: 1px solid var(--lod-gray-100);
  font-size: var(--fs-badge);
  color: var(--lod-muted);
  background: var(--lod-gray-50);
}
.app-scope .gs-foot-cmd {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  border-radius: var(--radius-md);
  padding: 4px 8px;
  cursor: pointer;
  color: var(--lod-fg-1);
  font-family: var(--lod-font-body);
  font-size: var(--font-size-sm);
}
.app-scope .gs-foot-cmd:hover { background: var(--color-bg-subtle); }
.app-scope .gs-foot-cmd.is-active { background: var(--brand-light); color: var(--tone-info-text); }
.app-scope .gs-foot-cmd .ui-ico { opacity: 0.7; }
.app-scope .gs-foot-hints { display: inline-flex; gap: 14px; align-items: center; }
.app-scope .gs-foot-hint { display: inline-flex; align-items: center; gap: 4px; }
.app-scope .gs-foot-hints kbd {
  font-family: var(--lod-font-mono);
  font-size: var(--fs-badge);
  border: 1px solid var(--lod-gray-200);
  border-radius: var(--radius-sm);
  background: var(--lod-white);
  /* einheitliche Box-Groesse, damit ↑ ↓ ↵ Esc nicht ungleichmaessig wirken */
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

/* ── Notebook (1000–1399) — zweispaltig bleibt, etwas schmaler ──────── */
@media (max-width: 1399px) {
  .app-scope .gs-palette { max-width: 760px; }
  .app-scope .gs-preview { flex-basis: 280px; }
}

/* ── Tablet (600–999) — Vorschau aus, einspaltig ────────────────────── */
@media (max-width: 999px) {
  .app-scope .gs-backdrop { padding-top: 8vh; }
  .app-scope .gs-palette { max-width: 92vw; max-height: 78vh; }
  .app-scope .gs-preview { display: none; }
}

/* ── Mobile (<600) — Vollbild ───────────────────────────────────────── */
@media (max-width: 599px) {
  .app-scope .gs-backdrop {
    padding: 0;
    align-items: stretch;
  }
  .app-scope .gs-palette {
    max-width: 100%;
    max-height: 100%;
    width: 100%;
    border-radius: 0;
    border: 0;
  }
  /* Footer bleibt (Zugang zu "Alle Befehle"), nur die Tastatur-Hinweise weg. */
  .app-scope .gs-foot-hints { display: none; }
  /* Vollbild ohne sichtbaren Backdrop + ohne ESC → X-Button ist der Ausgang. */
  .app-scope .gs-close-btn { display: inline-flex; }
}
