/* ================================
   Reusable Navigation Bar Styles
   ================================ */

/* Navbar container */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    z-index: 999;
    transition: all 0.3s ease;
}

[data-theme="dark"] .navbar {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.4);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.navbar-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
}

/* Logo */
.navbar-logo {
    text-decoration: none;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary, #1a202c);
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
}

[data-theme="dark"] .navbar-logo {
    color: var(--text-primary-dark, #f1f5f9);
}

.logo-text {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Logo images */
.navbar-logo img {
    height: 75px;
    width: auto;
    object-fit: contain;
    transition: opacity 0.3s ease;
}

/* Show light logo in light mode, hide dark logo */
.navbar-logo .logo-light {
    display: block;
}

.navbar-logo .logo-dark {
    display: none;
}

/* Show dark logo in dark mode, hide light logo */
[data-theme="dark"] .navbar-logo .logo-light {
    display: none;
}

[data-theme="dark"] .navbar-logo .logo-dark {
    display: block;
}

/* Hamburger menu button */
.navbar-toggle {
    display: none;
    flex-direction: column;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    gap: 5px;
}

.hamburger-line {
    width: 25px;
    height: 3px;
    background: var(--text-primary, #1a202c);
    border-radius: 3px;
    transition: all 0.3s ease;
}

[data-theme="dark"] .hamburger-line {
    background: var(--text-primary-dark, #f1f5f9);
}

/* Navigation menu */
.navbar-menu {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 0.25rem;
}

.navbar-item {
    position: relative;
}

.navbar-link {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.75rem 0.65rem;
    text-decoration: none;
    color: var(--text-secondary, #4a5568);
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    border-radius: 6px;
    white-space: nowrap;
}

[data-theme="dark"] .navbar-link {
    color: var(--text-secondary-dark, #cbd5e1);
}

.navbar-link:hover {
    color: var(--accent-color);
    background: rgba(59, 130, 246, 0.1);
}

/* Active link */
.navbar-link.active {
    color: var(--accent-color);
    background: rgba(59, 130, 246, 0.15);
}

/* Dropdown */
.dropdown-arrow {
    font-size: 0.65em;
    transition: transform 0.3s ease;
    display: inline-block;
}

.dropdown:hover .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--navbar-bg, #ffffff);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    list-style: none;
    padding: 0.5rem 0;
    margin: 0.5rem 0 0 0;
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

[data-theme="dark"] .dropdown-menu {
    background: var(--navbar-bg-dark, #1e293b);
    border-color: var(--border-color-dark, #334155);
}

.dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Right-align dropdown for items near the end (FAQ, etc.) */
.navbar-item:nth-last-child(-n+3) .dropdown-menu {
    left: auto;
    right: 0;
}

.dropdown-link {
    display: block;
    padding: 0.75rem 1.25rem;
    color: var(--text-secondary, #4a5568);
    text-decoration: none;
    transition: all 0.3s ease;
}

[data-theme="dark"] .dropdown-link {
    color: var(--text-secondary-dark, #cbd5e1);
}

.dropdown-link:hover {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-color);
}

/* Active dropdown link */
.dropdown-link.active {
    color: var(--accent-color);
    background: rgba(59, 130, 246, 0.15);
}

/* Prevent body scroll when mobile menu is open */
body.menu-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

/* Mobile responsive */
@media (max-width: 1208px) {
    .navbar-toggle {
        display: flex;
    }
    
    .navbar-menu {
        position: fixed;
        top: 70px;
        left: 0;
        right: 0;
        height: calc(100vh - 70px);
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(20px) saturate(180%);
        -webkit-backdrop-filter: blur(20px) saturate(180%);
        border-bottom: 1px solid rgba(0, 0, 0, 0.1);
        flex-direction: column;
        padding: 1rem 1rem 3rem 1rem;
        gap: 0;
        overflow-y: auto;
        overflow-x: hidden;
        opacity: 0;
        transform: translateX(-100%);
        transition: opacity 0.3s ease, transform 0.3s ease;
        visibility: hidden;
        -webkit-overflow-scrolling: touch;
    }
    
    [data-theme="dark"] .navbar-menu {
        background: rgba(30, 41, 59, 0.98);
        backdrop-filter: blur(20px) saturate(180%);
        -webkit-backdrop-filter: blur(20px) saturate(180%);
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    .navbar-menu.active {
        opacity: 1;
        transform: translateX(0);
        visibility: visible;
    }
    
    .navbar-item {
        width: 100%;
    }
    
    .navbar-link {
        padding: 1rem;
    }
    
    .dropdown-menu {
        position: static;
        opacity: 0;
        visibility: hidden;
        transform: none;
        box-shadow: none;
        border: none;
        background: transparent;
        padding: 0;
        margin: 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease, opacity 0.3s ease, visibility 0.3s ease;
        pointer-events: none;
    }
    
    .dropdown.active .dropdown-menu {
        max-height: 500px;
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        padding-left: 1rem;
        padding-bottom: 0.5rem;
        margin-top: 0.5rem;
    }
    
    .dropdown-arrow {
        float: right;
    }
    
    /* Hamburger animation when active */
    .navbar-toggle.active .hamburger-line:nth-child(1) {
        transform: rotate(45deg) translateY(8px);
    }
    
    .navbar-toggle.active .hamburger-line:nth-child(2) {
        opacity: 0;
    }
    
    .navbar-toggle.active .hamburger-line:nth-child(3) {
        transform: rotate(-45deg) translateY(-8px);
    }
}
