/**
 * Restaurant Multilang - Popup CSS
 * 
 * Estilos para el popup obligatorio de selección de idioma en el frontend.
 * Incluye popup modal, selector del header y versión móvil.
 * 
 * @package Restaurant_Multilang
 * @since 1.0.0
 */

/* ====================================
   VARIABLES CSS Y RESET
   ==================================== */

:root {
    --rml-popup-primary: #000000;
    --rml-popup-primary-hover: #333333;
    --rml-popup-white: #ffffff;
    --rml-popup-gray-50: #f9f9f9;
    --rml-popup-gray-100: #f0f0f0;
    --rml-popup-gray-200: #e0e0e0;
    --rml-popup-gray-300: #cccccc;
    --rml-popup-gray-400: #999999;
    --rml-popup-gray-500: #666666;
    --rml-popup-gray-600: #333333;
    --rml-popup-overlay: rgba(0, 0, 0, 0.85);
    
    --rml-popup-border-radius: 12px;
    --rml-popup-box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    --rml-popup-box-shadow-hover: 0 8px 25px rgba(0, 0, 0, 0.15);
    --rml-popup-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --rml-popup-transition-fast: all 0.15s ease;
    
    --rml-popup-font-family: 'Bebas Neue', 'Arial Black', sans-serif;
    --rml-popup-font-secondary: 'Oswald', 'Arial', sans-serif;
    --rml-popup-font-size-sm: 12px;
    --rml-popup-font-size-base: 14px;
    --rml-popup-font-size-lg: 16px;
    --rml-popup-font-size-xl: 20px;
    --rml-popup-font-size-2xl: 28px;
    --rml-popup-font-size-3xl: 36px;
    
    --rml-popup-z-modal: 999999;
    --rml-popup-z-header: 9999;
}

/* Reset específico para elementos del popup */
.rml-popup-overlay *,
.language-selector *,
.mobile-menu * {
    box-sizing: border-box;
}

/* ====================================
   POPUP MODAL PRINCIPAL
   ==================================== */

.rml-popup-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: var(--rml-popup-overlay) !important;
    z-index: var(--rml-popup-z-modal) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    opacity: 0;
    visibility: hidden;
    transition: var(--rml-popup-transition);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.rml-popup-overlay.show {
    opacity: 1;
    visibility: visible;
}

.rml-popup-backdrop {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: transparent;
    cursor: pointer;
}

.rml-popup-container {
    position: relative !important;
    max-width: 600px !important;
    width: 90% !important;
    background: var(--rml-popup-white) !important;
    border-radius: var(--rml-popup-border-radius) !important;
    box-shadow: var(--rml-popup-box-shadow) !important;
    z-index: calc(var(--rml-popup-z-modal) + 1) !important;
    transform: scale(0.8) translateY(20px);
    transition: var(--rml-popup-transition);
    overflow: hidden;
    border: 3px solid var(--rml-popup-primary);
}

.rml-popup-overlay.show .rml-popup-container {
    transform: scale(1) translateY(0);
}

.rml-popup-content {
    padding: 0;
}

/* ====================================
   HEADER DEL POPUP
   ==================================== */

.rml-popup-header {
    text-align: center;
    padding: 40px 30px 30px;
    background: linear-gradient(135deg, var(--rml-popup-gray-50) 0%, var(--rml-popup-white) 100%);
    border-bottom: 3px solid var(--rml-popup-primary);
    position: relative;
}

.rml-popup-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 6px;
    background: var(--rml-popup-primary);
    border-radius: 0 0 6px 6px;
}

.rml-popup-title {
    font-family: var(--rml-popup-font-family) !important;
    font-size: var(--rml-popup-font-size-3xl) !important;
    font-weight: 400 !important;
    color: var(--rml-popup-primary) !important;
    margin: 0 0 15px 0 !important;
    text-transform: uppercase !important;
    letter-spacing: 3px !important;
    line-height: 1.2 !important;
    text-shadow: 2px 2px 0px var(--rml-popup-gray-200);
}

.rml-popup-subtitle {
    font-family: var(--rml-popup-font-secondary) !important;
    font-size: var(--rml-popup-font-size-lg) !important;
    color: var(--rml-popup-gray-500) !important;
    margin: 0 !important;
    font-weight: 400 !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    line-height: 1.4 !important;
}

/* ====================================
   GRID DE IDIOMAS
   ==================================== */

.rml-language-grid {
    padding: 40px 30px;
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)) !important;
    gap: 20px !important;
    background: var(--rml-popup-white);
}

.rml-language-option {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 20px 15px !important;
    background: var(--rml-popup-white) !important;
    border: 3px solid var(--rml-popup-gray-200) !important;
    border-radius: var(--rml-popup-border-radius) !important;
    text-decoration: none !important;
    transition: var(--rml-popup-transition) !important;
    cursor: pointer !important;
    position: relative;
    overflow: hidden;
    min-height: 120px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.rml-language-option::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.5s ease;
}

.rml-language-option:hover {
    border-color: var(--rml-popup-primary) !important;
    background: var(--rml-popup-gray-50) !important;
    transform: translateY(-5px) scale(1.05) !important;
    box-shadow: var(--rml-popup-box-shadow-hover) !important;
}

.rml-language-option:hover::before {
    left: 100%;
}

.rml-language-option:active {
    transform: translateY(-2px) scale(1.02) !important;
    transition: var(--rml-popup-transition-fast) !important;
}

.rml-language-flag {
    font-size: 32px !important;
    margin-bottom: 10px !important;
    display: block !important;
    line-height: 1 !important;
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.1));
    transition: var(--rml-popup-transition);
}

.rml-language-option:hover .rml-language-flag {
    transform: scale(1.1);
    filter: drop-shadow(3px 3px 6px rgba(0, 0, 0, 0.2));
}

.rml-language-info {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 5px !important;
}

.rml-language-name {
    font-family: var(--rml-popup-font-family) !important;
    font-size: var(--rml-popup-font-size-lg) !important;
    font-weight: 400 !important;
    color: var(--rml-popup-primary) !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    line-height: 1 !important;
    margin: 0 !important;
    transition: var(--rml-popup-transition);
}

.rml-language-code {
    font-family: var(--rml-popup-font-secondary) !important;
    font-size: var(--rml-popup-font-size-sm) !important;
    color: var(--rml-popup-gray-500) !important;
    text-transform: uppercase !important;
    letter-spacing: 2px !important;
    font-weight: 600 !important;
    line-height: 1 !important;
    margin: 0 !important;
}

.rml-language-option:hover .rml-language-name {
    color: var(--rml-popup-primary);
    text-shadow: 1px 1px 0px var(--rml-popup-gray-200);
}

.rml-language-arrow {
    font-size: var(--rml-popup-font-size-xl) !important;
    color: var(--rml-popup-gray-400) !important;
    margin-top: 10px !important;
    transition: var(--rml-popup-transition) !important;
    opacity: 0;
    transform: translateX(-10px);
}

.rml-language-option:hover .rml-language-arrow {
    color: var(--rml-popup-primary) !important;
    opacity: 1;
    transform: translateX(0);
}

/* ====================================
   FOOTER DEL POPUP
   ==================================== */

.rml-popup-footer {
    padding: 25px 30px 30px;
    background: var(--rml-popup-gray-50);
    border-top: 1px solid var(--rml-popup-gray-200);
    text-align: center;
}

.rml-popup-note {
    margin: 0;
}

.rml-popup-note small {
    color: var(--rml-popup-gray-500) !important;
    font-family: var(--rml-popup-font-secondary) !important;
    font-size: var(--rml-popup-font-size-sm) !important;
    font-style: italic !important;
    line-height: 1.4 !important;
}

/* ====================================
   ESTADOS DEL POPUP
   ==================================== */

.rml-popup-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 10;
    backdrop-filter: blur(5px);
}

.rml-loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--rml-popup-gray-200);
    border-top: 4px solid var(--rml-popup-primary);
    border-radius: 50%;
    animation: rml-spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes rml-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.rml-popup-loading p {
    font-family: var(--rml-popup-font-secondary) !important;
    font-size: var(--rml-popup-font-size-lg) !important;
    color: var(--rml-popup-primary) !important;
    margin: 0 !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
}

.rml-popup-error {
    padding: 30px;
    text-align: center;
    background: var(--rml-popup-white);
}

.rml-error-icon {
    font-size: 48px;
    margin-bottom: 20px;
    display: block;
}

.rml-error-message {
    font-family: var(--rml-popup-font-secondary) !important;
    font-size: var(--rml-popup-font-size-lg) !important;
    color: #dc3545 !important;
    margin: 0 0 20px 0 !important;
    font-weight: 500 !important;
}

.rml-error-retry {
    background: var(--rml-popup-primary) !important;
    color: var(--rml-popup-white) !important;
    border: none !important;
    padding: 12px 24px !important;
    border-radius: var(--rml-popup-border-radius) !important;
    font-family: var(--rml-popup-font-family) !important;
    font-size: var(--rml-popup-font-size-base) !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    cursor: pointer !important;
    transition: var(--rml-popup-transition) !important;
}

.rml-error-retry:hover {
    background: var(--rml-popup-primary-hover) !important;
    transform: translateY(-2px) !important;
}

/* ====================================
   BLOQUEO DE PÁGINA
   ==================================== */

body.rml-popup-active {
    overflow: hidden !important;
    height: 100vh !important;
    position: fixed !important;
    width: 100% !important;
}

.rml-popup-page-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.3) !important;
    z-index: calc(var(--rml-popup-z-modal) - 1) !important;
    pointer-events: none !important;
}

/* ====================================
   SELECTOR DEL HEADER (DESKTOP)
   ==================================== */

.language-selector {
    position: relative;
    display: inline-block;
    z-index: var(--rml-popup-z-header);
}

.lang-button {
    background: var(--rml-popup-white) !important;
    color: var(--rml-popup-primary) !important;
    border: 2px solid var(--rml-popup-primary) !important;
    padding: 10px 16px !important;
    font-family: var(--rml-popup-font-family) !important;
    font-size: var(--rml-popup-font-size-base) !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    cursor: pointer !important;
    border-radius: var(--rml-popup-border-radius) !important;
    transition: var(--rml-popup-transition) !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
}

.lang-button:hover,
.lang-button.active {
    background: var(--rml-popup-primary) !important;
    color: var(--rml-popup-white) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) !important;
}

.lang-button .arrow {
    transition: var(--rml-popup-transition);
    font-size: 12px;
}

.lang-button.active .arrow {
    transform: rotate(180deg);
}

.lang-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--rml-popup-white);
    border: 2px solid var(--rml-popup-primary);
    border-top: none;
    border-radius: 0 0 var(--rml-popup-border-radius) var(--rml-popup-border-radius);
    min-width: 200px;
    box-shadow: var(--rml-popup-box-shadow-hover);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: var(--rml-popup-transition);
    z-index: calc(var(--rml-popup-z-header) + 1);
    overflow: hidden;
}

.lang-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.lang-option {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 12px 16px !important;
    color: var(--rml-popup-primary) !important;
    text-decoration: none !important;
    transition: var(--rml-popup-transition-fast) !important;
    border-bottom: 1px solid var(--rml-popup-gray-200);
}

.lang-option:last-child {
    border-bottom: none;
}

.lang-option:hover {
    background: var(--rml-popup-gray-50) !important;
    color: var(--rml-popup-primary) !important;
    text-decoration: none !important;
    transform: translateX(5px) !important;
}

.lang-option .flag {
    font-size: var(--rml-popup-font-size-lg);
    line-height: 1;
}

.lang-option .name {
    font-family: var(--rml-popup-font-secondary) !important;
    font-size: var(--rml-popup-font-size-base) !important;
    font-weight: 500 !important;
    color: inherit !important;
}

/* ====================================
   SELECTOR MÓVIL (EN MENÚ HAMBURGUESA)
   ==================================== */

@media (max-width: 768px) {
    
    /* Ocultar selector desktop */
    .language-selector {
        display: none !important;
    }
    
    /* Estilos para el selector móvil */
    .mobile-language-selector {
        border-bottom: 2px solid var(--rml-popup-primary) !important;
        padding-bottom: 20px !important;
        margin-bottom: 20px !important;
    }
    
    .mobile-lang-button {
        width: 100% !important;
        background: var(--rml-popup-primary) !important;
        color: var(--rml-popup-white) !important;
        border: 2px solid var(--rml-popup-primary) !important;
        padding: 15px 20px !important;
        font-family: var(--rml-popup-font-family) !important;
        font-size: var(--rml-popup-font-size-lg) !important;
        font-weight: 600 !important;
        text-transform: uppercase !important;
        letter-spacing: 1px !important;
        cursor: pointer !important;
        border-radius: var(--rml-popup-border-radius) !important;
        transition: var(--rml-popup-transition) !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
    }
    
    .mobile-lang-button:hover,
    .mobile-lang-button.active {
        background: var(--rml-popup-white) !important;
        color: var(--rml-popup-primary) !important;
        transform: translateY(-2px) !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    }
    
    .mobile-arrow {
        transition: var(--rml-popup-transition);
        font-size: 14px;
    }
    
    .mobile-lang-button.active .mobile-arrow {
        transform: rotate(180deg);
    }
    
    .mobile-lang-dropdown {
        position: relative;
        background: var(--rml-popup-white);
        border: 2px solid var(--rml-popup-primary);
        border-top: none;
        border-radius: 0 0 var(--rml-popup-border-radius) var(--rml-popup-border-radius);
        opacity: 0;
        visibility: hidden;
        max-height: 0;
        overflow: hidden;
        transition: var(--rml-popup-transition);
    }
    
    .mobile-lang-dropdown.show {
        opacity: 1;
        visibility: visible;
        max-height: 300px;
    }
    
    .mobile-lang-option {
        display: flex !important;
        align-items: center !important;
        gap: 15px !important;
        padding: 15px 20px !important;
        color: var(--rml-popup-primary) !important;
        text-decoration: none !important;
        transition: var(--rml-popup-transition-fast) !important;
        border-bottom: 1px solid var(--rml-popup-gray-200);
    }
    
    .mobile-lang-option:last-child {
        border-bottom: none;
    }
    
    .mobile-lang-option:hover {
        background: var(--rml-popup-gray-50) !important;
        color: var(--rml-popup-primary) !important;
        text-decoration: none !important;
        transform: translateX(10px) !important;
    }
    
    .mobile-lang-option .flag {
        font-size: var(--rml-popup-font-size-xl);
        line-height: 1;
    }
    
    .mobile-lang-option .name {
        font-family: var(--rml-popup-font-secondary) !important;
        font-size: var(--rml-popup-font-size-lg) !important;
        font-weight: 500 !important;
        color: inherit !important;
    }
}

/* ====================================
   RESPONSIVE POPUP MODAL
   ==================================== */

@media (max-width: 768px) {
    .rml-popup-container {
        width: 95% !important;
        max-width: none !important;
        margin: 20px;
    }
    
    .rml-popup-header {
        padding: 30px 20px 20px;
    }
    
    .rml-popup-title {
        font-size: var(--rml-popup-font-size-2xl) !important;
        letter-spacing: 2px !important;
    }
    
    .rml-popup-subtitle {
        font-size: var(--rml-popup-font-size-base) !important;
    }
    
    .rml-language-grid {
        padding: 30px 20px;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 15px !important;
    }
    
    .rml-language-option {
        padding: 15px 10px !important;
        min-height: 100px;
    }
    
    .rml-language-flag {
        font-size: 24px !important;
        margin-bottom: 8px !important;
    }
    
    .rml-language-name {
        font-size: var(--rml-popup-font-size-base) !important;
    }
    
    .rml-language-code {
        font-size: 10px !important;
    }
    
    .rml-popup-footer {
        padding: 20px;
    }
    
    .rml-popup-note small {
        font-size: 11px !important;
    }
}

@media (max-width: 480px) {
    .rml-popup-container {
        width: 98% !important;
        margin: 10px;
    }
    
    .rml-language-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 12px !important;
        padding: 20px 15px;
    }
    
    .rml-language-option {
        padding: 12px 8px !important;
        min-height: 85px;
    }
    
    .rml-language-flag {
        font-size: 20px !important;
        margin-bottom: 6px !important;
    }
    
    .rml-language-name {
        font-size: var(--rml-popup-font-size-sm) !important;
    }
    
    .rml-language-arrow {
        display: none !important;
    }
    
    .rml-popup-title {
        font-size: var(--rml-popup-font-size-xl) !important;
        letter-spacing: 1px !important;
    }
}

/* ====================================
   COMPATIBILIDAD Y FIXES
   ==================================== */

/* Fix para temas que usan !important en links */
.rml-language-option,
.lang-option,
.mobile-lang-option {
    color: var(--rml-popup-primary) !important;
}

.rml-language-option:hover,
.lang-option:hover,
.mobile-lang-option:hover {
    color: var(--rml-popup-primary) !important;
}

/* Fix para z-index conflicts */
.rml-popup-overlay {
    z-index: 2147483647 !important;
}

/* Fix para temas con box-sizing diferente */
.rml-popup-overlay,
.rml-popup-overlay * {
    box-sizing: border-box !important;
}

/* Fix para scroll en iOS */
.rml-popup-overlay {
    -webkit-overflow-scrolling: touch;
    overflow-y: auto;
}

/* Fix para backdrop-filter en navegadores antiguos */
@supports not (backdrop-filter: blur(10px)) {
    .rml-popup-overlay {
        background: rgba(0, 0, 0, 0.9) !important;
    }
}

/* ====================================
   ANIMACIONES ADICIONALES
   ==================================== */

@keyframes rml-bounce-in {
    0% {
        transform: scale(0.3) translateY(50px);
        opacity: 0;
    }
    50% {
        transform: scale(1.05) translateY(-5px);
    }
    70% {
        transform: scale(0.95) translateY(2px);
    }
    100% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

@keyframes rml-fade-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.rml-popup-overlay.animate-in .rml-popup-container {
    animation: rml-bounce-in 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

.rml-language-option {
    animation: rml-fade-in 0.5s ease-out forwards;
}

.rml-language-option:nth-child(1) { animation-delay: 0.1s; }
.rml-language-option:nth-child(2) { animation-delay: 0.2s; }
.rml-language-option:nth-child(3) { animation-delay: 0.3s; }
.rml-language-option:nth-child(4) { animation-delay: 0.4s; }
.rml-language-option:nth-child(5) { animation-delay: 0.5s; }

/* ====================================
   ACCESIBILIDAD
   ==================================== */

.rml-language-option:focus,
.lang-button:focus,
.mobile-lang-button:focus {
    outline: 3px solid #4A90E2 !important;
    outline-offset: 2px !important;
}

.rml-popup-overlay[aria-hidden="true"] {
    display: none !important;
}

/* Reducir animaciones para usuarios con preferencias de accesibilidad */
@media (prefers-reduced-motion: reduce) {
    .rml-popup-overlay,
    .rml-popup-container,
    .rml-language-option,
    .lang-button,
    .mobile-lang-button {
        transition: none !important;
        animation: none !important;
    }
}

/* ====================================
   MODO DE ALTO CONTRASTE
   ==================================== */

@media (prefers-contrast: high) {
    .rml-popup-container {
        border: 4px solid var(--rml-popup-primary) !important;
    }
    
    .rml-language-option {
        border: 3px solid var(--rml-popup-primary) !important;
    }
    
    .rml-language-option:hover {
        background: var(--rml-popup-primary) !important;
        color: var(--rml-popup-white) !important;
    }
    
    .lang-button,
    .mobile-lang-button {
        border: 3px solid var(--rml-popup-primary) !important;
    }
    
    .rml-popup-title {
        text-shadow: none !important;
        font-weight: 700 !important;
    }
}

/* ====================================
   PRINT STYLES
   ==================================== */

@media print {
    .rml-popup-overlay,
    .language-selector,
    .mobile-language-selector {
        display: none !important;
    }
}

/* ====================================
   DARK MODE SUPPORT
   ==================================== */

@media (prefers-color-scheme: dark) {
    :root {
        --rml-popup-primary: #ffffff;
        --rml-popup-primary-hover: #e0e0e0;
        --rml-popup-white: #1a1a1a;
        --rml-popup-gray-50: #2a2a2a;
        --rml-popup-gray-100: #333333;
        --rml-popup-gray-200: #404040;
        --rml-popup-gray-300: #555555;
        --rml-popup-gray-400: #888888;
        --rml-popup-gray-500: #aaaaaa;
        --rml-popup-gray-600: #cccccc;
        --rml-popup-overlay: rgba(0, 0, 0, 0.95);
    }
    
    .rml-popup-title {
        text-shadow: 2px 2px 0px #000000;
    }
    
    .rml-language-option:hover .rml-language-name {
        text-shadow: 1px 1px 0px #000000;
    }
}

/* ====================================
   CUSTOM SCROLLBAR PARA DROPDOWN
   ==================================== */

.lang-dropdown,
.mobile-lang-dropdown {
    scrollbar-width: thin;
    scrollbar-color: var(--rml-popup-gray-400) var(--rml-popup-gray-100);
}

.lang-dropdown::-webkit-scrollbar,
.mobile-lang-dropdown::-webkit-scrollbar {
    width: 6px;
}

.lang-dropdown::-webkit-scrollbar-track,
.mobile-lang-dropdown::-webkit-scrollbar-track {
    background: var(--rml-popup-gray-100);
    border-radius: 3px;
}

.lang-dropdown::-webkit-scrollbar-thumb,
.mobile-lang-dropdown::-webkit-scrollbar-thumb {
    background: var(--rml-popup-gray-400);
    border-radius: 3px;
}

.lang-dropdown::-webkit-scrollbar-thumb:hover,
.mobile-lang-dropdown::-webkit-scrollbar-thumb:hover {
    background: var(--rml-popup-gray-500);
}

/* ====================================
   PERFORMANCE OPTIMIZATIONS
   ==================================== */

.rml-popup-overlay {
    will-change: opacity, visibility;
}

.rml-popup-container {
    will-change: transform;
}

.rml-language-option {
    will-change: transform, box-shadow;
}

.lang-button,
.mobile-lang-button {
    will-change: transform, background-color;
}

/* Force hardware acceleration */
.rml-popup-overlay,
.rml-popup-container,
.rml-language-option:hover {
    transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ====================================
   CRITICAL CSS INLINE FALLBACKS
   ==================================== */

/* Estas reglas están duplicadas en el HTML inline para evitar FOUC */
.rml-popup-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.8) !important;
    z-index: 999999 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.rml-popup-backdrop {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.5) !important;
}

.rml-popup-container {
    position: relative !important;
    max-width: 600px !important;
    width: 90% !important;
    background: #fff !important;
    border-radius: 12px !important;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3) !important;
    z-index: 1000000 !important;
}

/* Bloquear scroll del body */
body.rml-popup-active {
    overflow: hidden !important;
    height: 100vh !important;
}

/* ====================================
   UTILITY CLASSES
   ==================================== */

.rml-popup-hidden {
    display: none !important;
}

.rml-popup-visible {
    display: flex !important;
}

.rml-popup-no-transition {
    transition: none !important;
}

.rml-popup-loading-state * {
    pointer-events: none !important;
    opacity: 0.6 !important;
}

/* ====================================
   VENDOR PREFIX FALLBACKS
   ==================================== */

/* Webkit específico */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
    .rml-popup-overlay {
        -webkit-backdrop-filter: blur(10px);
    }
    
    .rml-language-option {
        -webkit-transform: translateZ(0);
    }
}

/* Firefox específico */
@-moz-document url-prefix() {
    .rml-popup-overlay {
        background: rgba(0, 0, 0, 0.9) !important;
    }
}

/* ====================================
   RETINA DISPLAY OPTIMIZATIONS
   ==================================== */

@media only screen and (-webkit-min-device-pixel-ratio: 2),
       only screen and (min--moz-device-pixel-ratio: 2),
       only screen and (-o-min-device-pixel-ratio: 2/1),
       only screen and (min-device-pixel-ratio: 2),
       only screen and (min-resolution: 192dpi),
       only screen and (min-resolution: 2dppx) {
    
    .rml-popup-container {
        border: 2px solid var(--rml-popup-primary) !important;
    }
    
    .rml-language-option {
        border: 2px solid var(--rml-popup-gray-200) !important;
    }
    
    .rml-language-option:hover {
        border: 2px solid var(--rml-popup-primary) !important;
    }
    
    .lang-button,
    .mobile-lang-button {
        border: 2px solid var(--rml-popup-primary) !important;
    }
}

/* ====================================
   INTERNET EXPLORER FALLBACKS
   ==================================== */

/* IE10+ */
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
    .rml-popup-overlay {
        background: rgba(0, 0, 0, 0.9) !important;
    }
    
    .rml-language-grid {
        display: -ms-flexbox !important;
        -ms-flex-wrap: wrap !important;
    }
    
    .rml-language-option {
        -ms-flex: 1 1 18% !important;
        margin: 10px !important;
    }
}

/* ====================================
   FINAL OVERRIDES Y SPECIFICITY
   ==================================== */

/* Asegurar que nuestros estilos tengan precedencia sobre temas problemáticos */
html .rml-popup-overlay {
    position: fixed !important;
    z-index: 2147483647 !important;
}

html .rml-popup-overlay .rml-popup-container {
    position: relative !important;
    z-index: 2147483648 !important;
}

html .rml-popup-overlay .rml-language-option {
    color: var(--rml-popup-primary) !important;
    text-decoration: none !important;
    border-style: solid !important;
    border-width: 3px !important;
}

html .rml-popup-overlay .rml-language-option:hover {
    color: var(--rml-popup-primary) !important;
    text-decoration: none !important;
}

/* Override para temas que fuerzan colores de links */
.rml-popup-overlay a,
.rml-popup-overlay a:visited,
.rml-popup-overlay a:link,
.rml-popup-overlay a:active {
    color: var(--rml-popup-primary) !important;
    text-decoration: none !important;
}

.rml-popup-overlay a:hover {
    color: var(--rml-popup-primary) !important;
    text-decoration: none !important;
}

/* ====================================
   DEBUG STYLES (Solo en desarrollo)
   ==================================== */

/* Descomenta estas líneas para debugging */
/*
.rml-popup-overlay {
    border: 5px solid red !important;
}

.rml-popup-container {
    border: 3px solid blue !important;
}

.rml-language-option {
    border: 2px solid green !important;
}
*/