/**
 * Bengal SSG - Search Page Styles
 *
 * Full-page search experience matching the modal design language.
 * Frosted glass, neumorphic elements, and consistent theming.
 *
 * Design aligned with search-modal.css for visual consistency.
 */

/* ============================================
   SEARCH PAGE LAYOUT
   ============================================ */

.search-page {
  max-width: 720px;
  margin: 0 auto;
  padding: var(--space-8) var(--space-6) var(--space-16);
  min-height: calc(100vh - 200px);
}

/* ============================================
   HEADER
   ============================================ */

.search-page__header {
  margin-bottom: var(--space-8);
}

.search-page__title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.search-page__title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0;
  font-size: var(--text-2xl, 1.5rem);
  font-weight: var(--weight-semibold, 600);
  color: var(--color-text-primary);
}

.search-page__title-icon {
  color: var(--color-text-tertiary);
}

.search-page__page-count {
  font-size: var(--text-sm, 0.875rem);
  color: var(--color-text-tertiary);
}

/* ============================================
   CONTAINER (Frosted Glass)
   ============================================ */

.search-page__container {
  /* Frosted glass card */
  background: linear-gradient(180deg,
    rgba(255, 255, 255, 0.9),
    rgba(250, 250, 250, 0.85));
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--border-radius-xl, 16px);
  box-shadow:
    0 25px 50px -12px rgba(0, 0, 0, 0.15),
    0 0 0 1px rgba(0, 0, 0, 0.05),
    var(--neumorphic-subtle);
  overflow: hidden;
  position: relative;
}

/* Dark mode frosted glass */
[data-theme="dark"] .search-page__container {
  background: linear-gradient(180deg,
    rgba(30, 30, 32, 0.92),
    rgba(24, 24, 26, 0.88));
  border-color: rgba(255, 255, 255, 0.08);
}

/* Fallback for browsers without backdrop-filter */
@supports not (backdrop-filter: blur(20px)) {
  .search-page__container {
    background: var(--color-bg-elevated);
  }

  [data-theme="dark"] .search-page__container {
    background: var(--color-bg-elevated);
  }
}

/* Gradient top accent line */
.search-page__container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    color-mix(in srgb, var(--color-primary) 40%, transparent) 20%,
    color-mix(in srgb, var(--color-primary) 60%, transparent) 50%,
    color-mix(in srgb, var(--color-primary) 40%, transparent) 80%,
    transparent 100%);
  border-radius: var(--border-radius-xl, 16px) var(--border-radius-xl, 16px) 0 0;
  z-index: 10;
}

/* ============================================
   INPUT SECTION
   ============================================ */

.search-page__input-section {
  padding: 1.25rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  background: rgba(255, 255, 255, 0.5);
}

[data-theme="dark"] .search-page__input-section {
  border-bottom-color: rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.2);
}

.search-page__input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-radius: var(--border-radius-medium, 8px);
  border: 1px solid var(--color-border);
  background: var(--color-bg-primary);
  /* Neumorphic inset */
  box-shadow:
    inset 1px 1px 2px rgba(0, 0, 0, 0.06),
    inset -0.5px -0.5px 1px rgba(255, 255, 255, 0.4);
  transition: all var(--transition-fast, 0.15s);
}

.search-page__input-wrapper:focus-within {
  border-color: var(--color-primary);
  box-shadow:
    inset 1.5px 1.5px 3px rgba(0, 0, 0, 0.08),
    inset -0.5px -0.5px 1px rgba(255, 255, 255, 0.3),
    0 0 0 3px color-mix(in srgb, var(--color-primary) 15%, transparent);
}

[data-theme="dark"] .search-page__input-wrapper {
  box-shadow:
    inset 1.5px 1.5px 3px rgba(0, 0, 0, 0.3),
    inset -0.5px -0.5px 1px rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .search-page__input-wrapper:focus-within {
  box-shadow:
    inset 2px 2px 4px rgba(0, 0, 0, 0.4),
    inset -0.5px -0.5px 1px rgba(255, 255, 255, 0.03),
    0 0 0 3px color-mix(in srgb, var(--color-primary) 20%, transparent);
}

.search-page__icon {
  flex-shrink: 0;
  color: var(--color-text-tertiary);
  pointer-events: none;
}

.search-page__input {
  flex: 1;
  padding: 0.25rem 0.5rem;
  font-size: var(--text-lg, 1.125rem);
  font-family: inherit;
  color: var(--color-text-primary);
  background: transparent;
  border: none;
  outline: none;
  box-shadow: none;
}

/* Hide native browser clear button */
.search-page__input::-webkit-search-cancel-button,
.search-page__input::-webkit-search-decoration,
.search-page__input::-webkit-search-results-button,
.search-page__input::-webkit-search-results-decoration {
  -webkit-appearance: none;
  appearance: none;
  display: none;
}

.search-page__input:focus,
.search-page__input:focus-visible {
  outline: none;
  box-shadow: none;
  border: none;
}

.search-page__input::placeholder {
  color: var(--color-text-tertiary);
}

/* Loading spinner in input */
.search-page__loading {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
}

.search-page__spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: search-spin 0.6s linear infinite;
}

.search-page__spinner--large {
  width: 40px;
  height: 40px;
  border-width: 3px;
}

@keyframes search-spin {
  to { transform: rotate(360deg); }
}

/* Clear button */
.search-page__clear {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  background: linear-gradient(180deg,
    var(--color-surface, var(--color-bg-elevated)),
    var(--color-bg-secondary));
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-small, 4px);
  box-shadow: var(--neumorphic-subtle);
  color: var(--color-text-tertiary);
  cursor: pointer;
  transition: all var(--transition-fast, 0.15s);
}

.search-page__clear:hover {
  color: var(--color-text-primary);
  box-shadow: var(--neumorphic-hover);
  transform: translateY(-1px);
}

.search-page__clear:active {
  box-shadow: var(--neumorphic-subtle-pressed);
  transform: translateY(0) scale(0.98);
}

/* Keyboard hints */
.search-page__hints {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  margin-top: 0.75rem;
}

.search-page__hint {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: var(--text-xs, 0.75rem);
  color: var(--color-text-tertiary);
}

.search-page__hint kbd {
  padding: 0.1875rem 0.375rem;
  font-size: var(--text-xxs, 0.625rem);
  font-family: var(--font-mono);
  color: var(--color-text-secondary);
  background: linear-gradient(180deg,
    var(--color-surface, var(--color-bg-elevated)),
    var(--color-bg-secondary));
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-small, 4px);
  box-shadow: var(--neumorphic-subtle);
}

/* ============================================
   RESULTS AREA
   ============================================ */

.search-page__results-area {
  min-height: 300px;
}

.search-page__results {
  padding: 0.75rem;
}

.search-page__results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.5rem 0.75rem;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 0.75rem;
}

.search-page__results-count {
  font-size: var(--text-sm, 0.875rem);
  font-weight: var(--weight-medium, 500);
  color: var(--color-text-secondary);
}

/* Filters toggle */
.search-page__filters-toggle {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.625rem;
  font-size: var(--text-xs, 0.75rem);
  font-weight: var(--weight-medium, 500);
  color: var(--color-text-secondary);
  background: linear-gradient(180deg,
    var(--color-surface, var(--color-bg-elevated)),
    var(--color-bg-secondary));
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-small, 4px);
  box-shadow: var(--neumorphic-subtle);
  cursor: pointer;
  transition: all var(--transition-fast, 0.15s);
}

.search-page__filters-toggle:hover {
  color: var(--color-text-primary);
  box-shadow: var(--neumorphic-hover);
  transform: translateY(-1px);
}

.search-page__filters-toggle:active {
  box-shadow: var(--neumorphic-subtle-pressed);
  transform: translateY(0) scale(0.98);
}

/* Filters panel */
.search-page__filters {
  padding: 0.75rem;
  margin-bottom: 0.75rem;
  background: linear-gradient(180deg,
    var(--color-surface, var(--color-bg-elevated)),
    var(--color-bg-tertiary));
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-medium, 8px);
  box-shadow: var(--neumorphic-subtle);
}

.search-page__filters-grid {
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
}

.search-page__filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  flex: 1;
  min-width: 140px;
}

.search-page__filter-group label {
  font-size: var(--text-xs, 0.75rem);
  font-weight: var(--weight-medium, 500);
  color: var(--color-text-tertiary);
}

.search-page__filter-select {
  padding: 0.5rem 0.75rem;
  font-size: var(--text-sm, 0.875rem);
  font-family: inherit;
  color: var(--color-text-primary);
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-small, 4px);
  box-shadow: inset 0.5px 0.5px 1px rgba(0, 0, 0, 0.04);
  transition: all var(--transition-fast, 0.15s);
}

.search-page__filter-select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow:
    inset 0.5px 0.5px 1px rgba(0, 0, 0, 0.04),
    0 0 0 2px color-mix(in srgb, var(--color-primary) 15%, transparent);
}

.search-page__filter-clear {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem 0.75rem;
  font-size: var(--text-sm, 0.875rem);
  font-weight: var(--weight-medium, 500);
  color: var(--color-text-tertiary);
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-small, 4px);
  cursor: pointer;
  transition: all var(--transition-fast, 0.15s);
}

.search-page__filter-clear:hover {
  color: var(--color-error, #ef4444);
  border-color: var(--color-error, #ef4444);
}

/* ============================================
   RESULTS LIST (Matches Modal)
   ============================================ */

.search-page__results-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.search-page__results-group {
  margin-bottom: 0.75rem;
}

.search-page__results-group:last-child {
  margin-bottom: 0;
}

.search-page__section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.375rem 0.75rem;
  margin-bottom: 0.375rem;
  background: linear-gradient(180deg,
    var(--color-surface, var(--color-bg-elevated)),
    var(--color-bg-tertiary));
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-small, 4px);
  box-shadow: var(--neumorphic-subtle);
  font-size: var(--text-xs, 0.75rem);
  font-weight: var(--weight-semibold, 600);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.search-page__section-header--collapsible:hover {
  box-shadow: var(--neumorphic-hover);
}

.search-page__section-header--collapsible:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.search-page__section-title {
  flex: 1;
}

.search-page__section-toggle {
  font-size: 0.625rem;
  color: var(--color-text-tertiary);
  transition: transform var(--transition-fast, 0.15s);
}

.search-page__section-items {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

/* Result item - matches modal */
.search-page__result-item {
  border-radius: var(--border-radius-medium, 8px);
  border: 1px solid transparent;
  transition: all var(--transition-fast, 0.15s);
  position: relative;
}

.search-page__result-item:hover {
  background: linear-gradient(180deg,
    var(--color-surface, var(--color-bg-elevated)),
    var(--color-bg-secondary));
  border-color: var(--color-border);
  box-shadow: var(--neumorphic-subtle);
}

.search-page__result-item--selected {
  background: linear-gradient(180deg,
    var(--color-surface, var(--color-bg-elevated)),
    var(--color-bg-secondary));
  border-color: var(--color-border);
  box-shadow: var(--neumorphic-subtle);
}

/* Gradient accent bar on left for selected */
.search-page__result-item--selected::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--gradient-border);
  border-radius: var(--border-radius-medium, 8px) 0 0 var(--border-radius-medium, 8px);
}

.search-page__result-link {
  display: block;
  padding: 0.75rem;
  color: inherit;
  text-decoration: none;
}

.search-page__result-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.25rem;
}

.search-page__result-title {
  font-size: var(--text-body, 1rem);
  font-weight: var(--weight-medium, 500);
  color: var(--color-text-primary);
}

.search-page__result-section {
  font-size: var(--text-xxs, 0.625rem);
  font-weight: var(--weight-medium, 500);
  color: var(--color-text-tertiary);
  padding: 0.1875rem 0.5rem;
  background: linear-gradient(180deg,
    var(--color-surface, var(--color-bg-elevated)),
    var(--color-bg-tertiary));
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-full, 9999px);
  box-shadow: var(--neumorphic-subtle);
}

.search-page__result-excerpt {
  margin: 0;
  font-size: var(--text-body-sm, 0.875rem);
  color: var(--color-text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Highlight matches */
.search-page__result-title mark,
.search-page__result-excerpt mark {
  background: rgba(255, 215, 0, 0.3);
  color: inherit;
  font-weight: var(--weight-semibold, 600);
  padding: 0 0.125rem;
  border-radius: 2px;
}

[data-theme="dark"] .search-page__result-title mark,
[data-theme="dark"] .search-page__result-excerpt mark {
  background: color-mix(in srgb, var(--color-primary) 25%, transparent);
}

/* Autodoc badge */
.search-page__autodoc-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.1875rem 0.375rem;
  margin-left: auto;
  font-size: 0.625rem;
  font-weight: var(--weight-semibold, 600);
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--color-info, #3b82f6) 15%, var(--color-bg-elevated)),
    color-mix(in srgb, var(--color-info, #3b82f6) 10%, var(--color-bg-secondary)));
  color: var(--color-info, #3b82f6);
  border: 1px solid color-mix(in srgb, var(--color-info, #3b82f6) 30%, transparent);
  border-radius: var(--border-radius-small, 4px);
  box-shadow: var(--neumorphic-subtle);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  flex-shrink: 0;
}

[data-theme="dark"] .search-page__autodoc-badge {
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--color-info, #60a5fa) 20%, var(--color-bg-elevated)),
    color-mix(in srgb, var(--color-info, #60a5fa) 12%, var(--color-bg-secondary)));
  color: #60a5fa;
  border-color: color-mix(in srgb, var(--color-info, #60a5fa) 35%, transparent);
}

/* ============================================
   EMPTY STATE
   ============================================ */

.search-page__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12) var(--space-6);
  text-align: center;
}

.search-page__empty-content {
  margin-bottom: var(--space-8);
}

.search-page__empty-icon {
  margin-bottom: 1rem;
  color: var(--color-text-tertiary);
  opacity: 0.4;
}

.search-page__empty-title {
  margin: 0 0 0.5rem;
  font-size: var(--text-lg, 1.125rem);
  font-weight: var(--weight-medium, 500);
  color: var(--color-text-secondary);
}

.search-page__empty-hint {
  margin: 0;
  font-size: var(--text-sm, 0.875rem);
  color: var(--color-text-tertiary);
}

/* Suggestions */
.search-page__suggestions {
  margin-bottom: 1.5rem;
}

.search-page__suggestions-label {
  display: block;
  margin-bottom: 0.75rem;
  font-size: var(--text-xs, 0.75rem);
  font-weight: var(--weight-semibold, 600);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-tertiary);
}

.search-page__suggestion-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.search-page__suggestion {
  padding: 0.5rem 0.875rem;
  font-size: var(--text-sm, 0.875rem);
  font-weight: var(--weight-medium, 500);
  font-family: inherit;
  color: var(--color-text-primary);
  background: linear-gradient(180deg,
    var(--color-surface, var(--color-bg-elevated)),
    var(--color-bg-secondary));
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-full, 9999px);
  box-shadow: var(--neumorphic-subtle);
  cursor: pointer;
  transition: all var(--transition-fast, 0.15s);
}

.search-page__suggestion:hover {
  color: var(--color-primary);
  border-color: var(--color-primary);
  box-shadow: var(--neumorphic-hover);
  transform: translateY(-2px);
}

.search-page__suggestion:active {
  box-shadow: var(--neumorphic-subtle-pressed);
  transform: translateY(0) scale(0.98);
}

/* Tips */
.search-page__tips {
  max-width: 400px;
}

.search-page__tip {
  padding: 0.75rem 1rem;
  font-size: var(--text-xs, 0.75rem);
  color: var(--color-text-tertiary);
  background: linear-gradient(180deg,
    var(--color-surface, var(--color-bg-elevated)),
    var(--color-bg-tertiary));
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-medium, 8px);
  box-shadow: var(--neumorphic-subtle);
}

.search-page__tip-label {
  font-weight: var(--weight-semibold, 600);
  margin-right: 0.5rem;
}

.search-page__tip code {
  padding: 0.125rem 0.375rem;
  margin: 0 0.25rem;
  font-size: 0.9em;
  font-family: var(--font-mono);
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-small, 4px);
}

/* ============================================
   NO RESULTS
   ============================================ */

.search-page__no-results {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12) var(--space-4);
  text-align: center;
  color: var(--color-text-tertiary);
}

.search-page__no-results svg {
  margin-bottom: 1rem;
  opacity: 0.4;
}

.search-page__no-results-text {
  margin: 0 0 0.5rem;
  font-size: var(--text-body, 1rem);
  font-weight: var(--weight-medium, 500);
  color: var(--color-text-secondary);
}

.search-page__no-results-hint {
  margin: 0;
  font-size: var(--text-body-sm, 0.875rem);
}

/* ============================================
   LOADING & ERROR STATES
   ============================================ */

.search-page__loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12) var(--space-4);
  text-align: center;
  color: var(--color-text-secondary);
}

.search-page__loading-state p {
  margin: 1rem 0 0;
  font-size: var(--text-sm, 0.875rem);
}

.search-page__error {
  padding: 1rem;
  margin: 1rem;
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--color-error, #ef4444) 10%, var(--color-bg-elevated)),
    color-mix(in srgb, var(--color-error, #ef4444) 5%, var(--color-bg-secondary)));
  border: 1px solid color-mix(in srgb, var(--color-error, #ef4444) 30%, transparent);
  border-radius: var(--border-radius-medium, 8px);
  color: var(--color-error, #ef4444);
  text-align: center;
  font-size: var(--text-sm, 0.875rem);
}

.search-page__error p {
  margin: 0;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 640px) {
  .search-page {
    padding: 1rem 1rem 3rem;
  }

  .search-page__title-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .search-page__container {
    border-radius: var(--border-radius-large, 12px);
  }

  .search-page__input-section {
    padding: 1rem;
  }

  .search-page__input {
    font-size: var(--text-body, 1rem);
  }

  .search-page__hints {
    gap: 0.75rem;
    flex-wrap: wrap;
  }

  .search-page__hint span {
    display: none;
  }

  .search-page__filters-grid {
    flex-direction: column;
  }

  .search-page__filter-group {
    min-width: 100%;
  }

  .search-page__suggestion-pills {
    gap: 0.375rem;
  }

  .search-page__suggestion {
    padding: 0.375rem 0.75rem;
    font-size: var(--text-xs, 0.75rem);
  }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.search-page__result-item:focus-visible {
  outline: 2px solid var(--color-border-focus);
  outline-offset: -2px;
}

/* ============================================
   REDUCED MOTION
   ============================================ */

@media (prefers-reduced-motion: reduce) {
  .search-page__spinner {
    animation-duration: 1.5s;
  }

  .search-page__suggestion:hover,
  .search-page__clear:hover,
  .search-page__filters-toggle:hover {
    transform: none;
  }
}

/* ============================================
   SEARCH INLINE COMPONENT
   ============================================
   Compact, embeddable search that matches modal design.
   Uses shared design tokens for consistency.
   ============================================ */

.search-inline {
  max-width: 100%;
  margin: 0 auto;
}

/* Variant: compact */
.search-inline[data-variant="compact"] {
  max-width: 400px;
}

/* Variant: full */
.search-inline[data-variant="full"] {
  max-width: 720px;
}

/* --------------------------------------------
   Input Wrapper
   -------------------------------------------- */
.search-inline__input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 0.875rem;
  border-radius: var(--border-radius-medium, 8px);
  border: 1px solid var(--color-border);
  background: var(--color-bg-primary);
  box-shadow:
    inset 1px 1px 2px rgba(0, 0, 0, 0.06),
    inset -0.5px -0.5px 1px rgba(255, 255, 255, 0.4);
  transition: all var(--transition-fast, 0.15s);
}

.search-inline__input-wrapper:focus-within {
  border-color: var(--color-primary);
  box-shadow:
    inset 1.5px 1.5px 3px rgba(0, 0, 0, 0.08),
    inset -0.5px -0.5px 1px rgba(255, 255, 255, 0.3),
    0 0 0 3px color-mix(in srgb, var(--color-primary) 15%, transparent);
}

[data-theme="dark"] .search-inline__input-wrapper {
  box-shadow:
    inset 1.5px 1.5px 3px rgba(0, 0, 0, 0.3),
    inset -0.5px -0.5px 1px rgba(255, 255, 255, 0.05);
}

.search-inline__icon {
  flex-shrink: 0;
  color: var(--color-text-tertiary);
  pointer-events: none;
}

.search-inline__input {
  flex: 1;
  padding: 0.25rem 0.5rem;
  font-size: var(--text-body, 1rem);
  font-family: inherit;
  color: var(--color-text-primary);
  background: transparent;
  border: none;
  outline: none;
}

.search-inline__input::-webkit-search-cancel-button,
.search-inline__input::-webkit-search-decoration {
  -webkit-appearance: none;
  display: none;
}

.search-inline__input::placeholder {
  color: var(--color-text-tertiary);
}

/* --------------------------------------------
   Keyboard Shortcut Hint
   -------------------------------------------- */
.search-inline__shortcut {
  display: flex;
  gap: 0.125rem;
  pointer-events: none;
}

.search-inline__shortcut kbd {
  padding: 0.125rem 0.25rem;
  font-size: var(--text-xxs, 0.625rem);
  font-family: var(--font-mono);
  color: var(--color-text-tertiary);
  background: linear-gradient(180deg,
    var(--color-surface, var(--color-bg-elevated)),
    var(--color-bg-secondary));
  border: 1px solid var(--color-border);
  border-radius: 3px;
  box-shadow: var(--neumorphic-subtle);
}

.search-inline__input:focus ~ .search-inline__shortcut {
  display: none;
}

/* --------------------------------------------
   Loading & Clear Controls
   -------------------------------------------- */
.search-inline__loading {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
}

.search-inline__spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: search-inline-spin 0.6s linear infinite;
}

.search-inline__spinner--large {
  width: 32px;
  height: 32px;
  border-width: 3px;
}

@keyframes search-inline-spin {
  to { transform: rotate(360deg); }
}

.search-inline__clear {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  background: linear-gradient(180deg,
    var(--color-surface, var(--color-bg-elevated)),
    var(--color-bg-secondary));
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-small, 4px);
  box-shadow: var(--neumorphic-subtle);
  color: var(--color-text-tertiary);
  cursor: pointer;
  transition: all var(--transition-fast, 0.15s);
}

.search-inline__clear:hover {
  color: var(--color-text-primary);
  box-shadow: var(--neumorphic-hover);
}

/* --------------------------------------------
   Filters
   -------------------------------------------- */
.search-inline__filters {
  margin-top: 0.75rem;
}

.search-inline__filters-toggle {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.625rem;
  font-size: var(--text-xs, 0.75rem);
  font-weight: var(--weight-medium, 500);
  color: var(--color-text-secondary);
  background: linear-gradient(180deg,
    var(--color-surface, var(--color-bg-elevated)),
    var(--color-bg-secondary));
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-small, 4px);
  box-shadow: var(--neumorphic-subtle);
  cursor: pointer;
  transition: all var(--transition-fast, 0.15s);
}

.search-inline__filters-toggle:hover {
  box-shadow: var(--neumorphic-hover);
}

.search-inline__filters-content {
  margin-top: 0.75rem;
  padding: 0.75rem;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: flex-end;
  background: linear-gradient(180deg,
    var(--color-surface, var(--color-bg-elevated)),
    var(--color-bg-tertiary));
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-medium, 8px);
  box-shadow: var(--neumorphic-subtle);
}

.search-inline__filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
  min-width: 120px;
}

.search-inline__filter-group label {
  font-size: var(--text-xs, 0.75rem);
  font-weight: var(--weight-medium, 500);
  color: var(--color-text-tertiary);
}

.search-inline__filter-select {
  padding: 0.375rem 0.5rem;
  font-size: var(--text-sm, 0.875rem);
  font-family: inherit;
  color: var(--color-text-primary);
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-small, 4px);
}

.search-inline__filter-clear {
  padding: 0.375rem 0.625rem;
  font-size: var(--text-xs, 0.75rem);
  color: var(--color-text-tertiary);
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-small, 4px);
  cursor: pointer;
  transition: all var(--transition-fast, 0.15s);
}

.search-inline__filter-clear:hover {
  color: var(--color-error, #ef4444);
  border-color: var(--color-error, #ef4444);
}

/* --------------------------------------------
   Results Container (Frosted Glass)
   -------------------------------------------- */
.search-inline__results {
  margin-top: 1rem;
  padding: 0.75rem;
  background: linear-gradient(180deg,
    rgba(255, 255, 255, 0.9),
    rgba(250, 250, 250, 0.85));
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--border-radius-large, 12px);
  box-shadow:
    0 10px 25px -5px rgba(0, 0, 0, 0.1),
    0 0 0 1px rgba(0, 0, 0, 0.05);
  max-height: 400px;
  overflow-y: auto;
}

[data-theme="dark"] .search-inline__results {
  background: linear-gradient(180deg,
    rgba(30, 30, 32, 0.92),
    rgba(24, 24, 26, 0.88));
  border-color: rgba(255, 255, 255, 0.08);
}

.search-inline__results-header {
  padding-bottom: 0.5rem;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--color-border);
}

.search-inline__results-count {
  font-size: var(--text-xs, 0.75rem);
  font-weight: var(--weight-medium, 500);
  color: var(--color-text-tertiary);
}

.search-inline__results-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

/* --------------------------------------------
   Result Groups (Documentation / API)
   -------------------------------------------- */
.search-inline__results-group {
  margin-bottom: 0.5rem;
}

.search-inline__section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.25rem 0.5rem;
  margin-bottom: 0.25rem;
  background: linear-gradient(180deg,
    var(--color-surface, var(--color-bg-elevated)),
    var(--color-bg-tertiary));
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-small, 4px);
  font-size: var(--text-xxs, 0.625rem);
  font-weight: var(--weight-semibold, 600);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.search-inline__section-header--collapsible:hover {
  box-shadow: var(--neumorphic-subtle);
}

.search-inline__section-toggle {
  font-size: 0.5rem;
  color: var(--color-text-tertiary);
}

.search-inline__section-items {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

/* --------------------------------------------
   Result Items
   -------------------------------------------- */
.search-inline__result-item {
  border-radius: var(--border-radius-small, 6px);
  border: 1px solid transparent;
  transition: all var(--transition-fast, 0.15s);
  position: relative;
}

.search-inline__result-item:hover,
.search-inline__result-item--selected {
  background: linear-gradient(180deg,
    var(--color-surface, var(--color-bg-elevated)),
    var(--color-bg-secondary));
  border-color: var(--color-border);
}

.search-inline__result-item--selected::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--gradient-border);
  border-radius: var(--border-radius-small, 6px) 0 0 var(--border-radius-small, 6px);
}

.search-inline__result-link {
  display: block;
  padding: 0.5rem 0.625rem;
  color: inherit;
  text-decoration: none;
}

.search-inline__result-content {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.125rem;
}

.search-inline__result-title {
  font-size: var(--text-sm, 0.875rem);
  font-weight: var(--weight-medium, 500);
  color: var(--color-text-primary);
}

.search-inline__result-section {
  font-size: 0.5rem;
  font-weight: var(--weight-medium, 500);
  color: var(--color-text-tertiary);
  padding: 0.125rem 0.375rem;
  background: linear-gradient(180deg,
    var(--color-surface, var(--color-bg-elevated)),
    var(--color-bg-tertiary));
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-full, 9999px);
}

.search-inline__result-excerpt {
  margin: 0;
  font-size: var(--text-xs, 0.75rem);
  color: var(--color-text-secondary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* API Badge */
.search-inline__autodoc-badge {
  padding: 0.125rem 0.25rem;
  margin-left: auto;
  font-size: 0.5rem;
  font-weight: var(--weight-semibold, 600);
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--color-info, #3b82f6) 15%, var(--color-bg-elevated)),
    color-mix(in srgb, var(--color-info, #3b82f6) 10%, var(--color-bg-secondary)));
  color: var(--color-info, #3b82f6);
  border: 1px solid color-mix(in srgb, var(--color-info, #3b82f6) 30%, transparent);
  border-radius: var(--border-radius-small, 4px);
  text-transform: uppercase;
}

/* Match Highlighting */
.search-inline__result-title mark,
.search-inline__result-excerpt mark {
  background: rgba(255, 215, 0, 0.3);
  color: inherit;
  font-weight: var(--weight-semibold, 600);
  padding: 0 0.125rem;
  border-radius: 2px;
}

[data-theme="dark"] .search-inline__result-title mark,
[data-theme="dark"] .search-inline__result-excerpt mark {
  background: color-mix(in srgb, var(--color-primary) 25%, transparent);
}

/* --------------------------------------------
   State: No Results
   -------------------------------------------- */
.search-inline__no-results {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1rem;
  text-align: center;
  color: var(--color-text-tertiary);
}

.search-inline__no-results svg {
  margin-bottom: 0.75rem;
  opacity: 0.4;
}

.search-inline__no-results-text {
  margin: 0 0 0.25rem;
  font-size: var(--text-sm, 0.875rem);
  font-weight: var(--weight-medium, 500);
  color: var(--color-text-secondary);
}

.search-inline__no-results-hint {
  margin: 0;
  font-size: var(--text-xs, 0.75rem);
}

/* --------------------------------------------
   State: Loading
   -------------------------------------------- */
.search-inline__loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1rem;
  color: var(--color-text-secondary);
  font-size: var(--text-sm, 0.875rem);
}

.search-inline__loading-state p {
  margin: 0.75rem 0 0;
}

/* --------------------------------------------
   State: Error
   -------------------------------------------- */
.search-inline__error {
  padding: 0.75rem;
  margin-top: 1rem;
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--color-error, #ef4444) 10%, var(--color-bg-elevated)),
    color-mix(in srgb, var(--color-error, #ef4444) 5%, var(--color-bg-secondary)));
  border: 1px solid color-mix(in srgb, var(--color-error, #ef4444) 30%, transparent);
  border-radius: var(--border-radius-medium, 8px);
  color: var(--color-error, #ef4444);
  font-size: var(--text-sm, 0.875rem);
  text-align: center;
}

.search-inline__error p {
  margin: 0;
}

/* --------------------------------------------
   Responsive: Mobile
   -------------------------------------------- */
@media (max-width: 640px) {
  .search-inline__shortcut {
    display: none;
  }

  .search-inline__filters-content {
    flex-direction: column;
  }

  .search-inline__filter-group {
    min-width: 100%;
  }
}

/* --------------------------------------------
   Reduced Motion
   -------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .search-inline__spinner {
    animation-duration: 1.5s;
  }

  .search-inline__clear:hover,
  .search-inline__filters-toggle:hover {
    transform: none;
  }
}
