/* ===== EFG-Corporate Language Selector Styles ===== */

/* ===== LANGUAGE LOADING OVERLAY ===== */
.language-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(5, 84, 64, 0.95), rgba(232, 136, 36, 0.85));
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.language-loading-overlay.show {
    opacity: 1;
    visibility: visible;
}

.loading-content {
    text-align: center;
    color: white;
    max-width: 350px;
    padding: 2.5rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    box-shadow: 0 20px 40px rgba(5, 84, 64, 0.3);
}

.loading-content .loading-spinner {
    margin: 0 auto 1.5rem;
}

.loading-spinner .spinner {
    width: 70px;
    height: 70px;
    border: 5px solid rgba(255, 255, 255, 0.2);
    border-top: 5px solid #E88824;
    border-right: 5px solid #ffffff;
    border-radius: 50%;
    animation: efg-spin 1.2s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
    position: relative;
}

.loading-spinner .spinner::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    border: 3px solid transparent;
    border-top: 3px solid rgba(232, 136, 36, 0.6);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: efg-spin-reverse 0.8s linear infinite;
}

.loading-content h4 {
    font-size: 1.3rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
    animation: efg-pulse 2s ease-in-out infinite alternate;
}

.loading-content p {
    font-size: 1rem;
    font-weight: 400;
    margin: 0;
    opacity: 0.9;
    animation: efg-fade 1.8s ease-in-out infinite alternate;
}

@keyframes efg-spin {
    0% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(180deg) scale(1.1); }
    100% { transform: rotate(360deg) scale(1); }
}

@keyframes efg-spin-reverse {
    0% { transform: translate(-50%, -50%) rotate(360deg); }
    100% { transform: translate(-50%, -50%) rotate(0deg); }
}

@keyframes efg-pulse {
    0% { opacity: 0.8; transform: scale(1); }
    100% { opacity: 1; transform: scale(1.02); }
}

@keyframes efg-fade {
    0% { opacity: 0.6; }
    100% { opacity: 0.9; }
}

/* ===== EFG-CORPORATE LANGUAGE SELECTOR STYLES ===== */
.efg-language-selector-wrapper {
    position: relative;
    display: inline-block;
    z-index: 100;
}

/* Desktop Language Selector - Integrated in existing header */
.language-selector .language-btn {
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid rgba(5, 84, 64, 0.1);
    border-radius: 8px;
    padding: 8px 35px 8px 12px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #055440;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    outline: none;
    min-width: 140px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.language-selector .language-btn:hover {
    background: rgba(255, 255, 255, 1);
    border-color: #E88824;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(232, 136, 36, 0.2);
}

.language-selector .language-btn:focus {
    background: rgba(255, 255, 255, 1);
    border-color: #E88824;
    box-shadow: 0 0 0 3px rgba(232, 136, 36, 0.2);
    transform: translateY(-1px);
}

.language-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid rgba(5, 84, 64, 0.1);
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1000;
    margin-top: 4px;
}

.language-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.language-option {
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #055440;
}

.language-option:hover {
    background: rgba(232, 136, 36, 0.1);
    color: #E88824;
}

.language-option:first-child {
    border-radius: 6px 6px 0 0;
}

.language-option:last-child {
    border-radius: 0 0 6px 6px;
}

.language-option .flag {
    font-size: 1.1rem;
}

/* Mobile Language Dropdown Integration */
.mobile-language-section {
    width: 100%;
    margin: 1rem 0;
    padding: 1rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.mobile-language-title {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.mobile-language-btn {
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 12px 16px;
    color: white;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 48px;
}

.mobile-language-btn:hover,
.mobile-language-btn:focus {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

.mobile-language-btn .flag {
    font-size: 1.1rem;
    margin-right: 8px;
}

.mobile-language-btn .fas {
    transition: transform 0.3s ease;
}

.mobile-language-options {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    margin-top: 8px;
    border: 1px solid rgba(5, 84, 64, 0.1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.mobile-language-options.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.mobile-language-option {
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #055440;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
}

.mobile-language-option:hover {
    background: rgba(232, 136, 36, 0.1);
    color: #E88824;
}

.mobile-language-option:first-child {
    border-radius: 7px 7px 0 0;
}

.mobile-language-option:last-child {
    border-radius: 0 0 7px 7px;
}

/* Loading State */
.language-btn.loading,
.mobile-language-btn.loading {
    opacity: 0.7;
    pointer-events: none;
    cursor: wait;
    position: relative;
}

.language-btn.loading::after,
.mobile-language-btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 35px;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(5, 84, 64, 0.3);
    border-top: 2px solid #055440;
    border-radius: 50%;
    animation: efg-spin 1s linear infinite;
    transform: translateY(-50%);
}

/* ===== LANGUAGE CHANGE ANIMATIONS ===== */
.language-fade-out {
    opacity: 0;
    transform: translateY(-10px) scale(0.98);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.language-fade-in {
    opacity: 1;
    transform: translateY(0) scale(1);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0.1s;
}

/* ===== LANGUAGE SPECIFIC FONT ADJUSTMENTS ===== */
.lang-ar {
    font-family: 'Inter', 'Segoe UI', 'Tahoma', 'Arial', sans-serif;
    line-height: 1.7;
}

.lang-zh {
    font-family: 'Inter', 'Noto Sans SC', 'Microsoft YaHei', 'PingFang SC', 'Hiragino Sans GB', sans-serif;
    line-height: 1.6;
}

.lang-fr,
.lang-es {
    font-family: 'Inter', 'Segoe UI', 'Roboto', sans-serif;
    line-height: 1.6;
    letter-spacing: 0.01em;
}

.lang-en {
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
}

/* ===== SUCCESS NOTIFICATION ===== */
.language-success-notification {
    position: fixed;
    top: 100px;
    right: 20px;
    background: linear-gradient(135deg, #055440, #E88824);
    color: white;
    padding: 1.2rem 1.8rem;
    border-radius: 12px;
    box-shadow: 0 15px 35px rgba(5, 84, 64, 0.4);
    z-index: 9998;
    opacity: 0;
    transform: translateX(400px) scale(0.9);
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    max-width: 350px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 1rem;
    border: 1px solid rgba(232, 136, 36, 0.3);
}

.language-success-notification.show {
    opacity: 1;
    transform: translateX(0) scale(1);
}

.language-success-notification i {
    font-size: 1.4rem;
    color: #E88824;
    animation: efg-success-bounce 0.6s ease;
}

.language-success-notification .close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.3rem;
    cursor: pointer;
    margin-left: auto;
    opacity: 0.8;
    transition: all 0.3s ease;
    padding: 0.2rem;
    border-radius: 50%;
}

.language-success-notification .close-btn:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

@keyframes efg-success-bounce {
    0%, 20%, 50%, 80%, 100% { transform: scale(1); }
    40% { transform: scale(1.2); }
    60% { transform: scale(1.1); }
}

/* ===== TRANSLATING STATES ===== */
.translating {
    opacity: 0.8;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.translated {
    opacity: 1;
    pointer-events: auto;
    transition: opacity 0.3s ease 0.1s;
}

.language-changing {
    transition: all 0.3s ease !important;
}

.language-changing .hero__title,
.language-changing .section__title,
.language-changing .service__title {
    transform: scale(0.99);
    opacity: 0.9;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 576px) {
    .mobile-language-btn {
        font-size: 0.9rem;
        padding: 10px 15px;
        min-height: 44px;
    }
    
    .language-success-notification {
        right: 10px;
        left: 10px;
        max-width: none;
        transform: translateY(-100px) scale(0.9);
    }
    
    .language-success-notification.show {
        transform: translateY(0) scale(1);
    }
}

/* ===== ACCESSIBILITY IMPROVEMENTS ===== */
.language-btn:focus,
.mobile-language-btn:focus {
    outline: 3px solid #E88824;
    outline-offset: 2px;
}

.language-btn:focus-visible,
.mobile-language-btn:focus-visible {
    outline: 3px solid #E88824;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .language-btn,
    .mobile-language-btn {
        border: 3px solid #000;
        background: #fff;
        color: #000;
    }
    
    .language-btn:focus,
    .mobile-language-btn:focus {
        outline: 4px solid #000;
        box-shadow: 0 0 0 8px rgba(0, 0, 0, 0.3);
    }
    
    .language-loading-overlay {
        background: rgba(0, 0, 0, 0.95);
        backdrop-filter: none;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .loading-spinner .spinner,
    .loading-spinner .spinner::after {
        animation: none;
    }
    
    .loading-content h4,
    .loading-content p {
        animation: none;
    }
    
    .language-fade-out,
    .language-fade-in,
    .translating,
    .translated {
        transition: none;
    }
    
    .language-success-notification {
        transition: opacity 0.2s ease;
        transform: none;
    }
    
    .language-success-notification.show {
        transform: none;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    .language-loading-overlay,
    .language-success-notification,
    .language-selector,
    .mobile-language-section {
        display: none !important;
    }
}

/* ===== LANGUAGE SPECIFIC RESPONSIVE ADJUSTMENTS ===== */
@media (max-width: 768px) {
    .lang-ar .hero__title,
    .lang-zh .hero__title {
        font-size: clamp(1.8rem, 6vw, 2.5rem);
        line-height: 1.2;
    }
    
    .lang-ar .section__title,
    .lang-zh .section__title {
        font-size: clamp(1.6rem, 4vw, 2.2rem);
        line-height: 1.3;
    }
}

/* ===== THEME INTEGRATION ===== */
.language-btn,
.mobile-language-btn {
    font-family: inherit;
    font-feature-settings: inherit;
}

/* Ensure proper stacking order */
.language-selector {
    z-index: 100;
}

/* ===== PERFORMANCE OPTIMIZATIONS ===== */
.language-btn,
.mobile-language-btn {
    will-change: transform, opacity;
    backface-visibility: hidden;
}

.language-success-notification {
    will-change: transform, opacity;
    backface-visibility: hidden;
}

/* Force hardware acceleration for smooth animations */
.language-loading-overlay,
.language-btn,
.mobile-language-btn,
.language-success-notification {
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

/* ===== END OF EFG-CORPORATE LANGUAGE STYLES ===== */