/* Pilot Storefront — estilos base. El branding llega por variables:
   --sf-primary / --sf-accent / --sf-bg (inyectadas por tienda en base.html). */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --sf-surface: #ffffff;
  --sf-text: #1e293b;
  --sf-text-muted: #64748b;
  --sf-border: #e2e8f0;
  --sf-radius: 12px;
  --sf-shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 4px 14px rgba(15, 23, 42, .05);
}

html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--sf-bg);
  color: var(--sf-text);
  line-height: 1.55;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

.sf-container { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.sf-narrow { max-width: 860px; }
.sf-center { text-align: center; }
.sf-muted { color: var(--sf-text-muted); font-weight: 400; }
.sf-small { font-size: .85rem; }
.sf-link { color: var(--sf-primary); font-weight: 600; }
.sf-link:hover { text-decoration: underline; }
.sf-block-center { display: block; text-align: center; margin-top: 14px; }

/* Header */
.sf-header {
  background: var(--sf-surface);
  border-bottom: 1px solid var(--sf-border);
  position: sticky; top: 0; z-index: 50;
}
.sf-header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.sf-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sf-logo { height: 36px; width: auto; max-width: 120px; object-fit: contain; }
.sf-brand-name { font-weight: 700; font-size: 1.1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sf-nav { display: flex; align-items: center; gap: 22px; font-weight: 600; }
.sf-nav a:hover { color: var(--sf-primary); }
.sf-cart-link { position: relative; display: inline-flex; align-items: center; }
.sf-cart-badge {
  position: absolute; top: -8px; right: -10px;
  background: var(--sf-primary); color: #fff;
  font-size: .7rem; font-weight: 700; line-height: 1;
  padding: 3px 6px; border-radius: 999px; min-width: 18px; text-align: center;
}

/* Hero */
.sf-hero { background: var(--sf-surface); border-bottom: 1px solid var(--sf-border); padding: 48px 0; text-align: center; }
.sf-hero-title { font-size: clamp(1.6rem, 4vw, 2.4rem); font-weight: 800; letter-spacing: -.02em; }
.sf-hero-desc { max-width: 640px; margin: 10px auto 0; color: var(--sf-text-muted); }
.sf-search { display: flex; max-width: 460px; margin: 22px auto 0; gap: 8px; }
.sf-search input {
  flex: 1; padding: 11px 16px; border: 1px solid var(--sf-border); border-radius: 999px;
  font-size: .95rem; background: var(--sf-bg); outline: none;
}
.sf-search input:focus { border-color: var(--sf-primary); }
.sf-search button {
  padding: 11px 22px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--sf-primary); color: #fff; font-weight: 700; font-size: .95rem;
}
.sf-search-inline { margin: 0; max-width: 320px; }

/* Secciones */
.sf-section { padding: 34px 0; }
.sf-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.sf-section-title { font-size: 1.25rem; font-weight: 700; margin-bottom: 16px; }
.sf-page-title { font-size: 1.45rem; font-weight: 800; margin-bottom: 18px; }

/* Chips de categoría */
.sf-chips { display: flex; flex-wrap: wrap; gap: 10px; }
.sf-chips-scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 6px; margin-bottom: 16px; }
.sf-chip {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  background: var(--sf-surface); border: 1px solid var(--sf-border);
  padding: 8px 14px; border-radius: 999px; font-weight: 600; font-size: .9rem;
}
.sf-chip:hover { border-color: var(--sf-primary); color: var(--sf-primary); }
.sf-chip-active { background: var(--sf-primary); border-color: var(--sf-primary); color: #fff; }
.sf-chip-active .sf-chip-count { color: rgba(255,255,255,.85); }
.sf-chip-count { color: var(--sf-text-muted); font-weight: 500; font-size: .8rem; }

/* Grid de productos */
.sf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px; }
.sf-card {
  background: var(--sf-surface); border: 1px solid var(--sf-border);
  border-radius: var(--sf-radius); overflow: hidden; transition: box-shadow .15s, transform .15s;
  display: flex; flex-direction: column;
}
.sf-card:hover { box-shadow: var(--sf-shadow); transform: translateY(-2px); }
.sf-card-img { position: relative; aspect-ratio: 1; background: #fff; display: flex; align-items: center; justify-content: center; }
.sf-card-img img { width: 100%; height: 100%; object-fit: contain; padding: 10px; }
.sf-card-noimg { font-size: 2.4rem; opacity: .35; display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; }
.sf-badge-sale, .sf-badge-out {
  position: absolute; top: 10px; left: 10px; font-size: .72rem; font-weight: 700;
  padding: 4px 10px; border-radius: 999px;
}
.sf-badge-sale { background: #f0fdf4; color: #16a34a; }
.sf-badge-out { background: #fef2f2; color: #dc2626; }
.sf-card-body { padding: 12px 14px 14px; }
.sf-card-name { font-weight: 600; font-size: .92rem; line-height: 1.35; min-height: 2.5em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sf-card-price { margin-top: 8px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.sf-price { font-weight: 800; color: var(--sf-primary); }
.sf-price-lg { font-size: 1.5rem; }
.sf-price-regular { color: var(--sf-text-muted); text-decoration: line-through; font-size: .85em; }

/* Ficha de producto */
.sf-breadcrumb { font-size: .85rem; color: var(--sf-text-muted); margin-bottom: 18px; }
.sf-breadcrumb a:hover { color: var(--sf-primary); }
.sf-product { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 34px; }
@media (max-width: 760px) { .sf-product { grid-template-columns: 1fr; } }
.sf-gallery-main {
  background: var(--sf-surface); border: 1px solid var(--sf-border); border-radius: var(--sf-radius);
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.sf-gallery-main img { width: 100%; height: 100%; object-fit: contain; padding: 16px; }
.sf-gallery-thumbs { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; }
.sf-thumb {
  width: 64px; height: 64px; flex: 0 0 auto; border: 2px solid var(--sf-border); border-radius: 8px;
  background: var(--sf-surface); cursor: pointer; padding: 4px; overflow: hidden;
}
.sf-thumb img { width: 100%; height: 100%; object-fit: contain; }
.sf-thumb-active { border-color: var(--sf-primary); }
.sf-product-name { font-size: 1.5rem; font-weight: 800; line-height: 1.25; }
.sf-product-sku { color: var(--sf-text-muted); font-size: .85rem; margin-top: 4px; }
.sf-product-price { margin: 14px 0 6px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sf-product-stock { font-size: .9rem; font-weight: 600; margin-bottom: 14px; }
.sf-in-stock { color: #16a34a; }
.sf-out-stock { color: #dc2626; }
.sf-product-short { color: var(--sf-text-muted); margin-bottom: 16px; }
.sf-add-row { display: flex; gap: 12px; align-items: stretch; flex-wrap: wrap; margin: 8px 0 18px; }
.sf-qty { display: inline-flex; border: 1px solid var(--sf-border); border-radius: 10px; overflow: hidden; background: var(--sf-surface); }
.sf-qty button { width: 42px; border: 0; background: transparent; font-size: 1.2rem; cursor: pointer; color: var(--sf-text); }
.sf-qty button:hover { background: var(--sf-bg); }
.sf-qty input { width: 56px; border: 0; text-align: center; font-size: 1rem; font-weight: 600; outline: none; -moz-appearance: textfield; }
.sf-qty input::-webkit-outer-spin-button, .sf-qty input::-webkit-inner-spin-button { -webkit-appearance: none; }
.sf-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.sf-tag { background: #f1f5f9; color: #475569; font-size: .78rem; font-weight: 600; padding: 4px 10px; border-radius: 999px; }
.sf-product-desc h2, .sf-product-extra h2 { font-size: 1.05rem; font-weight: 700; margin: 18px 0 8px; }
.sf-desc-body { color: var(--sf-text-muted); }
.sf-desc-body p { margin-bottom: 8px; }
.sf-extra-table { border-collapse: collapse; width: 100%; max-width: 420px; }
.sf-extra-table th, .sf-extra-table td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--sf-border); font-size: .9rem; }
.sf-extra-table th { color: var(--sf-text-muted); font-weight: 600; width: 40%; }

/* Botones */
.sf-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px; border-radius: 10px; border: 0; cursor: pointer;
  font-weight: 700; font-size: .95rem; transition: filter .15s;
}
.sf-btn:hover { filter: brightness(.94); }
.sf-btn-primary { background: var(--sf-primary); color: #fff; }
.sf-btn-secondary { background: var(--sf-surface); color: var(--sf-text); border: 1px solid var(--sf-border); }
.sf-btn-lg { padding: 13px 26px; font-size: 1rem; }
.sf-btn-block { width: 100%; }
.sf-btn[disabled] { opacity: .55; cursor: not-allowed; }

/* Vacíos / paginación / loading */
.sf-empty { text-align: center; padding: 44px 16px; color: var(--sf-text-muted); }
.sf-empty .sf-btn { margin-top: 14px; }
.sf-loading { text-align: center; padding: 34px; color: var(--sf-text-muted); }
.sf-pagination { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 28px; }
.sf-page-btn { background: var(--sf-surface); border: 1px solid var(--sf-border); padding: 8px 16px; border-radius: 10px; font-weight: 600; }
.sf-page-btn:hover { border-color: var(--sf-primary); color: var(--sf-primary); }
.sf-page-info { color: var(--sf-text-muted); font-size: .9rem; }

/* Carrito */
.sf-cart-items { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.sf-cart-item {
  display: grid; grid-template-columns: 72px 1fr auto; gap: 14px; align-items: center;
  background: var(--sf-surface); border: 1px solid var(--sf-border); border-radius: var(--sf-radius); padding: 12px;
}
.sf-cart-item-img { width: 72px; height: 72px; border-radius: 8px; background: #fff; border: 1px solid var(--sf-border);
  display: flex; align-items: center; justify-content: center; overflow: hidden; }
.sf-cart-item-img img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.sf-cart-item-name { font-weight: 600; font-size: .92rem; }
.sf-cart-item-price { color: var(--sf-text-muted); font-size: .85rem; margin-top: 2px; }
.sf-cart-item-warn { color: #dc2626; font-size: .8rem; font-weight: 600; margin-top: 2px; }
.sf-cart-item-right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.sf-cart-item-total { font-weight: 700; }
.sf-cart-remove { background: none; border: 0; color: var(--sf-text-muted); cursor: pointer; font-size: .8rem; }
.sf-cart-remove:hover { color: #dc2626; }
.sf-cart-summary { background: var(--sf-surface); border: 1px solid var(--sf-border); border-radius: var(--sf-radius); padding: 18px; }
.sf-cart-total-row { display: flex; justify-content: space-between; align-items: baseline; padding: 6px 0; }
.sf-cart-total-row strong { font-size: 1.05rem; }
.sf-cart-summary .sf-btn { margin-top: 12px; }
.sf-cart-problems { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; border-radius: 10px; padding: 12px 16px; margin-bottom: 16px; font-size: .9rem; }

/* Checkout */
.sf-co-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 30px; }
@media (max-width: 760px) { .sf-co-grid { grid-template-columns: 1fr; } }
.sf-co-title { font-size: 1.02rem; font-weight: 700; margin: 18px 0 10px; }
.sf-co-col > .sf-co-title:first-child { margin-top: 0; }
.sf-field { display: block; margin-bottom: 12px; }
.sf-field span { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 5px; }
.sf-field input, .sf-field textarea {
  width: 100%; padding: 10px 14px; border: 1px solid var(--sf-border); border-radius: 10px;
  font-size: .95rem; font-family: inherit; background: var(--sf-surface); outline: none;
}
.sf-field input:focus, .sf-field textarea:focus { border-color: var(--sf-primary); }
.sf-options { display: flex; flex-direction: column; gap: 10px; }
.sf-option {
  display: flex; gap: 12px; align-items: flex-start; background: var(--sf-surface);
  border: 1px solid var(--sf-border); border-radius: 10px; padding: 12px 14px; cursor: pointer;
}
.sf-option:has(input:checked) { border-color: var(--sf-primary); box-shadow: 0 0 0 1px var(--sf-primary); }
.sf-option input { margin-top: 4px; accent-color: var(--sf-primary); }
.sf-option-title { display: block; font-weight: 700; font-size: .93rem; }
.sf-option-desc { display: block; color: var(--sf-text-muted); font-size: .83rem; margin-top: 2px; }
.sf-option-disabled { opacity: .6; cursor: not-allowed; }
.sf-badge-soon { background: #eff6ff; color: #3b82f6; font-size: .7rem; font-weight: 700; padding: 3px 8px; border-radius: 999px; vertical-align: middle; margin-left: 6px; }
.sf-co-summary { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.sf-co-line { display: flex; justify-content: space-between; gap: 10px; font-size: .9rem; }
.sf-co-line .sf-muted { flex: 1; }
.sf-co-total { border-top: 1px solid var(--sf-border); margin-top: 6px; padding-top: 12px; }
.sf-co-total strong { font-size: 1.25rem; color: var(--sf-primary); }
.sf-co-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; border-radius: 10px; padding: 12px 16px; margin: 12px 0; font-size: .9rem; }
.sf-confirm { text-align: center; padding: 40px 16px; }
.sf-confirm-icon {
  width: 68px; height: 68px; border-radius: 50%; background: #f0fdf4; color: #16a34a;
  font-size: 2rem; display: flex; align-items: center; justify-content: center; margin: 0 auto 16px;
}
.sf-confirm h2 { font-size: 1.4rem; margin-bottom: 8px; }
.sf-confirm p { color: var(--sf-text-muted); margin-bottom: 8px; }
.sf-confirm .sf-btn { margin-top: 16px; }
.sf-confirm-sinpe { background: var(--sf-surface); border: 1px dashed var(--sf-primary); border-radius: var(--sf-radius); padding: 16px; max-width: 380px; margin: 16px auto; }
.sf-sinpe-number { font-size: 1.3rem; font-weight: 800; letter-spacing: .04em; margin-top: 6px; }

/* Footer */
.sf-footer { background: var(--sf-accent); color: rgba(255,255,255,.85); margin-top: 40px; }
.sf-footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 26px; padding: 36px 20px; }
.sf-footer-brand { font-weight: 800; font-size: 1.05rem; color: #fff; margin-bottom: 8px; }
.sf-footer-desc { font-size: .88rem; opacity: .8; }
.sf-footer-title { font-weight: 700; color: #fff; margin-bottom: 10px; font-size: .92rem; }
.sf-footer-list { list-style: none; display: flex; flex-direction: column; gap: 7px; font-size: .88rem; }
.sf-footer-list a:hover { color: #fff; }
.sf-footer-hours { font-size: .88rem; white-space: pre-line; opacity: .85; }
.sf-footer-bottom { border-top: 1px solid rgba(255,255,255,.12); padding: 14px 0; font-size: .8rem; opacity: .7; }
.sf-footer-bottom a { text-decoration: underline; }

/* 404 */
.sf-404 { font-size: 4.5rem; font-weight: 900; color: var(--sf-border); line-height: 1; }
.sf-404-msg { color: var(--sf-text-muted); margin: 12px 0 22px; }

/* Toast */
.sf-toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--sf-accent); color: #fff; padding: 12px 22px; border-radius: 999px;
  font-weight: 600; font-size: .9rem; box-shadow: var(--sf-shadow); z-index: 100;
  animation: sf-toast-in .2s ease-out;
}
@keyframes sf-toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

@media (max-width: 560px) {
  .sf-brand-name { max-width: 150px; }
  .sf-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .sf-hero { padding: 32px 0; }
}

/* ── Variantes (Enmienda 1) ─────────────────────────────────────────── */
.sf-variants { margin: 6px 0 14px; }
.sf-variants-label { font-size: .85rem; font-weight: 700; margin-bottom: 8px; }
.sf-variant-options { display: flex; flex-wrap: wrap; gap: 8px; }
.sf-variant-option {
  display: inline-flex; cursor: pointer; border: 1px solid var(--sf-border);
  border-radius: 10px; background: var(--sf-surface); padding: 8px 14px;
}
.sf-variant-option input { position: absolute; opacity: 0; pointer-events: none; }
.sf-variant-option:has(input:checked) { border-color: var(--sf-primary); box-shadow: 0 0 0 1px var(--sf-primary); }
.sf-variant-name { display: block; font-weight: 700; font-size: .88rem; }
.sf-variant-price { display: block; color: var(--sf-text-muted); font-size: .8rem; }
.sf-variant-out { opacity: .5; cursor: not-allowed; }
.sf-price-desde { font-size: .72em; font-weight: 600; color: var(--sf-text-muted); }

/* ── WhatsApp flotante ──────────────────────────────────────────────── */
.sf-wa-float {
  position: fixed; right: 18px; bottom: 18px; z-index: 90;
  width: 56px; height: 56px; border-radius: 50%;
  background: #25D366; color: #fff; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .22); transition: transform .15s;
}
.sf-wa-float:hover { transform: scale(1.06); }

/* ── Redes sociales (footer) ────────────────────────────────────────── */
.sf-social { display: flex; gap: 12px; margin-top: 14px; font-size: 1.25rem; }
.sf-social a { opacity: .85; }
.sf-social a:hover { opacity: 1; }

/* ── Página de información / políticas ──────────────────────────────── */
.sf-info-nav { color: var(--sf-text-muted); font-size: .9rem; margin-bottom: 22px; }
.sf-info-nav a { color: var(--sf-primary); font-weight: 600; }
.sf-info-section { background: var(--sf-surface); border: 1px solid var(--sf-border);
  border-radius: var(--sf-radius); padding: 22px 24px; margin-bottom: 18px; }
.sf-info-section h2 { font-size: 1.1rem; margin-bottom: 10px; }
.sf-info-body { color: var(--sf-text-muted); white-space: pre-line; }
.sf-info-body p { margin-bottom: 8px; }
