/* ══════════════════════════════════════════════════════════════════════════
   Parker Physics — Shared Navigation Styles
   ══════════════════════════════════════════════════════════════════════════ */

nav {
    position: sticky; top: 0; z-index: 600;
    height: 50px; min-height: 50px;
    background: rgba(4,2,16,.93); backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255,255,255,.07);
    display: flex; align-items: center; padding: 0 16px; gap: 6px;
}
.nav-brand {
    display: flex; align-items: center; gap: 8px;
    font-size: .95rem; font-weight: 700; text-decoration: none; white-space: nowrap;
    background: linear-gradient(45deg, #ffd700, #ff8c00);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
    margin-right: 2px; flex-shrink: 0;
}
.nav-logo-img { height: 30px; width: auto; border-radius: 50%; flex-shrink: 0; }
.nav-menu { display: flex; align-items: center; gap: 4px; flex: 1; min-width: 0; }
.nav-item {
    padding: 5px 10px; background: rgba(255,255,255,.07);
    border: 1px solid rgba(255,255,255,.12); border-radius: 5px;
    color: #ccc; text-decoration: none; font-size: .8rem; white-space: nowrap;
    transition: background .2s, border-color .2s, color .2s; flex-shrink: 0;
    font-family: inherit; cursor: pointer; line-height: 1.3;
}
.nav-item.active { background: linear-gradient(45deg, #ff8c00, #ffd700); border-color: #ff8c00; color: #000; font-weight: 600; }
.nav-spacer { flex: 1; }
.nav-auth-sep { width: 1px; height: 22px; background: rgba(255,255,255,.15); margin: 0 3px; flex-shrink: 0; }

/* Hover only on devices with a real pointer (not touch) */
@media (hover: hover) and (pointer: fine) {
    .nav-item:hover { background: rgba(255,255,255,.16); border-color: rgba(255,200,0,.4); color: #fff; }
    .nav-drop-btn:hover { background: rgba(255,255,255,.16); color: #fff; }
}

/* Auth buttons */
.nav-login { background: transparent !important; border-color: rgba(255,255,255,.22) !important; color: #bbb !important; }
.nav-signup { background: linear-gradient(45deg, #ff8c00, #ffd700) !important; border-color: #ff8c00 !important; color: #000 !important; font-weight: 700 !important; }
.nav-signup:hover { filter: brightness(1.12) !important; }
.nav-dash { background: rgba(0,200,200,.1) !important; border-color: rgba(0,200,200,.25) !important; color: #0cc !important; }
.nav-signout { background: transparent !important; border-color: rgba(255,80,80,.15) !important; color: #977 !important; }
.nav-admin-link {
    background: rgba(255,60,60,.1) !important; border-color: rgba(255,60,60,.25) !important;
    color: #f66 !important; font-size: .72rem !important; font-weight: 700 !important;
}
@media (hover: hover) and (pointer: fine) {
    .nav-login:hover { background: rgba(255,255,255,.1) !important; color: #fff !important; }
    .nav-dash:hover { background: rgba(0,200,200,.2) !important; }
    .nav-signout:hover { background: rgba(255,80,80,.1) !important; color: #f88 !important; }
    .nav-admin-link:hover { background: rgba(255,60,60,.2) !important; }
}

/* PRO badge */
.nav-badge-pro {
    display: inline-block; padding: 1px 5px; border-radius: 3px;
    font-size: .55rem; font-weight: 700; letter-spacing: .06em;
    background: rgba(255,180,0,.12); color: #ffa500; border: 1px solid rgba(255,180,0,.25);
    margin-left: 3px; vertical-align: middle; line-height: 1.4;
}

/* ── Dropdown menus ──────────────────────────────────────────────────────── */
.nav-drop { position: relative; flex-shrink: 0; }
.nav-drop-btn {
    padding: 5px 10px; background: rgba(255,255,255,.07);
    border: 1px solid rgba(255,255,255,.12); border-radius: 5px;
    color: #ccc; font-size: .8rem; cursor: pointer; font-family: inherit;
    transition: background .2s, border-color .2s, color .2s; white-space: nowrap;
}
.nav-drop-btn.active { background: linear-gradient(45deg, #ff8c00, #ffd700); border-color: #ff8c00; color: #000; font-weight: 600; }

/* Caret indicator */
.nav-caret {
    display: inline-block; font-size: .6em; margin-left: 2px;
    transition: transform .25s ease; vertical-align: middle;
}
.nav-drop.open .nav-caret { transform: rotate(180deg); }

/* Dropdown panel */
.nav-drop-menu {
    display: block; position: absolute; top: 100%; left: 0;
    background: rgba(5,2,18,.97); backdrop-filter: blur(18px);
    border: 1px solid rgba(255,255,255,.11); border-radius: 9px;
    padding: 10px 0 8px; min-width: 268px; z-index: 800;
    box-shadow: 0 14px 44px rgba(0,0,0,.80);
    opacity: 0; visibility: hidden; pointer-events: none;
    transform: translateY(-6px);
    transition: opacity .2s ease, visibility .2s ease, transform .2s ease;
}

/* Invisible bridge to prevent hover loss in the gap between button and menu */
.nav-drop-menu::before {
    content: '';
    position: absolute;
    top: -12px; left: -8px; right: -8px;
    height: 16px;
    background: transparent;
}

/* Show on .open class (JS-managed for both hover and click) */
.nav-drop.open .nav-drop-menu {
    opacity: 1; visibility: visible; pointer-events: auto; transform: translateY(0);
}

/* Subtle highlight on the dropdown button when menu is open */
.nav-drop.open .nav-drop-btn:not(.active) {
    background: rgba(255,255,255,.14);
    border-color: rgba(255,200,0,.3);
    color: #fff;
}

/* Dropdown items */
.nav-drop-link {
    display: flex; align-items: center; gap: 11px;
    padding: 8px 16px; text-decoration: none;
    transition: background .15s;
    min-height: 38px;
}
.nav-drop-link.active { background: rgba(255,200,0,.06); }
.nav-drop-link.active .ndl-title { color: #ffd700 !important; font-weight: 600; }
.ndl-icon { font-size: 1.05rem; width: 20px; text-align: center; flex-shrink: 0; opacity: .72; transition: opacity .15s; }
.ndl-body { display: flex; flex-direction: column; gap: 1px; }
.ndl-title { color: #c8c8c8; font-size: .82rem; font-weight: 500; line-height: 1.25; transition: color .15s; }
.ndl-sub { color: #484e60; font-size: .70rem; line-height: 1.2; transition: color .15s; }

@media (hover: hover) and (pointer: fine) {
    .nav-drop-link:hover { background: rgba(255,255,255,.07); padding-left: 19px; }
    .nav-drop-link:hover .ndl-title { color: #fff; }
    .nav-drop-link:hover .ndl-sub { color: #7a8090; }
    .nav-drop-link:hover .ndl-icon { opacity: 1; }
}

/* Touch active state — immediate visual feedback */
.nav-drop-link:active {
    background: rgba(255,255,255,.10);
}
.nav-item:active {
    transform: scale(0.97);
}

/* Section dividers inside dropdowns */
.nav-drop-section {
    padding: 7px 16px 3px; font-size: .63rem; font-weight: 700;
    letter-spacing: .09em; color: #3d4255; text-transform: uppercase;
    border-top: 1px solid rgba(255,255,255,.06); margin-top: 3px;
}
.nav-drop-section:first-child { border-top: none; margin-top: 0; padding-top: 4px; }

/* ── Animated hamburger burger ──────────────────────────────────────────── */
.nav-burger {
    display: none; margin-left: auto;
    background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14);
    border-radius: 5px; color: #fff; padding: 8px 9px;
    cursor: pointer; line-height: 0; transition: background .2s;
    flex-direction: column; gap: 4px; align-items: center; justify-content: center;
    width: 40px; height: 36px;
}
.burger-line {
    display: block; width: 18px; height: 2px;
    background: #fff; border-radius: 1px;
    transition: transform .25s ease, opacity .2s ease;
}
/* Animated X when open */
.nav-burger.open .burger-line:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-burger.open .burger-line:nth-child(2) { opacity: 0; }
.nav-burger.open .burger-line:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ── Mobile / Tablet (<=1024px) ─────────────────────────────────────────── */
@media (max-width: 1024px) {
    .nav-burger { display: flex; }
    .nav-spacer, .nav-auth-sep { display: none; }

    .nav-menu {
        display: none; flex-direction: column; align-items: stretch;
        position: absolute; top: 50px; left: 0; right: 0;
        background: rgba(3,1,14,.98); backdrop-filter: blur(18px);
        border-bottom: 1px solid rgba(255,255,255,.1);
        padding: 8px 12px 14px; gap: 3px; z-index: 700;
        max-height: calc(100vh - 50px); overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        /* Safe area for notched phones */
        padding-bottom: max(14px, env(safe-area-inset-bottom));
    }
    .nav-menu.open { display: flex; }

    /* Larger touch targets (WCAG 44px minimum) */
    .nav-item { padding: 12px 14px; font-size: .9rem; min-height: 44px; display: flex; align-items: center; }
    .nav-drop-btn {
        padding: 12px 14px; font-size: .9rem; width: 100%; text-align: left;
        min-height: 44px; display: flex; align-items: center; justify-content: space-between;
    }

    /* Mobile: dropdowns expand inline as accordion */
    .nav-drop-menu {
        position: static; opacity: 1; visibility: visible; pointer-events: auto;
        transform: none; box-shadow: none;
        border: none; border-radius: 0;
        background: transparent; backdrop-filter: none; min-width: 0;
        margin-top: 0;
        /* Accordion animation via max-height */
        max-height: 0; overflow: hidden; padding: 0;
        transition: max-height .3s ease, padding .3s ease;
    }
    .nav-drop-menu::before { display: none; }

    .nav-drop.open .nav-drop-menu {
        max-height: 600px; /* large enough for any dropdown content */
        padding: 4px 0 4px 12px;
    }

    .nav-drop-link {
        padding: 10px 12px;
        min-height: 44px;
        border-radius: 6px;
    }
    .nav-drop-link:active { background: rgba(255,255,255,.10); }
    .ndl-icon { font-size: .9rem; }

    /* Visual indicator for open dropdown */
    .nav-drop.open .nav-drop-btn:not(.active) {
        background: rgba(255,255,255,.08);
        border-color: rgba(255,200,0,.2);
    }
}

/* ── Custom scrollbar for mobile menu ──────────────────────────────────── */
.nav-menu::-webkit-scrollbar { width: 4px; }
.nav-menu::-webkit-scrollbar-track { background: transparent; }
.nav-menu::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 2px; }
