/**
 * Chatvora — universal search modal (navbar trigger, Ctrl/Cmd+K)
 */

#sr-search-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 80px;
  box-sizing: border-box;
}

#sr-search-overlay:not([hidden]) {
  display: flex !important;
}

#sr-search-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

#sr-search-modal {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 600px;
  background: #111118;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
  margin: 0 16px;
  animation: sr-search-modal-in 0.18s ease-out;
}

#sr-search-modal:focus {
  outline: none;
}

#sr-search-input-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

#sr-search-input-wrap svg {
  width: 18px;
  height: 18px;
  color: rgba(255, 255, 255, 0.35);
  flex-shrink: 0;
}

#sr-search-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: white;
  font-size: 16px;
  caret-color: #6366f1;
}

#sr-search-input::placeholder {
  color: rgba(255, 255, 255, 0.25);
}

#sr-search-close {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  min-height: 30px;
  padding: 4px 9px;
  font-size: 11px !important;
  color: rgba(255, 255, 255, 0.3);
  font-family:
    ui-monospace,
    monospace !important;
  cursor: pointer;
  flex-shrink: 0;
}

#sr-search-close:hover {
  color: rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.11);
}

.sr-search-close__mobile {
  display: none;
}

@keyframes sr-search-modal-in {
  from {
    transform: translateY(-8px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

#sr-search-results {
  max-height: 420px;
  overflow-y: auto;
  padding: 8px;
}

.sr-search-section {
  margin-bottom: 4px;
}

.sr-search-section-label {
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.3);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 8px 12px 4px;
}

.sr-search-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.1s;
  text-decoration: none;
  color: white;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  font: inherit;
  box-sizing: border-box;
}

a.sr-search-item:hover,
a.sr-search-item.focused,
button.sr-search-item:hover,
button.sr-search-item.focused {
  background: rgba(99, 102, 241, 0.12);
}

.sr-search-item-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
}

.sr-search-item-icon.accent {
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
}

.sr-search-item-title {
  font-size: 14px;
  font-weight: 500;
  color: white;
  margin-bottom: 1px;
}

.sr-search-item-sub {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.35);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: min(400px, 100%);
}

.sr-search-highlight {
  background: rgba(99, 102, 241, 0.25);
  color: white;
  border-radius: 2px;
  padding: 0 2px;
}

.sr-search-empty {
  padding: 32px 20px;
  text-align: center;
  color: rgba(255, 255, 255, 0.3);
  font-size: 14px;
}

.sr-search-default {
  padding: 12px 8px;
}

.sr-search-kbd-hint {
  font-size: 11px;
  /* Enough contrast on #0f0f17 navbar for Lighthouse / WCAG (was 0.2 — failing) */
  color: rgba(255, 255, 255, 0.72);
  margin-left: 4px;
  user-select: none;
}

@media (max-width: 767px) {
  .sr-search-kbd-hint {
    display: none;
  }

  #sr-search-overlay {
    padding-top: 0;
    align-items: flex-start;
  }

  #sr-search-modal {
    max-width: 100%;
    margin: 8px 10px 0;
    border-radius: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
  }

  #sr-search-input {
    font-size: 16px;
  }

  #sr-search-close {
    min-height: 34px;
    padding: 6px 10px;
    border-radius: 9px;
    font-size: 12px !important;
    color: rgba(255, 255, 255, 0.72);
  }

  .sr-search-close__desktop {
    display: none;
  }

  .sr-search-close__mobile {
    display: inline;
  }

  #sr-search-results {
    max-height: calc(100vh - 120px);
  }
}

/* FAQ search offcanvas (legacy #offcanvasTop) — Chatvora wordmark */
.sr-offcanvas-shell .offcanvas-title .sr-search-offcanvas-logo {
  height: 28px;
  width: auto;
  max-width: min(200px, 55vw);
  object-fit: contain;
  object-position: left center;
  display: block;
}
