/* vendomiCatalog — estilos de la tienda.
   --primary / --accent (y sus colores de texto --on-*) los inyecta el servidor
   con los colores que la empresa configura en Vendomi. */

:root {
  --bg: #F6F7F9;
  --surface: #FFFFFF;
  --surface-2: #F1F3F5;
  --text: #14181D;
  --text-2: #4A535E;
  --muted: #7A8491;
  --border: #E3E7EC;
  --danger: #C62F3B;
  --success: #1E8E5A;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 16px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 40px rgba(16, 24, 40, .18);
  --radius: 16px;
  --radius-sm: 10px;
  --header-h: 64px;
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

[data-theme="dark"] {
  --bg: #0F1215;
  --surface: #181C21;
  --surface-2: #20262C;
  --text: #EEF1F4;
  --text-2: #B7C0CA;
  --muted: #8A95A1;
  --border: #2A3138;
  --danger: #F0616B;
  --success: #43C383;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .3);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, .55);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
body.locked { overflow: hidden; }
img { display: block; max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: inherit; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 55%, transparent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.boot { min-height: 100vh; display: grid; place-items: center; }
.spinner {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--primary);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.noscript { padding: 24px; text-align: center; }

/* ── Header ─────────────────────────────────────────────────────────────── */
.header {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1200px; margin: 0 auto; height: var(--header-h);
  padding: 0 16px; display: flex; align-items: center; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 0 1 auto; text-decoration: none; }
.brand-logo {
  width: 40px; height: 40px; border-radius: 12px; object-fit: cover; flex: none;
  background: var(--surface-2); border: 1px solid var(--border);
}
.brand-initial {
  width: 40px; height: 40px; border-radius: 12px; flex: none;
  display: grid; place-items: center; font-weight: 800; font-size: 18px;
  background: var(--primary); color: var(--on-primary);
}
.brand-name { font-weight: 800; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.search {
  flex: 1; min-width: 0; position: relative; max-width: 520px; margin-left: auto;
}
.search input {
  width: 100%; height: 42px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface-2);
  padding: 0 14px 0 40px; font-size: 14px; outline: none;
  transition: border-color .15s, background .15s;
}
.search input:focus { border-color: var(--primary); background: var(--surface); }
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }

.cart-btn {
  position: relative; flex: none; height: 42px; padding: 0 16px; border-radius: 999px;
  display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px;
  background: var(--primary); color: var(--on-primary);
  transition: transform .12s, filter .15s;
}
.cart-btn:hover { filter: brightness(1.06); }
.cart-btn:active { transform: scale(.97); }
.cart-count {
  min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px;
  display: inline-grid; place-items: center; font-size: 12px; font-weight: 800;
  background: var(--accent); color: var(--on-accent);
}
.cart-btn.bump { animation: bump .35s ease; }
@keyframes bump { 40% { transform: scale(1.1); } }

@media (max-width: 640px) {
  .header-inner { flex-wrap: wrap; height: auto; padding: 10px 16px; row-gap: 10px; }
  .search { order: 3; flex-basis: 100%; max-width: none; margin-left: 0; }
  .brand { flex: 1; }
  .cart-label { display: none; }
  .cart-btn { padding: 0 14px; }
}

/* ── Hero ───────────────────────────────────────────────────────────────── */
.hero { max-width: 1200px; margin: 16px auto 0; padding: 0 16px; }
.hero-card {
  position: relative; overflow: hidden; border-radius: 22px;
  min-height: 170px; display: flex; align-items: flex-end;
  background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 60%, #000));
  color: #fff;
}
.hero-card img.hero-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero-card.has-image::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,.05) 20%, rgba(0,0,0,.65));
}
.hero-content { position: relative; z-index: 1; padding: 28px; max-width: 720px; }
.hero h1 { margin: 0; font-size: clamp(24px, 4vw, 36px); line-height: 1.15; font-weight: 800; letter-spacing: -.02em; }
.hero .tagline { margin: 6px 0 0; font-size: 15px; opacity: .92; font-weight: 600; }
.hero .welcome { margin: 10px 0 0; font-size: 14px; opacity: .88; white-space: pre-line; }
.hero.has-banner .hero-card { min-height: 240px; }

/* ── Categorías ─────────────────────────────────────────────────────────── */
.cats {
  position: sticky; top: var(--header-h); z-index: 20;
  background: var(--bg);
}
@media (max-width: 640px) { .cats { top: 114px; } }
.cats-inner {
  max-width: 1200px; margin: 0 auto; padding: 14px 16px 10px;
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
}
.cats-inner::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 36px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  font-size: 13px; font-weight: 600; color: var(--text-2);
  transition: background .15s, color .15s, border-color .15s;
}
.chip:hover { border-color: var(--primary); color: var(--text); }
.chip[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }

/* ── Grid de productos ──────────────────────────────────────────────────── */
.main { max-width: 1200px; margin: 0 auto; padding: 6px 16px 120px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 8px 2px 12px; }
.section-head h2 { margin: 0; font-size: 18px; font-weight: 800; }
.section-head span { color: var(--muted); font-size: 13px; }
.grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (min-width: 720px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; } }
@media (min-width: 1000px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column;
  transition: box-shadow .2s, transform .2s;
}
.card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.card-media {
  position: relative; aspect-ratio: 1 / 1; background: var(--surface-2); overflow: hidden;
  display: block; width: 100%;
}
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s; }
.card:hover .card-media img { transform: scale(1.04); }
.placeholder { width: 100%; height: 100%; display: grid; place-items: center; color: var(--muted); }
.badge {
  position: absolute; top: 10px; left: 10px; z-index: 1;
  padding: 4px 9px; border-radius: 999px; font-size: 11px; font-weight: 800; letter-spacing: .02em;
  background: rgba(20, 24, 29, .78); color: #fff;
}
.card-body { padding: 12px 12px 14px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card-brand { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.card-name {
  font-size: 14px; font-weight: 600; line-height: 1.3; margin: 0; text-align: left;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 2.6em;
}
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 8px; }
.price { font-weight: 800; font-size: 16px; color: var(--text); white-space: nowrap; }
.price-ask { font-size: 12px; color: var(--muted); font-weight: 600; }
.stock-note { font-size: 11px; color: var(--muted); }
.card.is-out .card-media img { filter: grayscale(.7); opacity: .7; }
@media (max-width: 520px) {
  .card-foot { flex-wrap: wrap; row-gap: 8px; }
  .card-foot .stepper { width: 100%; justify-content: space-between; }
  .card-foot .stepper input { flex: 1; }
}

.add-btn {
  width: 38px; height: 38px; border-radius: 12px; flex: none;
  display: grid; place-items: center;
  background: var(--accent); color: var(--on-accent);
  transition: transform .12s, filter .15s;
}
.add-btn:hover { filter: brightness(1.05); }
.add-btn:active { transform: scale(.92); }
.add-btn:disabled { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }

.stepper {
  display: inline-flex; align-items: center; height: 38px; border-radius: 12px; overflow: hidden;
  background: var(--surface-2); border: 1px solid var(--border);
}
.stepper button { width: 34px; height: 100%; display: grid; place-items: center; color: var(--text); }
.stepper button:hover { background: color-mix(in srgb, var(--primary) 12%, transparent); }
.stepper output, .stepper input {
  min-width: 28px; width: 40px; text-align: center; font-weight: 800; font-size: 14px;
  border: 0; background: transparent; outline: none; -moz-appearance: textfield;
}
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.empty { text-align: center; padding: 60px 16px; color: var(--muted); }
.empty strong { display: block; color: var(--text); font-size: 16px; margin-bottom: 4px; }
.more { display: flex; justify-content: center; padding: 24px 0 0; }
.btn-ghost {
  height: 42px; padding: 0 20px; border-radius: 999px; font-weight: 700; font-size: 14px;
  border: 1px solid var(--border); background: var(--surface);
}
.btn-ghost:hover { border-color: var(--primary); }

/* ── Barra inferior de carrito (móvil) ─────────────────────────────────── */
.cart-bar {
  position: fixed; left: 16px; right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); z-index: 25;
  display: none; align-items: center; justify-content: space-between; gap: 12px;
  height: 56px; padding: 0 8px 0 18px; border-radius: 18px;
  background: var(--primary); color: var(--on-primary); box-shadow: var(--shadow-lg);
  font-weight: 700;
}
.cart-bar.show { display: flex; animation: rise .25s ease; }
.cart-bar .go {
  height: 40px; padding: 0 16px; border-radius: 12px; font-weight: 800;
  background: var(--accent); color: var(--on-accent);
}
@keyframes rise { from { transform: translateY(20px); opacity: 0; } }
@media (min-width: 900px) { .cart-bar.show { display: none; } }

/* ── Footer ─────────────────────────────────────────────────────────────── */
.footer { border-top: 1px solid var(--border); background: var(--surface); }
.footer-inner {
  max-width: 1200px; margin: 0 auto; padding: 28px 16px 110px;
  display: grid; gap: 22px; grid-template-columns: 1fr;
}
@media (min-width: 720px) { .footer-inner { grid-template-columns: 2fr 1fr; padding-bottom: 36px; } }
.footer h3 { margin: 0 0 8px; font-size: 15px; font-weight: 800; }
.contact-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 14px; color: var(--text-2); }
.contact-list li { display: flex; gap: 10px; align-items: flex-start; }
.contact-list svg { flex: none; margin-top: 2px; color: var(--primary); }
.contact-list a { text-decoration: none; }
.contact-list a:hover { text-decoration: underline; }
.socials { display: flex; gap: 10px; flex-wrap: wrap; }
.social {
  height: 40px; padding: 0 14px; border-radius: 12px; display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--border); text-decoration: none; font-size: 13px; font-weight: 700;
}
.social:hover { border-color: var(--primary); }
.powered { font-size: 12px; color: var(--muted); grid-column: 1 / -1; }

/* ── Overlays: producto y carrito ──────────────────────────────────────── */
.overlay {
  position: fixed; inset: 0; z-index: 50; background: rgba(10, 12, 16, .5);
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.overlay.open { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 60;
  width: min(440px, 100%); background: var(--surface); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .28s cubic-bezier(.2, .8, .2, 1);
  visibility: hidden;
}
.drawer.open { transform: none; visibility: visible; }
.drawer-head {
  display: flex; align-items: center; gap: 10px; padding: 16px 16px 14px;
  border-bottom: 1px solid var(--border);
}
.drawer-head h2 { margin: 0; font-size: 18px; font-weight: 800; flex: 1; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
  color: var(--text-2);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px; }
.drawer-foot { border-top: 1px solid var(--border); padding: 16px; padding-bottom: max(16px, env(safe-area-inset-bottom)); }

.line { display: grid; grid-template-columns: 64px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.line:last-child { border-bottom: 0; }
.line-img { width: 64px; height: 64px; border-radius: 12px; object-fit: cover; background: var(--surface-2); }
.line-name { font-size: 14px; font-weight: 600; margin: 0 0 2px; line-height: 1.3; }
.line-price { font-size: 13px; color: var(--muted); }
.line-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.line-total { font-weight: 800; font-size: 14px; }
.line .stepper { height: 34px; }
.line .stepper button { width: 32px; }
.remove { font-size: 12px; color: var(--danger); font-weight: 700; padding: 4px 0; }
.line-warn { font-size: 12px; color: var(--danger); margin-top: 4px; font-weight: 600; }

.totals { display: grid; gap: 6px; margin-bottom: 14px; font-size: 14px; }
.totals .row { display: flex; justify-content: space-between; color: var(--text-2); }
.totals .grand { font-size: 18px; font-weight: 800; color: var(--text); }
.notice {
  font-size: 13px; padding: 10px 12px; border-radius: var(--radius-sm); margin-bottom: 12px;
  background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--text);
}
.notice.error { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); font-weight: 600; }

.btn-primary {
  width: 100%; height: 52px; border-radius: 14px; font-weight: 800; font-size: 15px;
  background: var(--primary); color: var(--on-primary);
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  text-decoration: none;
  transition: filter .15s, transform .12s;
}
.btn-primary:hover { filter: brightness(1.06); }
.btn-primary:active { transform: scale(.99); }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; }
.btn-wa { background: #1FA855; color: #fff; }
.btn-link { display: block; margin: 12px auto 0; font-weight: 700; font-size: 14px; color: var(--text-2); }
.btn-link:hover { color: var(--text); }

/* Formulario */
.form { display: grid; gap: 14px; }
.field label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.field label .opt { color: var(--muted); font-weight: 500; }
.field input, .field textarea {
  width: 100%; border: 1px solid var(--border); background: var(--surface-2);
  border-radius: 12px; padding: 12px 14px; font-size: 15px; outline: none;
  transition: border-color .15s, background .15s;
}
.field textarea { min-height: 84px; resize: vertical; }
.field input:focus, .field textarea:focus { border-color: var(--primary); background: var(--surface); }
.field.invalid input, .field.invalid textarea { border-color: var(--danger); }
.field .err { font-size: 12px; color: var(--danger); margin-top: 4px; font-weight: 600; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seg {
  border: 1.5px solid var(--border); border-radius: 12px; padding: 12px; text-align: left;
  display: flex; gap: 10px; align-items: center; font-weight: 700; font-size: 14px; background: var(--surface);
}
.seg small { display: block; font-weight: 500; color: var(--muted); font-size: 12px; }
.seg[aria-checked="true"] { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 8%, var(--surface)); }
.seg svg { color: var(--primary); flex: none; }
.hint { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* Éxito */
.success { text-align: center; padding: 12px 4px; }
.success-icon {
  width: 72px; height: 72px; border-radius: 50%; margin: 8px auto 14px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--success) 15%, transparent); color: var(--success);
  animation: pop .4s cubic-bezier(.2, 1.4, .4, 1);
}
@keyframes pop { from { transform: scale(.4); opacity: 0; } }
.success h3 { margin: 0 0 6px; font-size: 22px; font-weight: 800; }
.success .code {
  display: inline-block; margin: 6px 0 12px; padding: 6px 14px; border-radius: 999px;
  background: var(--surface-2); font-weight: 800; letter-spacing: .04em;
}
.success p { color: var(--text-2); margin: 0 0 16px; white-space: pre-line; }
.summary { text-align: left; border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 16px; }
.summary .row { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; padding: 4px 0; }
.summary .row span:first-child { color: var(--text-2); }
.summary .grand { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 8px; font-weight: 800; }

/* Modal de producto */
.modal {
  position: fixed; z-index: 60; left: 50%; top: 50%;
  width: min(880px, calc(100% - 32px)); max-height: calc(100% - 48px);
  transform: translate(-50%, -46%) scale(.98); opacity: 0; visibility: hidden;
  background: var(--surface); border-radius: 22px; box-shadow: var(--shadow-lg); overflow: hidden;
  display: grid; grid-template-columns: 1.1fr 1fr;
  transition: transform .22s, opacity .22s, visibility .22s;
}
.modal.open { transform: translate(-50%, -50%); opacity: 1; visibility: visible; }
.modal-media { background: var(--surface-2); position: relative; min-height: 320px; }
.modal-media .main-img { width: 100%; height: 100%; aspect-ratio: 1 / 1; object-fit: cover; }
.thumbs { position: absolute; left: 12px; bottom: 12px; display: flex; gap: 8px; }
.thumb { width: 52px; height: 52px; border-radius: 10px; overflow: hidden; border: 2px solid rgba(255,255,255,.7); opacity: .8; }
.thumb[aria-current="true"] { border-color: var(--accent); opacity: 1; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.modal-info { padding: 24px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; }
.modal-info h2 { margin: 0; font-size: 22px; line-height: 1.25; font-weight: 800; }
.modal-info .price { font-size: 24px; }
.modal-info .desc { color: var(--text-2); font-size: 14px; white-space: pre-line; margin: 0; }
.modal-actions { margin-top: auto; display: flex; gap: 10px; align-items: center; padding-top: 12px; }
.modal-actions .stepper { height: 52px; border-radius: 14px; }
.modal-actions .stepper button { width: 42px; }
.modal-close { position: absolute; top: 12px; right: 12px; z-index: 2; background: var(--surface); box-shadow: var(--shadow); }
@media (max-width: 720px) {
  .modal {
    left: 0; right: 0; top: auto; bottom: 0; width: 100%; max-height: 92vh;
    border-radius: 22px 22px 0 0; grid-template-columns: 1fr; overflow-y: auto;
    transform: translateY(100%); opacity: 1;
  }
  .modal.open { transform: none; }
  .modal-media { min-height: 0; }
  .modal-info { padding: 18px 16px max(18px, env(safe-area-inset-bottom)); overflow: visible; }
}

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 90px; z-index: 80; transform: translate(-50%, 20px);
  background: #14181D; color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 14px; font-weight: 600;
  box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
  max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Páginas simples (404 / inicio) */
.simple { min-height: 100vh; display: grid; place-items: center; align-content: center; gap: 16px; padding: 24px 16px; }
.simple-card {
  max-width: 440px; background: var(--surface); border: 1px solid var(--border); border-radius: 22px;
  padding: 32px 28px; text-align: center; box-shadow: var(--shadow);
}
.simple-icon {
  width: 60px; height: 60px; border-radius: 18px; margin: 0 auto 16px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--primary);
}
.simple h1 { margin: 0 0 8px; font-size: 22px; }
.simple p { margin: 0; color: var(--text-2); }
.simple-foot { font-size: 13px; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
