header {
    background: var(--glass);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    height: 80px;
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 30px rgba(0,0,0,0.08);
    transition: var(--transition);
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

/* Left: Logo Section */
.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    flex: 0 0 auto; /* Don't grow, don't shrink */
    margin-right: 3rem; /* PUSH LINKS AWAY */
}

.logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.logo-main {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.3px;
}

.logo-sub {
    font-size: 0.55rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 0.5px;
    white-space: nowrap;
}

/* Center: Nav Links */
.nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    list-style: none;
    flex: 1;
    justify-content: center;
    transition: var(--transition);
}

.nav-link {
    text-decoration: none;
    color: var(--text-main);
    font-weight: 700; /* Bolder for better readability */
    font-size: 0.7rem; /* Slightly smaller to fit everything */
    text-transform: uppercase;
    letter-spacing: 0.8px;
    transition: var(--transition);
    padding: 10px 0;
    white-space: nowrap;
}

.nav-link:hover {
    color: var(--accent);
}

.mobile-donate-item {
    display: none;
}

/* Right: Actions */
.nav-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 0 0 auto; /* Don't grow, don't shrink */
    justify-content: flex-end;
    margin-left: 3rem; /* PUSH LINKS AWAY */
}

.theme-toggle {
    cursor: pointer;
    font-size: 1.1rem;
    color: var(--primary);
}

.btn-login, .btn-donate {
    text-decoration: none;
    font-weight: 700;
    font-size: 0.75rem;
    padding: 0.4rem 0.8rem;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
    text-transform: uppercase;
}

.btn-login {
    color: var(--primary);
    border: 1.5px solid var(--primary);
}

.btn-login:hover {
    background: var(--primary);
    color: white;
}

.btn-donate {
    color: var(--secondary-dark);
    border: 1.5px solid var(--secondary);
}

.btn-donate:hover {
    background: var(--secondary);
    color: var(--primary);
}

/* Dropdown Menus */
.dropdown {
    position: relative;
    padding: 10px 0; /* Creates hover bridge */
}

.dropdown {
    position: relative; /* CRITICAL: This keeps the menu attached to the link */
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    min-width: 220px;
    box-shadow: 0 15px 50px rgba(0,0,0,0.2);
    border: 1px solid rgba(0,0,0,0.05);
    border-radius: 12px;
    list-style: none;
    padding: 0.8rem 0;
    margin: 0;
    display: none; /* STRICT HIDE: Prevents any overlap or space-taking */
    z-index: 9999;
}

.dropdown:hover .dropdown-menu {
    display: block; /* Only shows on hover */
    animation: slideUp 0.3s ease-out;
}

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

.dropdown-menu li {
    padding: 0;
}

.dropdown-menu a {
    display: block;
    padding: 0.8rem 1.5rem;
    color: var(--primary) !important; /* Force dark color on white background */
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 700;
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
}

.dropdown-menu a:hover {
    background: #f1f5f9;
    color: var(--primary);
}

/* Mobile Adjustments */
@media (max-width: 1024px) {
    header { height: 70px; }
    .nav-links {
        position: fixed;
        top: 70px;
        left: -100%;
        width: 100%;
        height: calc(100vh - 70px);
        background: white;
        flex-direction: column;
        padding: 2rem;
        justify-content: flex-start;
        align-items: flex-start;
        gap: 0;
        overflow-y: auto;
        display: flex !important; /* Force display for transition */
    }
    .nav-links.active { left: 0; }
    .nav-link { color: var(--primary); font-size: 1.1rem; padding: 1.2rem 0; border-bottom: 1px solid #f1f5f9; width: 100%; }
    .mobile-donate-item { display: block; width: 100%; }
    
    .dropdown-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        box-shadow: none;
        border: none;
        padding-left: 1.5rem;
        transform: none;
        display: none; /* Toggle this via JS */
        min-width: 100%;
    }
    .dropdown.active .dropdown-menu { display: block; }
    
    .nav-actions { display: none; }
    .logo {
        position: absolute;
        left: 1.5rem;
        top: 0.8rem;
    }
    .menu-toggle { 
        display: block; 
        font-size: 2rem; 
        color: var(--primary); 
        position: absolute;
        right: 1.5rem;
        top: 1.2rem;
        cursor: pointer;
    }
}

/* PWA Install Button Style */
.btn-install {
    display: none; /* Shown via JS only when installable */
    background: var(--accent);
    color: white;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.7rem;
    cursor: pointer;
    text-transform: uppercase;
    margin-right: 10px;
}
