/* =========================================================
   FORCE LIGHT COLOR SCHEME
   =========================================================
   The customer-facing store page has no dark/light toggle —
   each theme is a deliberately designed, fixed palette. Without
   this, a visitor's phone/OS being set to dark mode can make
   browsers auto-recolor native form controls (checkboxes,
   dropdowns, date pickers, scrollbars) to dark, clashing with
   the theme's own colors. Locking color-scheme prevents that.
========================================================= */
html {
  color-scheme: light;
}

/* =========================
   THEME VARIABLES
========================= */

.preview-theme {
  --bg: #f2f2f2;
  --card: #ffffff;
  --text: #111111;
  --muted: #8a8a8a;
  --border: #e6e6e6;

  --accent: #e8f7d8;
  --accent-text: #3a8f00;

  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 22px;

  --space-1: 8px;
  --space-2: 14px;
  --space-3: 20px;
  --space-4: 32px;
  --space-5: 44px;

  --shadow-lg: 0 10px 30px rgba(0,0,0,0.06);

  background: var(--bg);
  color: var(--text);
  min-height: 100vh; /* fills the full viewport height, in the preview too, not just on the live page */
}

/* =========================
   MAIN CARD
========================= */

.preview-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  box-shadow: var(--shadow-lg);
  box-sizing: border-box;
}

/* =========================
   HEADER
========================= */

.business-name {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 6px;
}

.subtitle {
  font-size: 15px;
  color: var(--muted);
  margin-bottom: var(--space-5);
}

/* =========================
   FORM GRID (FIELDS)
========================= */

.form-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.form-group {
  display: flex;
  flex-direction: column;
  margin-bottom: var(--space-4);
}

.form-group label {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: var(--space-2);
  line-height: 1.5;
}

/* =========================
   INPUTS
========================= */

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  border: none;
  background: #f6f6f6;
  border-radius: var(--radius-md);
  padding: 18px 22px;
  font-size: 16px;
  outline: none;
}

.form-group textarea {
  min-height: 160px;
  resize: none;
  line-height: 1.7;
  padding-top: var(--space-3);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  background: #fff;
  box-shadow: 0 0 0 3px rgba(58,143,0,0.15);
}

/* =========================
   PRODUCT SECTION
========================= */

.product-section {
  margin-top: var(--space-5);
}

.product-section h3 {
  font-size: 19px;
  font-weight: 700;
  margin-bottom: var(--space-3);
}

/* =========================
   PRODUCT GRID (ECOMMERCE)
========================= */

.product-grid {
  display: grid;

  /* Minimum 2 products like Jumia */
  grid-template-columns: repeat(
    auto-fill,
    minmax(240px, 1fr)
  );

  gap: var(--space-4);
  max-height: 560px;
  overflow-y: auto;
  padding-right: 6px;
}

/* =========================
   PRODUCT CARD
========================= */

.product-card {
  background: #f7f7f7;
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  min-width: 0; /* CSS Grid items default to min-width:auto, which lets
                   card content (images, long names) force the track
                   wider than available space and overflow the screen
                   on narrow viewports — this removes that floor. */
}

.product-image {
  width: 100%;
  height: 220px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #eaeaea;
  margin-bottom: var(--space-3);
}

.product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.product-name {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
}

.product-price {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: var(--space-3);
}

/* =========================
   QTY CONTROL
========================= */

.product-qty {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--card);
  border-radius: var(--radius-md);
  padding: 10px 12px;
}

.product-qty button {
  border: none;
  background: var(--accent);
  color: var(--accent-text);
  width: 36px;
  height: 36px;
  border-radius: 10px;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
}

.product-qty span {
  font-size: 15px;
  font-weight: 600;
}

.product-qty button:hover {
  background: #dff1c9;
}

.product-qty button:active {
  transform: scale(0.95);
}

.product-qty button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* =========================
   TOTAL BOX
========================= */

.total-box {
  background: #f6f6f6;
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin: var(--space-5) 0;
  font-size: 15px;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.total-box div {
  display: flex;
  justify-content: space-between;
}

.total-box div:last-child {
  font-weight: 700;
}

/* =========================
   PAYMENT PROOF
========================= */

.payment-proof {
  margin-bottom: var(--space-5);
}

.payment-proof label {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: var(--space-1);
  display: block;
}

.upload-proof {
  display: block;
  cursor: pointer;
}

.upload-ui {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 18px;
  border-radius: var(--radius-md);
  background: #f6f6f6;
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
  transition: all 0.2s ease;
}

.upload-proof:hover .upload-ui {
  background: #ececec;
}

.upload-proof input {
  display: none;
}

.upload-proof input:focus + .upload-ui {
  outline: 2px solid var(--accent);
}

/* =========================
   SEND BUTTON
========================= */

.send-btn {
  width: 100%;
  background: #111;
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 18px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

.send-btn:hover {
  opacity: 0.92;
}

.send-btn:active {
  transform: scale(0.97);
}

.send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* =========================
   FOOTER
========================= */

.powered {
  text-align: center;
  font-size: 12px;
  color: #aaa;
  margin-top: var(--space-3);
}

/* =========================
   SCROLLBAR
========================= */

.product-grid::-webkit-scrollbar {
  width: 6px;
}

.product-grid::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.12);
  border-radius: 3px;
}

.product-grid::-webkit-scrollbar-track {
  background: transparent;
}

/* =========================================================
   NEW VISUAL SYSTEM (added) — minimal header, product-grid
   showcase, quick-view popup, checkout-as-overlay, sticky
   cart bar, and per-theme skins (see css/theme-r1..r4.css).
   Nothing above this line was removed, only added to.
========================================================= */

*, *::before, *::after { box-sizing: border-box; }

/* ---- minimal store header: business name + subtext only ---- */
.store-simple-header {
  max-width: 960px;
  margin: 0 auto;
  padding: 30px 20px 16px;
}
.store-simple-header h1 { margin: 0 0 4px; font-size: 24px; font-weight: 700; }
.store-simple-header p { margin: 0; font-size: 13px; }

/* ---- product showcase shell ---- */
.store-shell { max-width: 1080px; margin: 0 auto; padding: 0 20px 90px; box-sizing: border-box; }
.showcase { margin-bottom: var(--space-5); }
.showcase .product-grid {
  max-height: none;
  overflow: visible;
  padding-right: 0;
}

/* ---- unified product card: image, name, price, "+" quick-view ---- */
.product-card { position: relative; }

/* ---- quantity badge: always visible at the top-right of each product card ---- */
.product-qty-badge {
  position: absolute;
  top: 9px;
  right: 9px;
  z-index: 4;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(17, 17, 17, 0.88);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  pointer-events: none;
}

.product-description {
  margin: 0 0 8px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.popup-desc {
  overflow-wrap: anywhere;
}

.product-card .more-btn {
  position: absolute;
  bottom: var(--space-2);
  right: var(--space-2);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  font-weight: 700;
  background: var(--accent-text);
  color: #fff;
}

/* ---- quick-view popup, toggled via hidden checkbox + label (no JS needed) ---- */
.pop-toggle { display: none; }
.product-popup {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 80;
  align-items: flex-end;
  justify-content: center;
}
.pop-toggle:checked ~ .product-popup { display: flex; }
.popup-backdrop { position: absolute; inset: 0; cursor: pointer; background: rgba(0,0,0,0.4); }
.popup-card {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border-radius: 22px 22px 0 0;
  padding: 22px;
  max-height: 82vh;
  overflow-y: auto;
}
@media (min-width: 640px) {
  .product-popup { align-items: center; }
  .popup-card { border-radius: 20px; }
}
.popup-close {
  position: absolute; top: 14px; right: 14px;
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 14px; background: #f0f0f0;
}
.popup-image {
  border-radius: 16px; aspect-ratio: 4/3;
  display: flex; align-items: center; justify-content: center;
  font-size: 54px; margin-bottom: 14px; background: #eaeaea; overflow: hidden;
}
.popup-image img { width: 100%; height: 100%; object-fit: cover; }
.popup-card h3 { margin: 0 0 4px; font-size: 17px; }
.popup-desc { font-size: 12.5px; margin: 0 0 10px; color: var(--muted); }
.popup-price { font-size: 18px; font-weight: 700; margin-bottom: 14px; }
.popup-card .product-qty { margin-bottom: 4px; }

/* ---- checkout as overlay, triggered from the sticky cart bar ---- */
.cart-bar-checkout-label {
  border: none; border-radius: 999px; padding: 10px 18px;
  font-size: 13px; font-weight: 700; cursor: pointer;
}
.cart-bar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 16px;
  width: calc(100% - 32px); max-width: 480px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-radius: 999px; z-index: 60;
  opacity: 0; pointer-events: none; transition: opacity 0.2s ease;
  background: #111; box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}
.cart-bar.visible { opacity: 1; pointer-events: auto; }
.cart-bar .cb-info { font-size: 13.5px; font-weight: 600; color: #fff; }
.cart-bar .cb-info small { display: block; font-weight: 400; font-size: 11.5px; opacity: 0.85; }

.checkout-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 90;
  align-items: flex-end; justify-content: center;
}
.pop-toggle:checked ~ .checkout-overlay { display: flex; }
.checkout-overlay-backdrop { position: absolute; inset: 0; cursor: pointer; background: rgba(0,0,0,0.45); }
.checkout-overlay-card {
  position: relative; z-index: 2;
  width: 100%; max-width: 480px; background: var(--card);
  border-radius: 24px 24px 0 0; padding: 24px 22px 28px;
  max-height: 88vh; overflow-y: auto;
}
@media (min-width: 640px) {
  .checkout-overlay { align-items: center; }
  .checkout-overlay-card { border-radius: 20px; }
}
.checkout-overlay-card .checkout-close {
  position: absolute; top: 14px; right: 14px;
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 14px; background: #f0f0f0;
}
.checkout-overlay-card .form-group,
.checkout-overlay-card input,
.checkout-overlay-card textarea,
.checkout-overlay-card select,
.checkout-overlay-card .total-box,
.checkout-overlay-card .payment-proof,
.checkout-overlay-card .upload-proof,
.checkout-overlay-card .send-btn {
  width: 100%;
}
.checkout-badge {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; margin: 0 auto 10px; background: #f0f0f0;
}
.checkout-head { text-align: center; margin-bottom: var(--space-4); }
.checkout-head h2 { margin: 0 0 4px; font-size: 20px; }
.checkout-head p { margin: 0; font-size: 13px; color: var(--muted); }

/* =========================================================
   CATEGORY SCROLL (shown only when a product field has >1 category)
========================================================= */

.category-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 0 12px;
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.category-scroll::-webkit-scrollbar { display: none; }
.cat-chip {
  flex-shrink: 0;
  border-radius: 999px;
  padding: 7px 15px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.product-card.hidden { display: none !important; }

/* =========================================================
   9 STRUCTURALLY DISTINCT LAYOUT MODES
   These control SHAPE (columns, orientation, image ratio) —
   each theme's own CSS file controls color/type on top of this.
========================================================= */

/* dense (r1) — tight 2-col grid, no card padding (borderless video-tile feel) */
.layout-dense { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.layout-dense .product-image { aspect-ratio: 4/3; height: auto; min-height: 220px; }

/* airy (r2) — spacious 2-col grid, generous card padding */
.layout-airy { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }

/* rounded (r3) — 2-col grid, soft rounded cards */
.layout-rounded { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }

/* iconbadge (r4) — 2-col grid; still a distinct "badge" treatment
   (rounded square, sits above the name) but sized like a real product
   image, not a tiny icon */
.layout-iconbadge { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.layout-iconbadge .product-card { display: flex; flex-direction: column; }
.card-icon-badge {
  width: 100%; height: 220px; border-radius: 14px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: var(--space-2);
}
.card-icon-badge img { width: 100%; height: 100%; object-fit: cover; }

/* luxury (r5) — single column, large image, sparse */
.layout-luxury { display: flex; flex-direction: column; gap: 22px; }
.luxury-row { display: flex; flex-direction: column; }
.luxury-row .product-image { aspect-ratio: 16/10; height: auto; min-height: 240px; margin-bottom: var(--space-3); }
.luxury-details { text-align: center; }

/* marketplace (r6) — compact grid, still real-sized images */
.layout-marketplace { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.layout-marketplace .product-card { padding: var(--space-2); }
.layout-marketplace .product-image { height: 220px; }

/* listings (r7) — horizontal rows, image left / details right */
.layout-listings { display: flex; flex-direction: column; gap: 14px; }
.list-row { display: flex; flex-direction: row; align-items: center; gap: 16px; }
.list-row .product-image { width: 220px; height: 220px; flex-shrink: 0; margin-bottom: 0; }
.list-row-body { flex: 1; min-width: 0; }
.list-row .more-btn { position: static; margin-top: 6px; width: auto; height: auto; border-radius: 999px; padding: 6px 14px; font-size: 12px; }
@media (max-width: 640px) {
  .list-row { flex-direction: column; align-items: stretch; }
  .list-row .product-image { width: 100%; height: auto; aspect-ratio: 4/3; min-height: 220px; }
}

/* organic (r8) — large circular photos, single column, no card box */
.layout-organic { display: flex; flex-direction: column; gap: 26px; }
.organic-row { background: transparent !important; box-shadow: none !important; text-align: center; }
.circle-photo { border-radius: 50%; aspect-ratio: 1/1; height: auto; width: 80%; max-width: 260px; min-width: 220px; margin: 0 auto var(--space-3); overflow: hidden; }

/* editorial (r9) — see theme-r9.css for the full redesigned look */
.layout-editorial { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.layout-editorial .product-card.featured { grid-column: span 2; }
.layout-editorial .product-card.featured .product-image { aspect-ratio: 21/9; height: auto; min-height: 220px; }

/* Responsive column counts for the 6 grid-based themes above (Neon,
   Catalog, Simple, Tech, Marketplace, Bold Deals) — explicit breakpoints
   instead of unbounded auto-fit, which either overflowed narrow screens
   or crammed too many tiny columns onto wide ones. 1 col on very small
   phones, 2 on regular phones, 3 on tablets, 4 on desktop. */
@media (max-width: 420px) {
  .layout-dense, .layout-airy, .layout-rounded, .layout-iconbadge,
  .layout-marketplace, .layout-editorial {
    grid-template-columns: repeat(1, minmax(0, 1fr));
  }
  /* the grid only has 1 explicit column at this width — without this,
     "span 2" on the featured card creates an extra IMPLICIT column
     (sized by content, not minmax(0,1fr) like the real one), which is
     exactly what was making one column compressed and the other normal */
  .layout-editorial .product-card.featured {
    grid-column: span 1;
  }
}
@media (min-width: 900px) {
  .layout-dense, .layout-airy, .layout-rounded, .layout-iconbadge,
  .layout-marketplace, .layout-editorial {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (min-width: 1200px) {
  .layout-dense, .layout-airy, .layout-rounded, .layout-iconbadge,
  .layout-marketplace, .layout-editorial {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* =========================================================
   SUCCESS STATE (merged in from the old form.css — that file
   redeclared :root with smaller spacing values and a body
   padding that created a visible "border" around the whole
   page; both are gone now that this is the only stylesheet)
========================================================= */

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
               Roboto, Inter, system-ui, sans-serif;
}

.success-state {
  text-align: center;
  padding: 48px 24px;
}

.success-icon {
  width: 64px;
  height: 64px;
  margin: 24px auto;
  border-radius: 50%;
  background: rgba(60, 180, 120, 0.1);
  color: #3cb478;
  font-size: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.success-title {
  font-size: 18px;
  font-weight: 600;
  margin-top: 12px;
}

.success-subtitle {
  font-size: 14px;
  opacity: 0.7;
  margin-top: 6px;
}

@media (max-width: 600px) {
  body { font-size: 15px; }

  .success-state { padding: 56px 20px; }
  .success-icon { width: 72px; height: 72px; font-size: 40px; margin: 32px auto; }
  .success-title { font-size: 20px; line-height: 1.4; }
  .success-subtitle { font-size: 15px; line-height: 1.6; margin-top: 10px; }
}


/* Customer WhatsApp handoff */
.whatsapp-handoff-box { margin: 18px auto 8px; max-width: 420px; padding: 14px; border-radius: 14px; background: rgba(37,211,102,.08); text-align:center; }
.whatsapp-handoff-box p { margin: 0 0 10px; }
.whatsapp-handoff-btn { display:inline-flex; align-items:center; justify-content:center; padding:11px 16px; border-radius:10px; text-decoration:none; font-weight:700; background:#25d366; color:#fff; }

/* WhatsApp handoff: keep the final action simple and manual. */
.whatsapp-handoff-help {
  margin: 6px auto 12px;
  max-width: 360px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-secondary);
}


/* =========================
   CUSTOMER ORDER CONFIRMATION — RESPONSIVE
   ========================= */
.success-state {
  width: min(100%, 560px);
  margin: clamp(18px, 5vh, 48px) auto;
  padding: 34px clamp(16px, 5vw, 32px);
}

.success-icon {
  width: 58px;
  height: 58px;
  font-size: 32px;
  margin: 18px auto;
}

.success-title {
  font-size: clamp(18px, 4vw, 22px);
}

.success-subtitle {
  font-size: clamp(13px, 3.5vw, 15px);
}

.whatsapp-handoff-box {
  width: 100%;
  max-width: 390px;
  margin: 16px auto 6px;
  padding: 13px;
}

.whatsapp-handoff-help {
  font-size: 12px;
  line-height: 1.45;
}

@media (max-width: 420px) {
  .success-state {
    margin: 10px auto;
    padding: 22px 12px 18px;
  }

  .success-icon {
    width: 52px;
    height: 52px;
    font-size: 28px;
    margin: 14px auto;
  }

  .whatsapp-handoff-box {
    padding: 11px;
    margin-top: 12px;
  }

  .whatsapp-handoff-btn {
    width: 100%;
  }
}


/* Required payment verification details on customer checkout */
.payment-details-fields { margin: 0 0 var(--space-4); }
.payment-meta-group { margin: 0 0 14px; text-align: left; }
.payment-meta-group label { display:block; margin-bottom:6px; font-size:13px; font-weight:700; }
.payment-meta-group input { box-sizing:border-box; width:100%; min-height:44px; padding:11px 12px; border:1px solid var(--border, #d8dce2); border-radius:10px; background:var(--surface, #fff); color:var(--text, #20242a); font:inherit; }
.payment-meta-group small { display:block; margin-top:5px; font-size:11px; line-height:1.45; opacity:.72; }
.required-mark { color:#c62828; }
.payment-proof-preview { display:flex; align-items:center; gap:10px; margin-top:10px; flex-wrap:wrap; }
.payment-proof-preview:empty { display:none; }
.payment-proof-preview-image { display:block; max-width:160px; max-height:190px; width:auto; height:auto; object-fit:contain; border-radius:10px; border:1px solid rgba(120,120,120,.25); background:#fff; box-shadow:0 3px 12px rgba(0,0,0,.08); }
.payment-proof-selected-label { font-size:12px; font-weight:700; opacity:.8; }
