/* ================= VARIABLES DE MARCA ================= */
:root {
    --color-primario: #0e8a35; 
    --color-secundario: #facc15; 
    --color-acento: #ea580c; 
    --color-fondo: #f8fafc;
    --color-texto: #0f172a;
    --color-gris: #64748b;
    --color-borde: #e2e8f0;
}

/* ================= RESET UNIVERSAL ================= */
* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Poppins', sans-serif; -webkit-tap-highlight-color: transparent; }
body { background-color: var(--color-fondo); color: var(--color-texto); overflow-x: hidden; padding-bottom: 80px; }
body.no-scroll { overflow: hidden; } /* 🔒 Bloquea el fondo cuando el modal se abre */

/* ================= 1. CABECERA Y DELIVERY BAR ================= */
.header-app { position: fixed; top: 0; left: 0; width: 100%; background: white; z-index: 100; box-shadow: 0 2px 10px rgba(0,0,0,0.05); }
.header-top { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px; max-width: 1200px; margin: 0 auto; }
.btn-icon { background: none; border: none; font-size: 28px; color: var(--color-texto); cursor: pointer; }
.logo-mirkos { height: 35px; font-weight: 800; color: var(--color-primario); font-size: 1.2rem; text-transform: uppercase; letter-spacing: -0.5px; }
.cart-icon-wrapper { position: relative; background: var(--color-secundario); color: #000; width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.delivery-bar { background: white; color: var(--color-primario); padding: 10px 20px; text-align: center; font-size: 0.95rem; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; border-top: 1px solid var(--color-borde); max-width: 1200px; margin: 0 auto; }

/* ================= CONTENEDOR PRINCIPAL ================= */
.main-content { margin-top: 115px; background: white; min-height: 100vh; padding-top: 15px; max-width: 1200px; margin-left: auto; margin-right: auto; }

/* ================= 2. CARRUSELES Y SCROLL HORIZONTAL ================= */
.scroll-horizontal { display: flex; overflow-x: auto; gap: 20px; padding: 0 20px 15px 20px; scroll-behavior: smooth; }
.scroll-horizontal::-webkit-scrollbar { display: none; }
.cat-tab { white-space: nowrap; font-weight: 700; font-size: 0.95rem; color: var(--color-gris); padding-bottom: 5px; cursor: pointer; text-transform: uppercase; letter-spacing: 0.5px; }
.cat-tab.active { color: var(--color-acento); border-bottom: 3px solid var(--color-acento); }
.section-title { font-size: 1.3rem; font-weight: 800; text-transform: uppercase; margin: 20px 20px 15px 20px; display: flex; justify-content: space-between; align-items: center; }

/* ================= 3. TARJETAS DE PRODUCTO ================= */
.card-producto { display: flex; flex-direction: column; background: white; min-width: 140px; }
.card-img-wrapper { width: 100%; aspect-ratio: 1/1; display: flex; align-items: center; justify-content: center; border-radius: 12px; overflow: hidden; margin-bottom: 10px; }
.card-img { width: 100%; height: 100%; object-fit: contain; }
.card-title { font-size: 0.9rem; font-weight: 800; text-transform: uppercase; line-height: 1.2; margin-bottom: 5px; color: var(--color-texto); }
.card-desc { font-size: 0.75rem; color: var(--color-gris); line-height: 1.3; margin-bottom: 10px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-price { font-size: 1.1rem; font-weight: 800; color: var(--color-texto); margin-bottom: 10px; margin-top: auto; }
.btn-agregar { background: var(--color-primario); color: white; border: none; width: 100%; padding: 8px; border-radius: 6px; font-weight: 700; font-size: 0.9rem; cursor: pointer; transition: background 0.2s;}
.btn-agregar:hover { background: #0b6b29; }

/* ================= 4. GRILLA (POR DEFECTO MOBILE: 2 COLUMNAS) ================= */
.grid-productos { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; padding: 0 20px 20px 20px; }
.grid-productos .card-producto { min-width: auto; }

/* ================= 5. ADAPTACIÓN PARA PC Y TABLETS (RESPONSIVE) ================= */
@media (min-width: 768px) {
    .grid-productos { 
        grid-template-columns: repeat(2, 1fr); 
        gap: 20px; 
    }
    
    .grid-productos .card-producto {
        display: grid !important;
        grid-template-columns: 140px 1fr !important;
        grid-template-rows: auto auto auto auto;
        grid-template-areas:
            "img title"
            "img desc"
            "img price"
            "img btn";
        gap: 4px 15px;
        align-items: start;
        padding: 10px; /* Le da un respiro como Rokys */
        border: 1px solid var(--color-borde);
        border-radius: 16px;
    }
    
    .grid-productos .card-img-wrapper { grid-area: img; margin-bottom: 0; width: 140px; height: 140px; }
    .grid-productos .card-title { grid-area: title; margin-bottom: 0; font-size: 1.05rem; padding-top: 5px; }
    .grid-productos .card-desc { grid-area: desc; margin-bottom: 0; -webkit-line-clamp: 2; }
    .grid-productos .card-price { grid-area: price; margin-bottom: 0; font-size: 1.2rem; }
    .grid-productos .btn-agregar { grid-area: btn; width: max-content; padding: 6px 20px; align-self: start; }
}

@media (min-width: 1024px) {
    /* 3 columnas exactas para PC */
    .grid-productos { 
        grid-template-columns: repeat(3, 1fr); 
        gap: 25px; 
        padding-left: 0; 
        padding-right: 0; 
    }
    .scroll-horizontal { padding-left: 0; padding-right: 0; gap: 30px; }
    .section-title { margin-left: 0; margin-right: 0; }
    .scroll-horizontal .card-producto { width: 180px !important; } 
}

/* ================= 6. BOTTOM SHEET (MODAL CORREGIDO) ================= */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(15, 23, 42, 0.6); z-index: 1000; display: none; align-items: flex-end; opacity: 0; transition: opacity 0.3s ease; }

.bottom-sheet { background: white; width: 100%; height: 92vh; border-radius: 24px 24px 0 0; transform: translateY(100%); transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); position: relative; display: flex; flex-direction: column; max-width: 600px; margin: 0 auto; }
.bottom-sheet.show { transform: translateY(0); }
.btn-cerrar-modal { position: absolute; top: 15px; right: 15px; background: white; border: none; border-radius: 50%; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 10px rgba(0,0,0,0.15); cursor: pointer; z-index: 10; color: var(--color-gris); }

.modal-img-wrapper { width: 100%; height: 220px; background: #f1f5f9; display: flex; align-items: center; justify-content: center; flex-shrink: 0; border-radius: 24px 24px 0 0;}
.modal-img-wrapper img { width: 100%; height: 100%; object-fit: contain; padding: 20px; }

.modal-body { padding: 20px; flex: 1; overflow-y: auto; padding-bottom: 90px; } 
.modal-title { font-size: 1.4rem; font-weight: 800; margin-bottom: 8px; line-height: 1.2; }
.modal-desc { font-size: 0.9rem; color: var(--color-gris); line-height: 1.5; margin-bottom: 20px; }

.modal-sticky-footer { position: absolute; bottom: 0; left: 0; width: 100%; background: white; padding: 15px 20px; box-shadow: 0 -4px 15px rgba(0,0,0,0.05); display: flex; gap: 15px; align-items: center; z-index: 20; border-radius: 0; }
.control-cantidad { display: flex; align-items: center; gap: 15px; background: var(--color-fondo); border-radius: 12px; padding: 8px 15px; }
.btn-qty { background: none; border: none; font-size: 20px; font-weight: bold; color: var(--color-primario); cursor: pointer; }
.qty-numero { font-weight: 800; font-size: 1.1rem; }
.btn-agregar-final { flex: 1; background: var(--color-primario); color: white; border: none; padding: 14px; border-radius: 12px; font-weight: 700; font-size: 1rem; cursor: pointer; display: flex; justify-content: space-between; transition: background 0.2s; }
.btn-agregar-final:hover { background: #0b6b29; }

/* ================= 6. BOTTOM SHEET (MODAL CORREGIDO) ================= */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(15, 23, 42, 0.6); z-index: 1000; display: none; align-items: flex-end; opacity: 0; transition: opacity 0.3s ease; }

.bottom-sheet {
    background: white; width: 100%; 
    height: 92vh; /* 📏 Alto Fijo: 92% de la pantalla (deja un espacio arriba) */
    border-radius: 24px 24px 0 0; 
    transform: translateY(100%); transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
    position: relative;
    display: flex; flex-direction: column; /* Estructura interna para contener el scroll */
    max-width: 600px; margin: 0 auto; /* Centrado si lo abren en PC */
}

.bottom-sheet.show { transform: translateY(0); }
.btn-cerrar-modal { position: absolute; top: 15px; right: 15px; background: white; border: none; border-radius: 50%; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 10px rgba(0,0,0,0.15); cursor: pointer; z-index: 10; color: var(--color-gris); }

.modal-img-wrapper { width: 100%; height: 220px; background: #f1f5f9; display: flex; align-items: center; justify-content: center; flex-shrink: 0; border-radius: 24px 24px 0 0;}
.modal-img-wrapper img { width: 100%; height: 100%; object-fit: contain; padding: 20px; }

/* 📏 El cuerpo ahora tiene scroll independiente */
.modal-body { padding: 20px; flex: 1; overflow-y: auto; padding-bottom: 90px; } 

.modal-title { font-size: 1.4rem; font-weight: 800; margin-bottom: 8px; line-height: 1.2; }
.modal-desc { font-size: 0.9rem; color: var(--color-gris); line-height: 1.5; margin-bottom: 20px; }

/* Footer Fijo pero relativo al modal */
.modal-sticky-footer { position: absolute; bottom: 0; left: 0; width: 100%; background: white; padding: 15px 20px; box-shadow: 0 -4px 15px rgba(0,0,0,0.05); display: flex; gap: 15px; align-items: center; z-index: 20; border-radius: 0 0 0 0;}
.control-cantidad { display: flex; align-items: center; gap: 15px; background: var(--color-fondo); border-radius: 12px; padding: 8px 15px; }
.btn-qty { background: none; border: none; font-size: 20px; font-weight: bold; color: var(--color-primario); cursor: pointer; }
.qty-numero { font-weight: 800; font-size: 1.1rem; }
.btn-agregar-final { flex: 1; background: var(--color-primario); color: white; border: none; padding: 14px; border-radius: 12px; font-weight: 700; font-size: 1rem; cursor: pointer; display: flex; justify-content: space-between; transition: background 0.2s; }
.btn-agregar-final:hover { background: #0b6b29; }

/* ================= 7. CARRITO (SIDEBAR) ================= */
.cart-sidebar {
    position: fixed; top: 0; right: -500px; /* 🔧 Ajuste perfecto para PC */
    width: 100%; max-width: 400px; height: 100vh;
    background: white; z-index: 1001; transition: right 0.3s cubic-bezier(0.175, 0.885, 0.32, 1);
    display: flex; flex-direction: column; box-shadow: -5px 0 25px rgba(0,0,0,0.15);
}
.cart-sidebar.show { right: 0; }

.cart-header { padding: 20px; border-bottom: 1px solid var(--color-borde); display: flex; justify-content: space-between; align-items: center; }
.cart-header h2 { font-size: 1.2rem; font-weight: 800; }

.cart-body { flex: 1; overflow-y: auto; padding: 20px; }
.cart-footer { padding: 20px; border-top: 1px solid var(--color-borde); background: var(--color-fondo); }

/* Diseño de cada producto en la lista */
.cart-item { display: flex; gap: 15px; margin-bottom: 15px; padding-bottom: 15px; border-bottom: 1px solid var(--color-borde); }
.cart-item-img { width: 70px; height: 70px; border-radius: 12px; object-fit: contain; background: #f1f5f9; padding: 5px; }
.cart-item-info { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.cart-item-title { font-weight: 700; font-size: 0.95rem; line-height: 1.2; margin-bottom: 4px; color: var(--color-texto); }
.cart-item-sub { font-size: 0.8rem; color: var(--color-gris); margin-bottom: 4px; }
.cart-item-price { font-weight: 800; color: var(--color-primario); font-size: 1rem; }
.btn-eliminar { background: none; border: none; color: #ef4444; cursor: pointer; display: flex; align-items: center; padding: 5px; border-radius: 6px; transition: background 0.2s; }
.btn-eliminar:hover { background: #fee2e2; }