/* ══════════════════════════════════════════
   SEARCH — DESKTOP DROPDOWN
══════════════════════════════════════════ */
#search-dropdown {
  background: var(--surface);
  border: 1px solid var(--border-md);
  border-radius: var(--r-sm);
  box-shadow: 0 16px 48px var(--shadow);
  overflow: hidden;
  max-height: 420px;
  overflow-y: auto;

  /* Animate in */
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity .18s ease, transform .18s ease;
}

#search-dropdown.search-dropdown--open {
  opacity: 1;
  transform: translateY(0);
}

/* ─── RESULT ROW ─── */
.search-result {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  text-decoration: none;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  transition: background .12s;
  cursor: pointer;
  outline: none;
}

.search-result:last-child { border-bottom: none; }

.search-result:hover,
.search-result:focus {
  background: var(--panel);
}

/* ─── AVATAR ─── */
.search-result-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--panel);
  border: 1px solid var(--border);
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Initials fallback */
.search-result-avatar::after {
  content: attr(data-initials);
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 800;
  font-style: italic;
  color: var(--gold);
  z-index: 0;
}

.search-result-avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  z-index: 1;
  border-radius: 50%;
}

/* ─── INFO ─── */
.search-result-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.search-result-name {
  font-size: clamp(13px, 1vw, 14px);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-cat {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─── VOTES ─── */
.search-result-votes {
  font-size: 12px;
  color: var(--gold);
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ─── HIGHLIGHT ─── */
.search-highlight {
  background: var(--gold-dim);
  color: var(--gold);
  border-radius: 2px;
  padding: 0 1px;
  font-style: normal;
}

/* ─── EMPTY / LOADING ─── */
.search-empty {
  padding: 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.search-loading {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

/* Spinner */
@keyframes spin {
  to { transform: rotate(360deg); }
}

.search-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--border-md);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}

/* ─── SCROLLBAR ─── */
#search-dropdown::-webkit-scrollbar { width: 4px; }
#search-dropdown::-webkit-scrollbar-thumb { background: var(--panel); border-radius: 4px; }

/* ─── LIGHT THEME ─── */
[data-theme="light"] #search-dropdown {
  box-shadow: 0 8px 32px rgba(0,0,0,.12);
}

/* ══════════════════════════════════════════
   MOBILE SEARCH BUTTON
   Hidden on desktop, shown on mobile
══════════════════════════════════════════ */
.mobile-search-btn {
  display: none;   /* hidden on desktop */
}

@media (max-width: 768px) {
  .mobile-search-btn {
    display: grid;
    color: var(--text-2);
  }
}

/* ══════════════════════════════════════════
   MOBILE SEARCH OVERLAY
   Full-screen search on mobile
══════════════════════════════════════════ */
#mobile-search-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 10000;
  display: flex;
  flex-direction: column;

  /* Animate in from top */
  transform: translateY(-100%);
  transition: transform .22s cubic-bezier(.4, 0, .2, 1);
}

#mobile-search-overlay.msearch--open {
  transform: translateY(0);
}

/* ─── Search bar row ─── */
.msearch-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.msearch-back {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--panel);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 16px;
  color: var(--text);
  flex-shrink: 0;
  transition: background .15s;
}

.msearch-back:hover { background: var(--card); }

.msearch-input {
  flex: 1;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 50px;
  padding: 10px 18px;
  font-family: var(--font-ui);
  font-size: 15px;
  color: var(--text);
  outline: none;
  transition: border-color .18s;
}

.msearch-input:focus {
  border-color: rgba(232, 184, 75, .4);
}

.msearch-input::placeholder { color: var(--muted); }

/* ─── Results list ─── */
.msearch-results {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.msearch-results .search-result {
  padding: 12px 16px;
}

.msearch-results .search-result-avatar {
  width: 44px;
  height: 44px;
}

.msearch-results .search-result-name {
  font-size: 15px;
}

.msearch-results .search-result-cat {
  font-size: 12px;
}

.msearch-results .search-loading,
.msearch-results .search-empty {
  padding: 32px 20px;
  font-size: 14px;
}

/* Scrollbar */
.msearch-results::-webkit-scrollbar { width: 4px; }
.msearch-results::-webkit-scrollbar-thumb { background: var(--panel); border-radius: 4px; }
