/* ============================================================
   theme.css - Shared storefront design system
   ------------------------------------------------------------
   HOW TO RE-THEME:
   Everything below is driven by the CSS custom properties in
   :root. To re-skin the ENTIRE storefront, change only these:

     --brand        primary brand / action color (buttons, links)
     --brand-ink    text color that sits ON the brand color
     --brand-soft   very light tint of the brand (chips, hovers)
     --accent       secondary accent (badges, highlights)
     --bg           page background
     --surface      card / panel background
     --text         primary text
     --muted        secondary / helper text
     --border       hairline border color
     --radius       corner rounding for cards, buttons, inputs
     --font         base font family
     --font-head    display font for headings / logo

   THEME PRESETS - 5 deliberately broad "moods", each covering many
   business types. Applied via <html data-theme="..."> (store.js sets
   this automatically from the shop name/tagline, or from an explicit
   Shop.Theme value). Anything unmatched falls back to GENERIC (:root).

     GENERIC (default) -> indigo-blue   | general retail, electronics, hardware, auto, office/B2B, services
     FOOD              -> terracotta    | bakery, cafe, restaurant, grocery, juice bar, catering
     BOUTIQUE          -> black + gold  | fashion, jewelry, gifts, home decor, luxe beauty
     WELLNESS          -> sage green    | health, spa, yoga, skincare, florist, plants, pet, pharmacy
     PLAYFUL           -> violet        | toys, kids, party, sports, streetwear, entertainment

   To add/adjust a theme, edit only the variable blocks below.
   ============================================================ */

:root {
  /* GENERIC (default) - neutral, trustworthy commerce. */
  --brand: #3b5bdb;
  --brand-ink: #ffffff;
  --brand-soft: #eef1fd;
  --accent: #0ea5e9;
  --bg: #f7f8fa;
  --surface: #ffffff;
  --text: #181b23;
  --muted: #6b7280;
  --border: #e6e8ee;
  --radius: 14px;
  --radius-sm: 9px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-head: "Space Grotesk", "Inter", sans-serif;
  --shadow-sm: 0 1px 2px rgba(20, 22, 31, .05), 0 1px 3px rgba(20, 22, 31, .06);
  --shadow-md: 0 8px 24px rgba(20, 22, 31, .08);
  --shadow-lg: 0 18px 50px rgba(20, 22, 31, .14);
  --ok: #16a34a;
  --warn: #d97706;
  --danger: #dc2626;
  --maxw: 1200px;
}

/* ---------- reset ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .4em; letter-spacing: -.02em; font-family: var(--font-head, var(--font)); }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.section { padding: 44px 0; }
.section-head { display: flex; align-items: end; justify-content: space-between; margin-bottom: 22px; gap: 16px; flex-wrap: wrap; }
.section-head h2 { font-size: clamp(20px, 2.4vw, 28px); margin: 0; }
.section-head .link { color: var(--brand); font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; gap: 4px; }
.eyebrow { color: var(--brand); font-weight: 700; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; }
.muted { color: var(--muted); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 11px 18px; font-weight: 600; font-size: 14px;
  background: var(--surface); color: var(--text); transition: .15s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--brand); color: var(--brand-ink); box-shadow: var(--shadow-sm); }
.btn-primary:hover { filter: brightness(1.06); }
.btn-outline { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--brand); color: var(--brand); }
/* Buy button: outlined by default, fills solid with brand on hover */
.btn-buy { background: var(--surface); border-color: var(--brand); color: var(--brand); box-shadow: none; }
.btn-buy:hover { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); filter: none; }
.btn-ghost { background: transparent; }
.btn-block { width: 100%; }
.btn-lg { padding: 14px 22px; font-size: 15px; }
.btn-sm { padding: 8px 12px; font-size: 13px; }

/* ---------- badges / chips ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 4px 9px; border-radius: 999px; }
.badge-brand { background: var(--brand-soft); color: var(--brand); }
.badge-accent { background: color-mix(in srgb, var(--accent) 15%, white); color: color-mix(in srgb, var(--accent) 70%, black); }
.badge-ok { background: #e7f6ec; color: var(--ok); }
.badge-warn { background: #fdf1e0; color: var(--warn); }
.badge-danger { background: #fdecec; color: var(--danger); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
  font-size: 13px; font-weight: 500; cursor: pointer; transition: .15s;
}
.chip:hover, .chip.active { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
/* Persistent business details strip */
.topbar {
  display: block;
  background: var(--text);
  color: #d8dce8;
  font-size: 12px;
  text-align: center;
  padding: 8px 12px;
  font-weight: 500;
  letter-spacing: .01em;
}
.header-main { display: flex; align-items: center; gap: 18px; padding: 14px 0; }
.brand-logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 19px; letter-spacing: -.02em; }
.brand-logo .mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: var(--brand); color: var(--brand-ink); font-weight: 800;
}
.nav { display: flex; gap: 4px; margin-left: 8px; }
.nav a { padding: 8px 12px; border-radius: 8px; font-weight: 500; font-size: 15px; color: var(--text); }
.nav a:hover, .nav a.active { background: var(--brand-soft); color: var(--brand); }
.search {
  flex: 1; max-width: 420px; display: flex; align-items: center; gap: 8px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 999px; padding: 9px 14px;
}
.search input { border: 0; background: transparent; outline: none; width: 100%; font-size: 14px; color: var(--text); }
.header-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.topbar .sep { opacity: .45; padding: 0 10px; }
.icon-btn {
  position: relative; width: 42px; height: 42px; border-radius: 10px; border: 1px solid transparent;
  background: transparent; display: grid; place-items: center; color: var(--text);
}
.icon-btn:hover { background: var(--brand-soft); color: var(--brand); }
.cart-count {
  position: absolute; top: 4px; right: 4px; min-width: 18px; height: 18px; padding: 0 4px;
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; border-radius: 999px;
  display: grid; place-items: center;
}
.menu-toggle { display: none; }

/* ---------- product cards ---------- */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; transition: .18s ease; position: relative;
}
.product-card { display: flex; flex-direction: column; }
.product-card:hover { box-shadow: var(--shadow-md); transform: translateY(-3px); border-color: color-mix(in srgb, var(--brand) 30%, var(--border)); }
.product-media { position: relative; background: var(--bg); aspect-ratio: 1/1; overflow: hidden; }
.product-media img { width: 100%; height: 100%; object-fit: cover; transition: .3s; }
.product-card:hover .product-media img { transform: scale(1.04); }
.product-tag { position: absolute; top: 12px; left: 12px; }
.wish { position: absolute; top: 10px; right: 10px; width: 34px; height: 34px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); display: grid; place-items: center; color: var(--muted); }
.wish:hover { color: var(--danger); border-color: var(--danger); }
.product-body { padding: 14px 15px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.product-cat { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.product-name { font-size: 15px; font-weight: 600; margin: 0; }
.product-name a:hover { color: var(--brand); }
.stars { color: #f59e0b; font-size: 13px; letter-spacing: 1px; }
.price-row { display: flex; align-items: baseline; gap: 8px; margin-top: 2px; }
.price { font-size: 18px; font-weight: 800; letter-spacing: -.02em; }
.price-old { color: var(--muted); text-decoration: line-through; font-size: 14px; font-weight: 500; }
.product-actions { margin-top: auto; padding-top: 12px; display: flex; gap: 8px; }
/* price + buy on one row, button pushed right */
.product-foot { margin-top: auto; padding-top: 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.product-foot .price-row { margin: 0; }

/* ---------- category pills (replaces photo tiles) ---------- */
.cat-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.cat-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); font-weight: 600; font-size: 13px; color: var(--text);
  transition: .15s ease; box-shadow: var(--shadow-sm);
}
.cat-pill:hover { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); transform: translateY(-2px); }
.cat-pill .ct { font-weight: 500; font-size: 12px; color: var(--muted); }
.cat-pill:hover .ct { color: var(--brand); }

/* ---------- footer ---------- */
.site-footer { background: var(--text); color: #cfd2dc; margin-top: 40px; }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 32px; padding: 52px 0 34px; }
.site-footer h4 { color: #fff; font-size: 14px; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 14px; }
.site-footer a { display: block; padding: 5px 0; color: #cfd2dc; font-size: 14px; }
.site-footer a:hover { color: #fff; }
.footer-brand .brand-logo { color: #fff; margin-bottom: 12px; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.12); padding: 18px 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 13px; color: #9aa0b0; }
.pay-icons { display: flex; gap: 8px; }
.pay-icons span { background: rgba(255,255,255,.1); border-radius: 6px; padding: 4px 9px; font-size: 11px; font-weight: 700; letter-spacing: .04em; }

/* ---------- forms ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.input, select.input, textarea.input {
  width: 100%; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); font-size: 14px; color: var(--text); outline: none; transition: .15s; font-family: inherit;
}
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ---------- panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.summary-line { display: flex; justify-content: space-between; padding: 7px 0; font-size: 14px; }
.summary-line.total { border-top: 1px solid var(--border); margin-top: 8px; padding-top: 14px; font-size: 18px; font-weight: 800; }

/* ---------- qty stepper ---------- */
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.stepper button { width: 38px; height: 40px; border: 0; background: transparent; font-size: 18px; color: var(--text); }
.stepper button:hover { background: var(--brand-soft); color: var(--brand); }
.stepper input { width: 44px; text-align: center; border: 0; border-left: 1px solid var(--border); border-right: 1px solid var(--border); height: 40px; font-size: 15px; font-weight: 600; outline: none; background: var(--surface); color: var(--text); }

/* ---------- breadcrumb ---------- */
.crumbs { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); padding: 18px 0 4px; }
.crumbs a:hover { color: var(--brand); }
.crumbs .sep { opacity: .5; }

/* ---------- pagination ---------- */
.pager { display: flex; gap: 6px; justify-content: center; margin-top: 34px; }
.pager a { min-width: 40px; height: 40px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); display: grid; place-items: center; font-weight: 600; font-size: 14px; }
.pager a:hover { border-color: var(--brand); color: var(--brand); }
.pager a.active { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }

/* ---------- theme demo control ---------- */
.theme-dock {
  position: fixed; right: 18px; bottom: 18px; z-index: 80;
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  box-shadow: var(--shadow-lg); padding: 8px 10px; display: flex; align-items: center; gap: 10px;
}
.theme-dock .lbl { font-size: 12px; font-weight: 700; color: var(--muted); padding-left: 4px; }
.swatch { width: 26px; height: 26px; border-radius: 999px; border: 2px solid var(--border); cursor: pointer; padding: 0; position: relative; }
.swatch.on { border-color: var(--text); box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text); }
.sw-elec { background: linear-gradient(135deg, #4f46e5, #06b6d4); }
.sw-food { background: linear-gradient(135deg, #e0492f, #2f9e44); }
.sw-boutique { background: linear-gradient(135deg, #111, #c9a24b); }

/* ============================================================
   THEME PRESETS - applied via <html data-theme="...">
   Each overrides only the tokens it needs; everything else
   inherits from GENERIC (:root). store.js loads the matching
   Google font for --font / --font-head automatically.
   ============================================================ */

/* GENERIC alias - legacy pages may still say data-theme="electronics";
   map it to the generic default rather than leaving it unstyled. */
[data-theme="generic"], [data-theme="electronics"] { /* inherits :root */ }

/* FOOD - warm, appetizing, rounded. */
[data-theme="food"] {
  --brand: #d5442b; --brand-ink: #fff; --brand-soft: #fbe7e1;
  --accent: #e08a1e; --bg: #fbf5ef; --surface: #ffffff;
  --text: #2a1b16; --muted: #8a7268; --border: #ece0d8; --radius: 18px;
  --font: "Nunito", -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-head: "Poppins", "Nunito", sans-serif;
}

/* BOUTIQUE - elegant, premium, serif headings. */
[data-theme="boutique"] {
  --brand: #141414; --brand-ink: #fff; --brand-soft: #f1efe9;
  --accent: #c9a24b; --bg: #faf9f7; --surface: #ffffff;
  --text: #1b1b1b; --muted: #857f74; --border: #e7e3da; --radius: 6px;
  --font: "Inter", -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-head: "Fraunces", "Georgia", serif;
}

/* WELLNESS - calm, natural, soft. */
[data-theme="wellness"] {
  --brand: #2f6b4f; --brand-ink: #fff; --brand-soft: #e6f0ea;
  --accent: #cf8a4b; --bg: #f4f6f2; --surface: #ffffff;
  --text: #1e2a24; --muted: #6f7d74; --border: #e2e8e0; --radius: 16px;
  --font: "Nunito Sans", -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-head: "Fraunces", "Georgia", serif;
}

/* PLAYFUL - bright, energetic, chunky corners. */
[data-theme="playful"] {
  --brand: #7c3aed; --brand-ink: #fff; --brand-soft: #f1e9fe;
  --accent: #ec4899; --bg: #fdf7ff; --surface: #ffffff;
  --text: #241548; --muted: #6d6488; --border: #ece4f5; --radius: 20px;
  --font: "Nunito", -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-head: "Poppins", "Nunito", sans-serif;
}

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .grid-4 { grid-template-columns: repeat(3, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 26px; }
}
@media (max-width: 820px) {
  .nav, .search { display: none; }
  .menu-toggle { display: grid; }
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .row2 { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .theme-dock { right: 10px; bottom: 10px; }
}
