/* ===== Design tokens ===== */
:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --text: #1a1d29;
  --text-muted: #6b7280;
  --accent: #4f46e5;
  --accent-2: #06b6d4;
  --accent-grad: linear-gradient(135deg, #4f46e5, #06b6d4);
  --danger: #e11d48;
  --success: #059669;
  --border: #e5e7eb;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .07), 0 8px 24px -12px rgba(16, 24, 40, .12);
  --shadow-lg: 0 12px 40px -12px rgba(16, 24, 40, .25);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1117;
    --surface: #181b25;
    --text: #e8eaf2;
    --text-muted: #9aa1b5;
    --border: #2a2e3d;
    --shadow: 0 1px 3px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.5);
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
h1 { font-size: 2rem; line-height: 1.2; }
h2 { font-size: 1.4rem; margin: 0 0 1rem; }
.container { max-width: 1240px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--text-muted); }
.small { font-size: .85rem; }

/* ===== Header ===== */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50; }
.header-inner { display: flex; align-items: center; gap: 24px; padding: 14px 20px; }
.logo { display: flex; align-items: center; gap: 8px; font-size: 1.35rem; font-weight: 800; color: var(--text); white-space: nowrap; }
.logo:hover { text-decoration: none; }
.logo-mark { background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; color: transparent; font-size: 1.6rem; }
.search-form { flex: 1; display: flex; max-width: 560px; }
.search-form input { flex: 1; border: 1.5px solid var(--border); border-right: 0; border-radius: 10px 0 0 10px; padding: 10px 16px; font-size: .95rem; background: var(--bg); color: var(--text); outline: none; }
.search-form input:focus { border-color: var(--accent); }
.search-form button { border: 0; background: var(--accent-grad); color: #fff; padding: 0 18px; border-radius: 0 10px 10px 0; cursor: pointer; font-size: 1rem; }
.header-actions { margin-left: auto; }
.fav-link { display: flex; align-items: center; gap: 6px; color: var(--text); font-weight: 600; }
.fav-link .heart { color: var(--danger); font-size: 1.2rem; }
.fav-count { background: var(--danger); color: #fff; border-radius: 999px; font-size: .72rem; min-width: 19px; height: 19px; display: inline-flex; align-items: center; justify-content: center; padding: 0 5px; }
.cat-nav { border-top: 1px solid var(--border); overflow-x: auto; }
.cat-nav-inner { display: flex; gap: 4px; padding: 0 20px; }
.cat-nav a { padding: 9px 13px; color: var(--text-muted); font-size: .9rem; font-weight: 500; white-space: nowrap; border-radius: 8px 8px 0 0; }
.cat-nav a:hover { color: var(--accent); background: var(--bg); text-decoration: none; }

/* ===== Hero ===== */
.hero { text-align: center; padding: 64px 16px 40px; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.2rem); margin: 0 0 12px; font-weight: 800; }
.hero .accent { background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: var(--text-muted); font-size: 1.1rem; margin: 0 0 28px; }
.hero-search { display: flex; max-width: 600px; margin: 0 auto 24px; box-shadow: var(--shadow-lg); border-radius: 14px; }
.hero-search input { flex: 1; border: 2px solid transparent; border-radius: 14px 0 0 14px; padding: 16px 22px; font-size: 1.05rem; background: var(--surface); color: var(--text); outline: none; }
.hero-search button { border: 0; background: var(--accent-grad); color: #fff; font-weight: 700; padding: 0 28px; border-radius: 0 14px 14px 0; cursor: pointer; font-size: 1rem; }
.hero-shops { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.shop-pill { background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 5px 14px; font-size: .85rem; color: var(--text-muted); }

/* ===== Sections & grids ===== */
.section { margin: 44px 0; }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.cat-card { display: flex; flex-direction: column; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 12px; font-weight: 600; color: var(--text); text-align: center; transition: transform .15s, box-shadow .15s; }
.cat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); text-decoration: none; color: var(--accent); }
.cat-icon { font-size: 2rem; }

.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
.product-card { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; transition: transform .15s, box-shadow .15s; }
.product-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.card-link { display: block; color: var(--text); }
.card-link:hover { text-decoration: none; }
.card-img { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; background: #fff; padding: 16px; }
.card-img img { max-height: 100%; object-fit: contain; }
.img-placeholder { font-size: 3rem; opacity: .3; }
.img-placeholder.big { font-size: 6rem; }
.card-body { padding: 14px 16px 16px; }
.card-brand { font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); font-weight: 700; }
.card-title { font-size: .95rem; margin: 4px 0 10px; font-weight: 600; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em; }
.card-price strong { font-size: 1.15rem; }
.card-price .shops-count { font-size: .8rem; color: var(--success); margin-left: 6px; }
.old-price { text-decoration: line-through; color: var(--text-muted); font-size: .85rem; margin-right: 8px; }

.fav-btn { position: absolute; top: 10px; right: 10px; z-index: 2; border: 1px solid var(--border); background: var(--surface); color: #c3c8d4; width: 38px; height: 38px; border-radius: 50%; font-size: 1.15rem; cursor: pointer; transition: all .15s; line-height: 1; }
.fav-btn:hover { color: var(--danger); border-color: var(--danger); }
.fav-btn.active { color: #fff; background: var(--danger); border-color: var(--danger); }
.fav-btn.inline { position: static; width: auto; height: auto; border-radius: 10px; padding: 10px 18px; font-size: .95rem; font-weight: 600; color: var(--text-muted); }
.fav-btn.inline.active { color: #fff; }

/* ===== Buttons ===== */
.btn { display: inline-block; border: 0; border-radius: 10px; padding: 10px 20px; font-size: .95rem; font-weight: 600; cursor: pointer; text-align: center; transition: filter .15s, transform .1s; }
.btn:hover { text-decoration: none; filter: brightness(1.08); }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--accent-grad); color: #fff; }
.btn-outline { background: transparent; border: 1.5px solid var(--accent); color: var(--accent); }
.btn-ghost { background: transparent; border: 1.5px solid var(--border); color: var(--text-muted); }
.btn-lg { padding: 14px 30px; font-size: 1.05rem; }
.btn-block { display: block; width: 100%; margin-top: 8px; }

/* ===== Category page ===== */
.breadcrumbs { font-size: .85rem; color: var(--text-muted); margin: 18px 0 6px; }
.cat-header { margin-bottom: 16px; }
.cat-header h1 { margin: 4px 0 4px; }
.subcat-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.pill { background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 7px 16px; font-size: .88rem; font-weight: 600; color: var(--text); }
.pill:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.cat-layout { display: grid; grid-template-columns: 260px 1fr; gap: 26px; align-items: start; }
.filters { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; position: sticky; top: 110px; max-height: calc(100vh - 130px); overflow-y: auto; }
.filter-group { margin-bottom: 20px; }
.filter-group h3 { font-size: .82rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); margin: 0 0 8px; }
.filter-option { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: .92rem; cursor: pointer; }
.filter-option .count { color: var(--text-muted); font-size: .8rem; }
.price-inputs { display: flex; align-items: center; gap: 8px; }
.price-inputs input { width: 100%; border: 1.5px solid var(--border); border-radius: 8px; padding: 8px 10px; background: var(--bg); color: var(--text); }
.results-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 12px; }
.sort-form select { border: 1.5px solid var(--border); border-radius: 8px; padding: 8px 12px; background: var(--surface); color: var(--text); font-size: .9rem; }
.filters-toggle { display: none; }
.pagination { display: flex; gap: 6px; justify-content: center; margin: 30px 0; flex-wrap: wrap; }
.pagination a { min-width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: 9px; color: var(--text); font-weight: 600; }
.pagination a.current { background: var(--accent-grad); color: #fff; border: 0; }
.pagination a:hover { text-decoration: none; border-color: var(--accent); }

/* ===== Product page ===== */
.product-top { display: grid; grid-template-columns: minmax(280px, 440px) 1fr; gap: 36px; margin-top: 14px; }
.product-gallery { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; display: flex; align-items: center; justify-content: center; min-height: 340px; }
.product-gallery img { max-height: 400px; object-fit: contain; }
.product-info h1 { font-size: 1.65rem; margin: 4px 0 6px; }
.best-price-box { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; background: var(--surface); border: 2px solid var(--accent); border-radius: var(--radius); padding: 20px 24px; margin: 18px 0; box-shadow: var(--shadow); }
.best-price-box .label { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); font-weight: 700; }
.best-price { font-size: 2.1rem; font-weight: 800; background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.best-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spec-highlights { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-top: 16px; }
.spec-chip { background: var(--surface); border: 1px solid var(--border); border-radius: 11px; padding: 10px 14px; }
.spec-chip-name { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); font-weight: 700; }
.spec-chip-value { font-weight: 700; font-size: .95rem; }

.offers-table { display: flex; flex-direction: column; gap: 10px; }
.offer-row { display: grid; grid-template-columns: 1.4fr 1fr auto auto; gap: 16px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 20px; }
.offer-row.best { border-color: var(--accent); box-shadow: var(--shadow); }
.offer-row.out-of-stock { opacity: .55; }
.offer-shop { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.shop-logo { height: 26px; max-width: 90px; object-fit: contain; }
.badge-best { background: var(--accent-grad); color: #fff; font-size: .7rem; font-weight: 700; border-radius: 999px; padding: 3px 10px; text-transform: uppercase; letter-spacing: .04em; }
.offer-delivery { color: var(--text-muted); font-size: .9rem; }
.offer-price strong { font-size: 1.25rem; }

.spec-table { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.spec-row { display: grid; grid-template-columns: 240px 1fr; }
.spec-row:nth-child(odd) { background: color-mix(in srgb, var(--bg) 60%, var(--surface)); }
.spec-name { padding: 11px 18px; color: var(--text-muted); font-weight: 600; font-size: .92rem; }
.spec-value { padding: 11px 18px; font-weight: 500; }
.product-description { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; max-width: 860px; }

.price-chart { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.price-chart svg { width: 100%; height: 160px; }
.chart-labels { display: flex; justify-content: space-between; color: var(--text-muted); font-size: .85rem; margin-top: 8px; }

/* ===== Favorites & misc ===== */
.email-banner { display: grid; grid-template-columns: 1fr auto; gap: 20px; align-items: center; background: linear-gradient(135deg, rgba(79,70,229,.08), rgba(6,182,212,.08)); border: 1.5px solid var(--accent); border-radius: var(--radius); padding: 20px 24px; margin: 18px 0 26px; }
.email-banner p { margin: 4px 0 0; color: var(--text-muted); font-size: .92rem; }
.email-form { display: flex; gap: 8px; flex-wrap: wrap; }
.email-form input { border: 1.5px solid var(--border); border-radius: 10px; padding: 11px 16px; min-width: 240px; background: var(--surface); color: var(--text); font-size: .95rem; }
.email-form.centered { justify-content: center; margin-top: 14px; }
.empty-state { text-align: center; padding: 60px 20px; background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); margin: 26px 0; }
.alert { border-radius: 11px; padding: 13px 18px; margin: 14px 0; font-weight: 500; }
.alert-success { background: rgba(5,150,105,.1); border: 1px solid var(--success); color: var(--success); }

.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); border-radius: 11px; padding: 13px 22px; font-weight: 600; box-shadow: var(--shadow-lg); z-index: 100; max-width: 90vw; }

/* ===== Footer ===== */
.site-footer { background: var(--surface); border-top: 1px solid var(--border); margin-top: 70px; padding: 40px 0 0; }
.footer-inner { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 36px; padding-bottom: 26px; }
.site-footer ul { list-style: none; padding: 0; margin: 10px 0 0; }
.site-footer li { margin: 5px 0; }
.site-footer a { color: var(--text-muted); }
.disclosure { font-size: .82rem; color: var(--text-muted); }
.copyright { border-top: 1px solid var(--border); padding: 16px 20px; font-size: .82rem; color: var(--text-muted); }

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .header-inner { flex-wrap: wrap; gap: 12px; }
  .search-form { order: 3; min-width: 100%; }
  .cat-layout { grid-template-columns: 1fr; }
  .filters { display: none; position: static; max-height: none; }
  .filters.open { display: block; }
  .filters-toggle { display: inline-block; }
  .product-top { grid-template-columns: 1fr; }
  .offer-row { grid-template-columns: 1fr auto; }
  .offer-delivery { display: none; }
  .spec-row { grid-template-columns: 1fr; }
  .spec-name { padding-bottom: 0; }
  .email-banner { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; gap: 20px; }
}
