/**
 * DELIVERY FIXES CSS
 * Arregla conflictos específicos de Materialize en delivery
 * Sobrescribe estilos problemáticos de Yoko y otros temas
 */

/* 🔧 FIX 1: Permitir que Materialize funcione - NO forzar display */
select[name="forma_pago"] {
    /* NO interferir con Materialize - dejar que maneje el display */
    opacity: 1 !important;    
    pointer-events: auto !important;
    /* Materialize se encargará del display: none automáticamente */
}

/* 🎯 FIX 2: Asegurar que el dropdown de Materialize se vea correcto */
.input-field .select-dropdown {
    border: none;
    border-bottom: 1px solid #9e9e9e;
    border-radius: 0;
    outline: none;
    height: 3rem;
    width: 100%;
    font-size: 16px;
    margin: 0 0 8px 0;
    padding: 0;
    box-shadow: none;
    box-sizing: content-box;
    transition: box-shadow .3s, border .3s;
    background-color: transparent;
    cursor: pointer;
}

/* 🔄 FIX 3: Dropdown wrapper y estilos consistentes */
.input-field .select-wrapper {
    position: relative;
    display: block !important; /* ✅ Asegurar que el wrapper sea visible */
}

/* 🎯 FIX: Asegurar que el select-dropdown sea visible */
.input-field .select-dropdown {
    display: block !important; /* ✅ Dropdown visible */
    opacity: 1 !important;
}

.input-field .select-wrapper .caret {
    color: #9e9e9e;
    right: 0;
    margin-top: -2px;
}

/* Estilos del dropdown activo */
.input-field .select-dropdown:focus {
    border-bottom: 2px solid #26a69a;
    box-shadow: 0 1px 0 0 #26a69a;
}

/* Label activo cuando hay selección */
.input-field .select-wrapper + label {
    color: #9e9e9e;
}

.input-field .select-wrapper.valid + label,
.input-field .select-wrapper:focus + label {
    color: #26a69a;
    font-size: 0.8rem;
    transform: translateY(-14px);
}

.input-field .select-wrapper .caret {
    fill: rgba(0,0,0,.87);
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    margin: auto 0;
    z-index: 0;
    width: 10px;
}

/* 📱 FIX 4: FormSelect dropdown funcional */
.select-dropdown {
    position: absolute !important;
    background-color: white !important;
    margin: 0 !important;
    display: none !important;
    min-width: 100% !important;
    max-height: 650px !important;
    overflow-y: auto !important;
    z-index: 999 !important;
    will-change: width, height;
    border-radius: 2px !important;
    box-shadow: 0 2px 5px 0 rgba(0,0,0,0.16), 0 2px 10px 0 rgba(0,0,0,0.12) !important;
}

.select-dropdown li {
    padding: 12px 16px !important;
    cursor: pointer !important;
    line-height: 1.5rem !important;
    height: auto !important;
    text-align: left !important;
}

.select-dropdown li:hover,
.select-dropdown li.selected {
    background-color: #f1f1f1 !important;
}

/* ⚡ FIX 5: Sidenav optimizado sin touchmove warnings */
.sidenav {
    transform: translateX(-105%);
    transition: transform .3s ease-out;
    will-change: transform;
}

.sidenav.open {
    transform: translateX(0);
}

/* 🎨 FIX 6: Sobrescribir estilos Yoko problemáticos para delivery */
.delivery-page nav {
    display: block !important; /* Revertir display: none de Yoko */
    height: auto !important;   /* Altura automática */
}

.delivery-page header {
    position: relative !important; /* Revertir position: initial */
    height: auto !important;       /* Altura automática */
}

/* 📋 FIX 7: Labels y inputs alineados correctamente */
.input-field label {
    color: #9e9e9e;
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    font-size: 1rem;
    cursor: text;
    transition: transform .2s ease-out, color .2s ease-out;
    transform-origin: 0% 100%;
    text-align: initial;
    transform: translateY(12px);
    
}

.input-field label:not(.label-icon).active {
    transform: translateY(-14px) scale(0.8);
    transform-origin: 0 0;
}

/* 🚀 FIX 8: Buttons y responsive mejorado */
.btn, .btn-large, .btn-small, .btn-flat {
    border: none;
    border-radius: 2px;
    display: inline-block;
    height: 36px;
    line-height: 36px;
    padding: 0 16px;
    text-transform: uppercase;
    vertical-align: middle;
    text-decoration: none;
    color: #fff;
    background-color: #26a69a;
    text-align: center;
    letter-spacing: .5px;
    transition: background-color .2s ease-out;
    cursor: pointer;
}

/* 💫 FIX 9: Animaciones suaves sin conflictos */
* {
    box-sizing: border-box;
}

.quantity-button {
    transition: all 0.3s ease;
}

.quantity-button:hover {
    background-color: #f0f0f0;
}

/* 🎯 FIX 10: Z-index correcto para elementos flotantes */
.select-wrapper .caret {
    z-index: 1;
}

.dropdown-content {
    z-index: 999;
}

.sidenav-overlay {
    z-index: 997;
}

.sidenav {
    z-index: 999;
}

/* 📱 FIX 11: Responsive delivery específico */
@media only screen and (max-width: 992px) {
    .input-field .select-wrapper .caret {
        right: 8px;
    }
    
    select {
        font-size: 16px; /* Evita zoom en iOS */
    }
}

/* 🔧 FIX 12: Accesibilidad mejorada */
select:focus {
    outline: 2px solid #26a69a;
    outline-offset: 2px;
}

.btn:focus {
    outline: 2px solid #26a69a;
    outline-offset: 2px;
}

/* 🎨 FIX 14: Overrides finales para delivery */
body.delivery-encapsulated {
    overflow-x: hidden;
}

.delivery-content {
    padding-top: 80px; /* Espacio para header fijo */
}
