/* ─── Shared Navigation (desktop + mobile slide-out) ─── */

/* ── Badges ─────────────────────────────────────── */
.nav-badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 20px;
    line-height: 1;
    vertical-align: middle;
    margin-left: 4px;
}

.badge-new  { background: #5B7A5E; color: #fff; }
.badge-live { background: #C84040; color: #fff; }
.badge-pro  { background: var(--amber, #C8843C); color: #fff; }
.badge-ebay { background: linear-gradient(135deg, #0064D2, #004BA0); color: #fff; }

/* ── Desktop: sections become hover dropdowns ── */
@media (min-width: 769px) {
    /* Tighter gap to prevent overflow */
    .nav-links {
        gap: 14px !important;
        flex-wrap: nowrap;
    }

    /* Hide hamburger + drawer header on desktop */
    .mobile-hamburger,
    .nav-links-header {
        display: none !important;
    }

    /* Section wrapper is positioned relative for dropdown */
    .nav-section {
        position: relative;
    }

    /* Section header visible as nav label on desktop */
    .nav-section-header {
        display: flex !important;
        align-items: center;
        gap: 4px;
        background: none;
        border: none;
        cursor: pointer;
        font-family: 'DM Sans', sans-serif;
        font-size: 0.9rem;
        font-weight: 500;
        color: var(--warm-gray, #8A7E72);
        padding: 4px 2px;
        transition: color 0.15s;
        white-space: nowrap;
    }

    .nav-section-header:hover {
        color: var(--warm-black, #1A1612);
    }

    .nav-section-header .nav-chevron {
        width: 10px;
        height: 10px;
        opacity: 0.4;
        transition: transform 0.2s, opacity 0.2s;
    }

    .nav-section:hover .nav-section-header .nav-chevron {
        transform: rotate(180deg);
        opacity: 0.7;
    }

    .nav-section-header .nav-section-label {
        display: flex;
        align-items: center;
        gap: 4px;
    }

    /* Dropdown items hidden by default, shown on hover */
    .nav-section-items {
        display: none;
        position: absolute;
        top: 100%;
        left: 50%;
        transform: translateX(-50%);
        background: var(--cream, #FAF6F0);
        border: 1px solid rgba(26, 22, 18, 0.1);
        border-radius: 12px;
        box-shadow: 0 8px 24px rgba(26, 22, 18, 0.1);
        padding: 8px 0;
        min-width: 170px;
        z-index: 100;
        flex-direction: column;
    }

    .nav-section:hover .nav-section-items {
        display: flex;
    }

    .nav-section-items a {
        padding: 8px 18px;
        white-space: nowrap;
        font-size: 0.88rem;
        transition: background 0.12s, color 0.12s;
    }

    .nav-section-items a:hover {
        background: rgba(200, 132, 60, 0.08);
        color: var(--warm-black, #1A1612);
    }

    /* Active link: subtle amber underline on desktop */
    .nav-links a.active {
        color: var(--warm-black, #1A1612) !important;
        font-weight: 600;
    }

    /* Hide Home link on desktop (dashboard is accessible) */
    .nav-home-link {
        display: none;
    }
}

/* ── Hamburger button ──────────────────────────── */
.mobile-hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 1001;
    flex-shrink: 0;
}

.mobile-hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--warm-black, #1A1612);
    border-radius: 2px;
    transition: all 0.25s ease;
}

.mobile-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.mobile-hamburger.open span:nth-child(2) { opacity: 0; }
.mobile-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Overlay ───────────────────────────────────── */
.mobile-nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(26, 22, 18, 0.4);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-nav-overlay.open {
    display: block;
    opacity: 1;
}

/* ── Mobile breakpoint ─────────────────────────── */
@media (max-width: 768px) {

    .mobile-hamburger {
        display: flex;
    }

    nav {
        position: relative;
    }

    /* Slide-out drawer */
    .nav-links {
        display: none !important;
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: 300px;
        max-width: 88vw;
        background: var(--cream, #FAF6F0);
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0 !important;
        padding: 0 !important;
        z-index: 1000;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch; /* iOS Safari smooth scrolling + touch fix */
        box-shadow: -4px 0 32px rgba(26, 22, 18, 0.14);
        transform: translateX(100%);
        transition: transform 0.3s ease;
    }

    .nav-links.mobile-open {
        display: flex !important;
        transform: translateX(0);
    }

    /* ── Drawer header area ─── */
    .nav-links-header {
        padding: 20px 24px 16px;
        border-bottom: 1px solid rgba(26, 22, 18, 0.08);
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .nav-links-close {
        background: none;
        border: none;
        cursor: pointer;
        padding: 4px;
        color: var(--warm-gray, #8A7E72);
        font-size: 1.2rem;
        line-height: 1;
        display: flex;
        align-items: center;
    }

    /* ── Top-level links (Home, Dashboard) ── */
    .nav-home-link,
    .nav-dashboard-link {
        display: block;
        padding: 14px 24px;
        font-size: 0.95rem;
        font-weight: 500;
        color: var(--warm-gray, #8A7E72);
        text-decoration: none;
        border-bottom: 1px solid rgba(26, 22, 18, 0.06);
        border-left: 3px solid transparent;
        transition: color 0.15s, border-left-color 0.15s;
    }

    .nav-home-link:hover, .nav-dashboard-link:hover,
    .nav-home-link.active, .nav-dashboard-link.active {
        color: var(--warm-black, #1A1612);
        border-left-color: var(--amber, #C8843C);
        background: rgba(200, 132, 60, 0.04);
    }

    /* ── Section wrapper ── */
    .nav-section {
        display: block;
        border-bottom: 1px solid rgba(26, 22, 18, 0.08);
    }

    /* ── Section header (accordion trigger) ── */
    .nav-section-header {
        display: flex;
        width: 100%;
        align-items: center;
        justify-content: space-between;
        padding: 14px 24px;
        background: none;
        border: none;
        cursor: pointer;
        font-family: 'DM Sans', sans-serif;
        font-size: 0.7rem;
        font-weight: 700;
        letter-spacing: 1px;
        text-transform: uppercase;
        color: var(--warm-gray, #8A7E72);
        transition: color 0.15s;
    }

    .nav-section-header:hover {
        color: var(--warm-black, #1A1612);
    }

    .nav-section-header .nav-section-label {
        display: flex;
        align-items: center;
        gap: 8px;
    }

    /* Chevron */
    .nav-chevron {
        transition: transform 0.25s ease;
        flex-shrink: 0;
        opacity: 0.5;
    }

    .nav-section.open .nav-chevron {
        transform: rotate(180deg);
        opacity: 1;
    }

    /* ── Section items (hidden by default, shown when open) ── */
    .nav-section-items {
        display: none;
        flex-direction: column;
        padding-bottom: 6px;
    }

    .nav-section.open .nav-section-items {
        display: flex;
    }

    .nav-section-items a {
        display: flex;
        align-items: center;
        gap: 0;
        padding: 12px 24px 12px 32px;
        font-size: 0.9rem;
        font-weight: 500;
        color: var(--warm-gray, #8A7E72);
        text-decoration: none;
        border-left: 3px solid transparent;
        transition: color 0.15s, border-left-color 0.15s, background 0.15s;
    }

    .nav-section-items a:hover {
        color: var(--warm-black, #1A1612);
        background: rgba(26, 22, 18, 0.03);
    }

    .nav-section-items a.active {
        color: var(--warm-black, #1A1612);
        font-weight: 600;
        border-left-color: var(--amber, #C8843C);
        background: rgba(200, 132, 60, 0.06);
    }

    /* ── User chip & logout inside account section ── */
    .nav-section-items .user-chip {
        margin: 8px 24px 4px;
        width: calc(100% - 48px);
        padding: 8px 12px;
        background: rgba(26, 22, 18, 0.04);
        border-radius: 10px;
    }

    .nav-section-items .btn-logout {
        margin: 4px 24px 8px;
        width: calc(100% - 48px);
        text-align: center;
        border-radius: 8px;
        padding: 8px 14px;
    }
}
