:root {
  --wa-green: #25D366;
  --wa-green-dark: #1DA851;
  --ink: #1b2430;
  --ink-soft: #5b6675;
  --line: #e6e8ec;
  --bg: #f5f6f8;
  --card: #ffffff;
  --accent: #ff6f3c;
  --radius: 16px;
  --shadow: 0 2px 10px rgba(20, 25, 40, 0.06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

.topbar {
  background: linear-gradient(135deg, #2b2f77, #4c3a9e 60%, #7a3ea1);
  color: #fff;
  padding: 28px 16px 22px;
  text-align: center;
}
.topbar-inner h1 { margin: 0 0 6px; font-size: 1.6rem; }
.topbar-inner p { margin: 0; opacity: .9; font-size: .92rem; }

.tabs {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 10px 12px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.tab-btn {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-soft);
  padding: 9px 16px;
  border-radius: 999px;
  font-size: .92rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s ease;
}
.tab-btn:hover { border-color: #c9ccd6; }
.tab-btn.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.content { max-width: 980px; margin: 0 auto; padding: 18px 12px 140px; }

.category-section { display: none; }
.category-section.active { display: block; animation: fadein .2s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(4px);} to { opacity: 1; transform: translateY(0);} }

.category-intro {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0 14px;
}
.category-intro h2 { margin: 0; font-size: 1.25rem; }
.category-intro .count-pill {
  background: #eef0ff;
  color: #4c3a9e;
  font-size: .78rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
}

.gallery-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-weight: 600;
  font-size: .85rem;
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  margin-bottom: 12px;
}
.gallery-toggle:hover { border-color: #c9ccd6; }

.gallery {
  display: none;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
  padding: 12px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.gallery.open { display: grid; }
.gallery img {
  border-radius: 10px;
  border: 1px solid var(--line);
  cursor: zoom-in;
  width: 100%;
}

.group-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 14px;
  overflow: hidden;
}
.group-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.group-thumb {
  width: 56px;
  height: 56px;
  flex: 0 0 auto;
  object-fit: cover;
  object-position: top center;
  border-radius: 10px;
  border: 1px solid var(--line);
  cursor: zoom-in;
}
.group-head-text { min-width: 0; flex: 1 1 auto; }
.group-head h3 { margin: 0; font-size: 1rem; }
.group-head .size-note { font-size: .8rem; color: var(--ink-soft); margin-top: 2px; }

.item-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid #f0f1f4;
}
.item-row:last-child { border-bottom: none; }
.item-row.soldout { opacity: .5; }

.color-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,.12);
  flex: 0 0 auto;
}

.item-info { flex: 1 1 auto; min-width: 0; }
.item-name { font-weight: 600; font-size: .92rem; line-height: 1.25; }
.item-meta { font-size: .78rem; color: var(--ink-soft); margin-top: 2px; }
.item-meta .code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.item-price {
  font-weight: 700;
  font-size: .92rem;
  min-width: 78px;
  text-align: right;
  flex: 0 0 auto;
}
.item-price small { display: block; font-weight: 500; font-size: .68rem; color: var(--ink-soft); }

.soldout-badge {
  font-size: .72rem;
  font-weight: 700;
  color: #b3413a;
  background: #fdeceb;
  padding: 3px 8px;
  border-radius: 999px;
  flex: 0 0 auto;
}

.stepper {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}
.stepper button {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fafafa;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  line-height: 1;
}
.stepper button:active { background: #eee; }
.stepper .qty {
  min-width: 18px;
  text-align: center;
  font-weight: 700;
  font-size: .9rem;
}
.stepper button.add-btn {
  width: auto;
  padding: 0 12px;
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

/* Floating WhatsApp cart button */
.cart-fab-wrap {
  position: fixed;
  left: 0; right: 0; bottom: 14px;
  display: flex;
  justify-content: center;
  z-index: 40;
  padding: 0 14px;
  pointer-events: none;
}
.cart-fab {
  pointer-events: all;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 520px;
  background: var(--wa-green);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  font-size: .92rem;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(29, 168, 81, .4);
  cursor: pointer;
}
.cart-fab:active { background: var(--wa-green-dark); }
.cart-fab-icon { position: relative; flex: 0 0 auto; display: flex; }
.cart-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background: #ff3b30;
  color: #fff;
  font-size: .68rem;
  font-weight: 800;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--wa-green);
}
.cart-fab-text {
  flex: 1 1 auto;
  text-align: left;
  line-height: 1.15;
}
.cart-fab-wa { flex: 0 0 auto; display: flex; opacity: .95; }

/* Cart drawer */
.cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 12, 20, .45);
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 60;
}
.cart-overlay.open { display: flex; }
.cart-drawer {
  background: #fff;
  width: 100%;
  max-width: 560px;
  max-height: 82vh;
  border-radius: 20px 20px 0 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideup .18s ease;
}
@keyframes slideup { from { transform: translateY(30px); opacity: .6; } to { transform: translateY(0); opacity: 1; } }

.cart-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}
.cart-drawer-head h2 { margin: 0; font-size: 1.1rem; }
.icon-btn {
  border: none;
  background: #f0f1f4;
  width: 32px; height: 32px;
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
}

.cart-items { overflow-y: auto; padding: 8px 18px; flex: 1 1 auto; }
.cart-empty { text-align: center; color: var(--ink-soft); padding: 40px 10px; }

.cart-line {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #f0f1f4;
}
.cart-line .item-info { flex: 1 1 auto; }
.cart-line .item-name { font-size: .88rem; }
.cart-line .item-meta { font-size: .74rem; }
.cart-line .remove-btn {
  border: none;
  background: none;
  color: #b3413a;
  font-size: 1rem;
  cursor: pointer;
  padding: 4px 6px;
}

.cart-drawer-foot {
  padding: 14px 18px 18px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cart-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1rem;
}
.cart-total-row strong { font-size: 1.15rem; }

.btn-secondary {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-soft);
  padding: 11px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
}
.btn-whatsapp {
  border: none;
  background: var(--wa-green);
  color: #fff;
  padding: 13px;
  border-radius: 12px;
  font-weight: 700;
  font-size: .96rem;
  cursor: pointer;
}
.btn-whatsapp:active { background: var(--wa-green-dark); }

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(5,6,10,.9);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.lightbox.open { display: flex; }
.lightbox img { max-height: 92vh; border-radius: 6px; }
.lightbox-close {
  position: absolute;
  top: 16px; right: 20px;
  background: rgba(255,255,255,.15);
  border: none;
  color: #fff;
  width: 38px; height: 38px;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
}

.site-footer {
  text-align: center;
  padding: 18px 12px 100px;
}
.site-footer a {
  color: var(--ink-soft);
  font-size: .78rem;
  text-decoration: none;
}
.site-footer a:hover { text-decoration: underline; }

@media (min-width: 640px) {
  .topbar-inner h1 { font-size: 1.9rem; }
  .cart-fab-text { font-size: .98rem; }
}
