/* Aeglos Engine — Generic product browser styles
   Brand colors are injected via /api/tenant/theme.css at runtime */

:root {
  --gold:         #C9A84C;
  --gold-dim:     #8a6f2e;
  --gold-light:   #e8c96a;
  --bg:           #0b0b0d;
  --bg-card:      #111116;
  --bg-surface:   #18181f;
  --bg-hover:     #1e1e28;
  --border:       #252530;
  --border-dim:   #1a1a22;
  --text:         #e2e2e8;
  --text-dim:     #888898;
  --text-muted:   #555560;
  --red:          #e05555;
  --green:        #4caf7a;
  --radius:       6px;
  --radius-lg:    10px;
  --sidebar-w:    240px;
  --header-h:     108px;
  --font-sans:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:    'JetBrains Mono', 'Fira Code', monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body { font-family: var(--font-sans); background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
a { color: var(--gold); text-decoration: none; }
::-webkit-scrollbar { width: 6px; } ::-webkit-scrollbar-track { background: transparent; } ::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Header ── */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(11,11,13,0.96);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
}
.header-inner {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 24px; flex-wrap: wrap;
}
.brand-link { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-name { font-family: var(--font-mono); font-size: 1.05rem; font-weight: 700; color: var(--gold); white-space: nowrap; }
.tagline-bar { font-size: 0.72rem; color: var(--text-muted); padding: 0 24px 8px; font-style: italic; }
.tagline-bar:empty { display: none; }

/* AI bar */
.ai-bar { display: flex; flex: 1; max-width: 480px; gap: 0; }
.ai-bar input {
  flex: 1; background: var(--bg-surface); border: 1px solid var(--border);
  border-right: none; border-radius: var(--radius) 0 0 var(--radius);
  padding: 8px 14px; font-family: var(--font-sans); font-size: 0.88rem; color: var(--text); outline: none;
}
.ai-bar input:focus { border-color: var(--gold-dim); }
.ai-bar button {
  background: var(--gold); color: #0b0b0d; border: none;
  padding: 8px 16px; border-radius: 0 var(--radius) var(--radius) 0;
  font-weight: 600; font-size: 0.85rem; cursor: pointer; white-space: nowrap;
}
.ai-bar button:hover { background: var(--gold-light); }

/* Quick search */
.quick-search input {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 8px 12px; font-size: 0.85rem;
  color: var(--text); outline: none; width: 180px;
}
.quick-search input:focus { border-color: var(--gold-dim); }

/* Auth bar */
.auth-bar { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.auth-name { font-size: 0.8rem; color: var(--text-dim); }
.btn-ghost-sm { background: transparent; border: 1px solid var(--border); color: var(--text-dim); padding: 5px 12px; border-radius: var(--radius); font-size: 0.8rem; cursor: pointer; }
.btn-ghost-sm:hover { background: var(--bg-hover); color: var(--text); border-color: var(--border); }
.btn-primary-sm { background: var(--gold); color: #0b0b0d; border: none; padding: 5px 12px; border-radius: var(--radius); font-size: 0.8rem; font-weight: 600; cursor: pointer; }
.btn-primary-sm:hover { background: var(--gold-light); }

/* ── Feature nav ── */
.feature-nav {
  display: flex; gap: 0; padding: 0 24px;
  background: var(--bg-card); border-bottom: 1px solid var(--border);
  overflow-x: auto; scrollbar-width: none;
}
.feature-nav::-webkit-scrollbar { display: none; }
.nav-tab {
  padding: 11px 20px; font-size: 0.85rem; color: var(--text-dim);
  cursor: pointer; border-bottom: 2px solid transparent;
  white-space: nowrap; transition: all 0.15s; margin-bottom: -1px;
}
.nav-tab:hover { color: var(--text); }
.nav-tab.active { color: var(--gold); border-bottom-color: var(--gold); }

/* ── App layout ── */
.app-layout { display: flex; min-height: calc(100vh - 110px); }

/* ── Filter sidebar ── */
.filter-sidebar {
  width: var(--sidebar-w); min-width: var(--sidebar-w);
  background: var(--bg-card); border-right: 1px solid var(--border);
  padding: 20px 16px; overflow-y: auto;
  position: sticky; top: 110px; height: calc(100vh - 110px);
}
.filter-group { margin-bottom: 18px; }
.filter-label { font-size: 0.72rem; font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: 8px; }
.filter-group select, .filter-group input[type="number"] {
  width: 100%; background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 7px 10px; font-size: 0.82rem;
  color: var(--text); outline: none; font-family: var(--font-sans); appearance: none;
}
.filter-group select:focus, .filter-group input:focus { border-color: var(--gold-dim); }
.range-inputs { display: flex; gap: 6px; }
.range-inputs input { flex: 1; }
.brand-pills { display: flex; flex-wrap: wrap; gap: 5px; }
.brand-pill { padding: 3px 9px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: 20px; font-size: 0.75rem; cursor: pointer; color: var(--text-dim); transition: 0.12s; }
.brand-pill:hover { border-color: var(--gold-dim); color: var(--text); }
.brand-pill.active { background: rgba(201,168,76,0.12); border-color: var(--gold-dim); color: var(--gold); }
.filter-toggle label { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; cursor: pointer; }
.filter-toggle input { accent-color: var(--gold); }
.btn-clear-filters { width: 100%; margin-top: 8px; background: transparent; border: 1px solid var(--border); color: var(--text-muted); padding: 7px; border-radius: var(--radius); font-size: 0.8rem; cursor: pointer; }
.btn-clear-filters:hover { border-color: var(--red); color: var(--red); }

/* ── Main area ── */
.main-area { flex: 1; padding: 20px 24px 48px; overflow: hidden; }

/* Browse controls */
.controls-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.result-count { font-size: 0.82rem; color: var(--text-muted); font-family: var(--font-mono); }
.controls-right { display: flex; align-items: center; gap: 10px; }
.controls-right select { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 10px; font-size: 0.82rem; color: var(--text); outline: none; appearance: none; cursor: pointer; }
.view-toggle { display: flex; gap: 0; }
.view-toggle button { background: var(--bg-surface); border: 1px solid var(--border); color: var(--text-muted); padding: 6px 10px; font-size: 0.9rem; cursor: pointer; }
.view-toggle button:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.view-toggle button:last-child  { border-radius: 0 var(--radius) var(--radius) 0; }
.view-toggle button.active { background: rgba(201,168,76,0.1); color: var(--gold); border-color: var(--gold-dim); }

/* ── Product grid ── */
.product-grid.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.product-grid.list { display: flex; flex-direction: column; gap: 10px; }

/* Product card */
.product-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden; cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
  position: relative;
}
.product-card:hover { border-color: var(--gold-dim); transform: translateY(-2px); }
.card-image { position: relative; background: var(--bg-surface); aspect-ratio: 4/3; overflow: hidden; }
.card-image img { width: 100%; height: 100%; object-fit: contain; padding: 12px; }
.card-badges { position: absolute; top: 8px; left: 8px; display: flex; flex-direction: column; gap: 4px; }
.card-badge { background: rgba(201,168,76,0.15); border: 1px solid rgba(201,168,76,0.25); color: var(--gold); font-size: 0.68rem; font-weight: 600; font-family: var(--font-mono); text-transform: uppercase; padding: 2px 7px; border-radius: 4px; }
.compare-btn { position: absolute; bottom: 8px; right: 8px; background: rgba(11,11,13,0.85); border: 1px solid var(--border); color: var(--text-dim); font-size: 0.72rem; padding: 4px 10px; border-radius: var(--radius); cursor: pointer; backdrop-filter: blur(4px); transition: 0.15s; }
.compare-btn:hover { border-color: var(--gold-dim); color: var(--gold); }
.compare-btn.active { background: rgba(201,168,76,0.15); border-color: var(--gold-dim); color: var(--gold); }
.card-body { padding: 14px; }
.card-brand { font-size: 0.72rem; font-family: var(--font-mono); text-transform: uppercase; color: var(--text-muted); margin-bottom: 3px; }
.card-name { font-size: 0.95rem; font-weight: 600; margin-bottom: 6px; }
.card-price { font-size: 1.1rem; font-weight: 700; color: var(--gold); margin-bottom: 8px; }
.card-specs { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.spec-row { display: flex; justify-content: space-between; font-size: 0.78rem; }
.spec-label { color: var(--text-muted); }
.spec-value { font-family: var(--font-mono); font-weight: 500; }
.card-verdict { font-size: 0.78rem; color: var(--text-dim); font-style: italic; margin-bottom: 8px; line-height: 1.4; border-top: 1px solid var(--border-dim); padding-top: 8px; }
.card-cta { display: block; text-align: center; background: var(--gold); color: #0b0b0d; padding: 7px; border-radius: var(--radius); font-size: 0.82rem; font-weight: 600; margin-top: 8px; }
.card-cta:hover { background: var(--gold-light); color: #0b0b0d; }

/* List view */
.product-grid.list .product-card { display: flex; flex-direction: row; }
.product-grid.list .card-image { width: 160px; min-width: 160px; aspect-ratio: auto; height: 120px; }
.product-grid.list .card-body { flex: 1; padding: 12px 16px; }
.product-grid.list .card-specs { flex-direction: row; flex-wrap: wrap; gap: 12px; }

/* ── Compare table ── */
.compare-table-wrap { overflow-x: auto; margin-bottom: 20px; }
.compare-table { border-collapse: collapse; width: 100%; }
.compare-table th { background: var(--bg-card); border: 1px solid var(--border); padding: 14px 12px; text-align: center; font-size: 0.85rem; min-width: 160px; vertical-align: top; }
.compare-table th img { display: block; margin: 0 auto 8px; }
.compare-table td { border: 1px solid var(--border); padding: 9px 12px; font-size: 0.85rem; }
.compare-table td.spec-row-label { color: var(--text-muted); font-size: 0.8rem; background: var(--bg-surface); white-space: nowrap; }
.compare-table td.no-data { color: var(--text-muted); text-align: center; }
.compare-table tr.group-header td { background: rgba(201,168,76,0.07); font-size: 0.72rem; font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.5px; color: var(--gold); padding: 6px 12px; }

/* ── Pagination ── */
.pagination { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 24px; }
.pagination button { background: var(--bg-surface); border: 1px solid var(--border); color: var(--text); padding: 7px 16px; border-radius: var(--radius); font-size: 0.85rem; cursor: pointer; }
.pagination button:hover:not(:disabled) { border-color: var(--gold-dim); color: var(--gold); }
.pagination button:disabled { opacity: 0.3; cursor: not-allowed; }
.pagination span { font-size: 0.82rem; color: var(--text-muted); font-family: var(--font-mono); }

/* ── Modal ── */
.modal-root { position: fixed; inset: 0; z-index: 500; }
.modal-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.78); display: flex; align-items: center; justify-content: center; padding: 20px; backdrop-filter: blur(4px); }
.modal-box { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); max-width: 760px; width: 100%; max-height: 85vh; overflow-y: auto; position: relative; box-shadow: 0 8px 48px rgba(0,0,0,0.6); }
.modal-box.small { max-width: 420px; padding: 28px; }
.modal-close { position: absolute; top: 14px; right: 14px; background: none; border: none; color: var(--text-muted); font-size: 1.2rem; cursor: pointer; padding: 4px 8px; border-radius: var(--radius); }
.modal-close:hover { background: var(--bg-hover); color: var(--text); }
.modal-inner { display: flex; gap: 0; }
.modal-image { width: 300px; min-width: 300px; background: var(--bg-surface); display: flex; align-items: center; justify-content: center; padding: 24px; border-radius: var(--radius-lg) 0 0 var(--radius-lg); }
.modal-image img { max-width: 100%; max-height: 260px; object-fit: contain; }
.modal-content { flex: 1; padding: 28px; }
.modal-brand { font-size: 0.72rem; font-family: var(--font-mono); text-transform: uppercase; color: var(--text-muted); margin-bottom: 4px; }
.modal-name { font-size: 1.4rem; font-weight: 700; margin-bottom: 8px; }
.modal-price { font-size: 1.5rem; font-weight: 700; color: var(--gold); margin-bottom: 12px; }
.modal-verdict { font-size: 0.88rem; color: var(--text-dim); font-style: italic; margin-bottom: 16px; line-height: 1.5; }
.spec-table { width: 100%; border-collapse: collapse; margin-bottom: 20px; }
.spec-table td { padding: 7px 0; font-size: 0.85rem; border-bottom: 1px solid var(--border-dim); }
.spec-table td:first-child { color: var(--text-muted); width: 50%; }
.spec-table td:last-child { font-family: var(--font-mono); font-weight: 500; }

/* ── Auth form ── */
.modal-box.small h2 { font-size: 1.1rem; margin-bottom: 20px; }
.form-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.form-group label { font-size: 0.75rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.4px; }
.form-group input { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 9px 12px; font-size: 0.9rem; color: var(--text); outline: none; }
.form-group input:focus { border-color: var(--gold-dim); }
.btn-primary { display: block; background: var(--gold); color: #0b0b0d; border: none; padding: 10px 20px; border-radius: var(--radius); font-weight: 600; font-size: 0.9rem; cursor: pointer; text-align: center; }
.btn-primary:hover { background: var(--gold-light); }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text-dim); padding: 9px 18px; border-radius: var(--radius); font-size: 0.88rem; cursor: pointer; }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }
.w-full { width: 100%; }
.auth-switch { font-size: 0.82rem; color: var(--text-muted); text-align: center; margin-top: 14px; }

/* ── Listings ── */
.panel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.panel-header h2 { font-size: 1.1rem; }
.listings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.listing-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; cursor: pointer; }
.listing-card img { width: 100%; height: 160px; object-fit: cover; }
.listing-no-photo { height: 160px; background: var(--bg-surface); display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 0.8rem; }
.listing-body { padding: 12px; }
.listing-title { font-weight: 600; font-size: 0.9rem; margin-bottom: 4px; }
.listing-price { font-size: 1.05rem; font-weight: 700; color: var(--gold); margin-bottom: 4px; }
.listing-meta { font-size: 0.75rem; color: var(--text-muted); }

/* ── Dealers ── */
.dealer-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.dealer-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; }
.dealer-brand { font-size: 0.78rem; color: var(--text-dim); margin-top: 3px; }
.dealer-loc { font-size: 0.78rem; color: var(--text-muted); margin: 4px 0; }

/* ── News ── */
.news-list { display: flex; flex-direction: column; gap: 2px; }
.news-item { display: block; padding: 12px 14px; border-radius: var(--radius); border: 1px solid transparent; transition: 0.12s; }
.news-item:hover { background: var(--bg-card); border-color: var(--border); }
.news-title { font-size: 0.9rem; color: var(--text); margin-bottom: 4px; line-height: 1.4; }
.news-meta { font-size: 0.75rem; color: var(--text-muted); }

/* ── Section title ── */
.section-title { font-size: 1.1rem; font-weight: 600; margin-bottom: 20px; }

/* ── Compare tray ── */
.compare-tray {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 200;
  background: var(--bg-card); border-top: 1px solid var(--gold-dim);
  padding: 12px 24px; display: flex; align-items: center; gap: 14px;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.4);
}
.tray-count { font-family: var(--font-mono); font-size: 0.85rem; color: var(--gold); }
.compare-tray button { background: var(--gold); color: #0b0b0d; border: none; padding: 8px 18px; border-radius: var(--radius); font-weight: 600; font-size: 0.85rem; cursor: pointer; }
.tray-clear { background: transparent !important; color: var(--text-muted) !important; border: 1px solid var(--border) !important; }

/* ── States ── */
.loading-state { display: flex; justify-content: center; align-items: center; min-height: 200px; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-icon { font-size: 2.5rem; margin-bottom: 12px; opacity: 0.4; }
.empty-state p { font-size: 0.9rem; margin-bottom: 16px; }
.empty-state button { background: transparent; border: 1px solid var(--border); color: var(--text-dim); padding: 8px 16px; border-radius: var(--radius); cursor: pointer; font-size: 0.85rem; }
.spinner { width: 24px; height: 24px; border: 2px solid var(--border); border-top-color: var(--gold); border-radius: 50%; animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.hidden { display: none !important; }

/* ── Toast ── */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast-msg { padding: 10px 18px; border-radius: var(--radius); font-size: 0.88rem; font-weight: 500; animation: toastIn 0.2s ease; box-shadow: 0 4px 20px rgba(0,0,0,0.4); }
.toast-ok  { background: rgba(76,175,122,0.2); border: 1px solid rgba(76,175,122,0.35); color: #80e8aa; }
.toast-err { background: rgba(224,85,85,0.2); border: 1px solid rgba(224,85,85,0.35); color: #f08080; }
@keyframes toastIn { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }

/* ── Responsive ── */
@media (max-width: 860px) {
  .filter-sidebar { display: none; }
  .header-inner { padding: 10px 16px; }
  .ai-bar { max-width: 100%; order: 3; width: 100%; }
  .product-grid.grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .modal-inner { flex-direction: column; }
  .modal-image { width: 100%; min-width: 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
}
