/* Estilos de la tienda. Los colores principales están en :root para cambiarlos fácil. */
:root {
  --brand: #e11d48;
  --brand-dark: #be123c;
  --ink: #18181b;
  --ink-2: #3f3f46;
  --muted: #71717a;
  --line: #e4e4e7;
  --bg: #ffffff;
  --bg-soft: #f4f4f5;
  --ok: #16a34a;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg); line-height: 1.5; font-size: 16px; }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
h1 { font-size: clamp(24px, 4vw, 32px); line-height: 1.2; margin: 8px 0 16px; }
h2 { font-size: 20px; margin: 0 0 12px; }
h3 { font-size: 16px; margin: 20px 0 8px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
code { background: var(--bg-soft); padding: 1px 5px; border-radius: 4px; font-size: .9em; word-break: break-all; }
input, select, textarea, button { font: inherit; color: inherit; }

.container { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 16px; }
.container.narrow { max-width: 760px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.empty { color: var(--muted); padding: 24px 0; }
.success-text { color: var(--ok); font-weight: 600; }
.nowrap { white-space: nowrap; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0; margin: -1px; }
[hidden] { display: none !important; }

/* ---------- Botones ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: 8px; border: 1px solid transparent; background: var(--bg-soft); color: var(--ink); text-decoration: none; font-weight: 600; cursor: pointer; transition: background .15s, border-color .15s, color .15s; font-size: 15px; line-height: 1.2; }
.btn:disabled { opacity: .6; cursor: wait; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-light { background: #fff; border-color: var(--line); }
.btn-light:hover { border-color: var(--ink-2); }
.btn-outline { background: transparent; border-color: var(--ink); }
.btn-outline:hover { background: var(--ink); color: #fff; }
.btn-link { background: none; text-decoration: underline; font-weight: 500; }
.btn-lg { padding: 14px 24px; font-size: 16px; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.link-button { background: none; border: 0; padding: 0; color: var(--ink-2); text-decoration: underline; cursor: pointer; font-size: 14px; }
.link-button.danger { color: #b91c1c; }

/* ---------- Alertas y badges ---------- */
.alert { padding: 12px 16px; border-radius: 8px; margin: 12px 0; border: 1px solid; }
.alert-success { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.alert-error { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.alert-info { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
.alert-warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; vertical-align: middle; }
.badge-pendiente_pago { background: #fef3c7; color: #92400e; }
.badge-pagado { background: #dbeafe; color: #1e40af; }
.badge-preparando { background: #ede9fe; color: #5b21b6; }
.badge-despachado { background: #cffafe; color: #155e75; }
.badge-entregado { background: #dcfce7; color: #166534; }
.badge-cancelado { background: #fee2e2; color: #991b1b; }

/* ---------- Header ---------- */
.site-header { position: relative; z-index: 50; background: var(--ink); color: #fff; }
@media (min-width: 861px) and (min-height: 760px) { .site-header { position: sticky; top: 0; } }
.topbar { background: var(--brand); color: #fff; text-align: center; font-size: 13px; padding: 6px 16px; font-weight: 600; }
.header-row { display: flex; align-items: center; gap: 16px; padding-top: 12px; padding-bottom: 12px; }
.logo { font-size: 22px; font-weight: 900; letter-spacing: -.5px; text-decoration: none; text-transform: uppercase; white-space: nowrap; }
.search { flex: 1; display: flex; max-width: 520px; margin-left: auto; background: #fff; border-radius: 999px; overflow: hidden; }
.search input { flex: 1; min-width: 0; border: 0; padding: 9px 16px; color: var(--ink); outline: none; background: transparent; }
.search button { border: 0; background: transparent; padding: 0 14px; color: var(--ink-2); cursor: pointer; }
.cart-link { position: relative; display: inline-flex; padding: 6px; color: #fff; }
.cart-count { position: absolute; top: -2px; right: -4px; background: var(--brand); color: #fff; font-size: 11px; font-weight: 800; border-radius: 999px; min-width: 18px; height: 18px; display: grid; place-items: center; padding: 0 4px; }
.menu-toggle { display: none; background: none; border: 0; padding: 8px 4px; cursor: pointer; flex-direction: column; gap: 4px; }
.menu-toggle span { display: block; width: 22px; height: 2px; background: #fff; }

.main-nav { background: #27272a; }
.main-nav ul { list-style: none; margin: 0; padding: 0; }
.main-nav > .container > ul { display: flex; gap: 4px; }
.main-nav a { display: block; padding: 12px 14px; text-decoration: none; font-weight: 600; font-size: 14px; text-transform: uppercase; letter-spacing: .3px; color: #e4e4e7; }
.main-nav a:hover, .main-nav a.active { color: #fff; box-shadow: inset 0 -3px 0 var(--brand); }
.has-dropdown { position: relative; display: flex; align-items: center; }
.dropdown-toggle { background: none; border: 0; color: #e4e4e7; cursor: pointer; padding: 0 8px 0 0; }
.dropdown { display: none; position: absolute; top: 100%; left: 0; min-width: 240px; background: #fff; box-shadow: var(--shadow); border-radius: 0 0 8px 8px; padding: 6px 0; z-index: 60; }
.dropdown a { color: var(--ink); text-transform: none; font-weight: 500; padding: 9px 16px; }
.dropdown a:hover { background: var(--bg-soft); box-shadow: none; color: var(--ink); }
.has-dropdown:hover .dropdown, .has-dropdown.open .dropdown { display: block; }

.site-main { min-height: 60vh; padding-bottom: 48px; }

@media (max-width: 860px) {
  .menu-toggle { display: inline-flex; }
  .header-row { flex-wrap: wrap; gap: 10px; }
  .logo { font-size: 18px; flex: 1; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .main-nav { display: none; }
  .main-nav.open { display: block; }
  .main-nav > .container > ul { flex-direction: column; gap: 0; }
  .main-nav a { padding: 12px 0; }
  .has-dropdown { flex-wrap: wrap; justify-content: space-between; }
  .dropdown-toggle { padding: 12px; }
  .has-dropdown:hover .dropdown { display: none; }
  .has-dropdown.open .dropdown { display: block; position: static; width: 100%; box-shadow: none; background: #3f3f46; border-radius: 6px; margin-bottom: 8px; }
  .dropdown a { color: #e4e4e7; }
  .dropdown a:hover { background: transparent; color: #fff; }
}

/* ---------- Footer ---------- */
.site-footer { background: var(--ink); color: #d4d4d8; padding: 40px 0 20px; font-size: 14px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1.4fr; gap: 24px; }
.footer-logo { font-size: 20px; font-weight: 900; text-transform: uppercase; color: #fff; }
.site-footer h4 { color: #fff; margin: 0 0 10px; font-size: 14px; text-transform: uppercase; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: 6px; }
.site-footer a { text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.footer-bottom { border-top: 1px solid #3f3f46; margin-top: 28px; padding-top: 16px; color: var(--muted); font-size: 13px; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-grid > div:first-child { grid-column: 1 / -1; } }

/* ---------- Home ---------- */
.hero { background: linear-gradient(120deg, #18181b 0%, #3f3f46 55%, var(--brand) 140%); background-size: cover; background-position: center; color: #fff; position: relative; }
.hero[style]::before { content: ""; position: absolute; inset: 0; background: rgba(0,0,0,.45); }
.hero-inner { position: relative; padding: clamp(48px, 9vw, 110px) 16px; max-width: 1240px; }
.hero h1 { font-size: clamp(30px, 6vw, 56px); font-weight: 900; margin: 0 0 12px; max-width: 760px; letter-spacing: -1px; }
.hero p { font-size: clamp(16px, 2.2vw, 20px); max-width: 560px; margin: 0 0 24px; color: #e4e4e7; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.hero-actions.center { justify-content: center; }
.benefits { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 24px 0; }
.benefits div { background: var(--bg-soft); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; }
.benefits span { color: var(--muted); font-size: 14px; }
@media (max-width: 700px) { .benefits { grid-template-columns: 1fr; } }
.home-section { margin: 36px 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.section-head a { font-weight: 600; color: var(--brand); text-decoration: none; }
.category-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.category-card { position: relative; border-radius: var(--radius); overflow: hidden; aspect-ratio: 4 / 3; background: var(--ink); text-decoration: none; display: block; }
.category-card img { width: 100%; height: 100%; object-fit: cover; opacity: .75; transition: transform .3s, opacity .3s; }
.category-card:hover img { transform: scale(1.05); opacity: .6; }
.category-card span { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px; color: #fff; font-weight: 800; font-size: 18px; text-transform: uppercase; background: linear-gradient(transparent, rgba(0,0,0,.7)); }

/* ---------- Grilla de productos ---------- */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; }
@media (max-width: 560px) { .product-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; } }
.product-card { text-decoration: none; display: flex; flex-direction: column; border-radius: var(--radius); overflow: hidden; background: #fff; border: 1px solid var(--line); transition: box-shadow .2s, transform .2s; }
.product-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.product-card-img { aspect-ratio: 1; background: var(--bg-soft); overflow: hidden; }
.product-card-img img { width: 100%; height: 100%; object-fit: cover; }
.product-card-body { padding: 10px 12px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.product-card-name { font-size: 14px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--ink-2); }
.product-card-price { font-weight: 800; font-size: 17px; margin-top: auto; }

/* ---------- Listados ---------- */
.breadcrumbs { font-size: 13px; color: var(--muted); margin: 16px 0 4px; }
.breadcrumbs a { color: var(--muted); }
.listing-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.listing-head h1 { margin-bottom: 0; }
.listing-head p { margin: 4px 0 0; }
.sort-form select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 20px; }
.chip { padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; font-size: 14px; font-weight: 600; }
.chip:hover { border-color: var(--ink); }
.pagination { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 32px 0 8px; }
.pagination a, .pagination span { padding: 8px 13px; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; font-size: 14px; }
.pagination .current { background: var(--ink); color: #fff; border-color: var(--ink); }
.pagination span:not(.current) { border-color: transparent; }

/* ---------- Ficha de producto ---------- */
.product-page { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 40px; margin: 12px 0 40px; align-items: start; }
@media (max-width: 860px) { .product-page { grid-template-columns: 1fr; gap: 20px; } }
.gallery-main { background: var(--bg-soft); border-radius: var(--radius); overflow: hidden; }
.gallery-main img { width: 100%; max-height: 720px; object-fit: contain; margin: 0 auto; }
.gallery-thumbs { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; padding-bottom: 4px; }
.gallery-thumbs button { flex: 0 0 72px; height: 72px; padding: 0; border: 2px solid transparent; border-radius: 8px; overflow: hidden; cursor: pointer; background: var(--bg-soft); }
.gallery-thumbs button.active { border-color: var(--ink); }
.gallery-thumbs img { width: 100%; height: 100%; object-fit: cover; }
.product-info h1 { font-size: clamp(22px, 3vw, 28px); }
.product-price { font-size: 30px; font-weight: 900; margin-bottom: 16px; }
.size-picker { border: 0; padding: 0; margin: 0 0 16px; }
.size-picker legend { font-weight: 700; margin-bottom: 8px; display: flex; gap: 12px; align-items: baseline; padding: 0; }
.size-picker legend a { font-weight: 500; color: var(--muted); }
.size-picker label { display: inline-block; margin: 0 6px 6px 0; }
.size-picker input { position: absolute; opacity: 0; pointer-events: none; }
.size-picker span { display: inline-block; min-width: 52px; text-align: center; padding: 10px 14px; border: 1.5px solid var(--line); border-radius: 8px; font-weight: 700; cursor: pointer; }
.size-picker input:checked + span { border-color: var(--ink); background: var(--ink); color: #fff; }
.size-picker input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.qty-row { margin-bottom: 16px; }
.qty-row label { font-weight: 700; display: inline-flex; align-items: center; gap: 10px; }
.qty-input { width: 76px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; }
.buy-buttons { display: flex; gap: 10px; flex-wrap: wrap; }
.buy-buttons .btn { flex: 1 1 200px; }
.product-description { margin-top: 28px; border-top: 1px solid var(--line); padding-top: 20px; color: var(--ink-2); }
.product-description h2 { font-size: 16px; text-transform: uppercase; }
.product-perks { margin: 20px 0 0; padding: 16px 16px 16px 34px; background: var(--bg-soft); border-radius: var(--radius); font-size: 14px; color: var(--ink-2); }

/* ---------- Tarjetas y formularios ---------- */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid.four { grid-template-columns: repeat(4, 1fr); }
.span-2 { grid-column: span 2; }
@media (max-width: 640px) { .form-grid, .form-grid.four { grid-template-columns: 1fr 1fr; } .form-grid:not(.four) { grid-template-columns: 1fr; } .span-2 { grid-column: auto; } }
.field { margin-bottom: 14px; }
.field label, label.field > span { display: block; font-weight: 600; font-size: 14px; margin-bottom: 5px; }
.field input, .field select, .field textarea, .admin-form textarea, .filters input, .filters select { width: 100%; padding: 10px 12px; border: 1px solid #d4d4d8; border-radius: 8px; background: #fff; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--ink); outline-offset: -1px; border-color: var(--ink); }
.field input:disabled { background: var(--bg-soft); color: var(--muted); }
.field.invalid input, .field.invalid select { border-color: #dc2626; background: #fef2f2; }
.field-error { color: #b91c1c; font-size: 13px; margin-top: 4px; }
.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
label.inline { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; margin: 6px 0 12px; }
label.inline input { width: auto; }

/* ---------- Carrito y checkout ---------- */
.cart-layout, .checkout-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 28px; align-items: start; }
@media (max-width: 900px) { .cart-layout, .checkout-layout { grid-template-columns: 1fr; } }
.cart-item { display: grid; grid-template-columns: 96px 1fr auto; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--line); align-items: start; }
.cart-item img { width: 96px; height: 96px; object-fit: cover; border-radius: 8px; background: var(--bg-soft); }
.cart-item-name { font-weight: 700; text-decoration: none; display: block; margin-bottom: 2px; }
.cart-item-actions { display: flex; gap: 16px; align-items: center; margin-top: 8px; font-size: 14px; }
.cart-item-actions label { display: inline-flex; align-items: center; gap: 6px; }
.cart-item-total { font-weight: 800; }
.cart-items > .btn { margin-top: 16px; }
@media (max-width: 520px) { .cart-item { grid-template-columns: 72px 1fr; } .cart-item img { width: 72px; height: 72px; } .cart-item-total { grid-column: 2; } }
.summary { background: var(--bg-soft); border-radius: var(--radius); padding: 20px; position: sticky; top: 140px; }
.summary h2 { font-size: 18px; }
.summary-row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; font-size: 15px; }
.summary-row.total { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 12px; font-size: 19px; }
.summary .btn-block { margin-top: 12px; }
.summary-item { display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.summary-item img, .img-placeholder { width: 56px; height: 56px; object-fit: cover; border-radius: 6px; background: var(--line); }
.checkout-main .card h2 { font-size: 18px; }
.delivery-options { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 12px; margin-bottom: 16px; }   /* una fila: 2 o 3 opciones lado a lado */
@media (max-width: 760px) { .delivery-options { grid-template-columns: 1fr; grid-auto-flow: row; } }
.delivery-option { display: flex; gap: 10px; align-items: flex-start; border: 1.5px solid var(--line); border-radius: var(--radius); padding: 14px; cursor: pointer; }
.delivery-option:has(input:checked) { border-color: var(--ink); background: var(--bg-soft); }
.delivery-option.disabled { opacity: .5; cursor: not-allowed; }
.delivery-option input { margin-top: 4px; accent-color: var(--ink); }
.delivery-option > span { display: flex; flex-direction: column; }
.delivery-option small { color: var(--muted); }

/* ---------- Cuenta ---------- */
.auth-page { display: flex; justify-content: center; padding: 32px 0; }
.auth-card { width: 100%; max-width: 440px; }
.account-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 12px 0; }
.account-head h1 { margin: 0; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; color: var(--muted); padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.timeline { list-style: none; display: flex; padding: 0; margin: 20px 0 24px; counter-reset: step; }
.timeline li { flex: 1; text-align: center; position: relative; font-size: 13px; color: var(--muted); padding-top: 34px; }
.timeline li::before { counter-increment: step; content: counter(step); position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 26px; height: 26px; border-radius: 50%; background: var(--line); color: var(--muted); display: grid; place-items: center; font-weight: 800; z-index: 1; font-size: 12px; }
.timeline li::after { content: ""; position: absolute; top: 12px; left: -50%; width: 100%; height: 3px; background: var(--line); }
.timeline li:first-child::after { display: none; }
.timeline li.done { color: var(--ink); font-weight: 600; }
.timeline li.done::before { background: var(--ok); color: #fff; content: "✓"; }
.timeline li.done::after { background: var(--ok); }
.timeline li.current::before { box-shadow: 0 0 0 4px #bbf7d0; }
@media (max-width: 520px) { .timeline li { font-size: 11px; } }
.pay-box { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; background: #fffbeb; border-color: #fde68a; }
.pay-box p { margin: 0; }
.order-layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 860px) { .order-layout { grid-template-columns: 1fr; } }
.history { list-style: none; padding: 0; margin: 0; }
.history li { padding: 8px 0 8px 16px; border-left: 2px solid var(--line); margin-left: 4px; }
.history li strong { margin-right: 8px; }
.result-page { text-align: center; padding: 48px 16px; }
.result-icon { width: 72px; height: 72px; border-radius: 50%; background: var(--bg-soft); display: grid; place-items: center; font-size: 34px; font-weight: 900; margin: 0 auto 12px; }

/* ---------- Página de talles ---------- */
.rich-text table { border-collapse: collapse; width: 100%; margin: 16px 0; }
.rich-text th, .rich-text td { border: 1px solid var(--line); padding: 10px 12px; text-align: center; }
.rich-text th { background: var(--ink); color: #fff; }
.rich-text tr:nth-child(even) td { background: var(--bg-soft); }
