/* ============================================================
   Navigation Layout — Floating pill style
   ============================================================ */

header {
    width: 100%;
    background: transparent;
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 0.625rem 1.5rem;
    box-shadow: none;
    border-bottom: none;
}

/* The nav container - flat style, no card */
header nav {
    display: flex;
    align-items: center;
    gap: 0;
    max-width: 1280px;
    margin: 0 auto;
    background: #ffffff;
    border-radius: 0;
    box-shadow: none;
    padding: 0.5rem 1.25rem;
    position: relative;
}

/* ---- Logo ---- */
.logo-section {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
    margin-right: 0.75rem;
    position: relative;
}

.logo-container {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.site-logo {
    height: var(--logo-height, 48px);
    width: auto;
    max-width: 200px;
    display: block;
    object-fit: contain;
}

.logo {
    font-size: 1.1rem;
    font-weight: 700;
    color: #3B5998;
    line-height: 1.2;
    display: block;
}

/* ---- Header social icons (hidden by default in pill style) ---- */
.header-social-links {
    display: none;
}

/* ---- Mobile Give Button (shown only on mobile, next to logo) ---- */
.mobile-give-btn {
    display: none;
    background: #3B5998;
    color: #ffffff;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.8125rem;
    text-decoration: none;
    margin-left: auto;
    margin-right: 0.75rem;
    white-space: nowrap;
    transition: background 0.2s;
}
.mobile-give-btn:hover { background: #2D4373; color: #fff; }

/* ---- Desktop Give item (first in menu) ---- */
.desktop-give-item { display: block; }

/* ---- Hamburger ---- */
.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.4rem;
    z-index: 1002;
    flex-shrink: 0;
}

.menu-toggle span {
    width: 22px;
    height: 2.5px;
    background: #1f2937;
    border-radius: 2px;
    transition: all 0.3s ease;
    display: block;
}

.menu-toggle.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.menu-toggle.active span:nth-child(2) { opacity: 0; }
.menu-toggle.active span:nth-child(3) { transform: rotate(-45deg) translate(7px, -6px); }

/* ---- Nav menu ---- */
.nav-menu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 0;
    align-items: center;
    flex-wrap: nowrap;
    flex: 1;
}

.nav-menu li { position: relative; }

/* All nav links — plain text, no background */
.nav-menu > li > a {
    display: block;
    padding: 0.5rem 0.7rem;
    color: #1f2937;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.8125rem;
    letter-spacing: 0.01em;
    white-space: nowrap;
    border-radius: 6px;
    transition: color 0.15s;
}

.nav-menu > li > a:hover { color: #3B5998; background: none; }

/* ---- GIVE CTA (first item) ---- */
.nav-menu a.nav-cta {
    background: #3B5998;
    color: #ffffff !important;
    padding: 0.55rem 1.35rem;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.875rem;
    margin-right: 0.5rem;
    box-shadow: none;
    transition: background 0.2s;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}
.nav-menu a.nav-cta:hover {
    background: #2D4373;
    color: #ffffff !important;
    transform: none;
    box-shadow: none;
}

/* ---- Logout button (last item) — push to far right ---- */
.nav-menu > li:last-child { margin-left: auto; }

/* Logout button uniform with GIVE */
.nav-menu > li:last-child form button,
.nav-menu > li:last-child > a {
    background: #3B5998 !important;
    color: #ffffff !important;
    padding: 0.55rem 1.35rem !important;
    border-radius: 8px !important;
    font-weight: 700 !important;
    font-size: 0.875rem !important;
    border: none !important;
    cursor: pointer;
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.4rem !important;
    white-space: nowrap;
    transition: background 0.2s !important;
    text-decoration: none;
    width: auto !important;
    text-align: left;
}
.nav-menu > li:last-child form button:hover,
.nav-menu > li:last-child > a:hover {
    background: #2D4373 !important;
}

/* ---- Dropdown ---- */
.nav-menu .dropdown { position: relative; }

.nav-menu .dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background: #ffffff;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    border-radius: 10px;
    padding: 0.4rem 0;
    min-width: 200px;
    z-index: 1002;
    border: 1px solid #e5e7eb;
}

.nav-menu .dropdown.open .dropdown-menu {
    display: block;
    animation: fadeInDown 0.2s ease;
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.nav-menu .dropdown-menu li { list-style: none; }

.nav-menu .dropdown-menu a {
    display: block;
    padding: 0.55rem 1.1rem;
    color: #374151;
    text-decoration: none;
    font-weight: 400;
    font-size: 0.8125rem;
    transition: background 0.15s, color 0.15s;
}

.nav-menu .dropdown-menu a:hover {
    background: #f3f4f6;
    color: #3B5998;
    padding-left: 1.35rem;
}

/* ---- Mobile menu header (hidden on desktop) ---- */
.mobile-menu-header { display: none; }

/* ---- Menu overlay ---- */
.menu-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 998;
}
.menu-overlay.active { display: block; }

/* ============================================================
   Tablet (769–1200px)
   ============================================================ */
@media (min-width: 769px) and (max-width: 1200px) {
    header { padding: 0.5rem 1rem; }

    header nav { padding: 0.5rem 1rem; gap: 0; }

    .nav-menu > li > a { padding: 0.45rem 0.55rem; font-size: 0.775rem; }

    .nav-menu a.nav-cta { padding: 0.55rem 1.1rem; font-size: 0.8125rem; }

    .nav-menu > li:last-child form button,
    .nav-menu > li:last-child > a {
        padding: 0.55rem 1.1rem !important;
        font-size: 0.8125rem !important;
    }

    .site-logo { height: 42px; }
}

/* ============================================================
   Mobile (≤768px) — slide-in drawer
   ============================================================ */
@media (max-width: 768px) {
    header { padding: 0.5rem 0.75rem; }

    header nav {
        border-radius: 10px;
        padding: 0.5rem 0.75rem;
        gap: 0;
    }

    .menu-toggle { display: flex; }

    .mobile-give-btn { display: inline-block; }

    .logo-section { flex: 1 1 auto; min-width: 0; margin-right: 0; }

    .logo-container { min-width: 0; }

    .site-logo { max-width: 55vw; height: auto; max-height: 44px; }

    .desktop-give-item { display: none; }

    .nav-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 280px;
        height: 100vh;
        background: #ffffff;
        flex-direction: column;
        padding: 1rem;
        gap: 0;
        align-items: stretch;
        overflow-y: auto;
        transition: right 0.3s ease;
        z-index: 1001;
        box-shadow: -4px 0 16px rgba(0,0,0,0.15);
        flex: none;
    }

    .nav-menu.active { right: 0; }

    .mobile-menu-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.75rem 0;
        border-bottom: 1px solid #e5e7eb;
        margin-bottom: 0.75rem;
    }

    .mobile-menu-title { font-size: 1.1rem; font-weight: 700; color: #1f2937; }

    .menu-close {
        background: none;
        border: none;
        font-size: 1.75rem;
        color: #6b7280;
        cursor: pointer;
        padding: 0;
        width: 32px;
        height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
        line-height: 1;
    }

    .nav-menu > li { width: 100%; }

    .nav-menu > li > a {
        padding: 0.875rem 1rem;
        border-radius: 8px;
        width: 100%;
        font-size: 0.9rem;
    }

    /* Last child margin-left: auto doesn't work in column flex */
    .nav-menu > li:last-child { margin-left: 0; margin-top: 0.5rem; }

    .nav-menu a.nav-cta {
        background: #3B5998 !important;
        color: #ffffff !important;
        margin-right: 0;
        margin-top: 0.5rem;
        display: block;
        text-align: center;
    }

    /* Dropdown arrow */
    .nav-menu .dropdown > a { padding-right: 2.5rem !important; position: relative; }
    .nav-menu .dropdown > a::after {
        content: '\f078';
        font-family: 'Font Awesome 6 Free';
        font-weight: 900;
        position: absolute;
        right: 1rem;
        top: 50%;
        transform: translateY(-50%);
        transition: transform 0.3s;
        display: block !important;
        font-size: 0.7rem;
        color: #6b7280;
    }
    .nav-menu .dropdown.open > a::after { transform: translateY(-50%) rotate(180deg); }

    .nav-menu .dropdown-menu {
        position: static !important;
        display: none;
        box-shadow: none;
        background: #f9fafb !important;
        border: none !important;
        border-radius: 8px;
        margin: 0.25rem 0 0.5rem 0.75rem;
        padding: 0.25rem 0 !important;
    }

    .nav-menu .dropdown.open > .dropdown-menu { display: block; }

    .nav-menu .dropdown-menu a {
        padding: 0.65rem 1rem !important;
        font-size: 0.875rem !important;
        border-left: 3px solid #3B5998;
        border-radius: 0 6px 6px 0;
        margin: 0.15rem 0;
        background: transparent !important;
        color: #374151 !important;
    }
    .nav-menu .dropdown-menu a:hover { background: #e5e7eb !important; }
}

@media (max-width: 480px) {
    .nav-menu { width: 100%; }
    .site-logo { max-height: 38px; }
}
