/* ============================================================
   Chulísima — estilos (mobile-first, responsivo)
   ============================================================ */
:root {
  --brand:        #d6336c;
  --brand-dark:   #a61e4d;
  --brand-soft:   #fce4ec;
  --ink:          #1f2933;
  --muted:        #6b7280;
  --line:         #e5e7eb;
  --bg:           #f7f7fb;
  --card:         #ffffff;
  --ok:           #198754;
  --warn:         #b45309;
  --danger:       #dc2626;
  --radius:       14px;
  --shadow:       0 2px 10px rgba(0,0,0,.06);
  --shadow-lg:    0 10px 30px rgba(0,0,0,.15);
}

/* Modo oscuro */
:root[data-theme="dark"] {
  --ink: #e8eaed;
  --muted: #9aa0a6;
  --line: #34373b;
  --bg: #16181c;
  --card: #1f2227;
  --brand-soft: #3a1f2a;
  --shadow: 0 2px 10px rgba(0,0,0,.4);
  --shadow-lg: 0 10px 30px rgba(0,0,0,.6);
}
:root[data-theme="dark"] .card .price,
:root[data-theme="dark"] .price-big { color: var(--ink); }
:root[data-theme="dark"] .search,
:root[data-theme="dark"] .sort-select,
:root[data-theme="dark"] .field input,
:root[data-theme="dark"] .field textarea,
:root[data-theme="dark"] .field select { background: var(--card); color: var(--ink); }
:root[data-theme="dark"] .card .thumb,
:root[data-theme="dark"] .cat-ava { background: #2a2d33; }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-dark); text-decoration: none; }
img { max-width: 100%; display: block; }
h1,h2,h3 { line-height: 1.2; }

.container { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 16px; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 10px; cursor: pointer;
  font-size: 15px; font-weight: 600; padding: 11px 16px;
  background: var(--brand); color: #fff; transition: background .15s, transform .05s;
  text-align: center;
}
.btn:hover { background: var(--brand-dark); }
.btn:active { transform: translateY(1px); }
.btn.block { width: 100%; }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn.ghost:hover { background: #f3f4f6; }
.btn.ok { background: var(--ok); }
.btn.danger { background: var(--danger); }
.btn.sm { padding: 7px 12px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Header tienda ---------- */
.shop-header {
  position: sticky; top: 0; z-index: 40;
  background: var(--card); border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.shop-header .bar {
  display: flex; align-items: center; gap: 12px; height: 60px;
}
.shop-header .logo { font-size: 22px; font-weight: 800; color: var(--brand); letter-spacing: .3px; }
.shop-header .logo-img { height: 42px; max-width: 180px; object-fit: contain; }
.shop-header .spacer { flex: 1; }
.cart-btn {
  position: relative; background: var(--brand-soft); color: var(--brand-dark);
  border: 0; border-radius: 12px; padding: 10px 14px; font-weight: 700; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px; font-size: 15px;
}
.cart-btn .count {
  position: absolute; top: -7px; right: -7px; min-width: 20px; height: 20px;
  background: var(--brand); color: #fff; border-radius: 999px; font-size: 12px;
  display: flex; align-items: center; justify-content: center; padding: 0 5px;
}

/* ---------- Hero / búsqueda ---------- */
.hero { padding: 18px 0 6px; }
.hero p { color: var(--muted); margin: 4px 0 14px; }
.tools { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.search {
  flex: 1; min-width: 180px; padding: 11px 14px; border: 1px solid var(--line);
  border-radius: 10px; font-size: 15px; background: #fff;
}
.cats { display: flex; gap: 14px; overflow-x: auto; padding: 14px 0; -webkit-overflow-scrolling: touch; }
.cat-tile {
  flex: none; background: none; border: 0; cursor: pointer; display: flex; flex-direction: column;
  align-items: center; gap: 6px; width: 68px; font-weight: 600; font-size: 12px; color: var(--ink);
}
.cat-ava {
  width: 60px; height: 60px; border-radius: 50%; background: #f1f1f4; overflow: hidden;
  display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 800;
  color: var(--brand-dark); border: 2px solid transparent; transition: border-color .15s;
}
.cat-ava img { width: 100%; height: 100%; object-fit: cover; }
.cat-tile.active .cat-ava { border-color: var(--brand); }
.cat-tile span:last-child { white-space: nowrap; max-width: 68px; overflow: hidden; text-overflow: ellipsis; }

.sort-select {
  padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 14px;
  background: #fff; color: var(--ink); font-family: inherit;
}
.theme-toggle {
  background: var(--brand-soft); border: 0; border-radius: 12px; width: 42px; height: 42px;
  font-size: 18px; cursor: pointer; margin-right: 8px;
}
.promo-banner {
  display: block; background: linear-gradient(90deg, var(--brand-dark), var(--brand));
  color: #fff; text-align: center; padding: 10px 16px; font-weight: 700; font-size: 14px;
  text-decoration: none;
}

/* ---------- Banner mayoreo ---------- */
.wholesale-banner {
  background: linear-gradient(90deg, var(--brand), var(--brand-dark));
  color: #fff; border-radius: var(--radius); padding: 12px 16px; margin: 8px 0 16px;
  font-size: 14px; box-shadow: var(--shadow);
}
.wholesale-banner strong { font-weight: 800; }

/* ---------- Grid de productos ---------- */
.grid {
  display: grid; gap: 14px; padding: 6px 0 100px;
  grid-template-columns: repeat(2, 1fr);
}
@media (min-width: 640px)  { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px)  { .grid { grid-template-columns: repeat(4, 1fr); } }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column;
}
.card .thumb {
  aspect-ratio: 1/1; background: #f1f1f4; overflow: hidden; display: flex;
  align-items: center; justify-content: center;
}
.card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.card .thumb .ph { color: #c0c4cc; font-size: 13px; }
.card .thumb { position: relative; }
.soldout-badge {
  position: absolute; top: 8px; left: 8px; z-index: 2;
  background: var(--ink); color: #fff; font-size: 11px; font-weight: 800;
  padding: 4px 10px; border-radius: 999px; letter-spacing: .5px; text-transform: uppercase;
}
.card.is-soldout .thumb img { filter: grayscale(.7); opacity: .65; }
.card.is-soldout .price { color: var(--muted); }
.prod-badge {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  font-size: 11px; font-weight: 800; padding: 4px 9px; border-radius: 999px;
  letter-spacing: .3px; text-transform: uppercase; color: #fff;
}
.badge-new { background: #0d6efd; }
.badge-offer { background: #dc2626; }
.badge-featured { background: #b45309; }
.card .body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card .title { font-weight: 700; font-size: 14px; line-height: 1.25; }
.card .cat { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.card .desc {
  font-size: 12px; color: var(--muted); line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card .see-more {
  align-self: flex-start; background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--brand-dark); font-size: 12px; font-weight: 700;
}
.card .thumb[data-detail], .card .title[data-detail] { cursor: pointer; }
.detail-thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.detail-thumb {
  width: 56px; height: 56px; object-fit: cover; border-radius: 8px; cursor: pointer;
  border: 2px solid transparent; background: #f1f1f4;
}
.detail-thumb.sel { border-color: var(--brand); }

/* ---------- Página de producto ---------- */
.product-page { padding-bottom: 60px; }
.product-layout { display: grid; gap: 24px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .product-layout { grid-template-columns: 1fr 1fr; align-items: start; } }
.product-main {
  width: 100%; aspect-ratio: 1/1; object-fit: cover; border-radius: var(--radius);
  background: #f1f1f4; box-shadow: var(--shadow);
}
.product-main.is-soldout { filter: grayscale(.6); opacity: .8; }
.product-thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.pthumb {
  width: 64px; height: 64px; object-fit: cover; border-radius: 8px; cursor: pointer;
  border: 2px solid transparent; background: #f1f1f4;
}
.pthumb.sel { border-color: var(--brand); }
.product-info .cat { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.product-info h1 { margin: 4px 0 10px; font-size: 26px; }
.price-big { font-size: 30px; font-weight: 800; }
.price-big span { font-size: 13px; color: var(--muted); font-weight: 600; }
.card .prices { margin-top: auto; }
.card .price { font-size: 17px; font-weight: 800; color: var(--ink); }
.card .price .unit { font-size: 11px; color: var(--muted); font-weight: 600; }
.card .price-wholesale { font-size: 12px; color: var(--brand-dark); font-weight: 700; }
.card .add { margin-top: 8px; }

/* qty stepper dentro de card */
.stepper { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.stepper button {
  width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; font-size: 18px; font-weight: 700; cursor: pointer; color: var(--brand-dark);
}
.stepper .q { font-weight: 800; min-width: 24px; text-align: center; }

/* ---------- Drawer carrito ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50;
  opacity: 0; visibility: hidden; transition: opacity .2s;
}
.overlay.open { opacity: 1; visibility: visible; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100%; width: 100%; max-width: 420px;
  background: #fff; z-index: 60; transform: translateX(100%); transition: transform .25s ease;
  display: flex; flex-direction: column; box-shadow: var(--shadow-lg);
}
.drawer.open { transform: translateX(0); }
.drawer header {
  padding: 16px; border-bottom: 1px solid var(--line); display: flex;
  align-items: center; justify-content: space-between;
}
.drawer header h3 { margin: 0; font-size: 18px; }
.drawer .close { background: none; border: 0; font-size: 26px; cursor: pointer; color: var(--muted); line-height: 1; }
.drawer .items { flex: 1; overflow-y: auto; padding: 8px 16px; }
.drawer .foot { border-top: 1px solid var(--line); padding: 16px; background: #fff; }

.line {
  display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line);
}
.line .li-thumb { width: 56px; height: 56px; border-radius: 8px; background: #f1f1f4; object-fit: cover; flex: none; }
.line .li-info { flex: 1; min-width: 0; }
.line .li-name { font-weight: 700; font-size: 14px; }
.line .li-price { font-size: 13px; color: var(--muted); }
.line .li-right { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.line .li-total { font-weight: 800; }
.mini-stepper { display: flex; align-items: center; gap: 6px; }
.mini-stepper button { width: 28px; height: 28px; border-radius: 6px; border: 1px solid var(--line); background:#fff; cursor:pointer; font-weight:700; }
.mini-stepper .q { min-width: 18px; text-align: center; font-weight: 700; }

.summary-row { display: flex; justify-content: space-between; margin: 4px 0; }
.summary-row.total { font-size: 20px; font-weight: 800; margin-top: 8px; }
.badge-wholesale {
  display: inline-block; background: var(--brand-soft); color: var(--brand-dark);
  padding: 3px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; margin: 6px 0;
}
.empty-cart { text-align: center; color: var(--muted); padding: 48px 16px; }

/* ---------- Modal checkout ---------- */
.modal {
  position: fixed; inset: 0; z-index: 70; display: none; align-items: center; justify-content: center;
  padding: 16px; background: rgba(0,0,0,.5);
}
.modal.open { display: flex; }
.modal .box {
  background: #fff; border-radius: var(--radius); width: 100%; max-width: 460px;
  max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg);
}
.modal .box header { padding: 16px; border-bottom: 1px solid var(--line); display:flex; justify-content:space-between; align-items:center; }
.modal .box .content { padding: 16px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 15px; font-family: inherit;
}
.field textarea { resize: vertical; min-height: 70px; }
.radio-row { display: flex; gap: 10px; }
.radio-card {
  flex: 1; border: 1px solid var(--line); border-radius: 10px; padding: 12px; cursor: pointer;
  text-align: center; font-weight: 600; font-size: 14px;
}
.radio-card input { display: none; }
.radio-card.sel { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); }

/* ---------- Página de confirmación ---------- */
.confirm-wrap { max-width: 560px; margin: 24px auto; padding: 0 16px; }
.confirm-card { background:#fff; border:1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow:hidden; }
.confirm-card .top { background: var(--ok); color:#fff; padding: 24px 20px; text-align:center; }
.confirm-card .top .folio { font-size: 14px; opacity:.9; }
.confirm-card .sec { padding: 18px 20px; border-bottom: 1px solid var(--line); }
.confirm-card .sec:last-child { border-bottom: 0; }
.confirm-card h4 { margin: 0 0 8px; }
.data-row { display:flex; justify-content: space-between; padding: 4px 0; font-size: 14px; }
.data-row .k { color: var(--muted); }
.copy-box { background: var(--bg); border:1px dashed var(--line); border-radius: 10px; padding: 12px; margin-top:8px; font-family: ui-monospace, monospace; font-size: 14px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 10px;
  font-size: 14px; font-weight: 600; opacity: 0; transition: all .25s; z-index: 90; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.muted { color: var(--muted); }
.center { text-align: center; }
.mt8{margin-top:8px}.mt16{margin-top:16px}
