/* ─────────────────────────────────────────────────────────────
 * ⌘K Search Palette — docs.agencyg.de
 * Fuzzy-search over all 59 doc pages + scripts. Stripe/Linear-style.
 * ─────────────────────────────────────────────────────────── */

.aai-search-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px 7px 12px;
  border-radius: 10px;
  border: 1px solid rgba(201, 162, 39, 0.2);
  background: rgba(201, 162, 39, 0.06);
  color: rgba(245, 240, 224, 0.65);
  font-family: inherit;
  font-size: 12.5px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  min-width: 180px;
}
.aai-search-btn:hover {
  background: rgba(201, 162, 39, 0.12);
  border-color: rgba(201, 162, 39, 0.4);
  color: #f5f0e0;
}
.aai-search-btn .aai-search-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: 0.8;
}
.aai-search-btn .aai-search-label {
  flex: 1;
  text-align: left;
}
.aai-search-btn kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 4px;
  border: 1px solid rgba(201, 162, 39, 0.25);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(245, 240, 224, 0.8);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.aai-search-btn kbd + kbd { margin-left: 2px; }

/* Overlay backdrop */
.aai-search-overlay {
  position: fixed;
  inset: 0;
  z-index: 10020;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 16px 16px;
  background: rgba(4, 3, 1, 0.62);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  transition: opacity 0.2s cubic-bezier(.2, 1, .3, 1);
}
.aai-search-overlay.is-open {
  display: flex;
  opacity: 1;
}

/* Palette panel */
.aai-search-panel {
  width: 100%;
  max-width: 640px;
  background: linear-gradient(180deg, #0d0a04 0%, #070502 100%);
  border: 1px solid rgba(201, 162, 39, 0.3);
  border-radius: 16px;
  overflow: hidden;
  box-shadow:
    0 40px 100px -20px rgba(0, 0, 0, 0.8),
    0 0 0 1px rgba(201, 162, 39, 0.15),
    0 0 80px -10px rgba(201, 162, 39, 0.25);
  transform: translateY(-12px) scale(0.98);
  transition: transform 0.3s cubic-bezier(.2, 1.1, .3, 1);
  font-family: "Space Grotesk", "Inter", sans-serif;
  color: #f5f0e0;
}
.aai-search-overlay.is-open .aai-search-panel {
  transform: translateY(0) scale(1);
}

/* Search input row */
.aai-search-input-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(201, 162, 39, 0.15);
}
.aai-search-input-row svg {
  width: 18px;
  height: 18px;
  color: #c9a227;
  flex-shrink: 0;
}
.aai-search-input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: 0;
  color: #f5f0e0;
  font-family: inherit;
  font-size: 16px;
  caret-color: #c9a227;
}
.aai-search-input::placeholder {
  color: rgba(245, 240, 224, 0.4);
}
.aai-search-close {
  border: 1px solid rgba(201, 162, 39, 0.2);
  background: transparent;
  color: rgba(245, 240, 224, 0.65);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.aai-search-close:hover {
  border-color: rgba(201, 162, 39, 0.45);
  color: #f5f0e0;
}

/* Results area */
.aai-search-results {
  max-height: 56vh;
  overflow-y: auto;
  padding: 6px;
}
.aai-search-results::-webkit-scrollbar { width: 6px; }
.aai-search-results::-webkit-scrollbar-track { background: transparent; }
.aai-search-results::-webkit-scrollbar-thumb { background: rgba(201,162,39,0.25); border-radius: 3px; }

.aai-search-group-label {
  display: block;
  padding: 12px 14px 6px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(245, 240, 224, 0.45);
}

.aai-search-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s, transform 0.15s;
  border: 1px solid transparent;
}
.aai-search-item:hover,
.aai-search-item.is-active {
  background: linear-gradient(90deg, rgba(201,162,39,0.13), rgba(201,162,39,0.05));
  border-color: rgba(201, 162, 39, 0.28);
}
.aai-search-item-icon {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(201, 162, 39, 0.1);
  color: #c9a227;
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  font-weight: 700;
  border: 1px solid rgba(201, 162, 39, 0.25);
}
.aai-search-item-body {
  flex: 1;
  min-width: 0;
}
.aai-search-item-title {
  font-size: 13.5px;
  font-weight: 600;
  color: #f5f0e0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.aai-search-item-title mark {
  background: rgba(201, 162, 39, 0.3);
  color: #ffe49a;
  padding: 0 2px;
  border-radius: 2px;
}
.aai-search-item-meta {
  margin-top: 2px;
  font-size: 11.5px;
  color: rgba(245, 240, 224, 0.55);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.aai-search-item-kbd {
  flex-shrink: 0;
  font-family: "JetBrains Mono", monospace;
  font-size: 10.5px;
  color: rgba(245, 240, 224, 0.45);
  opacity: 0;
  transition: opacity 0.15s;
}
.aai-search-item.is-active .aai-search-item-kbd { opacity: 1; }

.aai-search-empty {
  padding: 40px 20px;
  text-align: center;
  color: rgba(245, 240, 224, 0.5);
  font-size: 13px;
}
.aai-search-empty strong {
  display: block;
  margin-bottom: 4px;
  color: #f5f0e0;
  font-size: 14px;
}

/* Footer with hotkey hints */
.aai-search-footer {
  display: flex;
  gap: 16px;
  padding: 10px 16px;
  border-top: 1px solid rgba(201, 162, 39, 0.12);
  background: rgba(0, 0, 0, 0.25);
  font-size: 11px;
  color: rgba(245, 240, 224, 0.5);
}
.aai-search-footer-hint {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.aai-search-footer-hint kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 3px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(245, 240, 224, 0.8);
  font-family: "JetBrains Mono", monospace;
  font-size: 9.5px;
  font-weight: 600;
}

@media (max-width: 640px) {
  .aai-search-btn {
    min-width: 0;
    padding: 7px 10px;
  }
  .aai-search-btn .aai-search-label { display: none; }
  .aai-search-btn kbd { display: none; }
  .aai-search-overlay { padding-top: 8vh; }
  .aai-search-panel { max-width: 100%; border-radius: 14px; }
  .aai-search-results { max-height: 60vh; }
  .aai-search-footer { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .aai-search-overlay,
  .aai-search-panel,
  .aai-search-item { transition: none !important; }
}
