/* ============================================
   NAVBAR STYLES - IDA Reference Design (Final)
   Row 1: Blue bar with logo + links
   Row 2: White menu bar
============================================ */

/* Navbar Wrapper */
.navbar-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    transition: transform 0.3s ease-in-out, background-color 0.3s;
}

/* When scrolled, adjust the navbar position */
.navbar-wrapper.scrolled .main-nav {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.navbar-wrapper.scrolled {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

/* ========================================
   TOP BAR - Blue Gradient
======================================== */
.top-bar {
    background: linear-gradient(135deg, #00a8cc 0%, #0088c7 50%, #0077b5 100%);
    padding: 12px 0;
    transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out, max-height 0.3s ease-in-out;
    overflow: hidden;
    max-height: 100px;
}

/* Hidden state for top bar when scrolling */
.top-bar.hidden {
    transform: translateY(-100%);
    opacity: 0;
    max-height: 0;
    padding: 0;
    pointer-events: none;
}

.top-bar-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Logo - Left Side */
.logo {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    z-index: 10;
}

.logo-mark {
    display: flex;
    align-items: baseline;
    font-family: 'Poppins', sans-serif;
    font-size: 42px;
    font-weight: 800;
    font-style: italic;
    line-height: 1;
}

/* Logo Letters - Outlined style for w, b, a and filled for i, d */
.logo-w,
.logo-b,
.logo-a {
    color: transparent;
    -webkit-text-stroke: 2px #ffffff;
}

.logo-i,
.logo-d {
    color: #ffffff;
}

.logo-r {
    font-size: 12px;
    font-style: normal;
    font-weight: 600;
    color: #ffffff;
    vertical-align: super;
    margin-left: 2px;
}

.logo-tagline {
    font-size: 9px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 400;
    letter-spacing: 0.3px;
}

/* Right Side Container */
.top-bar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Top Nav Links */
.top-nav-links {
    display: flex;
    align-items: center;
    gap: 20px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.top-nav-links li a {
    color: rgba(255, 255, 255, 0.9);
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.3s;
}

.top-nav-links li a:hover {
    color: #ffffff;
}

.member-welcome {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
}

/* Top Bar Actions */
.top-bar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logout-form {
    margin: 0;
}

.btn-cta {
    background: #0a2e4a;
    color: #ffffff;
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s;
}

.btn-cta:hover {
    background: #0d3d5c;
    transform: translateY(-1px);
}

.logout-btn {
    border: 0;
}

.divider {
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
}

.btn-cta-text {
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: opacity 0.3s;
}

.btn-cta-text:hover {
    opacity: 0.8;
}

/* Websites Dropdown */
.websites-dropdown {
    position: relative;
    margin-left: 15px;
}

.dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s;
}

.dropdown-toggle:hover {
    background: rgba(255, 255, 255, 0.25);
}

.dropdown-toggle i:last-child {
    font-size: 10px;
    margin-left: 2px;
}

.websites-dropdown .dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: #ffffff;
    min-width: 160px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    padding: 8px 0;
    display: none;
    z-index: 1001;
    margin-top: 8px;
    list-style: none;
}

.websites-dropdown:hover .dropdown-menu {
    display: block;
    animation: fadeIn 0.2s ease-out;
}

.websites-dropdown .dropdown-menu li a {
    display: block;
    padding: 10px 16px;
    color: #333;
    font-size: 13px;
    text-decoration: none;
    transition: all 0.2s;
}

.websites-dropdown .dropdown-menu li a:hover {
    background: #f5f8fa;
    color: #0088c7;
}

/* ========================================
   MAIN NAV - White Background
======================================== */
.main-nav {
    background: #ffffff;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    height: 45px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.main-nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    position: relative;
}

/* Nav Menu */
.nav-menu {
    display: flex;
    align-items: center;
    gap: 0;
    height: 100%;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-item {
    height: 100%;
    display: flex;
    align-items: center;
    position: relative;
}

.nav-link {
    color: #333;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    padding: 0 14px;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.nav-link.nav-home {
    color: #0088c7;
}

.nav-link.nav-home i {
    font-size: 16px;
}

.nav-link i {
    font-size: 9px;
    opacity: 0.5;
    color: inherit;
    transition: transform 0.3s;
}

.nav-link:hover {
    color: #0088c7;
}

.nav-item:hover .nav-link i:last-child {
    transform: rotate(180deg);
}

/* Main Nav Dropdown Menu */
.nav-item .dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: #ffffff;
    min-width: 200px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.12);
    border-radius: 0 0 8px 8px;
    padding: 8px 0;
    display: none;
    z-index: 1001;
    list-style: none;
}

.nav-item:hover .dropdown-menu {
    display: block;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.nav-item .dropdown-menu li a {
    display: block;
    padding: 10px 20px;
    color: #333;
    font-size: 13px;
    text-decoration: none;
    transition: all 0.2s;
}

.nav-item .dropdown-menu li a:hover {
    background: #f5f8fa;
    color: #0088c7;
    padding-left: 25px;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    color: #333;
    cursor: pointer;
    padding: 10px;
}

/* ========================================
   RESPONSIVE STYLES
======================================== */
@media (max-width: 1200px) {
    .top-nav-links {
        gap: 12px;
    }

    .top-nav-links li a {
        font-size: 11px;
    }

    .nav-link {
        padding: 0 10px;
        font-size: 12px;
    }
}

@media (max-width: 992px) {
    .top-bar-container {
        gap: 16px;
    }

    .top-bar-right {
        flex: 1;
        justify-content: flex-end;
    }

    .top-nav {
        display: none;
    }

    .logo-mark {
        font-size: 32px;
    }

    .nav-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 85%;
        max-width: 320px;
        height: 100vh;
        height: 100dvh;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
        z-index: 1050;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        padding: 40px 20px 100px 20px;
        overflow-y: auto;
        transition: right 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
        border: none;
        border-radius: 0;
    }

    .nav-menu::-webkit-scrollbar {
        display: none;
    }

    .main-nav {
        height: 0;
        border: none;
        box-shadow: none;
        background: transparent;
    }

    .main-nav-container {
        padding: 0;
    }

    .nav-menu.active {
        right: 0;
    }

    /* Fixed Overlay: Rendered outside the menu but controlled independently via JS/body class */
    .mobile-menu-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background: rgba(0, 0, 0, 0.4);
        backdrop-filter: blur(2px);
        -webkit-backdrop-filter: blur(2px);
        z-index: 1040;
        /* Lower than nav-menu (1050) */
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.4s ease;
    }

    body.menu-open .mobile-menu-overlay {
        opacity: 1;
        pointer-events: auto;
    }

    .nav-item {
        height: auto;
        align-items: stretch;
        flex-direction: column;
        border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    }

    .nav-item:last-child {
        border-bottom: none;
    }

    .nav-link {
        height: auto;
        padding: 14px 6px;
        justify-content: space-between;
        font-size: 15px;
    }

    .nav-link.nav-home {
        justify-content: flex-start;
        gap: 12px;
    }

    .nav-item:hover .nav-link i:last-child {
        transform: none;
    }

    .nav-item .dropdown-menu {
        position: static;
        display: none;
        /* Accordion starts hidden */
        min-width: 0;
        box-shadow: none;
        border-radius: 0;
        padding: 0 0 12px 18px;
        margin-top: 0;
        background: transparent;
        animation: none;
    }

    /* Accordion active state */
    .nav-item.mobile-dropdown-open .dropdown-menu {
        display: block;
        animation: slideDownFade 0.3s ease forwards;
    }

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

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .nav-item .dropdown-menu li a {
        padding: 8px 0;
        font-size: 14px;
        color: #4b5563;
    }

    .nav-item .dropdown-menu li a:hover {
        background: transparent;
        color: #0088c7;
        padding-left: 0;
    }

    .mobile-menu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.15);
        color: #ffffff;
        margin-left: 10px;
        transition: background 0.3s;
    }

    .mobile-menu-toggle:hover {
        background: rgba(255, 255, 255, 0.25);
    }

    .main-nav-container {
        justify-content: space-between;
    }
}

@media (max-width: 768px) {
    .top-bar {
        max-height: none;
    }

    .top-bar-container {
        flex-wrap: nowrap;
        align-items: center;
        gap: 10px;
    }

    .top-bar-right {
        flex: 0 1 auto;
        width: auto;
        justify-content: flex-end;
    }

    .top-bar-actions {
        width: auto;
        justify-content: flex-end;
        gap: 5px;
    }

    .btn-cta {
        padding: 6px 12px;
        font-size: 11px;
    }

    .divider,
    .btn-cta-text {
        display: none;
    }

    .member-welcome {
        display: none;
    }

    .websites-dropdown {
        display: none;
    }
}

@media (max-width: 576px) {

    .top-bar-container,
    .main-nav-container {
        padding: 0 10px;
    }

    .logo-tagline {
        display: none;
    }

    .logo-mark {
        font-size: 22px;
    }

    .btn-cta,
    .logout-btn {
        padding: 8px 14px;
        font-size: 11px;
    }
}