:root {
    --primary-color: #ef4444;
    --secondary-color: #f59e0b;
}

.primary-bg {
    background-color: var(--primary-color);
}

.secondary-bg {
    background-color: var(--secondary-color);
}

.primary-text {
    color: var(--primary-color);
}

.secondary-text {
    color: var(--secondary-color);
}

.glass-effect {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.product-card {
    transition: all 0.3s ease;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.category-section {
    scroll-margin-top: 100px;
}

/* =============================================
   JERARQUÍA DE Z-INDEX — LIMPIA Y DEFINITIVA
   Nav categorías : 500
   Header          : 1000
   Botones carrito : 2000
   Carrito lateral : 3000  (SIN transform — no crea stacking context)
   Modal           : 9000  (siempre encima de todo)
============================================= */

/* Estilos para Modal de Checkout */
.metodo-entrega {
    transition: all 0.3s ease;
    cursor: pointer;
}

.metodo-entrega:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.metodo-entrega.selected {
    border-color: #10b981;
    background-color: #f0fdf4;
}

.opcion-retiro {
    transition: all 0.3s ease;
    cursor: pointer;
}

.opcion-retiro:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.opcion-retiro.selected {
    border-color: #10b981;
    background-color: #f0fdf4;
}

.tiempo-btn {
    transition: all 0.2s ease;
    cursor: pointer;
}

.tiempo-btn:hover {
    background-color: #f0fdf4;
    border-color: #10b981;
}

.tiempo-btn.selected {
    background-color: #10b981;
    color: white;
    border-color: #10b981;
}

/* Animaciones para el modal */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#checkoutModal .bg-white {
    animation: slideIn 0.3s ease-out;
}

/* Estilos adicionales para asegurar scroll */
#checkoutModal .modal-content {
    max-height: 90vh !important;
    overflow-y: auto !important;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1;
}

#checkoutModal .modal-content::-webkit-scrollbar {
    width: 8px;
}

#checkoutModal .modal-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

#checkoutModal .modal-content::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

#checkoutModal .modal-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Estilos específicos para el grid de métodos de entrega */
#checkoutModal .metodos-entrega-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 768px) {
    #checkoutModal .metodos-entrega-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Estilos específicos para el grid de opciones de retiro */
#checkoutModal .opciones-retiro-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 768px) {
    #checkoutModal .opciones-retiro-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Estilos para radio buttons de métodos de entrega */
.metodo-entrega-option {
    display: block;
    position: relative;
}

.metodo-entrega-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.metodo-entrega-content {
    transition: all 0.3s ease;
}

.metodo-entrega-option input[type="radio"]:checked+.metodo-entrega-content {
    border-color: #10b981;
    background-color: #f0fdf4;
}

.metodo-entrega-option input[type="radio"]:focus+.metodo-entrega-content {
    outline: 2px solid #10b981;
    outline-offset: 2px;
}

/* Estilos adicionales para asegurar grid de 2 columnas */
#checkoutModal .metodos-entrega-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 1rem !important;
}

@media (min-width: 768px) {
    #checkoutModal .metodos-entrega-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* Estilos específicos para el grid de opciones de retiro */
#checkoutModal .opciones-retiro-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 1rem !important;
}

@media (min-width: 768px) {
    #checkoutModal .opciones-retiro-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* Estilos para forzar grid de 2 columnas */
#checkoutModal .metodos-entrega-grid,
#checkoutModal .opciones-retiro-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 1rem !important;
}

/* Estilo directo para los botones de método de entrega */
@media screen and (min-width: 768px) {

    #checkoutModal .metodos-entrega-grid>button,
    #checkoutModal .opciones-retiro-grid>button {
        width: 100% !important;
        max-width: none !important;
    }
}

/* Responsive para móvil */
@media (max-width: 768px) {

    .metodo-entrega,
    .opcion-retiro {
        padding: 1rem;
    }

    .tiempo-btn {
        padding: 0.75rem;
        font-size: 0.875rem;
    }
}

/* Carrito lateral: usa right en lugar de transform */
#cartSidebar {
    transition: right 0.3s ease !important;
}

/* Modal: el overlay ocupa toda la pantalla */
#ingredientModal {
    z-index: 9000 !important;
    isolation: isolate;
}

#checkoutModal {
    z-index: 9000 !important;
    isolation: isolate;
}

/* Notificaciones toast por encima del modal */
.toast-notification {
    z-index: 9500 !important;
}

.cart-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

.cart-badge-header {
    position: relative;
}

#cartBadgeHeader {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
}

/* Estilos para el modal de ingredientes */
.ingredient-toggle {
    transition: all 0.3s ease;
    border: 2px solid #e5e7eb;
    background: white;
}

.ingredient-toggle:hover {
    border-color: #ef4444;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.15);
}

.ingredient-toggle.active {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    border-color: #ef4444;
    color: white;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.ingredient-toggle .ingredient-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.ingredient-toggle .ingredient-name {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.ingredient-toggle .ingredient-price {
    font-size: 0.875rem;
    opacity: 0.8;
}

.ingredient-content {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ingredient-card {
    transition: all 0.3s ease;
    cursor: pointer;
    user-select: none;
}

.ingredient-card:active {
    transform: scale(0.95);
}

.tab-active {
    border-bottom-color: #ef4444 !important;
    color: #ef4444 !important;
}

/* Estilos para el scroll del modal */
#ingredientModal .overflow-y-auto {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e0 #f7fafc;
}

#ingredientModal .overflow-y-auto::-webkit-scrollbar {
    width: 8px;
}

#ingredientModal .overflow-y-auto::-webkit-scrollbar-track {
    background: #f7fafc;
    border-radius: 4px;
}

#ingredientModal .overflow-y-auto::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 4px;
}

#ingredientModal .overflow-y-auto::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* Asegurar que el contenido sea lo suficientemente alto */
.ingredient-content {
    min-height: 400px;
}

/* Bloquear scroll del body cuando modal está abierto */
.modal-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}

/* Forzar scroll del modal */
#ingredientModal {
    overflow: hidden !important;
}

#ingredientModal .modal-scrollable-area {
    overflow-y: auto !important;
    height: calc(90vh - 80px) !important;
    max-height: calc(90vh - 80px) !important;
}

/* Scrollbar visible siempre */
#ingredientModal .flex-1::-webkit-scrollbar {
    width: 12px !important;
    display: block !important;
}

#ingredientModal .flex-1::-webkit-scrollbar-track {
    background: #f1f1f1 !important;
    display: block !important;
}

#ingredientModal .flex-1::-webkit-scrollbar-thumb {
    background: #888 !important;
    border-radius: 6px !important;
    display: block !important;
}

#ingredientModal .flex-1::-webkit-scrollbar-thumb:hover {
    background: #555 !important;
}

.header-hidden {
    transform: translateY(-100%);
}

.header-spacer {
    height: 80px;
    transition: height 0.3s ease-in-out;
}

.header-spacer-reduced {
    height: 20px;
}

/* Ocultar barra de desplazamiento manteniendo funcionalidad */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}

.no-scrollbar {
    -ms-overflow-style: none; /* IE and Edge */
    scrollbar-width: none; /* Firefox */
}

/* Optimización para el nav de categorías */
.category-nav-scroll {
    display: flex;
    overflow-x: auto;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch; /* Momentum scroll en iOS */
}
