/* ===================================================================
   HEADER 2025 - MODERN FLOATING GLASS DESIGN
   =================================================================== */

:root {
    --header-height: 80px;
    --header-bg: rgba(255, 255, 255, 0.85);
    --header-blur: 20px;
    --brand-teal: #0A6A6E;
    --brand-dark: #1e293b;
    --brand-gray: #64748b;
}

/* Global offset for the fixed header */
main.main {
    padding-top: 80px;
}

/* --- 1. HEADER CONTAINER --- */
.header-v2 {
    position: fixed;
    top: 20px;
    /* Floating effect */
    left: 50%;
    transform: translateX(-50%);
    width: 95%;
    max-width: 1400px;
    height: var(--header-height);
    background: var(--header-bg);
    backdrop-filter: blur(var(--header-blur));
    -webkit-backdrop-filter: blur(var(--header-blur));
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50px;
    /* Pill Shape */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    transition: all 0.4s ease;
}

/* Scrolled State */
body.scrolled .header-v2 {
    top: 10px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.12);
}

/* LOGO */
.header-v2 .logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    gap: 8px;
}

.header-v2 .logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--brand-dark);
    margin: 0;
    line-height: 1;
}

/* --- 2. DESKTOP NAVIGATION --- */
.nav-v2 {
    display: none;
    /* Hidden on mobile */
}

@media (min-width: 1200px) {
    .nav-v2 {
        display: flex;
        gap: 5px;
        /* Center Alignment */
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        width: max-content;
        /* Ensure width fits content for correct centering */
        margin: 0;
    }

    .nav-item-v2 {
        list-style: none;
        position: relative;
    }

    .nav-link-v2 {
        text-decoration: none;
        color: var(--brand-dark);
        font-weight: 500;
        font-size: 0.95rem;
        padding: 10px 18px;
        border-radius: 20px;
        transition: 0.3s;
        display: flex;
        align-items: center;
        gap: 5px;
    }

    .nav-link-v2:hover,
    .nav-link-v2.active {
        background: rgba(10, 106, 110, 0.08);
        color: var(--brand-teal);
    }

    .nav-link-v2 i {
        font-size: 0.8rem;
        transition: transform 0.3s;
    }

    .nav-item-v2:hover .nav-link-v2 i {
        transform: rotate(180deg);
    }
}

/* --- 3. MEGA MENU (Desktop) --- */
@media (min-width: 1200px) {
    .mega-menu-v2 {
        position: absolute;
        top: 120%;
        /* Adjusted starting position */
        left: 50%;
        transform: translateX(-50%) translateY(20px);
        width: 900px;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(30px);
        border-radius: 24px;
        border: 1px solid rgba(0, 0, 0, 0.05);
        box-shadow: 0 30px 80px rgba(0, 0, 0, 0.15);
        padding: 40px;
        opacity: 0;
        visibility: hidden;
        /* Improved transition with delay for exit */
        transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
        pointer-events: none;
    }

    /* Bridge to prevent closing on gap */
    .mega-menu-v2::before {
        content: "";
        position: absolute;
        top: -40px;
        left: 0;
        width: 100%;
        height: 60px;
        /* Covers the gap */
        background: transparent;
    }

    .nav-item-v2:hover .mega-menu-v2 {
        opacity: 1;
        visibility: visible;
        pointer-events: all;
        top: 100%;
        /* Slide up effect */
        transform: translateX(-50%) translateY(15px);
        /* Slight delay before opening? No, instant open. */
    }

    /* Grid Layout */
    .mm-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 40px;
    }

    .mm-column h3 {
        font-size: 0.8rem;
        font-weight: 800;
        text-transform: uppercase;
        letter-spacing: 1px;
        margin-bottom: 20px;
        color: var(--brand-teal);
        border-bottom: 2px solid rgba(10, 106, 110, 0.1);
        padding-bottom: 10px;
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .mm-list {
        list-style: none;
        padding: 0;
        margin: 0;
    }

    .mm-item {
        display: flex;
        align-items: center;
        gap: 15px;
        text-decoration: none;
        padding: 12px;
        border-radius: 12px;
        transition: 0.2s;
    }

    .mm-item:hover {
        background: rgba(10, 106, 110, 0.05);
    }

    .mm-icon {
        width: 42px;
        height: 42px;
        background: #f8fafc;
        border-radius: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.2rem;
        color: var(--brand-gray);
        transition: 0.3s;
    }

    .mm-item:hover .mm-icon {
        background: var(--brand-teal);
        color: #fff;
        box-shadow: 0 8px 20px rgba(10, 106, 110, 0.25);
    }

    .mm-text strong {
        display: block;
        color: var(--brand-dark);
        font-size: 0.95rem;
    }

    .mm-text span {
        display: block;
        color: var(--brand-gray);
        font-size: 0.8rem;
    }
}

/* --- 4. RIGHT ACTIONS --- */
.header-actions-v2 {
    display: flex;
    align-items: center;
    gap: 15px;
}

.action-btn {
    background: var(--brand-teal);
    color: #fff;
    padding: 10px 24px;
    border-radius: 30px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: 0.3s;
    box-shadow: 0 4px 15px rgba(10, 106, 110, 0.3);
}

.action-btn:hover {
    background: #085659;
    transform: translateY(-2px);
    color: #fff;
}

.lang-switch-v2 a {
    text-decoration: none;
    color: var(--brand-dark);
    font-weight: 700;
    font-size: 0.9rem;
    padding: 5px;
    opacity: 0.6;
}

.lang-switch-v2 a.active {
    opacity: 1;
    color: var(--brand-teal);
}

/* --- 5. MOBILE MENU (Drawer) --- */
.mobile-toggle-v2 {
    display: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--brand-dark);
}

/* FIX: Hide mobile menu container by default on ALL screens */
#mobile-menu-overlay,
#mobile-menu-container {
    display: none;
}

@media (max-width: 1199px) {
    .mobile-toggle-v2 {
        display: block;
    }

    .nav-v2 {
        display: none;
        /* Hide desktop nav */
    }

    /* Mobile Drawer */
    #mobile-menu-overlay {
        display: block;
        /* Restore for mobile logic (visibility handled by opacity) */
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        opacity: 0;
        visibility: hidden;
        transition: 0.3s;
        z-index: 9998;
    }

    #mobile-menu-container {
        display: block;
        /* Restore for mobile logic (pos handled by right) */
        position: fixed;
        top: 0;
        right: -100%;
        /* Slide out */
        width: 85%;
        max-width: 400px;
        height: 100vh;
        background: #fff;
        z-index: 9999;
        transition: 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
        padding: 30px 20px;
        overflow-y: auto;
        box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
    }

    /* Open State */
    body.mobile-active #mobile-menu-overlay {
        opacity: 1;
        visibility: visible;
    }

    body.mobile-active #mobile-menu-container {
        right: 0;
    }

    /* Mobile Content */
    .mobile-nav-list {
        display: flex;
        flex-direction: column;
        gap: 15px;
        margin-top: 40px;
    }

    .mobile-nav-link {
        font-size: 1.1rem;
        font-weight: 600;
        color: var(--brand-dark);
        text-decoration: none;
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px 0;
        border-bottom: 1px solid #f1f5f9;
        cursor: pointer;
    }

    /* Mobile Accordion */
    .mobile-mega-content {
        display: none;
        /* Hidden by default */
        padding-left: 10px;
        margin-top: 10px;
        border-left: 2px solid #e2e8f0;
    }

    .mobile-nav-item.active .mobile-mega-content {
        display: block;
        animation: slideDown 0.3s ease;
    }

    @keyframes slideDown {
        from {
            opacity: 0;
            transform: translateY(-10px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .mobile-mm-group {
        margin-bottom: 20px;
    }

    .mobile-mm-title {
        font-size: 0.85rem;
        text-transform: uppercase;
        color: var(--brand-teal);
        font-weight: 700;
        margin-bottom: 10px;
        display: block;
    }

    .mobile-mm-link {
        display: block;
        padding: 8px 0;
        color: #475569;
        text-decoration: none;
        font-size: 1rem;
    }

    /* Header inside Mobile Menu */
    .mobile-menu-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 20px;
    }

    .btn-close-mobile {
        font-size: 1.5rem;
        cursor: pointer;
        color: var(--brand-dark);
    }

    /* ============================================
       MOBILE LANGUAGE SWITCHER
       ============================================ */

    .mobile-lang-switch {
        display: flex;
        gap: 6px;
        padding: 8px;
        margin-bottom: 15px;
        background: linear-gradient(135deg, rgba(10, 106, 110, 0.05) 0%, rgba(102, 165, 173, 0.05) 100%);
        border-radius: 8px;
    }

    .mobile-lang-btn {
        flex: 1;
        padding: 8px 16px;
        border: 1.5px solid #e2e8f0;
        border-radius: 8px;
        color: #64748b;
        text-decoration: none;
        font-weight: 600;
        font-size: 0.85rem;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        text-align: center;
        background: #ffffff;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
        position: relative;
        overflow: hidden;
    }

    .mobile-lang-btn::before {
        content: '';
        position: absolute;
        top: 0;
        left: -100%;
        width: 100%;
        height: 100%;
        background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
        transition: left 0.5s;
    }

    .mobile-lang-btn:hover::before {
        left: 100%;
    }

    .mobile-lang-btn.active {
        background: linear-gradient(135deg, var(--brand-teal) 0%, #0d8a8f 100%);
        color: #ffffff;
        border-color: var(--brand-teal);
        box-shadow: 0 2px 8px rgba(10, 106, 110, 0.25);
        transform: translateY(-1px);
    }

    .mobile-lang-btn:hover:not(.active) {
        background: #f8fafc;
        border-color: var(--brand-teal);
        color: var(--brand-teal);
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    }

    .mobile-lang-btn:active {
        transform: translateY(0);
    }
}