/* ─── Design tokens ──────────────────────────────────────────────── */
:root {
  --bg:          #eef1f7;
  --bg-card:     #ffffff;
  --bg-nav:      #0e2355;
  --bg-nav-dark: #09193e;
  --text:        #111827;
  --text2:       #4b5563;
  --text3:       #9ca3af;
  --navy:        #0e2355;
  --accent:      #ff6700;
  --accent-h:    #e55a00;
  --border:      #e2e8f0;
  --border2:     #f1f5f9;
  --green:       #059669;
  --green-bg:    #ecfdf5;
  --red:         #dc2626;
  --red-bg:      #fef2f2;
  --radius:      8px;
  --radius-lg:   14px;
  --shadow:      0 2px 8px rgba(0,0,0,.08);
  --shadow-md:   0 4px 16px rgba(0,0,0,.10);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:        #0d1424;
    --bg-card:   #161f35;
    --bg-nav:    #07111f;
    --bg-nav-dark: #040d18;
    --text:      #f1f5f9;
    --text2:     #94a3b8;
    --text3:     #64748b;
    --border:    #263352;
    --border2:   #161f35;
    --green:     #10b981;
    --green-bg:  #022c22;
    --red:       #ef4444;
    --red-bg:    #2d0a0a;
  }
}

:root[data-theme="dark"] {
  --bg:        #0d1424;
  --bg-card:   #161f35;
  --bg-nav:    #07111f;
  --bg-nav-dark: #040d18;
  --text:      #f1f5f9;
  --text2:     #94a3b8;
  --text3:     #64748b;
  --border:    #263352;
  --border2:   #161f35;
  --green:     #10b981;
  --green-bg:  #022c22;
  --red:       #ef4444;
  --red-bg:    #2d0a0a;
}

/* ─── Base ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--navy); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Nav ────────────────────────────────────────────────────────── */
.nav {
  background: var(--bg-nav);
  padding: 0 1.25rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,.25);
}
.nav-inner {
  max-width: 1140px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  height: 54px;
}
.nav-brand {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-decoration: none;
  line-height: 1;
}
.nav-brand:hover { text-decoration: none; }
.nav-brand-price  { color: #ffffff; }
.nav-brand-master { color: rgba(255,255,255,.75); }
.nav-brand-is     { color: var(--accent); }

.nav-links { display: flex; gap: 0.2rem; margin-left: auto; }
.nav-links a {
  padding: 0.3rem 0.75rem;
  border-radius: 6px;
  color: rgba(255,255,255,.65);
  font-size: 0.875rem;
  font-weight: 500;
  transition: background .15s, color .15s;
}
.nav-links a:hover { background: rgba(255,255,255,.1); color: #fff; text-decoration: none; }
.nav-links a.active { background: rgba(255,255,255,.12); color: #fff; }

/* ─── Page layout ────────────────────────────────────────────────── */
.page {
  max-width: 1140px;
  margin: 0 auto;
  padding: 2rem 1.25rem;
}

/* ─── Hero ───────────────────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, var(--bg-nav) 0%, #1a3d8f 100%);
  padding: 3.5rem 1.25rem 2.75rem;
  text-align: center;
}
.hero-inner { max-width: 640px; margin: 0 auto; }
.hero h1 {
  font-size: 2.25rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
}
.hero p { color: rgba(255,255,255,.7); font-size: 1rem; margin-bottom: 2rem; }

/* ─── Search bar ─────────────────────────────────────────────────── */
.search-wrap {
  display: flex;
  gap: 0.5rem;
  max-width: 620px;
  margin: 0 auto;
}
.search-input {
  flex: 1;
  padding: 0.8rem 1.25rem;
  font-size: 1rem;
  font-family: inherit;
  border: 2px solid transparent;
  border-radius: 50px;
  background: #fff;
  color: var(--text);
  outline: none;
  box-shadow: 0 4px 20px rgba(0,0,0,.18);
  transition: border-color .15s, box-shadow .15s;
}
.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 4px 20px rgba(0,0,0,.18), 0 0 0 4px rgba(255,103,0,.15);
}
.search-input::placeholder { color: #9ca3af; }

/* ─── Filters card ───────────────────────────────────────────────── */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  align-items: flex-end;
  padding: 1.1rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  margin: 1.5rem 0 1.25rem;
}
.filter-group { display: flex; flex-direction: column; gap: 0.35rem; }
.filter-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Store chips */
.filter-checks { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.check-pill {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.65rem;
  border: 1.5px solid var(--border);
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  background: var(--bg-card);
  color: var(--text2);
  user-select: none;
  transition: all .15s;
}
.check-pill input { accent-color: var(--accent); }
.check-pill:has(input:checked) {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

/* Price slider */
.price-filter-group { flex: 1; min-width: 220px; max-width: 400px; }
.price-slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 0.5rem;
}
#price-slider { margin: 0 4px; }

/* noUiSlider overrides */
.noUi-target {
  background: var(--border);
  border: none;
  box-shadow: none;
  height: 5px;
  border-radius: 3px;
}
.noUi-connect { background: var(--accent); }
.noUi-handle {
  width: 18px !important;
  height: 18px !important;
  right: -9px !important;
  top: -7px !important;
  border-radius: 50%;
  background: #fff;
  border: 2.5px solid var(--accent);
  box-shadow: 0 1px 6px rgba(0,0,0,.2);
  cursor: pointer;
}
.noUi-handle::before, .noUi-handle::after { display: none; }
.noUi-handle:focus { outline: none; box-shadow: 0 0 0 4px rgba(255,103,0,.2); }

/* In-stock toggle */
.filter-stock {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text2);
  cursor: pointer;
}
.filter-stock input { accent-color: var(--accent); width: 16px; height: 16px; }

/* ─── Results meta ───────────────────────────────────────────────── */
.results-meta {
  font-size: 0.8rem;
  color: var(--text3);
  margin: 0 0 0.6rem;
  font-weight: 500;
}
.results-empty {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--text3);
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}
.results-empty .empty-icon { font-size: 2.5rem; margin-bottom: 0.75rem; }
.results-empty p { margin: 0.3rem 0 0; font-size: 0.9rem; }

/* Loading fade */
#results.htmx-request { opacity: 0.45; transition: opacity .15s .08s; }

/* ─── Table ──────────────────────────────────────────────────────── */
.table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
thead tr { background: var(--bg); }
th {
  text-align: left;
  padding: 0.65rem 1rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border2);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background .1s; }
tbody tr:hover td { background: #fafbff; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) tbody tr:hover td { background: rgba(255,255,255,.03); }
}

/* Product name */
.product-name { font-weight: 600; color: var(--text); line-height: 1.3; }
.product-name a { color: var(--text); }
.product-name a:hover { color: var(--navy); text-decoration: underline; }

/* Store badge */
.store-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 50px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
  background: color-mix(in srgb, var(--store-c, #64748b) 12%, transparent);
  color: var(--store-c, #64748b);
  border: 1px solid color-mix(in srgb, var(--store-c, #64748b) 25%, transparent);
}
.store-badge[data-store="elko"]        { --store-c: #d97706; }
.store-badge[data-store="tolvutaekni"] { --store-c: #7c3aed; }
.store-badge[data-store="computer"]    { --store-c: #0369a1; }
.store-badge[data-store="ht"]          { --store-c: #047857; }
.store-badge[data-store="tl"]          { --store-c: #0891b2; }
.store-badge[data-store="ofar"]        { --store-c: #b91c1c; }
.store-badge[data-store="epli"]        { --store-c: #374151; }
.store-badge[data-store="ok"]          { --store-c: #1d4ed8; }
.store-badge[data-store="tolvutek"]    { --store-c: #be185d; }

/* Price */
.price-cell {
  font-size: 1rem;
  font-weight: 800;
  color: var(--accent);
  white-space: nowrap;
  letter-spacing: -0.02em;
}

/* CTA button */
.cta-cell { width: 90px; }
.cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.3rem 0.75rem;
  background: var(--navy);
  color: #fff;
  font-size: 0.775rem;
  font-weight: 600;
  border-radius: 50px;
  white-space: nowrap;
  transition: background .15s, transform .1s;
}
.cta-btn:hover { background: #1a3d8f; text-decoration: none; transform: translateY(-1px); }
.cta-arrow { font-size: 0.85em; opacity: .8; }

/* Stock badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  border-radius: 50px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-green::before { background: var(--green); }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-red::before { background: var(--red); }
.badge-orange { background: #fff7ed; color: #c2410c; }

/* ─── Pagination ─────────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.25rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--border2);
}
.page-info { font-size: 0.8rem; color: var(--text3); font-weight: 600; min-width: 60px; text-align: center; }

/* ─── Buttons ────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 1rem;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 50px;
  border: none;
  cursor: pointer;
  transition: background .15s, transform .1s;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-h); }
.btn-ghost { background: var(--bg-card); color: var(--text2); border: 1.5px solid var(--border); }
.btn-ghost:hover { border-color: var(--navy); color: var(--navy); background: var(--bg-card); }
.btn-sm { padding: 0.3rem 0.75rem; font-size: 0.8rem; }

/* ─── Product detail ─────────────────────────────────────────────── */
.product-header { margin-bottom: 1.5rem; }
.product-header h1 { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 0.4rem; }
.product-meta { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; margin-top: 0.5rem; }

.price-display {
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.03em;
  margin: 1rem 0 0.25rem;
}
.price-updated { font-size: 0.8rem; color: var(--text3); }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}
.card-title { font-size: 0.72rem; font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 0.75rem; }
.chart-wrap { height: 240px; }

/* ─── Watchlist ──────────────────────────────────────────────────── */
.wl-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.wl-header h1 { font-size: 1.5rem; font-weight: 800; margin: 0; flex: 1; }
.add-form { display: flex; gap: 0.5rem; }
.add-input {
  padding: 0.45rem 0.85rem;
  font-size: 0.9rem;
  font-family: inherit;
  border: 1.5px solid var(--border);
  border-radius: 50px;
  background: var(--bg-card);
  color: var(--text);
  width: 220px;
  outline: none;
}
.add-input:focus { border-color: var(--navy); }

.wl-list { list-style: none; }
.wl-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 1rem;
  overflow: hidden;
  box-shadow: var(--shadow);
  background: var(--bg-card);
}
.wl-item-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.1rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.wl-query { font-weight: 700; flex: 1; }
.wl-remove-form { margin: 0; }
.wl-results { padding: 0.5rem 0; }
.wl-results table { font-size: 0.85rem; }

/* ─── Status page ────────────────────────────────────────────────── */
.status-grid { display: grid; gap: 0.75rem; }
.status-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.25rem 1rem;
  align-items: start;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  box-shadow: var(--shadow);
}
.status-name { font-weight: 700; }
.status-method { font-size: 0.72rem; color: var(--text3); font-family: monospace; }
.status-info { font-size: 0.82rem; color: var(--text2); }
.status-info strong { color: var(--text); }
.status-error { font-size: 0.75rem; color: var(--red); margin-top: 0.25rem; font-family: monospace; word-break: break-all; }

/* ─── Page title ─────────────────────────────────────────────────── */
.page-title { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 1.5rem; }

/* ─── Misc ───────────────────────────────────────────────────────── */
.muted { color: var(--text3); }
hr { border: none; border-top: 1px solid var(--border2); margin: 1.5rem 0; }

/* ─── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .hero { padding: 2.5rem 1rem 2rem; }
  .hero h1 { font-size: 1.75rem; }
  .search-input { font-size: 0.95rem; padding: 0.7rem 1rem; }
  .filters { gap: 0.85rem; padding: 0.9rem 1rem; }
  th, td { padding: 0.5rem 0.6rem; }
  .price-display { font-size: 1.75rem; }
  .price-cell { font-size: 0.9rem; }
  .cta-cell { display: none; }
}
