/* =============================================================
 * Universal WhatsApp Commerce Store — storefront styles
 * Minimal Modern design. Colors & fonts are applied at runtime
 * from the store settings via CSS variables (see assets/js/store.js).
 * ============================================================= */

:root {
  --brand: #1F7A4D;
  --brand-dark: #14532D;
  --accent: #F59E0B;
  --bg: #FFFFFF;
  --text: #17251F;
  --muted: #6B7A72;
  --line: #E7ECE9;
  --card: #FFFFFF;
  --soft: #F5F8F6;
  --radius: 14px;
  --font-heading: 'Plus Jakarta Sans', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --shadow-sm: 0 1px 2px rgba(23, 37, 31, .06);
  --shadow-md: 0 8px 24px rgba(23, 37, 31, .10);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--brand); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
h1, h2, h3, h4 { font-family: var(--font-heading); line-height: 1.2; margin: 0; }

.container { max-width: 1160px; margin: 0 auto; padding: 0 20px; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------------- Header ---------------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .inner {
  display: flex; align-items: center; gap: 16px;
  min-height: 64px;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand img { width: 36px; height: 36px; border-radius: 10px; object-fit: cover; }
.brand .name { font-family: var(--font-heading); font-weight: 700; font-size: 19px; color: var(--text); white-space: nowrap; }
.brand .tagline { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.nav { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.nav a {
  color: var(--text); font-size: 14px; font-weight: 500;
  padding: 8px 12px; border-radius: 10px;
}
.nav a:hover, .nav a.active { background: var(--soft); color: var(--brand); }

.icon-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--card); color: var(--text);
}
.icon-btn:hover { border-color: var(--brand); color: var(--brand); }
.cart-count {
  position: absolute; top: -6px; right: -6px;
  min-width: 20px; height: 20px; padding: 0 5px;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand); color: #fff;
  font-size: 11px; font-weight: 700; border-radius: 999px;
}
.cart-count[hidden] { display: none; }

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border-radius: 12px; border: 1px solid transparent;
  font-size: 15px; font-weight: 600; text-align: center;
  transition: transform .05s ease, box-shadow .15s ease, background .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-accent { background: var(--accent); color: #3A2A00; }
.btn-outline { background: transparent; color: var(--brand); border-color: var(--brand); }
.btn-outline:hover { background: var(--soft); }
.btn-soft { background: var(--soft); color: var(--text); border-color: var(--line); }
.btn-soft:hover { border-color: var(--brand); color: var(--brand); }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 14px; font-size: 13px; border-radius: 10px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------------- Hero ---------------- */
.hero { position: relative; overflow: hidden; background: var(--soft); }
.hero .inner {
  display: grid; grid-template-columns: 1.05fr 1fr; gap: 32px;
  align-items: center; padding: 56px 20px;
}
.hero h1 { font-size: clamp(30px, 4.5vw, 46px); font-weight: 800; letter-spacing: -.02em; }
.hero p { color: var(--muted); font-size: 17px; margin: 16px 0 24px; max-width: 46ch; }
.hero .eyebrow {
  display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--brand); margin-bottom: 12px;
}
.hero-media { border-radius: 24px; overflow: hidden; box-shadow: var(--shadow-md); aspect-ratio: 4/3; }
.hero-media img { width: 100%; height: 100%; object-fit: cover; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---------------- Sections ---------------- */
.section { padding: 56px 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.section-head h2 { font-size: clamp(22px, 3vw, 30px); font-weight: 700; letter-spacing: -.01em; }
.section-head .sub { color: var(--muted); font-size: 14px; margin-top: 6px; }
.section-head .link { font-size: 14px; font-weight: 600; white-space: nowrap; }
.section-head .link:hover { text-decoration: underline; }

/* Categories */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
.cat-card {
  position: relative; border-radius: var(--radius); overflow: hidden;
  aspect-ratio: 4/3; background: var(--soft); box-shadow: var(--shadow-sm);
}
.cat-card img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s ease; }
.cat-card:hover img { transform: scale(1.04); }
.cat-card .label {
  position: absolute; inset: auto 0 0 0; padding: 24px 12px 10px;
  background: linear-gradient(transparent, rgba(0, 0, 0, .62));
  color: #fff; font-weight: 600; font-size: 14px;
}
.cat-card .ph {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 30px;
}

/* Product cards */
.prod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.prod-grid.rail { grid-auto-flow: column; grid-auto-columns: 220px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: thin; }
.prod-card {
  display: flex; flex-direction: column; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  transition: box-shadow .2s ease, border-color .2s ease;
}
.prod-card:hover { box-shadow: var(--shadow-md); border-color: transparent; }
.prod-card .thumb { position: relative; aspect-ratio: 1/1; background: var(--soft); cursor: pointer; }
.prod-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.prod-card .ph {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 26px;
}
.badges { position: absolute; top: 10px; left: 10px; display: flex; flex-direction: column; gap: 6px; }
.badge {
  padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700;
  background: var(--brand); color: #fff; width: fit-content;
}
.badge.offer { background: var(--accent); color: #3A2A00; }
.badge.out { background: #8A948E; }
.prod-card .body { display: flex; flex-direction: column; gap: 6px; padding: 14px; flex: 1; }
.prod-card .cat { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.prod-card .name { font-size: 15px; font-weight: 600; color: var(--text); }
.prod-card .name:hover { color: var(--brand); }
.price-row { display: flex; align-items: center; gap: 8px; margin-top: auto; }
.price { font-family: var(--font-heading); font-weight: 700; font-size: 17px; }
.price-old { color: var(--muted); text-decoration: line-through; font-size: 13px; }
.card-actions { padding: 0 14px 14px; }

/* Empty / loading */
.empty { color: var(--muted); text-align: center; padding: 40px 0; font-size: 14px; }
.skeleton { aspect-ratio: 1/1; border-radius: var(--radius); background: linear-gradient(100deg, var(--soft) 40%, #eef2ef 50%, var(--soft) 60%); background-size: 200% 100%; animation: shine 1.2s infinite; }
.skeleton.body-skel { aspect-ratio: auto; height: 90px; }
@keyframes shine { to { background-position: -200% 0; } }

/* About + CTA */
.about { border-top: 1px solid var(--line); }
.about .inner { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; align-items: center; padding: 56px 20px; }
.about h2 { font-size: clamp(22px, 3vw, 30px); }
.about p { color: var(--muted); font-size: 16px; }
.about ul { margin: 16px 0 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.about li { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; }
.about li svg { flex: 0 0 auto; margin-top: 3px; color: var(--brand); }

.cta-band { background: var(--brand); color: #fff; }
.cta-band .inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 40px 20px; flex-wrap: wrap; }
.cta-band h2 { color: #fff; font-size: clamp(20px, 3vw, 28px); }
.cta-band p { margin: 8px 0 0; opacity: .85; font-size: 15px; }
.cta-band .btn { background: #fff; color: var(--brand); }
.cta-band .btn:hover { background: var(--soft); }

/* ---------------- Footer ---------------- */
.site-footer { border-top: 1px solid var(--line); padding: 40px 0 28px; background: var(--soft); }
.foot-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 28px; }
.site-footer h4 { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }
.site-footer p, .site-footer a { color: var(--muted); font-size: 14px; }
.foot-links { display: grid; gap: 8px; }
.socials { display: flex; gap: 10px; margin-top: 14px; }
.socials a {
  display: inline-flex; width: 38px; height: 38px; border-radius: 10px;
  align-items: center; justify-content: center;
  background: var(--card); border: 1px solid var(--line); color: var(--text);
}
.socials a:hover { color: var(--brand); border-color: var(--brand); }
.foot-note { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------------- Products page controls ---------------- */
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 20px; }
.search-box { position: relative; flex: 1 1 260px; max-width: 380px; }
.search-box input {
  width: 100%; padding: 11px 14px 11px 40px; border: 1px solid var(--line);
  border-radius: 12px; font: inherit; font-size: 14px; background: var(--card); color: var(--text);
}
.search-box input:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
.search-box svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
select.sort {
  padding: 11px 12px; border: 1px solid var(--line); border-radius: 12px;
  font: inherit; font-size: 14px; background: var(--card); color: var(--text);
}
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 22px; }
.chip {
  padding: 8px 16px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); font-size: 13px; font-weight: 600;
}
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.pager { display: flex; gap: 8px; justify-content: center; margin-top: 28px; }
.pager button {
  min-width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); font-weight: 600; font-size: 14px;
}
.pager button.current { background: var(--brand); border-color: var(--brand); color: #fff; }
.pager button:disabled { opacity: .4; cursor: default; }
.result-count { color: var(--muted); font-size: 13px; }

/* ---------------- Product modal ---------------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 90; background: rgba(13, 22, 18, .5);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0; opacity: 0; pointer-events: none; transition: opacity .2s ease;
}
.modal-backdrop.open { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--card); width: 100%; max-width: 880px; max-height: 92vh;
  border-radius: 20px 20px 0 0; overflow: hidden; display: flex; flex-direction: column;
  transform: translateY(24px); transition: transform .25s ease;
}
.modal-backdrop.open .modal { transform: none; }
@media (min-width: 720px) {
  .modal-backdrop { align-items: center; padding: 24px; }
  .modal { border-radius: 20px; }
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 17px; }
.modal-body { overflow-y: auto; padding: 20px 18px; }
.pm-grid { display: grid; gap: 24px; }
@media (min-width: 720px) { .pm-grid { grid-template-columns: 1fr 1fr; } }
.pm-gallery .main { border-radius: 16px; overflow: hidden; aspect-ratio: 1/1; background: var(--soft); }
.pm-gallery .main img { width: 100%; height: 100%; object-fit: cover; }
.pm-thumbs { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.pm-thumbs button { width: 64px; height: 64px; border-radius: 10px; overflow: hidden; border: 2px solid transparent; padding: 0; background: var(--soft); }
.pm-thumbs button.active { border-color: var(--brand); }
.pm-thumbs img { width: 100%; height: 100%; object-fit: cover; }
.pm-info h2 { font-size: 24px; }
.pm-info .cat { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.pm-info .desc { color: var(--muted); font-size: 15px; margin: 12px 0; }
.pm-price { display: flex; align-items: center; gap: 10px; margin: 10px 0 18px; }
.pm-price .price { font-size: 24px; }
.opt-group { margin-bottom: 16px; }
.opt-group .opt-label { font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.opt-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.opt-chip {
  padding: 9px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); font-size: 13px; font-weight: 600; color: var(--text);
}
.opt-chip.active { border-color: var(--brand); color: var(--brand); background: var(--soft); }
.qty-row { display: flex; align-items: center; gap: 14px; margin: 18px 0; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.stepper button { width: 40px; height: 42px; border: 0; background: var(--soft); font-size: 18px; color: var(--text); }
.stepper button:hover { background: var(--line); }
.stepper span { min-width: 44px; text-align: center; font-weight: 700; }
.attr-table { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 8px; }
.attr-table td { padding: 8px 0; border-bottom: 1px dashed var(--line); }
.attr-table td:first-child { color: var(--muted); width: 40%; }
.stock-ok { color: var(--brand); font-weight: 600; font-size: 13px; }
.stock-out { color: #B3261E; font-weight: 600; font-size: 13px; }

/* ---------------- Cart drawer ---------------- */
.cart-backdrop {
  position: fixed; inset: 0; z-index: 95; background: rgba(13, 22, 18, .5);
  opacity: 0; pointer-events: none; transition: opacity .2s ease;
}
.cart-backdrop.open { opacity: 1; pointer-events: auto; }
.cart-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 96;
  width: min(420px, 100%); background: var(--card);
  display: flex; flex-direction: column;
  transform: translateX(105%); transition: transform .25s ease;
  box-shadow: -12px 0 40px rgba(13, 22, 18, .18);
}
.cart-drawer.open { transform: none; }
.cart-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.cart-head h3 { font-size: 17px; }
.cart-items { flex: 1; overflow-y: auto; padding: 10px 18px; }
.cart-item { display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.cart-item .ci-thumb { width: 64px; height: 64px; border-radius: 10px; overflow: hidden; background: var(--soft); }
.cart-item .ci-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cart-item .ci-name { font-size: 14px; font-weight: 600; }
.cart-item .ci-var { font-size: 12px; color: var(--muted); }
.cart-item .ci-price { font-weight: 700; font-size: 14px; }
.cart-item .ci-right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.cart-item .stepper button { width: 30px; height: 32px; font-size: 15px; }
.cart-item .stepper span { min-width: 32px; font-size: 13px; }
.ci-remove { border: 0; background: none; color: var(--muted); font-size: 12px; padding: 0; text-decoration: underline; }
.ci-remove:hover { color: #B3261E; }
.cart-empty { text-align: center; color: var(--muted); padding: 60px 20px; }
.cart-foot { border-top: 1px solid var(--line); padding: 16px 18px; display: grid; gap: 10px; }
.cart-total { display: flex; justify-content: space-between; font-size: 16px; }
.cart-total b { font-family: var(--font-heading); font-size: 19px; }
.cart-hint { font-size: 12px; color: var(--muted); }

/* FAB (mobile) */
.cart-fab {
  position: fixed; right: 16px; bottom: 16px; z-index: 60;
  display: none; align-items: center; gap: 8px;
  background: var(--brand); color: #fff; border: 0; border-radius: 999px;
  padding: 14px 20px; font-weight: 700; font-size: 14px; box-shadow: var(--shadow-md);
}
.cart-fab .cart-count { position: static; }

/* Toast */
.toast-wrap { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 120; display: grid; gap: 8px; width: min(420px, calc(100% - 32px)); }
.toast {
  background: var(--text); color: #fff; padding: 12px 16px; border-radius: 12px;
  font-size: 14px; box-shadow: var(--shadow-md); animation: rise .25s ease;
}
.toast.err { background: #B3261E; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* ---------------- Responsive ---------------- */
@media (max-width: 860px) {
  .hero .inner { grid-template-columns: 1fr; padding: 40px 20px; }
  .hero-media { order: -1; aspect-ratio: 16/9; }
  .about .inner { grid-template-columns: 1fr; }
  .foot-grid { grid-template-columns: 1fr; gap: 22px; }
  .brand .tagline { display: none; }
  .nav a { padding: 8px 8px; }
  .cart-fab { display: inline-flex; }
  .section { padding: 40px 0; }
}
@media (max-width: 480px) {
  .prod-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .prod-grid.rail { grid-auto-columns: 180px; }
  .cat-grid { grid-template-columns: repeat(2, 1fr); }
}
