/* ============================================================
   Cricket Manager — Navigation Styles
   ============================================================ */

/* ── Global Top Nav ── */
.global-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--cm-green-800, #1a472a);
    padding: 0.6rem 1.5rem;
    border-bottom: 3px solid var(--cm-green-600, #2d6a4f);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
}

.global-nav a,
.global-nav li {
    color: rgba(255, 255, 255, 0.85);
}

.global-nav a:hover {
    color: #fff;
}

.global-nav ul:first-child a {
    color: #fff;
    font-size: 1.1rem;
}

/* Active link in global nav */
.global-nav a.active-nav {
    font-weight: 700;
    color: #fff;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    text-decoration: none;
    padding: 0.35rem 0.75rem;
    text-underline-offset: unset;
}

/* Non-active links in global nav — override generic active-nav style */
.global-nav a:not(.active-nav) {
    text-decoration: none;
}

/* ── Dropdown (CSS-only, no JavaScript) ── */
.nav-dropdown {
    position: relative;
}

.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 220px;
    background: #fff;
    border: 1px solid var(--cm-gray-200, #e5e7eb);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    padding: 0.3rem 0;
    margin: 0;
    list-style: none;
    z-index: 200;
    flex-direction: column;
    overflow: hidden;
}

.nav-dropdown-menu li {
    padding: 0;
    margin: 0;
}

.nav-dropdown-menu li a {
    display: block;
    padding: 0.55rem 1rem;
    white-space: nowrap;
    text-decoration: none;
    color: var(--cm-gray-700, #374151);
    font-size: 0.9rem;
    transition: background 0.1s, color 0.1s;
}

.nav-dropdown-menu li a:hover {
    background: var(--cm-green-50, #f0fdf4);
    color: var(--cm-green-800, #1a472a);
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu {
    display: flex;
}

/* ── Team Sub-Navigation ── */
.team-subnav {
    background: linear-gradient(180deg, var(--cm-green-50, #f0fdf4), #fff);
    border-bottom: 1px solid var(--cm-green-100, #d8f3dc);
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    margin-bottom: 0;
}

.team-subnav ul {
    display: flex;
    gap: 0.3rem;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
    justify-content: center;
}

.team-subnav li {
    margin: 0;
    padding: 0;
}

.team-subnav a {
    padding: 0.4rem 0.9rem;
    border-radius: 20px;
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--cm-green-700, #1b4332);
    transition: background 0.15s, color 0.15s;
}

.team-subnav a:hover {
    background: var(--cm-green-100, #d8f3dc);
    color: var(--cm-green-800, #1a472a);
}

.team-subnav a.active-nav {
    background: var(--cm-green-800, #1a472a);
    color: #fff;
    text-decoration: none;
    font-weight: 600;
}

.team-subnav a:not(.active-nav):hover {
    background: var(--cm-green-100, #d8f3dc);
}

/* ── Hamburger Button ── */
.nav-hamburger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    margin: 0;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    z-index: 201;
    min-width: 44px;
    min-height: 44px;
    align-items: center;
}

.nav-hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: transform 0.25s ease, opacity 0.2s ease;
}

.nav-hamburger.is-active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.nav-hamburger.is-active span:nth-child(2) {
    opacity: 0;
}

.nav-hamburger.is-active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ── Mobile Nav ── */
@media (max-width: 768px) {
    .global-nav {
        flex-wrap: wrap;
        position: sticky;
        top: 0;
    }

    .nav-hamburger {
        display: flex;
    }

    .nav-links {
        display: none;
        flex-direction: column;
        width: 100%;
        padding: 0.5rem 0;
        margin: 0;
        gap: 0;
        order: 3;
    }

    .nav-links.nav-open {
        display: flex;
    }

    .nav-links li {
        width: 100%;
        padding: 0;
    }

    .nav-links li a {
        display: block;
        padding: 0.75rem 1rem;
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .nav-links li a.active-nav {
        padding: 0.75rem 1rem;
    }

    /* Mobile dropdown — show inline instead of absolute */
    .nav-dropdown .nav-dropdown-menu {
        position: static;
        background: rgba(255, 255, 255, 0.08);
        border: none;
        border-radius: 0;
        box-shadow: none;
        padding: 0;
        min-width: unset;
    }

    .nav-dropdown .nav-dropdown-menu li a {
        color: rgba(255, 255, 255, 0.85);
        padding-left: 2rem;
        font-size: 0.88rem;
    }

    .nav-dropdown .nav-dropdown-menu li a:hover {
        background: rgba(255, 255, 255, 0.1);
        color: #fff;
    }

    /* On mobile, show dropdown on click (via nav-open parent) */
    .nav-links.nav-open .nav-dropdown .nav-dropdown-menu {
        display: flex;
    }

    /* Team sub-nav: scrollable on mobile */
    .team-subnav ul {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        justify-content: flex-start;
        padding-bottom: 0.3rem;
    }

    .team-subnav a {
        white-space: nowrap;
        min-height: 44px;
        display: flex;
        align-items: center;
    }
}

/* ── Print: hide nav ── */
@media print {
    .global-nav,
    .team-subnav {
        display: none;
    }
}
