/* Advanced Menu Search — Frontend CSS v2.0 — Green & White */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --advs-accent:       #16a34a;
  --advs-accent-hover: #15803d;
  --advs-radius:       10px;
}

/* ── Trigger Button ─────────────────────────────────────────────────────────── */
#adv-search-trigger {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  color: #64748b;
  padding: 11px 16px;
  border-radius: var(--advs-radius);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s ease;
  width: var(--advs-btn-width, 100%);
  max-width: 100%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
}
#adv-search-trigger:hover {
  border-color: var(--advs-accent);
  box-shadow: 0 0 0 3px rgba(22,163,74,0.12), 0 1px 3px rgba(0,0,0,0.06);
  color: var(--advs-accent);
}
#adv-search-trigger svg { color: var(--advs-accent); flex-shrink: 0; }
.advs-trig-left { display: flex; align-items: center; gap: 9px; flex: 1; }
.advs-trig-ph   { color: #94a3b8; font-size: 14px; text-align: left; }
#adv-search-trigger kbd {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 5px;
  padding: 2px 7px;
  color: #94a3b8;
  margin-left: auto;
  flex-shrink: 0;
}

/* Nav search button */
.adv-search-nav-li  { list-style: none; display: flex; align-items: center; }
.adv-search-nav-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent; border: none;
  color: inherit; cursor: pointer;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px; font-weight: 500; padding: 6px 10px;
  border-radius: 6px; transition: all 0.15s;
}
.adv-search-nav-btn:hover { background: rgba(22,163,74,0.08); color: var(--advs-accent); }
.adv-search-nav-btn svg { flex-shrink: 0; }
.advs-nav-label { font-size: 14px; }

/* ── Overlay ────────────────────────────────────────────────────────────────── */
#adv-search-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 999999;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: clamp(48px, 9vh, 120px);
  animation: advsOverlayIn 0.15s ease;
  /* Overlay handles its own clicks in JS — dialog children must be clickable */
  pointer-events: auto;
}
#adv-search-overlay.open { display: flex; }
@keyframes advsOverlayIn { from { opacity:0 } to { opacity:1 } }

/* ── Dialog — must be fully clickable ───────────────────────────────────────── */
#adv-search-dialog {
  pointer-events: auto;
  position: relative;
  z-index: 1000000;
  width: min(660px, calc(100vw - 24px));
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  box-shadow: 0 25px 60px rgba(0,0,0,0.18), 0 0 0 1px rgba(0,0,0,0.04);
  display: flex; flex-direction: column;
  overflow: hidden;
  max-height: calc(100vh - 80px - clamp(48px,9vh,120px));
  animation: advsDlgIn 0.2s cubic-bezier(0.34,1.28,0.64,1);
  font-family: 'Inter', system-ui, sans-serif;
}

/* Force all interactive elements inside dialog to be clickable */
#adv-search-dialog a,
#adv-search-dialog button,
#adv-search-dialog input,
#adv-search-dialog .advs-row,
#adv-search-dialog .advs-results {
  pointer-events: auto !important;
  position: relative;
  z-index: 1;
}
@keyframes advsDlgIn {
  from { opacity:0; transform: translateY(-12px) scale(0.97); }
  to   { opacity:1; transform: translateY(0) scale(1); }
}

/* ── Input Rail ─────────────────────────────────────────────────────────────── */
.advs-input-rail {
  display: flex; align-items: center; gap: 12px;
  padding: 0 18px;
  border-bottom: 1.5px solid #f1f5f9;
  flex-shrink: 0;
}
.advs-search-ico { color: var(--advs-accent); flex-shrink: 0; display: flex; }
.advs-input {
  flex: 1; background: transparent; border: none; outline: none;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 16px; font-weight: 500; color: #0f172a;
  padding: 18px 0; caret-color: var(--advs-accent);
}
.advs-input::placeholder { color: #94a3b8; }
.advs-clear {
  background: #f1f5f9; border: none; color: #94a3b8;
  border-radius: 6px; width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 13px; flex-shrink: 0; transition: all 0.1s;
}
.advs-clear:hover { background: #fee2e2; color: #ef4444; }

/* ── Filter Chips ───────────────────────────────────────────────────────────── */
.advs-filters {
  display: flex; gap: 6px; padding: 10px 18px;
  border-bottom: 1px solid #f1f5f9;
  overflow-x: auto; flex-shrink: 0; scrollbar-width: none;
}
.advs-filters::-webkit-scrollbar { display: none; }
.advs-chip {
  display: flex; align-items: center; gap: 5px;
  padding: 5px 12px; border-radius: 20px;
  border: 1px solid #e2e8f0;
  font-size: 12px; font-weight: 500; cursor: pointer; white-space: nowrap;
  background: #f8fafc; color: #64748b;
  transition: all 0.12s; font-family: 'Inter', system-ui, sans-serif;
}
.advs-chip:hover { background: #f0fdf4; border-color: #86efac; color: #16a34a; }
.advs-chip.active {
  background: #f0fdf4; border-color: var(--advs-accent);
  color: var(--advs-accent); font-weight: 600;
}
.advs-chip-count { font-family: 'JetBrains Mono', monospace; font-size: 10px; opacity: 0.7; }

/* ── AI Hint ────────────────────────────────────────────────────────────────── */
.advs-ai-hint {
  display: none; align-items: center; gap: 8px;
  padding: 9px 18px; border-bottom: 1px solid #f0fdf4;
  font-size: 12px; color: #166534;
  background: #f0fdf4;
}
.advs-ai-hint.show { display: flex; }
.advs-ai-star { color: var(--advs-accent); font-size: 14px; }

/* ── Results ────────────────────────────────────────────────────────────────── */
.advs-results {
  overflow-y: auto; flex: 1;
  scrollbar-width: thin; scrollbar-color: #e2e8f0 transparent;
}
.advs-results::-webkit-scrollbar { width: 4px; }
.advs-results::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 4px; }

/* States */
.advs-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 40px 24px; color: #94a3b8; text-align: center;
}
.advs-state-icon  { font-size: 32px; }
.advs-state-title { font-size: 15px; font-weight: 600; color: #475569; }
.advs-state-sub   { font-size: 13px; }

/* Loading dots */
.advs-dots { display: flex; gap: 6px; align-items: center; justify-content: center; padding: 32px; }
.advs-dot  { width: 7px; height: 7px; background: var(--advs-accent); opacity: 0.5; border-radius: 50%; animation: advsBounc 1.2s infinite; }
.advs-dot:nth-child(2) { animation-delay: 0.2s; }
.advs-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes advsBounc { 0%,80%,100%{transform:scale(0.7);opacity:.35} 40%{transform:scale(1);opacity:.9} }

/* Lane headers */
.advs-lane { padding: 2px 0; }
.advs-lane-hdr { display: flex; align-items: center; gap: 8px; padding: 12px 18px 6px; }
.advs-lane-ico  { width: 22px; height: 22px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 12px; flex-shrink: 0; }
.advs-lane-lbl  { font-family: 'JetBrains Mono', monospace; font-size: 10px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: #94a3b8; }
.advs-lane-cnt  { margin-left: auto; font-family: 'JetBrains Mono', monospace; font-size: 10px; color: #cbd5e1; }
.advs-divider   { height: 1px; background: #f1f5f9; margin: 4px 0; }

/* Prevent child elements swallowing the click */
.advs-row .advs-thumb,
.advs-row .advs-text,
.advs-row .advs-title,
.advs-row .advs-meta,
.advs-row .advs-badge,
.advs-row .advs-arrow,
.advs-row mark { pointer-events: none; }

/* Works for both <a> and <div> rows */
a.advs-row,
div.advs-row {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 18px; cursor: pointer; position: relative;
  transition: background 0.1s;
  /* Reset anchor tag defaults */
  text-decoration: none;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}
a.advs-row:hover,
div.advs-row:hover,
a.advs-row.focused,
div.advs-row.focused { background: #f0fdf4; text-decoration: none; color: inherit; }
a.advs-row.focused::before,
div.advs-row.focused::before {
  content: ''; position: absolute; left: 0; top: 5px; bottom: 5px;
  width: 3px; background: var(--advs-accent); border-radius: 0 3px 3px 0;
}
a.advs-row:hover .advs-arrow,
a.advs-row.focused .advs-arrow,
div.advs-row:hover .advs-arrow,
div.advs-row.focused .advs-arrow { color: var(--advs-accent); }
.advs-thumb {
  width: 40px; height: 40px; border-radius: 10px;
  background: #f8fafc; border: 1px solid #e2e8f0;
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; flex-shrink: 0;
}
.advs-text { flex: 1; min-width: 0; }
.advs-title { font-size: 14px; font-weight: 600; color: #0f172a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.3; }
.advs-title mark { background: #dcfce7; color: #15803d; border-radius: 2px; padding: 0 2px; font-style: normal; }
.advs-meta  { font-size: 12px; color: #94a3b8; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.advs-badge { font-family: 'JetBrains Mono', monospace; font-size: 11px; padding: 3px 8px; border-radius: 5px; font-weight: 600; flex-shrink: 0; }
.badge-price { background: #f0fdf4; color: #15803d; border: 1px solid #86efac; }
.badge-page  { background: #fefce8; color: #854d0e; border: 1px solid #fde047; }
.badge-post  { background: #eff6ff; color: #1d4ed8; border: 1px solid #93c5fd; }
.badge-cat   { background: #faf5ff; color: #7e22ce; border: 1px solid #c4b5fd; }
.advs-arrow { color: #cbd5e1; font-size: 14px; flex-shrink: 0; transition: color 0.1s; }

/* Recents */
.advs-recents-hdr { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px 8px; }
.advs-recents-lbl { font-family: 'JetBrains Mono', monospace; font-size: 10px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: #94a3b8; }
.advs-clear-rec   { font-size: 11px; color: #64748b; background: none; border: none; cursor: pointer; font-family: 'Inter', system-ui, sans-serif; padding: 0; }
.advs-clear-rec:hover { color: #ef4444; }

/* Footer */
.advs-footer { border-top: 1.5px solid #f1f5f9; padding: 10px 18px; display: flex; align-items: center; gap: 14px; flex-shrink: 0; background: #fafafa; }
.advs-hint   { display: flex; align-items: center; gap: 5px; font-size: 11px; color: #94a3b8; }
.advs-hint kbd { font-family: 'JetBrains Mono', monospace; font-size: 10px; background: #fff; border: 1px solid #e2e8f0; border-radius: 4px; padding: 1px 6px; color: #64748b; box-shadow: 0 1px 2px rgba(0,0,0,0.06); }
.advs-powered { display: none; }
