/* ========================================
   MODAL DE PRODUCTO - VERSIÓN CORREGIDA
   ======================================== */

/* Overlay del modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: 99999;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Contenedor del modal - MODO CLARO SIEMPRE */
.product-modal {
    background: #FFFFFF !important;
    border-radius: 24px 24px 0 0;
    width: 100%;
    max-width: 100%;
    max-height: 75vh;
    overflow: hidden;
    position: relative;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.2);
    color: #333333 !important;
}

.modal-overlay.active .product-modal {
    transform: translateY(0);
}

/* Indicador de arrastre móvil */
.product-modal::before {
    content: '';
    position: absolute;
    top: 0.75rem;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 2px;
    z-index: 11;
}

/* Botón de cerrar */
.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.5) !important;
    color: white !important;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.7) !important;
    transform: rotate(90deg);
}

/* Contenido del modal */
.modal-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 75vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: white !important;
}

/* Imagen del producto en modal */
.modal-image-container {
    width: 100%;
    height: 200px;
    background: #f5f5f5 !important;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.modal-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.modal-emoji {
    font-size: 4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: #f9f9f9 !important;
}

/* Badge de oferta */
.modal-offer-badge {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    background: linear-gradient(135deg, #FF5A5F, #FF7B7E);
    color: white !important;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.8rem;
    box-shadow: 0 2px 10px rgba(255, 90, 95, 0.4);
}

/* Información del producto */
.modal-info {
    padding: 1.25rem;
    overflow-y: auto;
    flex: 1;
    background: white !important;
    color: #333333 !important;
}

.modal-header {
    margin-bottom: 1rem;
}

.modal-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: #1a1a1a !important;
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.modal-price-container {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.modal-price {
    font-size: 1.75rem;
    font-weight: 800;
    color: #FF6B35 !important;
}

.modal-price-old {
    font-size: 1.1rem;
    color: #999 !important;
    text-decoration: line-through;
}

.modal-description {
    color: #666666 !important;
    line-height: 1.5;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

/* Sección de extras */
.modal-extras {
    background: #f8f9fa !important;
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.modal-extras-title {
    font-weight: 700;
    color: #333333 !important;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.modal-extra-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0;
    color: #666666 !important;
    font-size: 0.85rem;
}

.modal-extra-icon {
    font-size: 1.1rem;
}

/* Sugerencias */
.modal-suggestions {
    margin-bottom: 1rem;
}

.modal-suggestions-title {
    font-weight: 700;
    color: #333333 !important;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.suggestion-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.suggestion-chip {
    background: rgba(255, 107, 53, 0.1) !important;
    border: 1px solid rgba(255, 107, 53, 0.2);
    color: #FF6B35 !important;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.suggestion-chip:hover {
    background: #FF6B35 !important;
    color: white !important;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.3);
}

/* Acciones del modal */
.modal-actions {
    padding: 1rem 1.25rem 1.25rem;
    border-top: 2px solid #e5e7eb;
    background: white !important;
    display: flex;
    gap: 0.75rem;
    align-items: center;
    position: sticky;
    bottom: 0;
    z-index: 5;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.modal-quantity-control {
    display: flex;
    align-items: center;
    background: #f9fafb !important;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid #e5e7eb;
}

.modal-quantity-btn {
    background: transparent !important;
    border: none;
    width: 38px;
    height: 38px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 600;
    color: #6b7280 !important;
    transition: all 0.2s;
}

.modal-quantity-btn:hover {
    background: #FF6B35 !important;
    color: white !important;
}

.modal-quantity-btn:active {
    transform: scale(0.95);
}

.modal-quantity-input {
    width: 40px;
    text-align: center;
    border: none;
    font-weight: 700;
    background: transparent !important;
    color: #1a1a1a !important;
    font-size: 0.95rem;
}

.modal-add-btn {
    flex: 1;
    background: linear-gradient(135deg, #10b981, #0ea570) !important;
    color: white !important;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.95rem;
    transition: all 0.3s;
    box-shadow: 0 2px 10px rgba(16, 185, 129, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    white-space: nowrap;
}

.modal-add-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

.modal-add-btn:active {
    transform: scale(0.98);
}

/* ========================================
   MÓVIL VERTICAL - AJUSTES ESPECÍFICOS
   ======================================== */
@media (max-width: 768px) and (orientation: portrait) {
    .modal-overlay {
        align-items: flex-end;
    }
    
    .product-modal {
        max-height: 70vh !important; /* Reducido para asegurar visibilidad */
        height: auto;
        border-radius: 20px 20px 0 0;
    }
    
    .modal-image-container {
        height: 180px !important; /* Más compacto */
    }
    
    .modal-emoji {
        font-size: 3.5rem !important;
    }
    
    .modal-info {
        padding: 1rem !important;
        max-height: calc(70vh - 180px - 80px); /* Ajustado para el espacio disponible */
    }
    
    .modal-title {
        font-size: 1.25rem !important;
    }
    
    .modal-price {
        font-size: 1.5rem !important;
    }
    
    .modal-description {
        font-size: 0.85rem !important;
    }
    
    .modal-extras {
        padding: 0.75rem !important;
    }
    
    .modal-extra-item {
        font-size: 0.8rem !important;
        padding: 0.3rem 0 !important;
    }
    
    .modal-suggestions {
        display: none !important; /* Ocultar en móvil vertical para ahorrar espacio */
    }
    
    .modal-actions {
        padding: 1rem !important;
        flex-wrap: nowrap;
    }
    
    .modal-quantity-control {
        flex-shrink: 0;
    }
    
    .modal-add-btn {
        padding: 0.7rem 1rem !important;
        font-size: 0.9rem !important;
    }
}

/* Móviles muy pequeños */
@media (max-width: 375px) {
    .product-modal {
        max-height: 65vh !important;
    }
    
    .modal-image-container {
        height: 150px !important;
    }
    
    .modal-emoji {
        font-size: 3rem !important;
    }
    
    .modal-title {
        font-size: 1.1rem !important;
    }
    
    .modal-price {
        font-size: 1.3rem !important;
    }
    
    .modal-quantity-btn {
        width: 34px !important;
        height: 34px !important;
    }
    
    .modal-add-btn {
        padding: 0.6rem 0.8rem !important;
        font-size: 0.85rem !important;
    }
}

/* ========================================
   LANDSCAPE MÓVIL
   ======================================== */
@media (max-width: 896px) and (orientation: landscape) {
    .modal-overlay {
        align-items: center;
        padding: 1rem;
    }
    
    .product-modal {
        max-height: 90vh;
        max-width: 90vw;
        margin: auto;
        display: grid;
        grid-template-columns: 40% 60%;
        border-radius: 16px;
        transform: scale(0.9);
    }
    
    .modal-overlay.active .product-modal {
        transform: scale(1);
    }
    
    .product-modal::before {
        display: none;
    }
    
    .modal-content {
        display: contents;
        max-height: 90vh;
    }
    
    .modal-image-container {
        grid-row: 1 / 3;
        height: 100%;
        max-height: 90vh;
    }
    
    .modal-info {
        grid-column: 2;
        padding: 1rem;
        overflow-y: auto;
    }
    
    .modal-actions {
        grid-column: 2;
        padding: 0.75rem 1rem;
        border-top: 1px solid #e5e7eb;
    }
}

/* ========================================
   TABLETS
   ======================================== */
@media (min-width: 769px) and (max-width: 1024px) {
    .modal-overlay {
        align-items: center;
        padding: 2rem;
    }
    
    .product-modal {
        max-width: 700px;
        max-height: 80vh;
        border-radius: 20px;
        transform: scale(0.95);
    }
    
    .modal-overlay.active .product-modal {
        transform: scale(1);
    }
    
    .product-modal::before {
        display: none;
    }
}

/* ========================================
   DESKTOP
   ======================================== */
@media (min-width: 1025px) {
    .modal-overlay {
        align-items: center;
        padding: 2rem;
    }
    
    .product-modal {
        display: grid;
        grid-template-columns: 55% 45%;
        max-height: 85vh;
        max-width: 1000px;
        border-radius: 24px;
        transform: scale(0.95);
    }
    
    .modal-overlay.active .product-modal {
        transform: scale(1);
    }
    
    .product-modal::before {
        display: none;
    }
    
    .modal-content {
        display: contents;
    }
    
    .modal-image-container {
        grid-row: 1 / 3;
        height: 100%;
        min-height: 500px;
    }
    
    .modal-info {
        grid-column: 2;
        padding: 2rem 2rem 1rem;
    }
    
    .modal-actions {
        grid-column: 2;
        padding: 1rem 2rem 2rem;
        background: transparent !important;
        border-top: 2px solid #e5e7eb;
    }
    
    .modal-title {
        font-size: 1.75rem !important;
    }
    
    .modal-price {
        font-size: 2rem !important;
    }
    
    .modal-emoji {
        font-size: 6rem !important;
    }
}

/* Animaciones */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

/* Fix para z-index en iOS */
@supports (-webkit-touch-callout: none) {
    .modal-overlay {
        z-index: 999999 !important;
    }
    
    .product-modal {
        -webkit-transform: translateY(100%);
        transform: translateY(100%);
    }
    
    .modal-overlay.active .product-modal {
        -webkit-transform: translateY(0);
        transform: translateY(0);
    }
}

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

/* Asegurar que todo está en modo claro */
.product-modal,
.product-modal *,
.modal-overlay {
    color-scheme: light !important;
}

/* ELIMINAR COMPLETAMENTE EL MODO OSCURO */
@media (prefers-color-scheme: dark) {
    /* No aplicar ningún estilo de modo oscuro */
}