:root {
  --navy: #0b1324;
  --navy-2: #121d35;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --red: #ef4444;
  --green: #16a34a;
  --amber: #d97706;
  --whatsapp: #25d366;
  --whatsapp-dark: #1ebe5a;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #ffffff;
  --bg-alt: #f5f7fb;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(15, 23, 42, .08);
  /* Marca de la tienda (portada) */
  --brand: #d71920;
  --brand-dark: #a50f15;
  --brand-soft: #fde2e4;
  --ink: #1f2937;
  --nav-bg: #eef0f3;
  --promo-blue: #0b74d8;
  --promo-blue-2: #0a4fae;
  --promo-amber: #f59e0b;
  --promo-amber-2: #f97316;
  --shadow-soft: 0 4px 16px rgba(15, 23, 42, .07);
  --font-store: 'Poppins', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
button { font: inherit; cursor: pointer; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 .5rem; }
.container { width: min(1180px, 100% - 32px); margin-inline: auto; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .8rem 1.4rem; border-radius: 10px; border: 1px solid transparent;
  font-weight: 600; text-decoration: none; transition: background .15s, transform .1s, border-color .15s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--blue-dark); }
.btn-ghost { color: #fff; border-color: rgba(255,255,255,.3); }
.btn-ghost:hover { border-color: #fff; }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: #000; }
.btn-ghost-dark { color: var(--text); border-color: var(--line); background: #fff; }
.btn-ghost-dark:hover { border-color: var(--muted); }
.btn-sm { padding: .55rem 1rem; font-size: .9rem; }
.btn-block { width: 100%; }
.link { background: none; border: 0; padding: 0; color: inherit; text-align: left; }
.link:hover { color: var(--blue); }
.link.danger { color: var(--muted); font-size: .85rem; }
.link.danger:hover { color: var(--red); }
.icon-btn {
  width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--bg-alt);
  color: var(--text); font-size: 1rem;
}
.icon-btn:hover { background: var(--line); }

/* ---------- Aviso de modo demo y encabezado del panel de administración ---------- */
.demo-banner {
  background: #fef3c7; color: #78350f; text-align: center; font-size: .875rem;
  padding: .5rem 16px; font-weight: 500;
}
.header {
  position: sticky; top: 0; z-index: 30; background: rgba(11, 19, 36, .92);
  backdrop-filter: blur(10px); color: #fff; border-bottom: 1px solid rgba(255,255,255,.08);
}
.header-inner { display: flex; align-items: center; gap: 2rem; height: 68px; }
.logo { display: flex; align-items: center; gap: .6rem; color: #fff; text-decoration: none; font-size: 1.1rem; font-weight: 500; }
.logo strong { font-weight: 800; }
.logo-mark { width: 34px; height: 34px; display: block; flex-shrink: 0; }
.cart-btn {
  display: flex; align-items: center; gap: .5rem; background: rgba(255,255,255,.08);
  color: #fff; border: 1px solid rgba(255,255,255,.12); border-radius: 10px; padding: .55rem .9rem; font-weight: 600;
}
.cart-btn:hover { background: rgba(255,255,255,.14); }
.cart-count {
  min-width: 22px; height: 22px; border-radius: 11px; background: var(--red);
  font-size: .75rem; display: grid; place-items: center; padding: 0 6px;
}
.cart-count.bump { animation: bump .35s ease; }
@keyframes bump { 50% { transform: scale(1.35); } }

/* ---------- Tienda: cabecera ---------- */
body.store { font-family: var(--font-store); }
/* Deja espacio para la cabecera fija al saltar a una sección */
.store section[id] { scroll-margin-top: 90px; }

.site-header { position: sticky; top: 0; z-index: 30; background: #fff; box-shadow: 0 1px 0 var(--line); }
.site-header-inner { display: flex; align-items: center; gap: 1.5rem; padding: 14px 0; }
.brand { display: flex; flex-direction: column; text-decoration: none; line-height: 1; flex-shrink: 0; }
.brand-name {
  font-style: italic; font-weight: 800; font-size: 1.85rem; color: var(--brand); white-space: nowrap;
  letter-spacing: -.02em; text-transform: uppercase;
}
.brand-sub {
  font-size: .68rem; font-weight: 600; letter-spacing: .42em; text-transform: uppercase;
  color: var(--ink); margin-top: 4px; padding-left: 3px;
}

/* Buscador redondeado con botón circular */
.head-search {
  position: relative; flex: 1; max-width: 520px; margin-inline: auto; display: flex; align-items: center; box-sizing: border-box; min-width: 0;
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 4px 4px 1.1rem; background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.head-search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.head-search input {
  flex: 1; min-width: 0; border: 0; outline: 0; font: inherit; font-size: .92rem;
  background: transparent; color: var(--text); padding: .45rem 0;
}
.head-search button {
  width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--brand); color: #fff;
  display: grid; place-items: center; flex-shrink: 0; transition: background .15s;
}
.head-search button:hover { background: var(--brand-dark); }

/* Sugerencias en vivo bajo el buscador */
.suggest {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 35;
  max-height: min(70vh, 460px); overflow-y: auto; padding: .35rem;
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
}
.suggest[hidden] { display: none; }
.suggest-item {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: .75rem;
  padding: .45rem .6rem; border-radius: 8px; cursor: pointer; color: var(--ink);
}
.suggest-item[aria-selected="true"] { background: var(--brand-soft); }
.suggest-thumb {
  width: 44px; height: 44px; border-radius: 8px; background: var(--bg-alt); overflow: hidden;
  display: grid; place-items: center;
}
.suggest-thumb img, .suggest-thumb svg { width: 100%; height: 100%; object-fit: contain; }
.suggest-name {
  font-size: .88rem; font-weight: 500; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.suggest-name mark { background: transparent; color: var(--brand); font-weight: 700; }
.suggest-price { font-size: .88rem; font-weight: 700; color: var(--ink); white-space: nowrap; }
.suggest-all {
  display: block; margin-top: .25rem; padding: .65rem .6rem; border-top: 1px solid var(--line);
  color: var(--brand); font-size: .86rem; font-weight: 600; text-decoration: none;
}
.suggest-all:hover, .suggest-all:focus-visible { text-decoration: underline; }
.suggest-empty { margin: 0; padding: .8rem .6rem; color: var(--muted); font-size: .88rem; }

.head-shipping {
  display: flex; align-items: center; gap: .6rem; color: var(--ink); text-decoration: none; flex-shrink: 0;
  font-weight: 600; font-size: .82rem; text-transform: uppercase; letter-spacing: .02em;
}
.head-shipping svg { color: var(--brand); }
.head-shipping:hover { color: var(--brand); }

.head-cart {
  display: flex; align-items: center; gap: .5rem; flex-shrink: 0; background: var(--bg-alt); color: var(--ink);
  border: 1px solid var(--line); border-radius: 999px; padding: .55rem 1rem; font-weight: 600; font-size: .9rem;
  transition: border-color .15s, background .15s;
}
.head-cart:hover { border-color: var(--brand); background: #fff; }
.head-cart .cart-count { color: #fff; background: var(--brand); }

/* ---------- Tienda: barra de navegación ---------- */
.navbar { background: var(--nav-bg); position: relative; z-index: 25; }
.navbar-inner { display: flex; align-items: center; gap: 1.5rem; padding: 10px 0; }
.round-icon {
  width: 36px; height: 36px; border-radius: 50%; background: var(--brand); color: #fff;
  display: grid; place-items: center; flex-shrink: 0;
}
.cat-menu { position: relative; }
.cat-btn {
  display: flex; align-items: center; gap: .65rem; background: #fff; border: 0; border-radius: 999px;
  padding: 5px 1.2rem 5px 5px; font-weight: 600; font-size: .9rem; color: var(--ink); box-shadow: var(--shadow-soft);
}
.cat-btn:hover { color: var(--brand); }
.cat-list {
  display: none; position: absolute; top: calc(100% + 8px); left: 0; z-index: 26;
  width: min(270px, calc(100vw - 32px)); list-style: none; margin: 0; padding: .4rem;
  background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
}
.cat-list.open { display: block; }
.cat-list a {
  display: block; padding: .6rem .8rem; border-radius: 8px; color: var(--ink);
  text-decoration: none; font-size: .9rem; font-weight: 500;
}
.cat-list a:hover { background: var(--brand-soft); color: var(--brand-dark); }
.main-nav { display: flex; align-items: center; gap: .35rem; }
.main-nav a {
  color: var(--ink); text-decoration: none; font-weight: 500; font-size: .9rem;
  padding: .5rem 1rem; border-radius: 999px; transition: background .15s, color .15s;
}
.main-nav a:hover { color: var(--brand); }
.main-nav a.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.nav-toggle {
  display: none; align-items: center; gap: .4rem; background: #fff; border: 0; border-radius: 999px;
  padding: .55rem .95rem; font-weight: 600; font-size: .9rem; color: var(--ink); box-shadow: var(--shadow-soft);
}
.nav-phone {
  margin-left: auto; display: flex; align-items: center; gap: .6rem; color: var(--ink);
  text-decoration: none; font-weight: 600; font-size: .95rem; white-space: nowrap;
}
.nav-phone:hover { color: var(--brand); }
.cat-btn:focus-visible, .nav-toggle:focus-visible, .main-nav a:focus-visible, .nav-phone:focus-visible,
.head-search button:focus-visible, .head-cart:focus-visible, .brand:focus-visible, .head-shipping:focus-visible,
.cat-list a:focus-visible, .promo:focus-visible, .cat-card:focus-visible, .slider button:focus-visible {
  outline: 3px solid var(--blue); outline-offset: 2px;
}

/* ---------- Tienda: portada (carrusel y promociones) ---------- */
.home-hero { padding: 20px 0 8px; }
.home-hero-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.slider {
  position: relative; display: flex; flex-direction: column; min-height: 380px;
  border-radius: 16px; overflow: hidden; color: #fff; box-shadow: var(--shadow-soft);
  background: radial-gradient(circle at 80% 30%, rgba(255, 90, 90, .55) 0%, transparent 55%),
    linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
}
.slides { flex: 1; display: grid; }
/* Todas las diapositivas ocupan la misma celda; solo la activa se ve */
.slide {
  grid-area: 1 / 1; display: grid; grid-template-columns: 1.25fr .75fr; align-items: center; gap: 1.25rem;
  padding: 44px 60px 68px; opacity: 0; visibility: hidden; transition: opacity .6s ease, visibility .6s;
}
.slide.is-active { opacity: 1; visibility: visible; }
.slide-title { font-size: clamp(1.5rem, 2.4vw, 2.1rem); font-weight: 700; line-height: 1.2; margin: 0 0 .75rem; color: #fff; }
.slide-text p { margin: 0 0 1.5rem; color: rgba(255, 255, 255, .9); }
.slide-media {
  aspect-ratio: 1; border-radius: 50%; background: #fff; display: grid; place-items: center;
  padding: 16%; box-shadow: 0 20px 40px rgba(0, 0, 0, .25);
}
.slide-media img { width: 100%; height: 100%; object-fit: contain; }
.slider-arrow {
  position: absolute; top: 50%; z-index: 2; transform: translateY(-50%); width: 40px; height: 40px;
  border-radius: 50%; border: 0; background: rgba(255, 255, 255, .15); color: #fff;
  display: grid; place-items: center; transition: background .15s;
}
.slider-arrow:hover { background: rgba(255, 255, 255, .32); }
.slider-prev { left: 10px; }
.slider-next { right: 10px; }
.slider-dots {
  position: absolute; left: 50%; bottom: 16px; z-index: 2; transform: translateX(-50%);
  display: flex; gap: 8px; background: #fff; padding: 7px 12px; border-radius: 999px;
}
.slider-dots button {
  width: 9px; height: 9px; padding: 0; border: 0; border-radius: 5px; background: #cbd5e1;
  transition: background .15s, width .2s;
}
.slider-dots button.active { width: 22px; background: var(--ink); }

.promos { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1.2fr 1fr; gap: 20px; }
.promo {
  position: relative; display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 24px; border-radius: 16px; color: #fff; text-decoration: none; overflow: hidden;
  box-shadow: var(--shadow-soft); transition: transform .2s, box-shadow .2s;
}
.promo:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.promo-lg {
  grid-column: 1 / -1;
  background: radial-gradient(circle at 85% 20%, rgba(96, 165, 250, .35), transparent 55%),
    linear-gradient(135deg, var(--navy-2) 0%, #1e3a8a 100%);
}
.promo-blue { background: linear-gradient(135deg, var(--promo-blue) 0%, var(--promo-blue-2) 100%); }
.promo-amber { background: linear-gradient(135deg, var(--promo-amber) 0%, var(--promo-amber-2) 100%); }
.promo-text { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: flex-start; gap: .4rem; min-width: 0; }
.promo-title { font-size: 1.05rem; font-weight: 700; line-height: 1.25; overflow-wrap: break-word; }
.promo-lg .promo-title { font-size: clamp(1.3rem, 2.2vw, 1.75rem); }
.promo-sub { font-size: .85rem; opacity: .92; }
.promo-btn {
  margin-top: .5rem; background: #fff; color: var(--ink); font-weight: 600; font-size: .82rem;
  padding: .5rem 1rem; border-radius: 8px; transition: background .15s, color .15s;
}
.promo:hover .promo-btn { background: var(--ink); color: #fff; }
.promo-btn-red { background: var(--brand); color: #fff; }
.promo:hover .promo-btn-red { background: var(--brand-dark); }
.promo-media {
  flex-shrink: 0; width: 150px; aspect-ratio: 1; background: #fff; border-radius: 50%; padding: 20px;
  display: grid; place-items: center; box-shadow: 0 10px 24px rgba(0, 0, 0, .2);
}
.promo-media img { width: 100%; height: 100%; object-fit: contain; }
/* Tarjetas pequeñas: texto arriba, imagen en la esquina */
.promo-blue, .promo-amber { flex-direction: column; align-items: flex-start; justify-content: space-between; min-height: 190px; }
.promo-blue .promo-text, .promo-amber .promo-text { height: 100%; }
.promo-blue .promo-btn, .promo-amber .promo-btn { margin-top: auto; }
.promo-blue .promo-media, .promo-amber .promo-media {
  position: absolute; right: 14px; bottom: 14px; width: 76px; padding: 10px;
}

/* ---------- Tienda: categorías de la portada ---------- */
.section-tight { padding: 48px 0; }
.home-title { font-size: clamp(1.4rem, 2.5vw, 1.8rem); font-weight: 600; color: var(--ink); margin-bottom: 1.25rem; }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 20px; }
.cat-card { display: flex; flex-direction: column; align-items: center; gap: .6rem; text-align: center; text-decoration: none; color: var(--ink); }
.cat-card-media {
  width: 100%; aspect-ratio: 1; display: grid; place-items: center; padding: 18%;
  background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-soft);
  transition: transform .2s, box-shadow .2s, border-color .2s;
}
.cat-card-media img, .cat-card-media svg { width: 100%; height: 100%; object-fit: contain; }
.cat-card:hover .cat-card-media { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--brand-soft); }
.cat-card-name { font-weight: 600; font-size: 1rem; line-height: 1.3; }
.cat-card:hover .cat-card-name { color: var(--brand); }
.cat-card-count { margin-top: -.4rem; font-size: .8rem; color: var(--muted); }

/* ---------- Secciones ---------- */
.section { padding: 80px 0; }
.section-alt { background: var(--bg-alt); }
.section-head { text-align: center; margin-bottom: 2.5rem; }
.section-head h2 { font-size: clamp(1.7rem, 3vw, 2.3rem); font-weight: 800; letter-spacing: -.01em; }
.section-head p { color: var(--muted); margin: 0; font-size: 1.05rem; }

/* Productos destacados de la portada */
.section-head #show-featured { margin-top: 1rem; }
.products-more { text-align: center; margin: 2.5rem 0 0; }

/* ---------- Página de la tienda (tienda.html) ---------- */
.shop { padding: 24px 0 72px; }
.breadcrumb { display: flex; flex-wrap: wrap; gap: .4rem; font-size: .85rem; color: var(--muted); margin-bottom: 1rem; }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--brand); text-decoration: underline; }
.breadcrumb [aria-current] { color: var(--ink); font-weight: 500; }
.breadcrumb a[aria-current] + span { display: none; } /* sin "/" al final en la tienda general */
.shop-title { font-size: clamp(1.6rem, 3vw, 2.1rem); font-weight: 700; color: var(--ink); margin: 0 0 .35rem; }
.shop-desc { color: var(--muted); margin: 0 0 1.25rem; max-width: 70ch; }
.shop-cats { display: flex; align-items: center; flex-wrap: wrap; gap: .6rem; margin-bottom: 1.5rem; }
.shop-cats-label { font-weight: 600; color: var(--muted); }
.shop-chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.shop-chip {
  background: var(--brand-soft); color: var(--brand-dark); border-radius: 10px; padding: .45rem .95rem;
  font-weight: 600; font-size: .9rem; text-decoration: none; transition: background .15s, color .15s;
}
.shop-chip:hover { background: var(--brand); color: #fff; }
.shop-chip.active { background: var(--brand); color: #fff; }
.shop-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.shop-count { margin: 0; color: var(--muted); }
.shop-sort {
  font: inherit; font-weight: 600; color: var(--ink); background: var(--nav-bg); border: 0;
  border-radius: 999px; padding: .6rem 1.1rem; cursor: pointer;
}
.shop-sort:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.shop .empty .btn { margin-top: .5rem; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 2rem; }
.chip {
  border: 1px solid var(--line); background: #fff; color: var(--text); border-radius: 999px;
  padding: .45rem 1rem; font-weight: 500; font-size: .9rem;
}
.chip:hover { border-color: var(--muted); }
.chip.active { background: var(--navy); color: #fff; border-color: var(--navy); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.25rem; }
.card {
  display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; transition: box-shadow .2s, transform .2s;
}
.card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.card-media {
  position: relative; border: 0; padding: 1.5rem; aspect-ratio: 4 / 3;
  background: linear-gradient(160deg, #f8fafc, #e8eef8); display: grid; place-items: center;
}
.card-media svg, .card-media img { width: 85%; height: 100%; object-fit: contain; }
.badge {
  position: absolute; top: 12px; left: 12px; background: #fff; border: 1px solid var(--line);
  border-radius: 999px; font-size: .75rem; font-weight: 600; padding: .2rem .65rem; color: var(--muted);
}
.card-body { padding: 1.1rem 1.2rem 1.25rem; display: flex; flex-direction: column; flex: 1; }
.card-meta { margin: 0 0 .25rem; color: var(--blue); font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.card h3 { font-size: 1.05rem; font-weight: 700; }
.card-features { padding-left: 1.1rem; margin: .25rem 0 1rem; color: var(--muted); font-size: .9rem; }
.card-foot { margin-top: auto; display: flex; align-items: flex-end; justify-content: space-between; gap: .75rem; }
.price { margin: 0; font-size: 1.35rem; font-weight: 800; }
.price-lg { font-size: 1.9rem; margin: .25rem 0 .35rem; }
.stock { font-size: .8rem; font-weight: 600; color: var(--green); }
.stock.low { color: var(--amber); }
.stock.out { color: var(--red); }
.empty { text-align: center; color: var(--muted); padding: 2rem 0; }

.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1.25rem; }
.feature { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; }
.feature-icon { font-size: 1.8rem; margin-bottom: .75rem; }
.feature h3 { font-size: 1.1rem; }
.feature p { color: var(--muted); margin: 0; }

.contact {
  display: flex; align-items: center; justify-content: space-between; gap: 2rem; flex-wrap: wrap;
  background: var(--navy); color: #fff; border-radius: 20px; padding: 2.5rem;
}
.contact h2 { font-size: 1.8rem; font-weight: 800; }
.contact p { color: #cbd5e1; margin: 0; max-width: 32rem; }
.contact-actions { display: flex; gap: .75rem; flex-wrap: wrap; }

/* ---------- Pie de página (fondo oscuro, columnas de enlaces y redes con íconos) ---------- */
.footer { background: var(--navy); color: #cbd5e1; font-size: .95rem; }
.footer p { margin: 0; }
.footer-grid {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 2.5rem 2rem;
  padding: 3.5rem 0 3rem;
}
.footer-title { font-size: 1.05rem; font-weight: 700; color: #fff; margin-bottom: 1.15rem; }
.footer-links { list-style: none; padding: 0; margin: 0; display: grid; gap: .85rem; }
.footer a { color: #e2e8f0; text-decoration: none; transition: color .15s; }
.footer a:hover { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
.footer a:focus-visible { outline: 2px solid #fff; outline-offset: 3px; border-radius: 4px; }
.footer-contact li { overflow-wrap: break-word; }
/* Redes sociales con ícono */
.footer-social a { display: inline-flex; align-items: center; gap: .8rem; }
.footer-social svg { width: 22px; height: 22px; flex-shrink: 0; }
/* Acceso al Libro de Reclamaciones (debe ser visible en la web, exigido por INDECOPI) */
.footer a.libro-link {
  display: inline-flex; align-items: center; gap: .65rem; margin-top: 1.25rem; padding: .6rem .9rem;
  background: #fff; border-radius: 10px; color: var(--ink); font-weight: 600; font-size: .85rem; line-height: 1.25;
}
.footer a.libro-link:hover { color: var(--brand); text-decoration: none; }
.libro-link svg { width: 30px; height: 30px; flex-shrink: 0; color: var(--brand); }
/* Barra inferior: logo y datos legales, separada por una línea */
.footer-bottom { border-top: 1px solid rgba(255, 255, 255, .16); padding: 1.75rem 0; font-size: .85rem; }
.footer-bottom-inner {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem 2rem;
}
.footer a.footer-logo { display: inline-flex; color: #fff; font-size: 1.4rem; font-weight: 800; letter-spacing: -.01em; }
.footer a.footer-logo:hover { text-decoration: none; }
.footer-logo .logo-mark { width: 38px; height: 38px; }
.footer-legal { display: grid; gap: .25rem; text-align: right; color: #94a3b8; }

/* ---------- Carrito ---------- */
.overlay { position: fixed; inset: 0; background: rgba(2, 6, 23, .5); z-index: 40; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100%); z-index: 50;
  background: #fff; display: flex; flex-direction: column; transform: translateX(100%);
  transition: transform .25s ease; box-shadow: -10px 0 40px rgba(0,0,0,.15);
}
.drawer.open { transform: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--line); }
.drawer-head h2 { margin: 0; font-size: 1.25rem; }
.drawer-body { flex: 1; overflow-y: auto; padding: .5rem 1.5rem; }
.drawer-foot { border-top: 1px solid var(--line); padding: 1.25rem 1.5rem; }
.total-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; font-size: 1.1rem; }
.total-row strong { font-size: 1.35rem; }
.cart-empty { text-align: center; padding: 3rem 0; color: var(--muted); }
.cart-line { display: grid; grid-template-columns: 64px 1fr auto; gap: .9rem; padding: 1rem 0; border-bottom: 1px solid var(--line); }
.cart-thumb { width: 64px; height: 64px; border-radius: 10px; background: var(--bg-alt); display: grid; place-items: center; padding: 6px; }
.cart-thumb svg, .cart-thumb img { width: 100%; height: 100%; object-fit: contain; }
.cart-name { margin: 0; font-weight: 600; font-size: .92rem; line-height: 1.3; }
.cart-price { margin: .1rem 0 .4rem; color: var(--muted); font-size: .85rem; }
.cart-right { display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; }

.qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.qty button { width: 38px; height: 42px; border: 0; background: #fff; font-size: 1.1rem; }
.qty button:hover:not(:disabled) { background: var(--bg-alt); }
.qty button:disabled { color: var(--line); cursor: not-allowed; }
.qty input { width: 48px; height: 42px; border: 0; text-align: center; font: inherit; font-weight: 600; -moz-appearance: textfield; }
.qty input::-webkit-inner-spin-button { -webkit-appearance: none; }
.qty-sm button { width: 30px; height: 30px; }
.qty-sm span { min-width: 28px; text-align: center; font-weight: 600; font-size: .9rem; }

/* ---------- Modales ---------- */
.modal {
  border: 0; border-radius: 18px; padding: 2rem; width: min(820px, calc(100% - 32px));
  max-height: calc(100dvh - 32px); box-shadow: 0 30px 80px rgba(0,0,0,.3); color: var(--text);
}
.modal::backdrop { background: rgba(2, 6, 23, .55); }
.modal-wide { width: min(960px, calc(100% - 32px)); }
.modal-close { position: absolute; top: 14px; right: 14px; }
.detail { display: grid; grid-template-columns: 1fr 1.1fr; gap: 2rem; align-items: start; }
.detail-media { background: linear-gradient(160deg, #f8fafc, #e8eef8); border-radius: var(--radius); padding: 2rem; aspect-ratio: 1; display: grid; place-items: center; }
.detail-media svg, .detail-media img { width: 100%; height: 100%; object-fit: contain; }
.detail h1 { font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 700; color: var(--ink); margin: .2rem 0 .5rem; }
.detail-wa { display: inline-block; margin-top: 1rem; color: var(--green); font-weight: 600; font-size: .9rem; }
.product-page .detail { margin-top: .5rem; }
.related { margin-top: 3rem; }
.related-title { font-size: 1.35rem; font-weight: 700; color: var(--ink); margin: 0 0 1rem; }
a.link { text-decoration: none; }
a.card-media { color: inherit; text-decoration: none; }
.detail-desc { color: var(--muted); }
.detail-features { padding-left: 1.2rem; margin: 0 0 1.5rem; }
.detail-features li { margin-bottom: .3rem; }
.detail-actions { display: flex; gap: .75rem; flex-wrap: wrap; }

.checkout { display: grid; grid-template-columns: 1.4fr 1fr; gap: 2rem; margin-top: 1rem; }
fieldset { border: 0; padding: 0; margin: 0 0 1.25rem; }
legend { font-weight: 700; margin-bottom: .75rem; }
label { display: flex; flex-direction: column; gap: .3rem; font-size: .88rem; font-weight: 500; margin-bottom: .8rem; }
label.check { flex-direction: row; align-items: center; gap: .5rem; }
input, textarea, select { font: inherit; }
fieldset input:not([type=checkbox]):not([type=radio]), fieldset textarea, fieldset select {
  padding: .7rem .85rem; border: 1px solid var(--line); border-radius: 10px; width: 100%;
}
fieldset select { background: #fff; color: var(--text); cursor: pointer; }
fieldset select:invalid { color: var(--muted); } /* "Elige tu distrito" en gris hasta elegir uno */
fieldset select option { color: var(--text); }
fieldset input:focus, fieldset textarea:focus, fieldset select:focus { outline: 2px solid var(--blue); outline-offset: -1px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.form-error { background: #fef2f2; color: #b91c1c; border-radius: 10px; padding: .7rem .9rem; font-size: .9rem; }
.secure-note { font-size: .8rem; color: var(--muted); text-align: center; }
.summary { background: var(--bg-alt); border-radius: var(--radius); padding: 1.5rem; align-self: start; }
.summary h3 { font-size: 1.1rem; }
.summary ul { list-style: none; padding: 0; margin: 0 0 1rem; }
.summary li { display: flex; justify-content: space-between; gap: 1rem; padding: .6rem 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.summary .total-row { margin: 0; }

/* ---------- Página de pago (pago.html) ---------- */
.pay-header { justify-content: space-between; }
.pay-secure { margin: 0; color: var(--muted); font-size: .9rem; font-weight: 500; }
.pay-back { color: var(--brand); font-weight: 600; text-decoration: none; }
.pay-back:hover { text-decoration: underline; }
.pay-page { padding: 2rem 0 4rem; }
.pay-page h1 { font-size: 1.7rem; }
.pay-page .summary { position: sticky; top: 100px; }
.pay-methods { display: grid; gap: .6rem; }
.pay-method {
  flex-direction: row; align-items: flex-start; gap: .75rem; margin: 0; cursor: pointer;
  padding: .9rem 1rem; border: 1px solid var(--line); border-radius: 12px; transition: border-color .15s, background .15s;
}
.pay-method:hover { border-color: var(--muted); }
.pay-method:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.pay-method input { margin-top: .2rem; accent-color: var(--brand); width: 18px; height: 18px; flex-shrink: 0; }
.pay-method[hidden] { display: none; }
.pay-method-body { display: flex; flex-direction: column; gap: .15rem; }
.terms-check { align-items: flex-start; font-weight: 400; line-height: 1.45; margin-bottom: 1rem; }
.terms-check input { margin-top: .2rem; accent-color: var(--brand); width: 16px; height: 16px; flex-shrink: 0; }
.terms-check a, .legal a:not(.btn) { color: var(--brand); }
.pay-method-body small { color: var(--muted); font-weight: 400; }
.transfer-info { margin-top: 1rem; padding: 1rem; border-radius: 12px; background: var(--bg-alt); font-size: .9rem; }
.transfer-info[hidden] { display: none; }
.transfer-info p { margin: 0 0 .75rem; }

/* Datos de la cuenta bancaria (pago.html y exito.html) */
.bank-box { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: .9rem 1rem; text-align: left; margin-bottom: 1rem; }
.bank-name { margin: 0 0 .5rem; font-weight: 700; color: var(--ink); }
.bank-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: .1rem .75rem; padding: .5rem 0; border-top: 1px solid var(--line); }
.bank-row span { grid-column: 1; font-size: .78rem; color: var(--muted); }
.bank-row strong { grid-column: 1; font-family: ui-monospace, monospace; font-size: 1rem; letter-spacing: .03em; word-break: break-all; }
.bank-copy {
  grid-column: 2; grid-row: 1 / span 2; font: inherit; font-size: .8rem; font-weight: 600; cursor: pointer;
  padding: .4rem .75rem; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--ink);
}
.bank-copy:hover { border-color: var(--muted); }
.transfer-steps { text-align: left; color: var(--ink); padding-left: 1.25rem; margin: 0 0 1rem; }
.transfer-steps li { margin-bottom: .4rem; }
.order-code { font-family: ui-monospace, monospace; letter-spacing: .05em; color: var(--brand); }
.btn-whatsapp { background: var(--whatsapp); color: #fff; }
.btn-whatsapp:hover { background: var(--whatsapp-dark); }

/* ---------- Páginas legales (terminos.html, devoluciones.html, libro-reclamaciones.html) ---------- */
.legal { width: min(820px, 100% - 32px); margin-inline: auto; padding: 2rem 0 4rem; color: var(--ink); }
.legal h1 { font-size: clamp(1.6rem, 3vw, 2.1rem); font-weight: 700; margin-bottom: .35rem; }
.legal h2 { font-size: 1.2rem; font-weight: 700; margin: 2rem 0 .6rem; }
.legal h3 { font-size: 1rem; font-weight: 600; margin: 1.25rem 0 .4rem; }
.legal p, .legal li { line-height: 1.65; }
.legal ul, .legal ol { padding-left: 1.3rem; }
.legal li { margin-bottom: .35rem; }
.legal-meta { color: var(--muted); font-size: .9rem; margin: 0 0 1.5rem; }
.legal-box {
  background: var(--bg-alt); border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1.25rem; margin: 1.25rem 0;
}
.legal-box p { margin: .2rem 0; }
.legal-toc { columns: 2; column-gap: 2rem; margin: 0 0 1rem; }
.legal-note { font-size: .88rem; color: var(--muted); }
.legal fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 1.1rem 1.25rem .5rem; margin-bottom: 1.25rem; }
.legal legend { padding: 0 .4rem; font-size: 1rem; }
.legal select { font: inherit; padding: .7rem .85rem; border: 1px solid var(--line); border-radius: 10px; width: 100%; background: #fff; }
.radio-row { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; margin-bottom: .8rem; }
.radio-row label { flex-direction: row; align-items: center; gap: .45rem; margin: 0; font-weight: 500; }
.radio-row input { accent-color: var(--brand); width: 16px; height: 16px; }
.field-hint { font-size: .8rem; color: var(--muted); font-weight: 400; }
.constancia dl { display: grid; grid-template-columns: minmax(150px, auto) 1fr; gap: .45rem 1rem; margin: 0; }
.constancia dt { color: var(--muted); font-size: .88rem; }
.constancia dd { margin: 0; overflow-wrap: anywhere; white-space: pre-line; }
.constancia h2 { font-size: 1.05rem; margin: 1.5rem 0 .6rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.constancia-num { font-family: ui-monospace, monospace; color: var(--brand); }
.constancia-actions { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 1.5rem; }

@media print {
  .site-header, .footer, .wa-float, .constancia-actions, .no-print { display: none !important; }
  .legal { width: 100%; padding: 0; }
}

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 120px); z-index: 60;
  background: var(--navy); color: #fff; padding: .8rem 1.2rem; border-radius: 10px;
  font-weight: 500; box-shadow: var(--shadow); transition: transform .25s ease; max-width: calc(100% - 32px);
}
.toast.show { transform: translate(-50%, 0); }

/* Botón flotante de WhatsApp: debajo del carrito (z 40-50), mensajes y modales */
.wa-float {
  position: fixed; right: 24px; bottom: 24px; z-index: 35;
  width: 56px; height: 56px; border-radius: 50%; background: var(--whatsapp); color: #fff;
  display: grid; place-items: center; box-shadow: 0 6px 18px rgba(15, 23, 42, .25);
  transition: transform .15s, background .15s, box-shadow .15s;
}
.wa-float svg { width: 30px; height: 30px; }
.wa-float:hover { background: var(--whatsapp-dark); transform: scale(1.08); box-shadow: 0 10px 24px rgba(15, 23, 42, .3); }
.wa-float:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }

.processing { position: fixed; inset: 0; z-index: 70; background: rgba(2, 6, 23, .6); display: grid; place-items: center; padding: 16px; }
.processing[hidden] { display: none; }
.processing-box { background: #fff; border-radius: 16px; padding: 2rem 2.5rem; text-align: center; box-shadow: var(--shadow); }
.processing-box p { margin: 1rem 0 0; font-weight: 600; }
.processing-box small { color: var(--muted); font-weight: 400; }
.spinner { width: 44px; height: 44px; margin: 0 auto; border-radius: 50%; border: 4px solid var(--line); border-top-color: var(--blue); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Responsivo ---------- */
/* Espacio para que el botón de WhatsApp no tape la barra inferior del pie */
@media (max-width: 1340px) {
  .footer-bottom { padding-bottom: 5.5rem; }
}
@media (max-width: 1080px) {
  .head-shipping span { display: none; }
}
@media (max-width: 900px) {
  .footer-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .detail, .checkout { grid-template-columns: 1fr; }
  .header-inner { justify-content: space-between; }
  .summary { order: -1; }
  .pay-page { padding-top: 1.25rem; }
  .pay-page .summary { position: static; }
  .pay-secure { display: none; }
  /* Tienda: cabecera en dos filas, buscador a todo el ancho */
  .store section[id] { scroll-margin-top: 135px; }
  .site-header-inner { flex-wrap: wrap; gap: 10px 1rem; padding: 10px 0 12px; }
  .head-search { order: 3; flex-basis: 100%; max-width: none; }
  .head-shipping { display: none; }
  .head-cart { margin-left: auto; }
  /* Menú colapsable */
  .navbar-inner { gap: .6rem; padding: 8px 0; }
  .nav-toggle { display: inline-flex; }
  .main-nav {
    display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; align-items: stretch;
    gap: 2px; padding: .5rem 16px 1rem; background: #fff; border-top: 1px solid var(--line); box-shadow: var(--shadow);
  }
  .main-nav.open { display: flex; }
  .main-nav a { padding: .75rem 1rem; }
  /* Portada apilada */
  .home-hero-grid { grid-template-columns: 1fr; }
  .slider { min-height: 0; }
}
@media (max-width: 560px) {
  .section { padding: 56px 0; }
  .section-tight { padding: 36px 0; }
  /* Categorías en una fila que se desliza con el dedo */
  .shop-cats { display: block; margin-inline: -16px; }
  .shop-cats-label { display: none; }
  .shop-chips { flex-wrap: nowrap; overflow-x: auto; padding: 0 16px 4px; scrollbar-width: none; }
  .shop-chip { white-space: nowrap; flex-shrink: 0; }
  .shop-sort { padding: .5rem .9rem; font-size: .9rem; }
  .brand-name { font-size: 1.45rem; }
  .brand-sub { font-size: .6rem; letter-spacing: .36em; }
  .head-cart { padding: .5rem .75rem; }
  .head-cart-label { display: none; }
  .nav-phone-number { display: none; }
  .cat-btn { padding-right: 1rem; }
  .slide { grid-template-columns: 1fr; gap: 1rem; padding: 24px 22px 64px; align-content: start; }
  .slide-media { width: 120px; order: -1; padding: 18px; }
  .slider-arrow { display: none; }
  .promos { grid-template-columns: 1fr; grid-template-rows: none; gap: 14px; }
  .promo { padding: 20px; }
  .promo-lg .promo-media { width: 96px; padding: 12px; }
  .promo-blue, .promo-amber { min-height: 170px; }
  .cat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .cat-card-name { font-size: .92rem; }
  .row { grid-template-columns: 1fr; }
  .cart-btn span:not(.cart-count) { display: none; }
  .modal { padding: 1.5rem 1.1rem; }
  .contact { padding: 1.75rem; }
  .card-foot { flex-wrap: wrap; }
  .wa-float { width: 50px; height: 50px; right: 16px; bottom: 16px; }
  .wa-float svg { width: 26px; height: 26px; }
  .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2rem 1.25rem; padding: 2.5rem 0 2rem; }
  .footer-legal { text-align: left; }
  .legal-toc { columns: 1; }
  .constancia dl { grid-template-columns: 1fr; gap: .1rem; }
  .constancia dd { margin-bottom: .5rem; }
  .footer-bottom-inner { flex-direction: column; align-items: flex-start; }
}
