/**
 * Navbar CSS — New Design
 * Dual navbar: top (social/auth) + main (logo/nav), both fixed, glass effect.
 * Both slide up when scrolling down > 80px, slide back when scrolling up.
 */

/* ===== TOP NAVBAR ===== */
.top-navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(9, 65, 25, 0.25);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 0.9rem;
    padding: 8px 20px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 999;
    transition: transform 0.4s ease, opacity 0.4s ease;
}

.top-navbar .social-icons {
    display: flex;
    align-items: center;
}

.top-navbar .social-icons a {
    margin-right: 15px;
    color: #fff;
    transition: color 0.2s;
    text-decoration: none;
    font-size: 1rem;
}

.top-navbar .social-icons a:hover {
    color: #1c913d;
}

.top-navbar .auth-buttons,
.top-navbar .user-menu {
    display: flex;
    gap: 10px;
    align-items: center;
}

.top-navbar .auth-buttons button,
.top-navbar .user-menu button {
    padding: 6px 16px;
    border: none;
    background: transparent;
    color: #fff;
    cursor: pointer;
    border-radius: 4px;
    font-family: "Montserrat", sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.top-navbar .auth-buttons button:hover,
.top-navbar .user-menu button:hover {
    background: #1c913d;
    transform: translateY(-1px);
}

.top-navbar .user-menu #userName {
    color: #a8f0c0;
    font-weight: 600;
    font-family: "Montserrat", sans-serif;
    font-size: 0.85rem;
    margin-right: 4px;
}

/* ===== MAIN NAVBAR ===== */
.mainNavbar {
    position: fixed;
    top: var(--top-navbar-height, 40px);
    left: 0;
    right: 0;
    background: rgba(9, 65, 25, 0.25);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    padding: 0 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 1000;
    transition: transform 0.4s ease, opacity 0.4s ease, background 0.3s ease, box-shadow 0.3s ease;
}

.mainNavbar.scrolled {
    background: rgba(9, 65, 25, 0.5);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

/* Slide-up hidden state */
.top-navbar.nav-hidden {
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
}

.mainNavbar.nav-hidden {
    transform: translateY(calc(-100% - var(--top-navbar-height, 40px)));
    opacity: 0;
    pointer-events: none;
}

/* ===== NAV CONTAINER ===== */
.main-nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 100%;
    height: 12vh;
    min-height: 60px;
}

/* ===== LOGO ===== */
.logo {
    color: #fff;
    font-size: 1.5rem;
    font-weight: bold;
    text-decoration: none !important;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.logo:hover {
    transform: scale(1.05);
}

.logo img {
    width: 80px;
    height: auto;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

/* ===== NAV MENU ===== */
.main-nav-menu {
    display: flex;
    list-style: none;
    gap: 0;
    margin: 0;
    padding: 0;
    flex-wrap: nowrap;
}

.main-nav-item {
    position: relative;
}

.main-nav-link {
    color: #fff;
    text-decoration: none !important;
    padding: 0.75rem 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    transition: all 0.3s ease;
    border-radius: 6px;
    font-family: "Montserrat", sans-serif;
    text-transform: uppercase;
    font-weight: 600;
    font-size: 0.78rem;
    letter-spacing: 0.4px;
    position: relative;
    white-space: nowrap;
}

/* Underline bar animation */
.main-nav-link::after {
    content: '';
    position: absolute;
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: 70%;
    height: 2px;
    background: linear-gradient(90deg, transparent, #fff, transparent);
    transition: transform 0.3s ease;
}

.main-nav-link:hover {
    color: #fff;
    text-decoration: none !important;
}

.main-nav-link:hover::after {
    transform: translateX(-50%) scaleX(1);
}

/* Active nav item */
.main-nav-item.active > .main-nav-link::after {
    transform: translateX(-50%) scaleX(1);
    background: linear-gradient(90deg, transparent, #4CAF50, transparent);
}

/* ===== DROPDOWN ARROW ===== */
.main-dropdown-arrow {
    font-size: 0.6rem;
    transition: transform 0.3s ease;
    opacity: 0.8;
}

.main-nav-item.dropdown-open .main-dropdown-arrow {
    transform: rotate(180deg);
}

/* ===== DROPDOWN MENU ===== */
.main-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    min-width: 220px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    border-radius: 10px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
    z-index: 1001;
    margin-top: 0.4rem;
    border: 1px solid rgba(255, 255, 255, 0.4);
    overflow: hidden;
}

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

.main-dropdown-item {
    display: block;
    padding: 0.75rem 1.2rem;
    color: #1a2e22;
    text-decoration: none !important;
    transition: all 0.2s ease;
    font-family: "Montserrat", sans-serif;
    text-transform: uppercase;
    font-weight: 600;
    font-size: 0.78rem;
    letter-spacing: 0.3px;
    position: relative;
}

/* Left accent bar */
.main-dropdown-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #1c913d;
    transform: scaleY(0);
    transition: transform 0.2s ease;
}

.main-dropdown-item:hover {
    background-color: rgba(9, 65, 25, 0.08);
    color: #094119;
    text-decoration: none !important;
    padding-left: 1.5rem;
}

.main-dropdown-item:hover::before {
    transform: scaleY(1);
}

.main-dropdown-item.active {
    background-color: rgba(9, 65, 25, 0.12);
    color: #094119;
    padding-left: 1.5rem;
}

.main-dropdown-item.active::before {
    transform: scaleY(1);
}

/* ===== MOBILE TOGGLE ===== */
.mobile-toggle {
    display: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #fff;
    padding: 0.5rem;
    border-radius: 4px;
    transition: background 0.2s;
}

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

/* ===== RESPONSIVE ===== */

/* Laptop / MacBook (1200px – 1440px) */
@media (max-width: 1440px) {
    .main-nav-link {
        font-size: 0.75rem;
        padding: 0.7rem 0.65rem;
        letter-spacing: 0.2px;
    }
    .logo img {
        width: 68px;
    }
    .main-nav-container {
        height: 10vh;
        min-height: 56px;
    }
    .main-dropdown-menu {
        min-width: 190px;
    }
    .main-dropdown-item {
        font-size: 0.75rem;
        padding: 0.65rem 1rem;
    }
}

@media (max-width: 1280px) {
    .main-nav-link {
        font-size: 0.72rem;
        padding: 0.65rem 0.55rem;
        letter-spacing: 0.1px;
    }
    .logo img {
        width: 62px;
    }
    .mainNavbar {
        padding: 0 1.2rem;
    }
}

@media (max-width: 1100px) {
    .main-nav-link {
        font-size: 0.7rem;
        padding: 0.6rem 0.5rem;
    }
}

@media (max-width: 900px) {
    .mobile-toggle {
        display: block;
    }

    .main-nav-menu {
        position: fixed;
        top: 0;
        right: -100%;
        height: 100vh;
        width: 80%;
        max-width: 320px;
        background: rgba(9, 65, 25, 0.97);
        backdrop-filter: blur(20px);
        flex-direction: column;
        padding: 5rem 0 2rem;
        box-shadow: -4px 0 24px rgba(0, 0, 0, 0.3);
        transition: right 0.35s ease;
        overflow-y: auto;
        gap: 0;
        z-index: 2000;
    }

    .main-nav-menu.mobile-open {
        right: 0;
    }

    .main-nav-item {
        width: 100%;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .main-nav-link {
        padding: 1rem 1.5rem;
        font-size: 0.85rem;
        border-radius: 0;
        justify-content: space-between;
    }

    .main-nav-link::after {
        display: none;
    }

    .main-dropdown-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        background: rgba(0, 0, 0, 0.2);
        border-radius: 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
        margin-top: 0;
        border: none;
    }

    .main-nav-item.mobile-dropdown-open .main-dropdown-menu {
        max-height: 400px;
    }

    .main-dropdown-item {
        color: rgba(255, 255, 255, 0.85);
        padding: 0.7rem 2rem;
        font-size: 0.78rem;
    }

    .main-dropdown-item:hover {
        background: rgba(28, 145, 61, 0.2);
        color: #fff;
        padding-left: 2.5rem;
    }

    /* Close button (X) inside mobile menu */
    .main-nav-menu::before {
        content: '\f00d';
        font-family: 'Font Awesome 6 Free';
        font-weight: 900;
        position: fixed;
        top: 1.2rem;
        right: 1.5rem;
        font-size: 1.5rem;
        cursor: pointer;
        color: rgba(255,255,255,0.8);
        z-index: 2001;
    }
}

/* ===== TOP NAVBAR RESPONSIVE ===== */
/* Keep the top bar on a single row at every width so the dynamically
   measured --top-navbar-height stays stable and content never wraps. */
.top-navbar .auth-buttons,
.top-navbar .user-menu { flex-wrap: nowrap; }

.top-navbar .auth-buttons button,
.top-navbar .user-menu button { white-space: nowrap; }

@media (max-width: 768px) {
    .top-navbar { padding: 6px 14px; font-size: 0.82rem; }
    .top-navbar .social-icons a { margin-right: 11px; font-size: 0.92rem; }
    .top-navbar .auth-buttons,
    .top-navbar .user-menu { gap: 6px; }
    .top-navbar .auth-buttons button,
    .top-navbar .user-menu button { padding: 5px 11px; font-size: 0.78rem; }
    #registerClubBtn { padding: 0.35rem 0.7rem !important; font-size: 0.74rem !important; margin-right: 0.15rem !important; }
}

@media (max-width: 600px) {
    /* Social icons are secondary — hide them to give the auth/user actions room */
    .top-navbar .social-icons { display: none; }
    .top-navbar { justify-content: flex-end; }
    .top-navbar .auth-buttons,
    .top-navbar .user-menu { justify-content: flex-end; }
    .top-navbar .user-menu #userName {
        max-width: 96px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        margin-right: 2px;
    }
}

@media (max-width: 430px) {
    .top-navbar { padding: 6px 8px; }
    .top-navbar .auth-buttons,
    .top-navbar .user-menu { gap: 2px; }
    .top-navbar .auth-buttons button,
    .top-navbar .user-menu button { padding: 4px 6px; font-size: 0.62rem; }
    #registerClubBtn { padding: 0.3rem 0.4rem !important; font-size: 0.58rem !important; margin-right: 0 !important; }
    .top-navbar .user-menu #userName { display: none; }
}
