/* Propuesta de catálogo Valdivia Accesorios: HTML, CSS y JavaScript sin dependencias. */
:root {
  --ink: #111214;
  --ink-2: #1E2125;
  --line-dark: #2C3036;
  --bg: #F2F3F5;
  --card: #FFFFFF;
  --line: #E3E5E9;
  --muted: #5B616B;
  --gold: #F3BD1A;
  --gold-soft: #F6EEDC;
  --gold-text: #7A5A1E;
  --green: #1F7A4D;
  --red: #B3261E;
  --radius: 18px;
  --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; font-size: 17px; }
a { color: var(--gold-text); }
button, input, select, textarea { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.price { font-variant-numeric: tabular-nums; }

/* botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px; border-radius: 14px; border: 1px solid #D5D8DD; background: var(--card); font-weight: 700; font-size: 15px; text-decoration: none; color: var(--ink); cursor: pointer; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn-gold { background: var(--gold); color: var(--ink); border-color: var(--gold); }
.btn-green { background: var(--green); color: #fff; border-color: var(--green); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--gold-text); min-height: 44px; padding: 0 8px; }
.btn-block { width: 100%; }
.btn.big { min-height: 56px; font-size: 17px; border-radius: 16px; }
.btn.add { min-height: 48px; font-size: 16px; }
.btn svg { width: 20px; height: 20px; flex-shrink: 0; }
.input { min-height: 48px; border-radius: 14px; border: 1px solid #D5D8DD; background: var(--card); padding: 0 14px; font-size: 16px; color: var(--ink); width: 100%; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 700; color: var(--muted); }
.input:focus, .btn:focus-visible, .chip:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid2 .btn { white-space: normal; text-align: center; line-height: 1.2; }
.kv { display: flex; justify-content: space-between; gap: 12px; font-size: 16px; }
.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 14px; font-weight: 600; font-size: 14px; z-index: 100; max-width: 90vw; box-shadow: 0 8px 24px rgba(0,0,0,.25); }

/* encabezado */
.cat-header { background: var(--ink); color: #fff; padding: 16px 18px; padding-top: calc(16px + env(safe-area-inset-top)); display: flex; flex-direction: column; gap: 12px; position: sticky; top: 0; z-index: 10; }
.cat-header .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 1200px; width: 100%; margin: 0 auto; }
.cat-header .logo { height: 52px; width: auto; }
.seller-name { font-size: 22px; font-weight: 800; line-height: 1.1; }
.hdr-btn { min-height: 44px; padding: 0 14px; background: transparent; color: #fff; border-color: var(--line-dark); font-size: 15px; }
.search { display: flex; align-items: center; gap: 10px; min-height: 46px; border-radius: 14px; background: var(--ink-2); border: 1px solid var(--line-dark); padding: 0 14px; flex: 1; }
.search svg { width: 20px; height: 20px; color: #B9BEC6; flex-shrink: 0; }
.search input { flex: 1; border: none; background: transparent; color: #fff; font-size: 16px; outline: none; min-width: 0; }

/* catálogo */
.cat-main { max-width: 1200px; margin: 0 auto; padding: 14px 16px 140px; display: flex; flex-direction: column; gap: 14px; }
.hello { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; font-size: 16px; }
.hello b:first-child { font-size: 19px; }
.linklike { all: unset; color: var(--gold-text); font-weight: 700; text-decoration: underline; cursor: pointer; margin-top: 4px; min-height: 32px; display: inline-flex; align-items: center; }
.notice { background: #EEF0F2; border-radius: 14px; padding: 12px 14px; font-size: 15px; line-height: 1.4; }
.notice.warn { background: #FCEFD8; color: #5C3D00; border: 1px solid #F0C77A; }
.featured { background: var(--gold-soft); border-radius: 16px; padding: 12px 14px; display: flex; align-items: center; gap: 12px; border: none; text-align: left; cursor: pointer; width: 100%; color: var(--ink); }
.featured svg { width: 24px; height: 24px; color: var(--gold-text); flex-shrink: 0; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex-shrink: 0; min-height: 44px; padding: 0 14px; border-radius: 22px; border: 1px solid #D5D8DD; background: var(--card); font-size: 15px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.chip.small { min-height: 40px; font-size: 14px; }
.chip[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.group-title { font-size: 20px; font-weight: 800; margin: 12px 0 0; letter-spacing: .5px; }
.group-title span { font-size: 15px; font-weight: 600; }
.products { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 10px; }
@media (min-width: 700px) { .products { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1050px) { .products { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.pcard { background: var(--card); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; display: flex; flex-direction: column; }
.pcard-open { all: unset; cursor: pointer; display: flex; flex-direction: column; flex: 1; }
.pcard-open:focus-visible { outline: 3px solid var(--gold); outline-offset: -3px; }
.pcard .ph { aspect-ratio: 1 / 1; background: #F7F7F8; display: flex; align-items: center; justify-content: center; position: relative; }
.pcard .ph img { width: 100%; height: 100%; object-fit: cover; }
.pcard .info { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 3px; }
.pcard .line { font-size: 13px; font-weight: 800; color: var(--gold-text); }
.pcard .name { font-size: 16px; font-weight: 800; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pbig { font-size: 20px; font-weight: 800; margin-top: 4px; }
.psmall { font-size: 13px; color: var(--muted); }
.was { font-size: 14px; color: var(--muted); font-weight: 600; text-decoration: line-through; margin-left: 4px; }
.tag { position: absolute; top: 8px; left: 8px; background: var(--red); color: #fff; font-size: 12px; font-weight: 800; padding: 4px 8px; border-radius: 8px; }
.iva { font-size: 13px; font-weight: 700; color: var(--muted); }
.pcard-act { padding: 0 10px 10px; }
.empty { text-align: center; padding: 48px 16px; color: var(--muted); }

/* cantidad */
.stepper { display: grid; grid-template-columns: 48px 1fr 48px; gap: 6px; align-items: center; }
.stepper button { height: 48px; border-radius: 12px; border: 1px solid #C9CDD3; background: #fff; font-size: 24px; font-weight: 700; cursor: pointer; color: var(--ink); }
.stepper input { height: 48px; width: 100%; min-width: 0; border-radius: 12px; border: 2px solid var(--ink); text-align: center; font-size: 20px; font-weight: 800; -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }
.detail-step { max-width: 320px; }

/* botones flotantes */
.fab { position: fixed; right: 18px; bottom: calc(24px + env(safe-area-inset-bottom)); min-height: 54px; padding: 0 20px; border-radius: 27px; background: var(--green); color: #fff; display: flex; align-items: center; gap: 8px; font-weight: 800; text-decoration: none; box-shadow: 0 6px 18px rgba(17,18,20,.25); z-index: 15; }
.fab svg { width: 20px; height: 20px; }
.cartbar { position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 16; min-height: 64px; border: none; border-radius: 18px; background: var(--gold); color: var(--ink); display: flex; align-items: center; justify-content: space-between; padding: 10px 18px; font-size: 17px; text-align: left; cursor: pointer; box-shadow: 0 8px 24px rgba(17,18,20,.3); max-width: 640px; margin: 0 auto; }
.cartbar small { font-size: 14px; font-weight: 600; }
.cartbar b.price { font-size: 20px; }

/* ventanas */
dialog.sheet { border: none; padding: 0; width: min(560px, 100vw); max-height: 92vh; border-radius: 24px; background: var(--card); color: var(--ink); }
dialog.sheet::backdrop { background: rgba(17,18,20,.55); }
dialog.sheet.full { width: min(640px, 100vw); height: 100vh; max-height: 100vh; border-radius: 0; margin: 0 auto; }
@media (min-width: 700px) { dialog.sheet.full { height: 92vh; border-radius: 24px; margin: auto; } }
.sheet .body { padding: 16px 18px 20px; display: flex; flex-direction: column; gap: 14px; font-size: 16px; }
.sheet .gallery { background: #F7F7F8; aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center; position: relative; }
.sheet .gallery img { width: 100%; height: 100%; object-fit: contain; }
.sheet .thumbs { display: flex; gap: 8px; padding: 10px 16px 0; overflow-x: auto; }
.sheet .thumbs button { width: 56px; height: 56px; border-radius: 12px; border: 1px solid var(--line); background: #fff; padding: 2px; cursor: pointer; flex-shrink: 0; }
.sheet .thumbs button[aria-pressed="true"] { border: 2px solid var(--ink); }
.sheet .thumbs img { width: 100%; height: 100%; object-fit: cover; border-radius: 9px; }
.close-x { position: absolute; top: 12px; right: 12px; width: 44px; height: 44px; border-radius: 22px; border: none; background: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.close-x svg { width: 22px; height: 22px; }
.prices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.prices > div { border-radius: 16px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; background: var(--bg); }
.prices > div.dark { background: var(--ink); color: #fff; }
.prices small { font-size: 12px; font-weight: 600; opacity: .8; }
.prices b { font-size: 22px; }
.desc { white-space: pre-line; font-size: 15px; line-height: 1.5; color: var(--muted); margin: 0; }
.cart-head { position: sticky; top: 0; background: #fff; display: flex; align-items: center; gap: 8px; padding: 10px 10px 6px; border-bottom: 1px solid var(--line); z-index: 2; }
.cart-head h2 { margin: 0; font-size: 22px; }
.list { display: flex; flex-direction: column; }
.list > * { display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px; border-top: 1px solid #EEF0F2; }
.list > *:first-child { border-top: none; }
.thumb { width: 64px; height: 64px; border-radius: 12px; background: #F7F7F8; object-fit: cover; flex-shrink: 0; }
.grow { flex: 1; min-width: 0; }
.cart-list .stepper { width: 190px; grid-template-columns: 48px 70px 48px; margin-top: 8px; }
.totals-box { background: var(--bg); border-radius: 16px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.totals-box .total { font-size: 20px; border-top: 1px solid #D5D8DD; padding-top: 8px; }
.accept { display: flex; gap: 12px; align-items: flex-start; background: #FCEFD8; border: 2px solid #F0C77A; border-radius: 16px; padding: 14px; font-size: 16px; font-weight: 700; color: #5C3D00; cursor: pointer; }
.accept input { width: 28px; height: 28px; flex-shrink: 0; margin: 0; accent-color: var(--ink); }
.confirm-box { background: var(--bg); border-radius: 18px; padding: 18px; text-align: center; display: flex; flex-direction: column; gap: 4px; }
.done-check { width: 80px; height: 80px; border-radius: 40px; background: var(--green); color: #fff; font-size: 44px; display: flex; align-items: center; justify-content: center; }
.steps { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 10px; font-size: 17px; }
.linkbox { background: var(--ink); color: #fff; border-radius: 18px; padding: 16px; display: flex; flex-direction: column; gap: 8px; word-break: break-all; font-size: 13px; }
.linkbox span { color: #B9BEC6; font-weight: 700; }
.linkbox a { color: var(--gold); font-weight: 700; }

/* PDF (ventana de impresión del navegador) */
#print-area { display: none; }
@media print {
  @page { size: letter; margin: 12mm; }
  body { background: #fff; }
  body > *:not(#print-area) { display: none !important; }
  #print-area { display: block; }
  .pp-cover { height: 240mm; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10mm; background: var(--ink); color: #fff; -webkit-print-color-adjust: exact; print-color-adjust: exact; page-break-after: always; }
  .pp-cover img { width: 110mm; }
  .pp-slide { height: 240mm; page-break-after: always; display: grid; grid-template-columns: 1.3fr 1fr; align-items: center; gap: 10mm; }
  .pp-slide img { width: 100%; height: 200mm; object-fit: contain; }
  .pp-slide h2 { font-size: 24pt; margin: 0 0 4mm; }
  .pp-slide .line { font-size: 13pt; font-weight: 800; color: var(--gold-text); letter-spacing: 1px; }
  .pp-slide p { margin: 2mm 0; font-size: 12pt; }
  .pp-group { font-size: 14pt; font-weight: 800; margin: 6mm 0 2mm; }
  .pp-table { width: 100%; border-collapse: collapse; font-size: 9.5pt; }
  .pp-table th { background: var(--ink); color: #fff; text-align: left; padding: 2mm; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .pp-table td { border-bottom: 1px solid #ddd; padding: 1.5mm 2mm; vertical-align: middle; }
  .pp-table img { width: 22mm; height: 22mm; object-fit: cover; }
  .pp-table tr { page-break-inside: avoid; }
}
