/* =========================
    VARIABLES
========================= */
:root {
    --font-main: sans-serif;
    --color-primary: #f8c11b;
    --color-primary-dark: #d9a30f;
    --color-accent: #e74c3c;
    --color-accent-dark: #c0392b;
    --color-text: #333;
    --color-muted: #666;
    --color-bg: #f9f9f9;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 8px rgba(0,0,0,0.15);
    --shadow-lg: 0 6px 20px rgba(0,0,0,0.2);
}

/* =========================
    RESET & BASE
========================= */
html, body {
    margin: 0;
    padding: 0;
    font-family: var(--font-main);
    scroll-behavior: smooth;
    overflow-x: hidden;
    background-color: #F8F9FA; /* Nuevo color de fondo */
}

/* ✅ Fuente optimizada para rendimiento y legibilidad */
body {
    font-family: 'Open Sans', sans-serif;
    font-display: swap;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Utilitarios */
.text-center { text-align: center; }
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.hover-lift:hover { transform: translateY(-2px); }

/* =========================
    TYPOGRAPHY
========================= */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-main);
    font-weight: 700;
    color: var(--color-text);
    line-height: 1.3;
    margin: 0 0 1rem 0;
}

h1 {
    color: white;
}

h2 {
    font-family: var(--font-main) !important; /* Forzando la fuente */
    color: #4D2A13 !important;
}

h2 {
    font-size: 2rem; /* 32px */
    margin-bottom: 1.5rem;
    position: relative;
    padding-bottom: 0.5rem;
}

h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60px;
    height: 3px;
    background-color: var(--color-primary);
}

/* Si necesitas estilos específicos para h2 en ciertas secciones */
.section-title {
    text-align: center;
    margin-bottom: 2.5rem;
}

.section-title::after {
    left: 50%;
    transform: translateX(-50%);
}

/* =========================
    HERO SECTION
========================= */
.hero {
    position: relative;
    min-height: 100vh;
    background: url('../img/bg/bg.jpg') no-repeat center center/cover;
    background-size: cover;
    background-position: center;
    background-attachment: scroll; /* evita saltos en móviles */
    will-change: opacity;
    contain: layout paint style; /* mejora estabilidad visual */
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: white;
    overflow: hidden;
}
.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(rgba(0,0,0,0.8), rgba(0,0,0,0.8));
    z-index: 1;
}
.hero-content {
    text-align: center;
    position: relative;
    z-index: 2;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    animation: fadeIn 2s ease-in-out;
}
.hero-logo {
    margin-bottom: 25px;
    animation: fadeInDown 1.5s ease-in-out;
    max-width: 230px;
    width: 100%;
}
.hero h1 {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: clamp(1.6rem, 4vw, 3.8rem);
    margin: 0 0 20px;
    line-height: 1.2;
    animation: fadeInUp 2s ease-in-out;
    text-shadow: 2px 2px 15px rgba(0,0,0,0.8);
}
.hero h1 span { color: var(--color-primary); }
.hero .description {
    font-size: clamp(0.9rem, 2vw, 1.3rem);
    margin: 0 auto 30px;
    line-height: 1.6;
    animation: fadeIn 2.5s ease-in-out;
    color: #f1f1f1;
    max-width: 90%;
}
.hero-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    animation: scaleIn 3s ease-in-out;
}

/* =========================
    BOTONES
========================= */
.btn, .add-to-cart {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 30px;
    border-radius: 50px;
    font-weight: 600;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    font-size: 0.9rem;
    cursor: pointer;
    border: 2px solid transparent;
}

.btn { color: white; }

/* Botón Hero */
.btn-primary {
    background-color: var(--color-primary);
    color: #222;
    box-shadow: 0 4px 15px rgba(248, 193, 27, 0.3);
    animation: pulse 2s infinite;
}
.btn-primary:hover {
    background-color: var(--color-primary-dark);
    box-shadow: 0 6px 20px rgba(248, 193, 27, 0.4);
    animation-play-state: paused;
}
.btn-outline {
    background-color: transparent;
    border: 2px solid white;
    box-shadow: 0 4px 15px rgba(255,255,255,0.2);
}
.btn-outline:hover {
    background-color: rgba(255,255,255,0.1);
    box-shadow: 0 6px 20px rgba(255,255,255,0.3);
}

/* Botón Menu */
.add-to-cart {
    border-radius: 5px;
    background-color: var(--color-primary);
    color: #4D2A12;
    margin-top: 10px;
    font-size: 0.95rem;
    width: 100%;
    max-width: 220px;
}
.add-to-cart i { margin-right: 8px; font-size: 1rem; }
.add-to-cart:hover { background-color: var(--color-primary-dark); }
.add-to-cart.red {
    background-color: var(--color-accent);
    color: white;
    gap: 8px;
    box-shadow: var(--shadow-sm);
}
.add-to-cart.red:hover {
    background-color: var(--color-accent-dark);
    box-shadow: var(--shadow-md);
}

/* =========================
    MENU SECTION
========================= */
.menu-section {
    padding: 20px 0;
    background-color: var(--color-bg);
}
.section-title {
    text-align: center;
    font-size: 2.5rem;
    color: var(--color-text);
    margin-bottom: 50px;
    position: relative;
    padding-bottom: 15px;
}
.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 3px;
    background-color: var(--color-primary);
}

/* Grid general */
.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
    padding: 0 10px;
}
.menu-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
}
.menu-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-md);
}
.card-image {
    width: 100%;
    height: 200px;
    overflow: hidden;
}
.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}
.menu-card:hover .card-image img { transform: scale(1.05); }
.card-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    padding: 12px 15px 8px;
}
.card-content h3 {
    font-size: 1.3rem;
    margin: 0 0 5px;
    color: var(--color-text);
    text-align: center;
}
.card-content .description {
    font-size: 0.85rem;
    color: var(--color-muted);
    margin: 0 0 8px;
    line-height: 1.3;
    text-align: center;
}
.card-content .price {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--color-accent);
    margin: 8px 0;
    text-align: center;
}
.card-content .add-to-cart {
    margin-top: auto;
    align-self: flex-end;
}

/* =========================
    EMPANADAS & POSTRES
========================= */
.menu-section.empanadas-postres:has(.two-column-grid) .two-column-grid {
    display: flex;
    flex-direction: column;
    gap: 30px;
    margin-top: 20px;
}
.menu-section.empanadas-postres .menu-category {
    background: transparent;
    border-radius: 10px;
    padding: 15px 0;
    box-shadow: none;
    width: 100%;
}
.menu-section.empanadas-postres .category-title {
    text-align: center;
    color: #4D2A12;
    font-size: 1.8rem;
    margin: 20px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--color-primary);
    position: relative;
    font-family: 'Playfair Display', serif;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.menu-section.empanadas-postres .menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 20px;
}
.menu-section.empanadas-postres .menu-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
}
@media (max-width: 768px) {
    .menu-section.empanadas-postres .menu-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 15px;
    }
}

/* =========================
    ANIMACIONES
========================= */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeInDown { from { opacity: 0; transform: translateY(-40px); } to { opacity: 1; transform: translateY(0); } }
@keyframes scaleIn { from { transform: scale(0.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes pulse { 0%,100% { transform: scale(1);} 50% { transform: scale(1.05);} }

/* =========================
    RESPONSIVE
========================= */
@media (max-width: 992px) {
    .hero { padding: 20px 15px; }
}
@media (max-width: 768px) {
    .hero { background-attachment: scroll; padding: 15px 10px; }
    .hero-buttons { flex-direction: column; gap: 12px; max-width: 280px; margin: 0 auto; }
    .btn, .add-to-cart { width: 100%; padding: 12px 20px; font-size: 0.9rem; }
    .menu-grid { grid-template-columns: repeat(2, 1fr); gap: 15px; }
    .card-content h3 { font-size: 1.1rem; }
    .card-content .price { font-size: 1rem; }
    .section-title { font-size: 2rem; }
}
@media (max-width: 576px) {
    .hero { padding: 10px; }
    .hero-logo { margin-bottom: 20px; }
    .btn, .add-to-cart { padding: 10px 15px; font-size: 0.85rem; }
    .menu-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; padding: 0 5px; }
    .card-content { padding: 10px; }
    .section-title { font-size: 1.8rem; margin-bottom: 30px; }
}
@media (max-width: 400px) {
    .btn, .add-to-cart { padding: 8px 12px; font-size: 0.8rem; }
}

/* Primero, corregir la regla que desactiva las animaciones */
.btn:not(.btn-primary), 
.btn-ver-menu,
button:not(.whatsapp-float):not(.btn-primary) {
    animation: none !important;
    box-shadow: none !important;
}

/* Luego, asegurarnos de que el botón Ver Menú tenga prioridad */
.hero .btn-primary {
    animation: menuPulse 2s infinite !important;
    background-color: var(--color-primary);
    color: #fff;
    border: none;
    padding: 12px 25px;
    border-radius: 5px;
    font-weight: 600;
    text-transform: uppercase;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    z-index: 1;
}

/* Asegurar que la animación funcione en hover */
.hero .btn-primary:hover {
    animation: menuPulse 2s infinite !important;
    transform: translateY(-2px);
    background-color: var(--color-primary-dark);
}

/* Mover la definición de @keyframes al inicio del archivo o antes de su uso */
@keyframes menuPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(248, 193, 27, 0.7);
    }
    70% {
        box-shadow: 0 0 0 15px rgba(248, 193, 27, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(248, 193, 27, 0);
    }
}

/* Estilos para móviles - Mejora de opciones de entrega */
@media (max-width: 768px) {
    /* Contenedor principal */
    .opciones-entrega {
        display: flex;
        flex-direction: column;
        gap: 12px;
        margin: 15px 0;
        padding: 0 10px;
    }

    /* Cada opción de entrega */
    .opcion-entrega {
        display: flex;
        flex-direction: column;
        background: #fff;
        border-radius: 8px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.05);
        padding: 12px 15px;
        border: 1px solid #e2e8f0;
    }

    /* Estilo para las etiquetas */
    .opcion-entrega label {
        display: flex;
        align-items: center;
        font-weight: 500;
        color: #2d3748;
        cursor: pointer;
        margin: 0;
        padding: 5px 0;
    }

    /* Estilo para los radio buttons */
    .opcion-entrega input[type="radio"] {
        margin-right: 10px;
        width: 18px;
        height: 18px;
    }

    /* Dirección de retiro */
    .direccion-retiro {
        margin: 8px 0 0 0 !important;
        padding: 12px !important;
        background: #f8fafc;
        border: 1px solid #e2e8f0;
        border-radius: 6px;
        width: 100% !important;
        box-sizing: border-box;
    }

    /* Formulario de dirección para delivery */
    #formulario-direccion {
        margin: 10px 0 0 0 !important;
        padding: 15px !important;
        background: #f8fafc;
        border: 1px solid #e2e8f0;
        border-radius: 6px;
        width: 100% !important;
        box-sizing: border-box;
    }

    /* Mejora los campos del formulario */
    #formulario-direccion .form-group {
        margin-bottom: 12px;
    }

    #formulario-direccion label {
        display: block;
        margin-bottom: 5px;
        font-weight: 500;
        color: #4a5568;
    }

    #formulario-direccion input,
    #formulario-direccion select {
        width: 100%;
        padding: 10px 12px;
        border: 1px solid #e2e8f0;
        border-radius: 4px;
        font-size: 0.95em;
        box-sizing: border-box;
    }
}

/* Estilos para el botón de pago */
.btn-pagar {
    width: 100%;
    padding: 12px;
    background-color: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: 5px;
    font-weight: 600;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
}

.btn-pagar:hover {
    background-color: var(--color-primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* =========================
   OPTIMIZACIÓN DE RENDIMIENTO HERO (LCP)
========================= */

/* Priorizar renderizado del texto principal */
.hero h1, 
.hero .description {
    will-change: transform, opacity;
    contain: layout style paint;
}

/* Forzar render rápido del logo */
.hero-logo {
    image-rendering: auto;
    content-visibility: auto;
}

/* Mejora de contraste para texto hero */
.hero h1 {
    color: #fff;
    text-shadow: 3px 3px 12px rgba(0, 0, 0, 0.7);
}

.hero .description {
    color: #f5f5f5;
}

/* Mejora de contraste en botones */
.btn-outline {
    border: 2px solid #fff;
    color: #fff;
}

.btn-outline:hover {
    background-color: rgba(255, 255, 255, 0.2);
    color: #fff;
}

/* Acelera carga inicial del hero */
.hero {
    background-attachment: scroll; /* mejora el render en móviles */
    will-change: opacity;
}



/* =========================
   HERO FIXES (Previene cambios bruscos de layout)
========================= */

.hero-logo {
    display: block;
    margin: 20px auto 25px; /* centrado y mismo espacio vertical */
    max-width: 230px;
    width: 100%;
    height: auto;
    aspect-ratio: auto; /* respeta proporción real del logo */
}

.hero-content {
    min-height: 70vh; /* mantiene la altura del hero */
}

/* Evita saltos cuando carga la fuente o imágenes */
h1,
.hero .description {
    min-height: 3em;
}

    /* =========================
    HERO OPTIMIZATION EXTRA
    ========================= */
    .hero h1, 
    .hero .description {
        font-display: swap;
        contain: layout paint;
        will-change: opacity, transform;
    }

    .btn-agregar {
    background-color: var(--color-primary);
    border: none;
    border-radius: 50%;
    padding: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, background-color 0.3s ease;
    }

    .btn-agregar:hover {
    background-color: var(--color-primary-dark);
    transform: scale(1.1);
    }

    .icon-cart-plus {
    width: 18px;
    height: 18px;
    color: #4D2A13;
    transition: color 0.3s ease;
    }

    .btn-agregar:hover .icon-cart-plus {
    color: #fff;
    }
