/* ==========================================================================
VARIABLES Y CONFIGURACIÓN BASE
========================================================================== */
:root {
--bg-main: #0b0b0d;
--bg-card: #141417;
--bg-card-hover: #1c1c21;
--primary: #e61e25; /* Rojo Donde Nacho */
--primary-glow: rgba(230, 30, 37, 0.15);
--accent: #ff9f0a; /* Dorado Premium */
--text-main: #ffffff;
--text-muted: #9898a0;
--border-color: rgba(255, 255, 255, 0.06);
--radius-lg: 24px;
--radius-md: 16px;
--radius-sm: 12px;
--font-sans: 'Plus Jakarta Sans', sans-serif;
}

* {
box-sizing: border-box;
margin: 0;
padding: 0;
font-family: var(--font-sans);
-webkit-tap-highlight-color: transparent;
}

html, body {
background-color: var(--bg-main);
color: var(--text-main);
max-width: 100%;
overflow-x: hidden;
width: 100%;
}

body {
padding-bottom: 90px;
}

.checkered-banner {
height: 10px;
background-image: linear-gradient(45deg, #000 25%, transparent 25%), 
                    linear-gradient(-45deg, #000 25%, transparent 25%), 
                    linear-gradient(45deg, transparent 75%, #000 75%), 
                    linear-gradient(-45deg, transparent 75%, #000 75%);
background-size: 14px 14px;
background-position: 0 0, 0 7px, 7px -7px, -7px 0px;
background-color: #fff;
width: 100%;
}

/* ==========================================================================
CONTENEDOR GLOBAL (SOLUCIÓN AL PROBLEMA DEL 50% DE ZOOM)
========================================================================== */
.app-container {
width: 100%;
padding: 16px;
display: flex;
flex-direction: column;
gap: 20px;
}

/* ==========================================================================
CABECERA COMPONENTE
========================================================================== */
.main-header {
display: flex;
justify-content: space-between;
align-items: center;
width: 100%;
gap: 10px;
}

.brand-wrapper {
display: flex;
align-items: center;
gap: 12px;
}

.brand-logo-fallback {
width: 44px;
height: 44px;
background: var(--primary);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-weight: 800;
font-size: 16px;
box-shadow: 0 0 15px var(--primary-glow);
border: 2px solid #fff;
overflow: hidden;
}

.brand-logo-fallback img {
width: 100%;
height: 100%;
object-fit: cover;
}

.brand-info h1 {
font-size: 18px;
font-weight: 800;
letter-spacing: -0.5px;
}

.brand-info p {
font-size: 11px;
color: var(--primary);
font-weight: 600;
}

.icon-btn {
width: 44px;
height: 44px;
border-radius: var(--radius-sm);
background: var(--bg-card);
border: 1px solid var(--border-color);
color: var(--text-main);
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
position: relative;
transition: background 0.2s;
}

.icon-btn:hover {
background: var(--bg-card-hover);
}

.badge {
position: absolute;
top: -5px;
right: -5px;
background: var(--primary);
color: #fff;
font-size: 11px;
font-weight: 700;
padding: 2px 6px;
border-radius: 10px;
border: 2px solid var(--bg-main);
}

/* ==========================================================================
SECCIÓN RECOMENDADOS (AUTO-SCROLL)
========================================================================== */
.promotions-section {
width: 100%;
overflow: hidden;
}

.promotions-scroll {
display: flex;
gap: 16px;
overflow-x: auto;
padding: 6px 0 14px 0;
scroll-behavior: smooth;
-webkit-overflow-scrolling: touch;
scrollbar-width: none;
}

.promotions-scroll::-webkit-scrollbar {
display: none;
}

.promo-banner {
background: linear-gradient(135deg, #1c1112 0%, #0f0a0a 100%);
border-radius: var(--radius-lg);
padding: 20px;
border: 1px solid rgba(230, 30, 37, 0.15);
display: flex;
justify-content: space-between;
align-items: center;
gap: 15px;
position: relative;
overflow: hidden;
min-width: 290px;
flex: 1 0 290px;
}

.promo-content {
flex: 1;
}

.promo-tag {
background: rgba(230, 30, 37, 0.1);
color: var(--primary);
padding: 4px 10px;
border-radius: 20px;
font-size: 11px;
font-weight: 700;
display: inline-block;
margin-bottom: 8px;
}

.promo-content h2 {
font-size: 18px;
font-weight: 800;
line-height: 1.2;
margin-bottom: 4px;
}

.promo-content p {
font-size: 12px;
color: var(--text-muted);
line-height: 1.4;
margin-bottom: 12px;
}

.promo-graphic {
font-size: 50px;
filter: drop-shadow(0 8px 10px rgba(0,0,0,0.4));
}

/* ==========================================================================
CATEGORÍAS HORIZONTALES
========================================================================== */
.categories-container {
width: 100%;
overflow: hidden;
}

.categories-scroll {
display: flex;
gap: 8px;
overflow-x: auto;
padding: 4px 0 12px 0;
scrollbar-width: none;
}

.categories-scroll::-webkit-scrollbar {
display: none;
}

.category-pill {
padding: 10px 18px;
background: var(--bg-card);
border: 1px solid var(--border-color);
border-radius: 30px;
color: var(--text-muted);
font-weight: 600;
font-size: 13px;
white-space: nowrap;
cursor: pointer;
transition: all 0.2s ease;
}

.category-pill.active {
background: var(--text-main);
color: var(--bg-main);
border-color: var(--text-main);
font-weight: 700;
}

/* ==========================================================================
GRID DE PRODUCTOS
========================================================================== */
.section-title {
font-size: 18px;
font-weight: 800;
display: flex;
align-items: center;
gap: 8px;
}

.section-title span {
color: var(--accent);
font-size: 12px;
background: rgba(255, 159, 10, 0.1);
padding: 2px 8px;
border-radius: 6px;
}

.products-grid {
display: grid;
grid-template-columns: 1fr; 
gap: 16px;
width: 100%;
}

.product-card {
background: var(--bg-card);
border: 1px solid var(--border-color);
border-radius: var(--radius-lg);
padding: 16px;
display: flex;
flex-direction: column;
cursor: pointer;
transition: transform 0.2s, background 0.2s;
}

.product-card:active {
transform: scale(0.98);
}

.card-top {
position: relative;
display: flex;
justify-content: center;
padding: 15px 0;
margin-bottom: 12px;
}

.card-badge {
position: absolute;
top: 0;
left: 0;
background: var(--accent);
color: #000;
font-size: 9px;
font-weight: 800;
padding: 3px 8px;
border-radius: 20px;
}

.product-image-emulated {
font-size: 60px;
filter: drop-shadow(0 8px 10px rgba(0,0,0,0.3));
}

.product-info h3 {
font-size: 16px;
font-weight: 700;
margin-bottom: 4px;
}

.product-desc {
font-size: 12px;
color: var(--text-muted);
line-height: 1.4;
margin-bottom: 15px;
min-height: 34px;
}

.card-bottom {
display: flex;
justify-content: space-between;
align-items: center;
margin-top: auto;
}

.price-value {
font-size: 18px;
font-weight: 800;
}

.add-btn {
width: 36px;
height: 36px;
border-radius: 50%;
background: var(--text-main);
color: var(--bg-main);
border: none;
font-size: 16px;
font-weight: 700;
cursor: pointer;
}

/* ==========================================================================
SISTEMA DE CARRITO DE COMPRAS (MODAL EN MÓVIL / SIDEBAR EN PC)
========================================================================== */
.cart-overlay {
position: fixed;
inset: 0;
background: rgba(0, 0, 0, 0.75);
backdrop-filter: blur(6px);
-webkit-backdrop-filter: blur(6px);
z-index: 2400;
opacity: 0;
pointer-events: none;
transition: opacity 0.3s ease;
}

.cart-overlay.active {
opacity: 1;
pointer-events: auto;
}

.cart-panel {
background: var(--bg-card);
border: 1px solid var(--border-color);
border-radius: var(--radius-lg);
padding: 20px;
display: flex;
flex-direction: column;
width: 100%;
}

.cart-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 15px;
border-bottom: 1px solid var(--border-color);
padding-bottom: 12px;
}

.close-cart-btn {
display: none;
}

.cart-items {
flex: 1;
max-height: 40vh;
overflow-y: auto;
margin-bottom: 10px;
}

.cart-item {
display: flex;
align-items: center;
justify-content: space-between;
padding: 12px 0;
border-bottom: 1px solid rgba(255,255,255,0.03);
}

.cart-item-info h4 { font-size: 14px; font-weight: 600; }
.cart-item-info p { font-size: 12px; color: var(--accent); font-weight: 700; }

.cart-item-qty {
display: flex;
align-items: center;
gap: 10px;
background: rgba(255,255,255,0.04);
padding: 4px 10px;
border-radius: 20px;
}

.qty-btn {
background: none;
border: none;
color: #fff;
font-weight: 700;
font-size: 14px;
width: 20px;
height: 20px;
cursor: pointer;
}

/* SUGERIDOS */
.cart-suggestions-section {
border-top: 1px solid var(--border-color);
padding-top: 14px;
margin-bottom: 15px;
}

.cart-suggestions-scroll {
display: flex;
gap: 10px;
overflow-x: auto;
padding: 4px 0 8px 0;
scrollbar-width: none;
}

.cart-suggestions-scroll::-webkit-scrollbar {
display: none;
}

.suggested-mini-item {
background: rgba(255, 255, 255, 0.03);
border: 1px solid var(--border-color);
border-radius: var(--radius-sm);
padding: 8px 12px;
display: flex;
align-items: center;
gap: 10px;
min-width: 175px;
}

.suggested-mini-info h5 {
font-size: 12px;
font-weight: 700;
max-width: 95px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}

.suggested-mini-info p {
font-size: 11px;
color: var(--accent);
font-weight: 600;
}

.cart-summary {
background: rgba(255,255,255,0.02);
border-radius: var(--radius-md);
padding: 12px;
margin-bottom: 15px;
}

.summary-row {
display: flex;
justify-content: space-between;
margin-bottom: 8px;
font-size: 13px;
color: var(--text-muted);
}

.summary-row.total {
margin-bottom: 0;
padding-top: 8px;
border-top: 1px dashed var(--border-color);
color: #fff;
font-weight: 800;
font-size: 16px;
}

.tasa-bcv {
font-size: 10px;
color: var(--text-muted);
text-align: center;
margin-top: 6px;
}

.checkout-btn {
background: var(--primary);
color: #fff;
border: none;
border-radius: var(--radius-md);
padding: 14px;
font-weight: 700;
font-size: 14px;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
gap: 8px;
width: 100%;
}

/* MODALES GENERALES */
.modal-overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0,0,0,0.8);
backdrop-filter: blur(6px);
z-index: 2000;
display: flex;
align-items: flex-end; 
justify-content: center;
opacity: 0;
pointer-events: none;
transition: opacity 0.25s ease;
}

.modal-overlay.active {
opacity: 1;
pointer-events: auto;
}

.modal-box {
background: var(--bg-card);
border: 1px solid var(--border-color);
width: 100%;
max-width: 500px;
border-radius: 24px 24px 0 0; 
padding: 20px;
position: relative;
transform: translateY(100%);
transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
max-height: 85vh;
overflow-y: auto;
}

.modal-overlay.active .modal-box {
transform: translateY(0);
}

.close-modal {
position: absolute;
top: 15px;
right: 15px;
background: rgba(255,255,255,0.05);
border: none;
color: #fff;
width: 32px;
height: 32px;
border-radius: 50%;
font-weight: 700;
}

.modal-hero { text-align: center; margin-bottom: 15px; }
.modal-hero-img { font-size: 70px; margin-bottom: 5px; }
.modal-hero h2 { font-size: 20px; font-weight: 800; }
.modal-hero p { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.custom-section { margin-bottom: 15px; }
.custom-section h4 { font-size: 12px; text-transform: uppercase; color: var(--accent); margin-bottom: 8px; font-weight: 700; }

.option-item {
display: flex;
align-items: center;
justify-content: space-between;
background: rgba(255,255,255,0.02);
padding: 10px 14px;
border-radius: var(--radius-sm);
border: 1px solid var(--border-color);
margin-bottom: 6px;
}

.option-label { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.option-item input { width: 16px; height: 16px; accent-color: var(--primary); }
.option-price { font-size: 12px; font-weight: 700; color: var(--text-muted); }

/* NAVEGACIÓN INFERIOR (MÓVIL) */
.mobile-nav {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
height: 68px;
background: rgba(20, 20, 23, 0.9);
backdrop-filter: blur(20px);
border-top: 1px solid var(--border-color);
z-index: 500;
display: flex;
justify-content: space-around;
align-items: center;
padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
display: flex;
flex-direction: column;
align-items: center;
color: var(--text-muted);
font-size: 10px;
font-weight: 600;
cursor: pointer;
text-decoration: none;
}

.nav-item.active { color: var(--primary); }
.nav-item-icon { font-size: 18px; margin-bottom: 2px; }

/* RUTEO SEDES */
.branch-overlay {
position: fixed;
inset: 0;
background: rgba(7, 9, 15, 0.97);
backdrop-filter: blur(20px);
-webkit-backdrop-filter: blur(20px);
z-index: 9999; 
display: flex;
align-items: center;
justify-content: center;
transition: opacity 0.5s ease, visibility 0.5s ease;
}

.branch-overlay.hidden {
opacity: 0;
visibility: hidden;
pointer-events: none;
}

.branch-card {
background: linear-gradient(185deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.01) 100%);
border: 1px solid rgba(255, 255, 255, 0.08);
padding: 40px 30px;
border-radius: 32px;
max-width: 450px;
width: 90%;
text-align: center;
}

.branch-card h2 { font-size: 26px; margin-bottom: 12px; font-weight: 800; }
.branch-card .brand-highlight { color: var(--primary); }
.branch-card p { color: var(--text-muted); font-size: 14px; margin-bottom: 30px; }

.branch-options { display: flex; flex-direction: column; gap: 14px; }
.branch-btn {
background: rgba(255, 255, 255, 0.03);
border: 1px solid rgba(255, 255, 255, 0.08);
color: #fff;
padding: 16px 24px;
border-radius: 16px;
font-size: 15px;
font-weight: 700;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
gap: 10px;
transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.branch-btn:hover {
background: var(--primary);
border-color: var(--primary);
transform: translateY(-2px);
box-shadow: 0 8px 24px rgba(230, 30, 37, 0.3);
}

.active-branch-chip {
display: inline-flex;
align-items: center;
gap: 8px;
background: rgba(255, 255, 255, 0.04);
border: 1px solid var(--border-color);
padding: 6px 14px;
border-radius: 100px;
font-size: 11px;
font-weight: 700;
margin-top: 15px;
}

.pulse-dot {
width: 7px;
height: 7px;
background-color: #10b981; 
border-radius: 50%;
animation: microPulse 2s infinite;
}

.change-branch-link {
background: none;
border: none;
color: var(--primary);
cursor: pointer;
font-size: 11px;
text-decoration: underline;
margin-left: 4px;
font-weight: 700;
}

@keyframes microPulse {
0% { transform: scale(0.9); opacity: 0.6; }
50% { transform: scale(1.1); opacity: 1; }
100% { transform: scale(0.9); opacity: 0.6; }
}

.product-price-box {
display: flex;
flex-direction: column;
gap: 2px;
margin: 8px 0;
}

.price-usd { font-size: 20px; font-weight: 800; }
.price-bs { font-size: 13px; color: var(--text-muted); }

.toast-notification {
position: fixed;
top: 20px;
left: 50%;
transform: translateX(-50%) translateY(-100px);
background: rgba(20, 20, 23, 0.95);
border: 1px solid var(--primary);
box-shadow: 0 15px 30px rgba(230, 30, 37, 0.25);
color: #fff;
padding: 12px 24px;
border-radius: 30px;
font-size: 14px;
font-weight: 700;
z-index: 10000;
display: flex;
align-items: center;
gap: 8px;
transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s;
opacity: 0;
pointer-events: none;
}

.toast-notification.show {
transform: translateX(-50%) translateY(0);
opacity: 1;
}

.modal-brand-header { width: 100%; display: flex; justify-content: center; margin-bottom: 20px; }
.modal-logo { max-width: 130px; height: auto; }

/* ==========================================================================
   SISTEMA DE FORMULARIOS Y RESUMEN (CHECKOUT & SUMMARY SYNC)
   ========================================================================== */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
    width: 100%;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    width: 100%;
}

.form-label {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--accent);
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-left: 4px;
}

/* Reemplaza y estiliza todos los controles del Checkout */
#checkout-modal input.custom-input,
#checkout-modal select.custom-select,
#checkout-modal textarea.custom-textarea {
    width: 100% !important;
    padding: 12px 16px !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-sm) !important;
    color: #ffffff !important;
    font-family: var(--font-sans) !important;
    font-size: 14px !important;
    transition: all 0.2s ease !important;
}

#checkout-modal input.custom-input:focus,
#checkout-modal select.custom-select:focus,
#checkout-modal textarea.custom-textarea:focus {
    outline: none !important;
    border-color: var(--primary) !important;
    background: rgba(255, 255, 255, 0.06) !important;
    box-shadow: 0 0 12px var(--primary-glow) !important;
}

#checkout-modal select.custom-select option {
    background: var(--bg-card);
    color: #fff;
}

/* Estilos de Sincronización para el Modal de Resumen Final */
.summary-order-header {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px dashed var(--border-color);
}

.summary-order-header h2 {
    font-size: 20px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.5px;
}

.summary-details-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.summary-item-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.summary-item-row:last-child {
    border-bottom: none;
}

.summary-item-info h4 {
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    margin: 0;
}

@media (min-width: 480px) {
    .promo-banner {
        min-width: 360px;
        flex: 1 0 360px;
    }
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
}

@media (min-width: 500px) {
    .modal-overlay { align-items: center; }
    .modal-box { border-radius: var(--radius-lg); }
}

@media (max-width: 1023px) {
    .cart-panel {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 80vh;
        z-index: 2500;
        border-radius: 24px 24px 0 0;
        border-bottom: none;
        box-shadow: 0 -10px 40px rgba(0,0,0,0.6);
        transform: translateY(100%);
        visibility: hidden;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.3s;
    }

    .cart-panel.active {
        transform: translateY(0);
        visibility: visible;
    }

    .close-cart-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        background: rgba(255, 255, 255, 0.05);
        border: none;
        color: #fff;
        width: 36px;
        height: 36px;
        border-radius: 50%;
        font-size: 18px;
        cursor: pointer;
    }
}

@media (min-width: 1024px) {
    .cart-panel {
        position: sticky;
        top: 30px;
        height: fit-content;
    }
    .close-cart-btn {
        display: none; /* Oculto en el diseño estático de PC */
        background: none;
        border: none;
        color: var(--text-muted, #8a8a93);
        font-size: 24px;
        cursor: pointer;
        padding: 4px 8px;
        line-height: 1;
        transition: color 0.2s ease;
    }
    .close-cart-btn:hover {
        color: var(--primary, #e61e25); /* Cambia a rojo al pasar el mouse */
    }

    /* ¡Aquí está el truco! Si el carrito se convierte en modal en PC, mostramos la X */
    #cart-panel-element.cart-as-modal .close-cart-btn {
        display: block !important;
    }

    #cart-panel-element.cart-as-modal {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%) scale(0.9);
        width: 450px; /* Ancho fijo para que parezca una ventana de PC */
        height: 80vh; /* Alto máximo */
        max-height: 650px;
        border-radius: var(--radius-md, 16px);
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
        border: 1px solid var(--border-color, rgba(255,255,255,0.1));
        right: auto; /* Desactivamos el comportamiento lateral */
        bottom: auto;
        opacity: 0;
        transition: transform 0.3s ease, opacity 0.3s ease;
        z-index: 2500;
    }

    /* Animación de entrada cuando se activa */
    #cart-panel-element.cart-as-modal.active {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }

    body {
        padding-bottom: 30px;
    }

    .app-container {
        display: grid;
        grid-template-columns: 1fr 380px;
        max-width: 1300px;
        margin: 0 auto;
        padding: 40px 24px;
        gap: 30px;
    }

    /* Evita que el carrusel empuje el grid horizontalmente al 100% de zoom */
    main {
        min-width: 0; 
    }
    .product-card:hover {
        transform: translateY(-4px);
        background: var(--bg-card-hover);
    }
    .mobile-nav { display: none; }
}