/**
 * SearchAutocomplete.css
 * ─────────────────────────────────────────────────────────────────────────────
 * Scoped, standalone styles for the SearchAutocomplete widget.
 * All classes are namespaced with `sac-` to avoid collisions.
 *
 * Drop this file into any project and link it independently of your
 * site's main stylesheet.
 *
 * CSS Custom Properties (override in your own stylesheet or :root):
 *
 *   --sac-accent        #38bdf8      Blue highlight / border
 *   --sac-bg            rgba(255,255,255,0.05)
 *   --sac-bg-hover      rgba(255,255,255,0.12)
 *   --sac-border        rgba(255,255,255,0.10)
 *   --sac-text          #fff
 *   --sac-text-muted    #94a3b8
 *   --sac-radius        16px
 *   --sac-font          'Inter', system-ui, -apple-system, sans-serif
 * ─────────────────────────────────────────────────────────────────────────────
 */

/* ── CSS Tokens ─────────────────────────────────────────────────────────── */
:root {
  --sac-accent:     #38bdf8;
  --sac-accent-dim: rgba(56, 189, 248, 0.2);
  --sac-bg:         rgba(255, 255, 255, 0.05);
  --sac-bg-hover:   rgba(255, 255, 255, 0.12);
  --sac-border:     rgba(255, 255, 255, 0.10);
  --sac-text:       #fff;
  --sac-text-muted: #94a3b8;
  --sac-placeholder:#64748b;
  --sac-radius:     16px;
  --sac-font:       'Inter', system-ui, -apple-system, sans-serif;
  --sac-transition: 0.2s ease;
}

/* ── Search Wrapper ─────────────────────────────────────────────────────── */
.sac-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--sac-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1.5px solid var(--sac-accent);
  border-radius: var(--sac-radius);
  padding: 4px;
  box-shadow:
    0 10px 25px -5px rgba(0, 0, 0, 0.3),
    0 0 15px var(--sac-accent-dim);
  transition: box-shadow var(--sac-transition), background var(--sac-transition);
  font-family: var(--sac-font);
}

.sac-wrapper:focus-within {
  box-shadow: 0 0 25px rgba(56, 189, 248, 0.4);
  background: rgba(255, 255, 255, 0.08);
}

/* ── Text Input ─────────────────────────────────────────────────────────── */
.sac-input {
  flex: 1;
  padding: 12px 12px 12px 15px;
  background: transparent;
  border: none;
  color: var(--sac-text);
  font-size: 1.05rem;
  font-family: inherit;
  outline: none;
}

.sac-input::placeholder {
  color: var(--sac-placeholder);
}

/* ── Search Button ──────────────────────────────────────────────────────── */
.sac-btn {
  background: transparent;
  border: none;
  color: var(--sac-accent);
  padding: 10px 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  transition: transform var(--sac-transition), color var(--sac-transition);
}

.sac-btn:hover {
  transform: scale(1.1);
  color: #7dd3fc;
}

.sac-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.sac-btn svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: block;
}

/* ── Autocomplete Dropdown ──────────────────────────────────────────────── */
.sac-suggestions {
  list-style: none;
  padding: 0;
  margin: 6px 0 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ── Results List ───────────────────────────────────────────────────────── */
.sac-results {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

/* ── Shared List Item ───────────────────────────────────────────────────── */
.sac-suggestions li,
.sac-results li {
  background: var(--sac-bg);
  border: 1px solid var(--sac-border);
  border-radius: 12px;
  overflow: hidden;
  transition:
    background var(--sac-transition),
    border-right-width var(--sac-transition),
    transform var(--sac-transition);
  cursor: pointer;
}

.sac-suggestions li:hover,
.sac-results li:hover,
.sac-suggestions li.sac-active {
  background: var(--sac-bg-hover);
  border-right: 4px solid var(--sac-accent);
  transform: translateX(4px);
}

/* Inner layout — works for both bare <li> and <li><a> patterns */
.sac-suggestions li > *,
.sac-results li > a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  color: var(--sac-text);
  text-decoration: none;
  width: 100%;
}

/* Make bare <li> items (autocomplete) use the same flex layout */
.sac-suggestions li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
}

/* ── Meta / Badge ───────────────────────────────────────────────────────── */
.sac-meta {
  color: var(--sac-text);
  font-weight: 800;
  font-size: 0.75rem;
  white-space: nowrap;
  margin-left: 8px;
}

/* ── Status Messages (loading / error) ──────────────────────────────────── */
.sac-status {
  background: none !important;
  border: none !important;
  opacity: 0.65;
  padding: 14px 4px !important;
  font-size: 0.9rem;
  color: var(--sac-text-muted);
  pointer-events: none;
}

.sac-status.sac-error {
  color: #f87171;
  opacity: 1;
}

/* ── Dark / Light mode override example ────────────────────────────────── */
/* Light mode: add class="sac-light" to your wrapper or a parent element    */
.sac-light {
  --sac-bg:         rgba(0, 0, 0, 0.04);
  --sac-bg-hover:   rgba(0, 0, 0, 0.08);
  --sac-border:     rgba(0, 0, 0, 0.12);
  --sac-text:       #0f172a;
  --sac-text-muted: #475569;
  --sac-placeholder:#94a3b8;
}
