/**
 * Harimathana - Sinhala Translation Styles
 * Modern language switcher dropdown, notification, banner & font support
 */

/* ═══════ Sinhala Font Support ═══════ */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Sinhala:wght@300;400;500;600;700&display=swap');

html[lang="si"] body,
html[lang="si"] * {
    font-family: 'Noto Sans Sinhala', 'Poppins', sans-serif;
}

/* ═══════ Language Switcher Widget ═══════ */
.lang-switcher {
    position: relative;
    z-index: 1000;
    margin-left: 4px;
}

.lang-switcher-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1.5px solid rgba(0, 0, 0, 0.15);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.04);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #1a1a2e;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

.lang-switcher-btn:hover {
    border-color: rgba(0, 0, 0, 0.3);
    background: rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

/* Home page - white style initially, black when scrolled */
body[data-page="home"] .desktop-lang-switcher .lang-switcher-btn {
    border-color: rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

body[data-page="home"] .desktop-lang-switcher .lang-switcher-btn:hover {
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.16);
}

/* Auth pages - white style for language switcher */
body[data-page="login"] .desktop-lang-switcher .lang-switcher-btn,
body[data-page="register"] .desktop-lang-switcher .lang-switcher-btn,
body[data-page="forgot-password"] .desktop-lang-switcher .lang-switcher-btn,
body[data-page="verify-email"] .desktop-lang-switcher .lang-switcher-btn,
body[data-page="reset-password"] .desktop-lang-switcher .lang-switcher-btn,
body[data-page="resend-verification"] .desktop-lang-switcher .lang-switcher-btn,
body[data-page="youtube-subscription-verification"] .desktop-lang-switcher .lang-switcher-btn {
    border-color: rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

body[data-page="login"] .desktop-lang-switcher .lang-switcher-btn:hover,
body[data-page="register"] .desktop-lang-switcher .lang-switcher-btn:hover,
body[data-page="forgot-password"] .desktop-lang-switcher .lang-switcher-btn:hover,
body[data-page="verify-email"] .desktop-lang-switcher .lang-switcher-btn:hover,
body[data-page="reset-password"] .desktop-lang-switcher .lang-switcher-btn:hover,
body[data-page="resend-verification"] .desktop-lang-switcher .lang-switcher-btn:hover,
body[data-page="youtube-subscription-verification"] .desktop-lang-switcher .lang-switcher-btn:hover {
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.16);
}

/* Mobile white header pages - white style */
body[data-page="home"] .mobile-lang-switcher .lang-switcher-btn,
body[data-page="dashboard"] .mobile-lang-switcher .lang-switcher-btn,
body[data-page="leaderboard"] .mobile-lang-switcher .lang-switcher-btn,
body[data-page="profile"] .mobile-lang-switcher .lang-switcher-btn,
body[data-page="login"] .mobile-lang-switcher .lang-switcher-btn,
body[data-page="register"] .mobile-lang-switcher .lang-switcher-btn,
body[data-page="forgot-password"] .mobile-lang-switcher .lang-switcher-btn,
body[data-page="verify-email"] .mobile-lang-switcher .lang-switcher-btn,
body[data-page="reset-password"] .mobile-lang-switcher .lang-switcher-btn,
body[data-page="resend-verification"] .mobile-lang-switcher .lang-switcher-btn,
body[data-page="youtube-subscription-verification"] .mobile-lang-switcher .lang-switcher-btn {
    border-color: rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

body[data-page="home"] .mobile-lang-switcher .lang-switcher-btn:hover,
body[data-page="dashboard"] .mobile-lang-switcher .lang-switcher-btn:hover,
body[data-page="leaderboard"] .mobile-lang-switcher .lang-switcher-btn:hover,
body[data-page="profile"] .mobile-lang-switcher .lang-switcher-btn:hover,
body[data-page="login"] .mobile-lang-switcher .lang-switcher-btn:hover,
body[data-page="register"] .mobile-lang-switcher .lang-switcher-btn:hover,
body[data-page="forgot-password"] .mobile-lang-switcher .lang-switcher-btn:hover,
body[data-page="verify-email"] .mobile-lang-switcher .lang-switcher-btn:hover,
body[data-page="reset-password"] .mobile-lang-switcher .lang-switcher-btn:hover,
body[data-page="resend-verification"] .mobile-lang-switcher .lang-switcher-btn:hover,
body[data-page="youtube-subscription-verification"] .mobile-lang-switcher .lang-switcher-btn:hover {
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.16);
}

.lang-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    stroke: #000 !important;
    color: #000 !important;
}

/* White icons for home, dashboard, leaderboard, profile and upload subscription pages */
body[data-page="home"] .lang-icon,
body[data-page="dashboard"] .lang-icon,
body[data-page="leaderboard"] .lang-icon,
body[data-page="profile"] .lang-icon,
body[data-page="youtube-subscription-verification"] .lang-icon {
    stroke: #fff !important;
    color: #fff !important;
}

/* Black icon for pages that don't have white headers */
body:not([data-page="home"]):not([data-page="dashboard"]):not([data-page="leaderboard"]):not([data-page="profile"]):not([data-page="youtube-subscription-verification"]) .lang-icon {
    stroke: #000 !important;
}

/* White icon for pages with white headers */
body[data-page="home"] .lang-icon,
body[data-page="dashboard"] .lang-icon,
body[data-page="leaderboard"] .lang-icon,
body[data-page="profile"] .lang-icon,
body[data-page="youtube-subscription-verification"] .lang-icon {
    stroke: #fff !important;
}

/* Keep white icon when scrolled on home page */
body[data-page="home"] .header.scrolled-logo .lang-icon {
    stroke: #fff !important;
}

.lang-current-text {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.lang-chevron {
    width: 14px;
    height: 14px;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.lang-switcher.open .lang-chevron {
    transform: rotate(180deg);
}

/* ═══════ Language Dropdown Menu ═══════ */
.lang-dropdown {
    position: fixed;
    min-width: 220px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 14px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.04);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.96);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    z-index: 99999;
}

.lang-switcher.open .lang-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.lang-dropdown-header {
    padding: 12px 16px 8px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #94a3b8;
    border-bottom: 1px solid #f1f5f9;
}

.lang-option {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: background 0.15s ease;
    text-align: left;
    font-family: inherit;
}

.lang-option:hover {
    background: #f8fafc;
}

.lang-option.active {
    background: linear-gradient(135deg, #eff6ff, #e0f2fe);
}

.lang-option:last-child {
    border-radius: 0 0 14px 14px;
}

.lang-option-flag {
    font-size: 24px;
    line-height: 1;
    flex-shrink: 0;
}

.lang-option-info {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.lang-option-name {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.3;
}

.lang-option-native {
    font-size: 11px;
    color: #94a3b8;
    line-height: 1.3;
}

.lang-option-check {
    font-size: 16px;
    color: #3b82f6;
    font-weight: 700;
    opacity: 0;
    transform: scale(0);
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.lang-option.active .lang-option-check {
    opacity: 1;
    transform: scale(1);
}

/* ═══════ Language Change Notification ═══════ */
.lang-notification {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(-30px);
    background: linear-gradient(135deg, #1e3a8a, #2563eb);
    color: #fff;
    padding: 14px 28px;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 600;
    z-index: 100000;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 40px rgba(30, 58, 138, 0.4);
    display: flex;
    align-items: center;
    gap: 10px;
    pointer-events: none;
    white-space: nowrap;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.lang-notification.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.lang-notification.hiding {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
}

.lang-notif-flag {
    font-size: 22px;
    line-height: 1;
}

/* ═══════ Mobile Responsive ═══════ */
/* Hide desktop lang switcher on mobile, show mobile version */
@media (max-width: 768px) {
    .desktop-lang-switcher {
        display: none !important;
    }
    
    .mobile-lang-switcher {
        display: flex !important;
        position: relative;
        margin-left: 0;
        margin-right: 8px;
        transition: none;
    }
    
    .mobile-lang-switcher .lang-switcher-btn {
        padding: 8px 10px;
        border: 1.5px solid rgba(255, 255, 255, 0.25);
        background: rgba(255, 255, 255, 0.08);
        color: #fff;
        border-radius: 8px;
        gap: 4px;
        font-size: 12px;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    /* Keep white mobile lang switcher for all white header pages */
    body[data-page="home"] .header.scrolled-logo .mobile-lang-switcher .lang-switcher-btn {
        color: #fff;
        border-color: rgba(255, 255, 255, 0.25);
        background: rgba(255, 255, 255, 0.08);
    }

    /* All white header pages use same mobile lang switcher style */
    body[data-page="home"] .mobile-lang-switcher .lang-switcher-btn,
    body[data-page="dashboard"] .mobile-lang-switcher .lang-switcher-btn,
    body[data-page="leaderboard"] .mobile-lang-switcher .lang-switcher-btn,
    body[data-page="profile"] .mobile-lang-switcher .lang-switcher-btn,
    body[data-page="youtube-subscription-verification"] .mobile-lang-switcher .lang-switcher-btn {
        color: #fff;
        border-color: rgba(255, 255, 255, 0.25);
        background: rgba(255, 255, 255, 0.08);
    }
    .lang-switcher-btn {
        padding: 5px 8px;
        gap: 4px;
    }
    
    .lang-icon {
        width: 16px;
        height: 16px;
    }
    
    .lang-current-text {
        font-size: 11px;
    }
    
    .lang-chevron {
        width: 12px;
        height: 12px;
    }
    
    .mobile-lang-switcher .lang-dropdown {
        min-width: 200px;
    }

    .lang-notification {
        top: 70px;
        font-size: 13px;
        padding: 10px 20px;
        max-width: 90vw;
    }

    .verify-banner-inner {
        gap: 8px;
    }
    
    .verify-banner-txt strong {
        font-size: 13px;
    }
    
    .verify-banner-txt span {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .lang-current-text {
        display: none;
    }
    
    .lang-chevron {
        display: none;
    }
    
    .lang-switcher-btn {
        padding: 6px 8px;
        border-radius: 8px;
    }
    
    .lang-icon {
        width: 20px;
        height: 20px;
    }

    .lang-dropdown {
        min-width: 180px;
    }
    
    .verify-banner-btn {
        width: 100%;
        text-align: center;
        margin-top: 6px;
    }
}

/* ═══════ Desktop/Mobile Visibility ═══════ */
@media (min-width: 769px) {
    .mobile-lang-switcher {
        display: none !important;
    }
    
    .desktop-lang-switcher {
        display: flex !important;
    }
}

@media (max-width: 768px) {
    .desktop-lang-switcher {
        display: none !important;
    }
    
    .mobile-lang-switcher {
        display: flex !important;
    }
}