:root {
    --primary: #2c3e50;
    --accent: #ec1c24;
    --accent-dark: #b9151c;
    --ink: #2c3e50;
    --bg: #f6f6f7;
    --card: #ffffff;
    --wa: #25d366;
    /* Paleta flyer publicitario */
    --blue: #1e4fd8;
    --blue-dark: #0d2570;
    --yellow: #ffd21f;
}

* { box-sizing: border-box; }

.catalog-wrap {
    max-width: 1320px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
}
@media (min-width: 768px) {
    .catalog-wrap {
        padding-left: 2.5rem;
        padding-right: 2.5rem;
    }
}

body {
    background: var(--bg);
    color: var(--ink);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    padding-bottom: 64px; /* espacio para mobile-nav */
}
@media (min-width: 768px) { body { padding-bottom: 0; } }

/* ---------- Header ---------- */
.top-banner {
    background: var(--yellow);
    color: var(--blue-dark);
    text-align: center;
    font-size: .85rem;
    padding: .4rem 1rem;
    font-weight: 700;
}

.tienda-header {
    background: linear-gradient(90deg, var(--blue-dark) 0%, var(--blue) 100%);
    box-shadow: 0 1px 6px rgba(0,0,0,.15);
    position: sticky;
    top: 0;
    z-index: 1020;
}
.tienda-header .nav-link-tienda { color: #dfe7ef; }
.tienda-header .nav-link-tienda:hover { color: #fff; }
.tienda-header .cart-btn { color: #fff; }
.tienda-header .search-form {
    background: rgba(255,255,255,.14);
    border-color: transparent;
}
.tienda-header .search-form:focus-within {
    background: #fff;
    border-color: #fff;
}
.tienda-header .search-form i { color: rgba(255,255,255,.7); }
.tienda-header .search-form:focus-within i { color: #888; }
.tienda-header .search-form input { color: #fff; }
.tienda-header .search-form input::placeholder { color: rgba(255,255,255,.6); }
.tienda-header .search-form:focus-within input { color: var(--ink); }
.tienda-header .search-form:focus-within input::placeholder { color: #999; }

.brand {
    display: flex;
    align-items: center;
    text-decoration: none;
    white-space: nowrap;
}
.brand img {
    max-height: 38px;
    width: auto;
}

.search-form {
    display: flex;
    align-items: center;
    background: var(--bg);
    border-radius: 2rem;
    padding: .45rem 1rem;
    gap: .5rem;
    border: 1px solid transparent;
}
.search-form:focus-within { border-color: var(--accent); background: #fff; }
.search-form input {
    border: 0; background: transparent; outline: none;
    width: 100%; font-size: .95rem;
}
.search-form i { color: #888; }

.nav-link-tienda {
    color: var(--ink);
    text-decoration: none;
    font-size: .9rem;
    font-weight: 600;
    white-space: nowrap;
}
.nav-link-tienda:hover { color: var(--accent); }

.cart-btn {
    position: relative;
    font-size: 1.4rem;
    color: var(--ink);
    text-decoration: none;
    padding: .3rem .5rem;
}
.cart-badge {
    position: absolute;
    top: -2px; right: -4px;
    background: var(--accent);
    color: #fff;
    font-size: .7rem;
    font-weight: 700;
    border-radius: 1rem;
    min-width: 1.2rem;
    text-align: center;
    padding: 0 .25rem;
}

/* ---------- Categorías ---------- */
.cats-bar {
    background: linear-gradient(90deg, var(--accent-dark) 0%, var(--accent) 60%, #f0434a 100%);
    border-top: 1px solid rgba(0,0,0,.08);
}
.cats-scroll {
    display: flex;
    gap: .5rem;
    overflow-x: auto;
    padding: .55rem 1rem;
    scrollbar-width: none;
}
.cats-scroll::-webkit-scrollbar { display: none; }
.cat-chip {
    flex: 0 0 auto;
    padding: .3rem .9rem;
    border-radius: 2rem;
    background: rgba(255,255,255,.14);
    color: #fff;
    text-decoration: none;
    font-size: .85rem;
    font-weight: 600;
    border: 1px solid rgba(255,255,255,.25);
}
.cat-chip:hover { background: rgba(255,255,255,.3); color: #fff; }
.cat-chip.active { background: #fff; color: var(--accent); border-color: #fff; }
.cat-chip.chip-oferta { background: var(--yellow); border-color: var(--yellow); color: var(--blue-dark); font-weight: 800; }
.cat-chip.chip-oferta.active { background: #fff; color: var(--accent); border-color: #fff; }

/* ---------- Flyers ---------- */
.flyer-slide {
    position: relative;
    min-height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.flyer-slide img {
    width: 100%;
    max-height: 340px;
    object-fit: cover;
}
.flyer-caption {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 2rem;
    text-shadow: 0 2px 8px rgba(0,0,0,.4);
}
.flyer-caption h2 { font-weight: 800; font-size: clamp(1.4rem, 4vw, 2.4rem); }
.flyer-caption p { font-size: clamp(.9rem, 2vw, 1.1rem); max-width: 30rem; }

/* ---------- Secciones ---------- */
.seccion-titulo {
    font-size: 1.35rem;
    font-weight: 900;
    font-style: italic;
    color: var(--blue-dark);
    margin: 0;
    padding-left: .6rem;
    border-left: 5px solid var(--accent);
}
.ver-todas { font-size: .85rem; font-weight: 600; color: var(--accent); text-decoration: none; }

.ofertas-scroll {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 170px;
    gap: .8rem;
    overflow-x: auto;
    padding-bottom: .5rem;
    scrollbar-width: thin;
}
@media (min-width: 768px) { .ofertas-scroll { grid-auto-columns: 200px; } }

/* ---------- Grid de productos ---------- */
.prod-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: .9rem;
}
@media (min-width: 576px) { .prod-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 992px) {
    .prod-grid {
        grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
        gap: 1.2rem;
    }
}

.prod-card {
    background: var(--card);
    border-radius: 1.3rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid #ececec;
    box-shadow: 0 2px 10px rgba(13,37,112,.06);
    transition: box-shadow .15s, transform .15s;
}
.prod-card:hover {
    box-shadow: 0 8px 24px rgba(13,37,112,.14);
    transform: translateY(-2px);
    border-color: var(--accent);
}

.prod-img-wrap {
    position: relative;
    display: block;
    aspect-ratio: 1/1;
    background: #fff;
    cursor: zoom-in;
}
.prod-img-wrap img {
    width: 100%; height: 100%;
    object-fit: contain;
    padding: 1.1rem;
    transition: transform .2s;
}
.prod-card:hover .prod-img-wrap img { transform: scale(1.05); }

.qv-hint {
    position: absolute;
    bottom: .5rem; right: .5rem;
    background: rgba(44,62,80,.75);
    color: #fff;
    border-radius: 50%;
    width: 1.9rem; height: 1.9rem;
    display: flex; align-items: center; justify-content: center;
    font-size: .95rem;
    opacity: 0;
    transition: opacity .15s;
}
.prod-card:hover .qv-hint { opacity: 1; }

.badge-oferta {
    position: absolute;
    top: .5rem; left: .5rem;
    background: var(--accent);
    color: #fff;
    font-size: .72rem;
    font-weight: 800;
    padding: .2rem .5rem;
    border-radius: .5rem;
}

.prod-body { padding: .6rem .8rem .8rem; flex: 1; display: flex; flex-direction: column; }
.prod-marca { font-size: .7rem; color: #999; text-transform: uppercase; font-weight: 700; letter-spacing: .5px; }
.prod-nombre {
    font-size: .9rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--blue-dark);
    margin: .15rem 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.2em;
}
.prod-pack { font-size: .72rem; color: #888; }
.prod-precio { margin-top: auto; display: flex; align-items: baseline; gap: .4rem; flex-wrap: wrap; }
.precio-final {
    display: inline-block;
    font-size: 1.05rem;
    font-weight: 800;
    background: var(--blue-dark);
    color: #fff;
    padding: .18rem .65rem;
    border-radius: .55rem;
}
.precio-final.oferta { background: var(--accent); }
.precio-tachado { font-size: .8rem; color: #999; text-decoration: line-through; }

.btn-add {
    border: 0;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    font-size: .85rem;
    padding: .55rem;
    border-radius: 0 0 1.3rem 1.3rem;
    transition: background .15s;
}
.btn-add:hover { background: var(--accent-dark); }
.btn-add.added { background: var(--wa); }

/* ---------- Carrito ---------- */
.cart-list { display: flex; flex-direction: column; gap: .7rem; }
.cart-item {
    display: flex;
    align-items: center;
    gap: .8rem;
    background: var(--card);
    border-radius: 1rem;
    padding: .7rem;
    border: 1px solid #ececec;
}
.cart-item-img { width: 64px; height: 64px; flex: 0 0 64px; }
.cart-item-img img { width: 100%; height: 100%; object-fit: contain; }
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-info h3 { font-size: .9rem; font-weight: 600; margin: 0 0 .15rem; }
.precio-unit { font-size: .8rem; color: #888; }
.cart-item-subtotal { font-weight: 800; min-width: 4.5rem; text-align: right; }

.qty-stepper {
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 2rem;
    overflow: hidden;
}
.qty-stepper button {
    border: 0;
    background: transparent;
    width: 2rem; height: 2rem;
    font-size: 1.1rem;
    font-weight: 700;
}
.qty-stepper button:hover { background: var(--bg); }
.qty-stepper span { min-width: 2rem; text-align: center; font-weight: 700; }

.btn-remove {
    border: 0; background: transparent;
    color: #bbb; font-size: 1.1rem; padding: .3rem;
}
.btn-remove:hover { color: var(--accent); }

/* ---------- Resumen / formularios ---------- */
.resumen-card, .form-card, .pedido-card {
    background: var(--card);
    border-radius: 1rem;
    border: 1px solid #ececec;
    padding: 1.2rem;
}
.form-card { margin-bottom: 1rem; }
.resumen-card h2, .form-card h2 { font-size: 1.05rem; font-weight: 800; margin-bottom: .8rem; }
.pedido-card { margin-bottom: 1rem; }

.resumen-items { display: flex; flex-direction: column; gap: .35rem; margin-bottom: .8rem; max-height: 300px; overflow-y: auto; }
.resumen-item { display: flex; justify-content: space-between; gap: 1rem; font-size: .88rem; }
.resumen-linea {
    display: flex; justify-content: space-between;
    padding-top: .6rem; margin-top: .4rem;
    border-top: 1px solid #eee;
    font-size: 1rem;
}
.resumen-linea.total strong { font-size: 1.4rem; color: var(--accent); }

.opcion-radio {
    display: flex;
    align-items: center;
    gap: .8rem;
    border: 1.5px solid #e5e5e5;
    border-radius: .8rem;
    padding: .7rem .9rem;
    margin-bottom: .6rem;
    cursor: pointer;
}
.opcion-radio:has(input:checked) { border-color: var(--accent); background: #fff5f5; }
.opcion-radio input { accent-color: var(--accent); }
.opcion-info { flex: 1; display: flex; flex-direction: column; }
.opcion-info small { color: #888; }
.opcion-costo { font-weight: 800; }

.btn-cta {
    display: block;
    width: 100%;
    background: var(--yellow);
    color: var(--blue-dark);
    border: 0;
    border-radius: .8rem;
    padding: .85rem;
    font-weight: 900;
    font-style: italic;
    font-size: 1rem;
    text-align: center;
    text-decoration: none;
    margin-top: 1rem;
    box-shadow: 0 3px 0 rgba(0,0,0,.15);
}
.btn-cta:hover { background: #ffdf52; color: var(--blue-dark); }
.btn-wa { background: var(--wa); color: #fff; }
.btn-wa:hover { background: #1eb856; color: #fff; }
.btn-mp { background: #009ee3; color: #fff; }
.btn-mp:hover { background: #0082ba; color: #fff; }
.btn-secundario {
    display: block;
    width: 100%;
    text-align: center;
    color: var(--ink);
    text-decoration: none;
    font-weight: 600;
    font-size: .9rem;
    padding: .6rem;
    margin-top: .4rem;
}
.btn-secundario:hover { color: var(--accent); }

/* ---------- Confirmación ---------- */
.confirmado-wrap { max-width: 560px; margin: 0 auto; text-align: center; }
.confirmado-icono {
    width: 4.5rem; height: 4.5rem;
    border-radius: 50%;
    background: var(--wa);
    color: #fff;
    font-size: 2.2rem;
    display: flex; align-items: center; justify-content: center;
    margin: 1.5rem auto 1rem;
}
.confirmado-wrap h1 { font-size: 1.5rem; font-weight: 800; }

/* ---------- Estado de pedidos ---------- */
.estado-pendiente { background: #fff3cd; color: #856404; }
.estado-procesando { background: #cfe2ff; color: #084298; }
.estado-entregado { background: #d1e7dd; color: #0f5132; }
.estado-cancelado { background: #f8d7da; color: #842029; }
.estado-pagado { background: #d1e7dd; color: #0f5132; }

/* ---------- Varios ---------- */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #999;
}
.empty-state i { font-size: 3rem; display: block; margin-bottom: .8rem; }

.wa-float {
    position: fixed;
    right: 1rem; bottom: 5rem;
    width: 3.4rem; height: 3.4rem;
    border-radius: 50%;
    background: var(--wa);
    color: #fff;
    font-size: 1.7rem;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 14px rgba(0,0,0,.25);
    z-index: 1030;
    text-decoration: none;
}
.wa-float:hover { color: #fff; transform: scale(1.05); }
@media (min-width: 768px) { .wa-float { bottom: 1.5rem; } }

.mobile-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--card);
    border-top: 1px solid #e5e5e5;
    display: flex;
    z-index: 1030;
}
.mobile-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: .5rem 0 .4rem;
    color: #666;
    text-decoration: none;
    font-size: .7rem;
}
.mobile-nav a i { font-size: 1.25rem; }
.mobile-nav a:hover, .mobile-nav a.active { color: var(--accent); }

.tienda-footer {
    background: var(--primary);
    color: #cfd8e3;
    font-size: .9rem;
    border-top: 4px solid var(--accent);
}
.tienda-footer a { color: var(--wa); font-weight: 600; text-decoration: none; }
.tienda-footer .text-muted { color: #8fa3b8 !important; }

/* Paginación en rojo de marca */
.page-link { color: var(--ink); }
.page-item.active .page-link {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.page-link:hover { color: var(--accent); }

#cartToast { background: var(--ink); color: #fff; border: 0; }

/* ---------- Modal previsualización ---------- */
.qv-content {
    border: 0;
    border-radius: 1.2rem;
    overflow: hidden;
}
.qv-close {
    position: absolute;
    top: .8rem; right: .8rem;
    z-index: 5;
    background: #fff;
    border-radius: 50%;
    opacity: .9;
    padding: .5rem;
}
.qv-img-wrap {
    position: relative;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 280px;
}
.qv-img-wrap img {
    width: 100%;
    height: 100%;
    max-height: 420px;
    object-fit: contain;
    padding: 1.2rem;
}
.qv-body {
    padding: 1.6rem;
    display: flex;
    flex-direction: column;
    background: var(--bg);
}
.qv-nombre { font-size: 1.3rem; font-weight: 800; margin: .2rem 0 .4rem; }
.qv-descripcion {
    font-size: .88rem;
    color: #666;
    max-height: 150px;
    overflow-y: auto;
    margin-bottom: .8rem;
}
.qv-descripcion:empty { display: none; }
.qv-precio {
    display: flex;
    align-items: baseline;
    gap: .6rem;
    margin: auto 0 .9rem;
}
.qv-precio .precio-final { font-size: 1.7rem; }
.qv-precio .precio-tachado { font-size: 1rem; }
.qv-acciones {
    display: flex;
    gap: .7rem;
    align-items: stretch;
}
.qv-acciones .qty-stepper { background: #fff; }
.qv-acciones .btn-cta { flex: 1; }

/* ---------- Detalle de producto ---------- */
.prod-detalle-img {
    position: relative;
    background: #fff;
    border: 1px solid #ececec;
    border-radius: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 320px;
}
.prod-detalle-img img {
    width: 100%;
    max-height: 480px;
    object-fit: contain;
    padding: 1.5rem;
}
.prod-detalle-img .badge-oferta { top: 1rem; left: 1rem; font-size: .85rem; }

.btn-share {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    border: 0;
    border-radius: .6rem;
    padding: .5rem .9rem;
    font-size: .85rem;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
}
.btn-share:hover { color: #fff; filter: brightness(.9); }
.btn-fb { background: #1877f2; }
.btn-tw { background: #000; }
.btn-copy { background: var(--primary); }

/* ---------- Hero promocional estilo flyer ---------- */
.promo-hero {
    position: relative;
    overflow: hidden;
    background: radial-gradient(ellipse at 80% 20%, #2b63f0 0%, var(--blue) 40%, var(--blue-dark) 100%);
    border-radius: 1.5rem;
    padding: 2.2rem 1.5rem;
    text-align: center;
    color: #fff;
    box-shadow: 0 10px 30px rgba(13,37,112,.25);
}
.promo-hero::before {
    content: '';
    position: absolute;
    top: -60px; right: -60px;
    width: 260px; height: 260px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(236,28,36,.85), rgba(236,28,36,0) 70%);
}
.promo-hero::after {
    content: '';
    position: absolute;
    bottom: -80px; left: -50px;
    width: 220px; height: 220px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,210,31,.35), rgba(255,210,31,0) 70%);
}
.promo-hero > * { position: relative; z-index: 1; }

.promo-badge {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    font-size: clamp(1.5rem, 5vw, 2.6rem);
    font-weight: 900;
    font-style: italic;
    letter-spacing: .5px;
    padding: .35rem 1.6rem;
    border-radius: .7rem;
    transform: rotate(-2deg);
    box-shadow: 0 6px 0 rgba(0,0,0,.25);
    text-transform: uppercase;
    margin-bottom: .8rem;
}
.promo-sub {
    display: inline-block;
    background: var(--yellow);
    color: var(--blue-dark);
    font-weight: 700;
    font-size: clamp(.85rem, 2.5vw, 1.05rem);
    padding: .3rem 1.1rem;
    border-radius: .4rem;
    transform: rotate(-1deg);
    margin-bottom: 1.1rem;
}
.promo-cta {
    display: inline-block;
    background: var(--yellow);
    color: var(--blue-dark);
    font-weight: 900;
    font-style: italic;
    font-size: 1.15rem;
    text-decoration: none;
    padding: .7rem 2.2rem;
    border-radius: 2rem;
    box-shadow: 0 4px 0 rgba(0,0,0,.25);
    transition: transform .15s, box-shadow .15s;
}
.promo-cta:hover {
    color: var(--blue-dark);
    background: #ffdf52;
    transform: translateY(-2px);
    box-shadow: 0 6px 0 rgba(0,0,0,.25);
}

/* ---------- Barra de beneficios (franja inferior del flyer) ---------- */
.benefits-bar {
    background: linear-gradient(90deg, var(--blue-dark), var(--blue));
    border-radius: 1.2rem;
    color: #fff;
    padding: 1rem .5rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem;
}
.benefit {
    display: flex;
    align-items: center;
    gap: .6rem;
    font-size: .9rem;
    max-width: 15rem;
}
.benefit i {
    font-size: 1.7rem;
    color: var(--yellow);
    flex: 0 0 auto;
}
.benefit strong { color: var(--yellow); font-style: italic; }
