/* 🌐 WORLD LANGUAGE SELECTOR - PROFESSIONAL GRADE */

/* Container */
.language-selector {
    position: relative;
    display: inline-block;
}

/* Button - ULTRA CLICKABLE FIX */
.language-btn {
    background: var(--background);
    border: var(--glass-border);
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer !important;
    color: var(--text-secondary);
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
    font-size: 0.9rem;
    position: relative;
    pointer-events: auto !important;
    z-index: 100;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.language-btn:hover {
    background: var(--primary-light);
    color: var(--primary);
    transform: translate3d(0, -2px, 0);
}

.language-btn .lang-flag {
    font-size: 20px;
    line-height: 1;
    display: block;
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
}

/* Dropdown - CRITICAL: Must be direct child of body for proper z-index */
.language-dropdown {
    position: fixed !important;
    top: 70px !important;
    right: 20px !important;
    background: var(--surface);
    border: var(--glass-border);
    border-radius: 10px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    min-width: 280px;
    max-width: 350px;
    max-height: 450px;
    overflow: hidden;
    z-index: 999999999 !important;
    display: none;
    pointer-events: auto !important;
    touch-action: auto !important;
}

.language-dropdown.show {
    display: block !important;
    pointer-events: auto !important;
    animation: dropdownSlide 0.3s ease;
    visibility: visible !important;
    opacity: 1 !important;
}

.language-dropdown * {
    pointer-events: auto !important;
    cursor: pointer !important;
}

@keyframes dropdownSlide {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Search Box */
.language-search {
    padding: 8px;
    border-bottom: var(--glass-border);
    background: var(--background);
}

.language-search input {
    width: 100%;
    padding: 6px 10px;
    border: var(--glass-border);
    border-radius: 6px;
    font-size: 12px;
    background: var(--surface);
    color: var(--text-primary);
    transition: all 0.3s;
}

.language-search input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-light);
}

.language-search input::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

/* Language List */
.language-list {
    max-height: 380px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 4px 0;
}

/* Custom Scrollbar - Auto Hide */
.language-list {
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
}

.language-list:hover {
    scrollbar-color: var(--primary) transparent;
}

.language-list::-webkit-scrollbar {
    width: 6px;
}

.language-list::-webkit-scrollbar-track {
    background: transparent;
}

.language-list::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 3px;
    transition: background 0.3s;
}

.language-list:hover::-webkit-scrollbar-thumb {
    background: var(--primary);
}

.language-list::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* Region Headers */
.language-region {
    padding: 6px 12px;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--background);
    border-top: var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* Language Options - ULTRA CLICKABLE */
.language-option {
    padding: 8px 12px;
    cursor: pointer !important;
    pointer-events: auto !important;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
    color: var(--text-primary);
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: rgba(212, 175, 55, 0.2);
    touch-action: manipulation;
}

.language-option:hover {
    background: var(--primary-light);
}

.language-option.active {
    background: var(--primary-light);
    border-left: 3px solid var(--primary);
}

.language-option .lang-flag {
    font-size: 20px;
    min-width: 28px;
    text-align: center;
}

.language-option .lang-info {
    flex: 1;
    min-width: 0;
}

.language-option .lang-name {
    font-weight: 500;
    font-size: 13px;
    color: var(--text-primary);
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.language-option .lang-code {
    font-size: 10px;
    color: var(--text-secondary);
    opacity: 0.7;
}

.language-option .check-icon {
    color: var(--primary);
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.2s;
}

.language-option.active .check-icon {
    opacity: 1;
}

.language-option.hidden {
    display: none;
}

/* Popular Badge */
.language-option.popular::after {
    content: '⭐';
    font-size: 10px;
    margin-left: auto;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .language-dropdown {
        right: 10px;
        left: 10px;
        min-width: auto;
        max-width: none;
    }
    
    .language-list {
        max-height: 60vh;
    }
}

/* Light Mode Specific Fixes */
body.light-mode .language-dropdown,
body.pure-light-mode .language-dropdown,
html.light-mode .language-dropdown,
html.pure-light-mode .language-dropdown {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.15);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

body.light-mode .language-btn,
body.pure-light-mode .language-btn,
html.light-mode .language-btn,
html.pure-light-mode .language-btn {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: #2d2d2d;
}

body.light-mode .language-btn:hover,
body.pure-light-mode .language-btn:hover,
html.light-mode .language-btn:hover,
html.pure-light-mode .language-btn:hover {
    background: rgba(201, 162, 54, 0.1);
    color: #c9a236;
}

body.light-mode .language-search,
body.pure-light-mode .language-search,
html.light-mode .language-search,
html.pure-light-mode .language-search {
    background: #f5f5f5;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

body.light-mode .language-search input,
body.pure-light-mode .language-search input,
html.light-mode .language-search input,
html.pure-light-mode .language-search input {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: #2d2d2d;
}

body.light-mode .language-region,
body.pure-light-mode .language-region,
html.light-mode .language-region,
html.pure-light-mode .language-region {
    background: #f5f5f5;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    color: #5a5a5a;
}

body.light-mode .language-option,
body.pure-light-mode .language-option,
html.light-mode .language-option,
html.pure-light-mode .language-option {
    color: #2d2d2d;
}

body.light-mode .language-option:hover,
body.pure-light-mode .language-option:hover,
html.light-mode .language-option:hover,
html.pure-light-mode .language-option:hover {
    background: rgba(201, 162, 54, 0.1);
}

body.light-mode .language-option .lang-code,
body.pure-light-mode .language-option .lang-code,
html.light-mode .language-option .lang-code,
html.pure-light-mode .language-option .lang-code {
    color: #5a5a5a;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .language-dropdown {
        right: 10px;
        left: 10px;
        min-width: auto;
        max-width: none;
    }
    
    .language-list {
        max-height: 60vh;
    }
}


/* 🔥 MOBILE TOUCH FIX - ULTRA RESPONSIVE */
@media (max-width: 768px) {
    .language-btn {
        width: 42px !important;
        height: 42px !important;
        -webkit-tap-highlight-color: rgba(212, 175, 55, 0.3) !important;
        touch-action: manipulation !important;
    }
    
    .language-btn .lang-flag {
        font-size: 22px !important;
    }
    
    .language-option {
        padding: 12px 16px !important;
        min-height: 48px !important;
        -webkit-tap-highlight-color: rgba(212, 175, 55, 0.2) !important;
        touch-action: manipulation !important;
    }
    
    .language-dropdown {
        top: 60px !important;
    }
}

/* 🔥 FORCE CLICKABLE - NUCLEAR OPTION */
.language-selector,
.language-selector *,
.language-btn,
.language-btn *,
.language-dropdown,
.language-dropdown *,
.language-option,
.language-option * {
    pointer-events: auto !important;
}

.lang-flag {
    pointer-events: none !important;
}
