/* ══════════════════════════════════════════════════════════════════
   NAVBAR — Desktop 3-column layout + Mobile drawer
   ══════════════════════════════════════════════════════════════════ */

/* ── Navbar Shell ────────────────────────────────────────────────── */
.navbar {
    background: var(--navy);
    height: var(--nav-height);
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    box-shadow: 0 2px 12px rgba(26,50,99,0.25);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    height: 100%;
    display: flex;
    align-items: center;
}

/* ── Brand (ซ้าย) ────────────────────────────────────────────────── */
.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: white;
    font-weight: 700;
    flex-shrink: 0;
    cursor: pointer;
}

.nav-brand-text {
    font-size: 1.6rem;
    color: white;
    white-space: nowrap;
}

/* ── Links (กลาง — absolute center desktop) ──────────────────────── */
.nav-links {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 0.1rem;
}

/* ── Auth (ขวา — desktop) ────────────────────────────────────────── */
.nav-auth {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-left: auto;
    flex-shrink: 0;
}

/* Mobile auth section — ซ่อนใน desktop */
.nav-auth-mobile {
    display: none;
}

/* ── Nav Link ────────────────────────────────────────────────────── */
.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.85rem;
    color: rgba(255,255,255,0.8);
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
    line-height: 1;
}

    .nav-link:hover {
        color: white;
        background: rgba(255,255,255,0.12);
    }

    .nav-link.active {
        color: var(--gold);
        background: rgba(250,185,91,0.12);
    }

/* Icon alignment */
.nav-link i:not(.drop-arrow) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    position: relative;
    top: 1px;
}

/* ── Drop Arrow — ซ่อนทิ้ง ───────────────────────────────────────── */
.drop-arrow { display: none; }

/* ── Dropdown ────────────────────────────────────────────────────── */
.nav-dropdown {
    position: relative;
    /* padding-bottom สร้าง invisible bridge ให้เมาส์เดินลงไป menu ได้ */
    padding-bottom: 8px;
    margin-bottom: -8px;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;          /* ชิดกับ button ไม่มี gap */
    left: 0;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: 0 8px 24px rgba(26,50,99,0.15);
    min-width: 220px;
    z-index: 200;
    overflow: hidden;
    padding: 0.25rem 0;
}

/* Desktop — Hover แสดง dropdown */
@media (min-width: 769px) {
    .nav-dropdown:hover .dropdown-menu,
    .nav-dropdown-hover:hover .dropdown-menu {
        display: block;
        animation: fadeIn 0.15s ease;
    }

    .nav-dropdown:hover > .nav-link,
    .nav-dropdown-hover:hover > .nav-link {
        color: white;
        background: rgba(255,255,255,0.12);
    }
}

/* Mobile — Click แสดง dropdown */
.nav-dropdown.dropdown-open .dropdown-menu {
    display: block;
}

.nav-dropdown.dropdown-open > .nav-link {
    color: white;
    background: rgba(255,255,255,0.12);
}

/* Dropdown right-align (auth menu) */
.dropdown-menu-right {
    left: auto !important;
    right: 0 !important;
}

/* ── Dropdown Items ──────────────────────────────────────────────── */
.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.65rem 1rem;
    color: var(--text);
    font-size: 0.875rem;
    transition: var(--transition);
    cursor: pointer;
    white-space: nowrap;
}

    .dropdown-item:hover {
        background: var(--cream);
        color: var(--navy);
    }

    .dropdown-item.text-muted {
        color: var(--text-muted);
        cursor: default;
    }

    .dropdown-item.text-warning { color: #d97706 !important; }
    .dropdown-item.text-danger  { color: #dc2626 !important; }

.dropdown-item-disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
    color: var(--text-muted) !important;
}

    .dropdown-item-disabled i {
        color: var(--gold);
        font-size: 0.75rem;
    }

.dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 0.25rem 0;
}

/* ── Auth Buttons ─────────────────────────────────────────────────── */
.nav-login-btn {
    color: rgba(255,255,255,0.85) !important;
}

    .nav-login-btn:hover {
        color: white !important;
        background: rgba(255,255,255,0.12);
    }

.nav-register-btn {
    background: var(--gold) !important;
    color: var(--navy) !important;
    font-weight: 700 !important;
    border-radius: var(--radius-sm);
    padding: 0.45rem 1rem !important;
}

    .nav-register-btn:hover {
        background: var(--gold-dark) !important;
        transform: translateY(-1px);
    }

/* ── Hamburger ───────────────────────────────────────────────────── */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    margin-left: auto;
    flex-shrink: 0;
}

    .nav-toggle span {
        display: block;
        width: 22px;
        height: 2px;
        background: white;
        border-radius: 2px;
        transition: var(--transition);
        transform-origin: center;
    }

    /* Hamburger → X animation */
    .nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
    .nav-toggle.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
    .nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ══════════════════════════════════════════════════════════════════
   MOBILE (max-width: 768px)
   ══════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

    /* แสดง hamburger */
    .nav-toggle { display: flex; }

    /* ซ่อน auth desktop */
    .nav-auth { display: none; }

    /* Nav drawer */
    .nav-links {
        position: absolute;
        top: var(--nav-height);
        left: 0;
        right: 0;
        transform: none;
        background: var(--navy-dark);
        flex-direction: column;
        align-items: stretch;
        padding: 0;
        border-bottom: 2px solid rgba(255,255,255,0.1);
        gap: 0.1rem;
        max-height: 0;
        overflow: hidden;
        display: flex;
        transition: max-height 0.3s ease, padding 0.3s ease;
    }

        .nav-links.open {
            max-height: 680px;
            padding: 0.5rem 0.75rem 0.75rem;
        }

    /* nav-link เต็มความกว้าง */
    .nav-link {
        width: 100%;
        justify-content: space-between;
        padding: 0.7rem 0.85rem;
    }

    /* dropdown เปิด static */
    .nav-dropdown { width: 100%; }

    .nav-dropdown.dropdown-open .dropdown-menu {
        display: block;
        position: static;
        box-shadow: none;
        border: none;
        border-radius: var(--radius-sm);
        background: rgba(255,255,255,0.06);
        margin: 0.1rem 0 0.25rem;
        padding: 0.25rem 0;
        animation: none;
        min-width: unset;
        width: 100%;
    }

    /* dropdown items ใน mobile */
    .nav-dropdown.dropdown-open .dropdown-item {
        color: rgba(255,255,255,0.85);
        padding: 0.6rem 1rem;
    }

        .nav-dropdown.dropdown-open .dropdown-item:hover {
            background: rgba(255,255,255,0.1);
            color: white;
        }

    .nav-dropdown.dropdown-open .dropdown-divider {
        background: rgba(255,255,255,0.1);
    }

    .nav-dropdown.dropdown-open .dropdown-item-disabled {
        color: rgba(255,255,255,0.3) !important;
    }

    /* Auth section ใน mobile drawer */
    .nav-auth-mobile {
        display: flex;
        flex-direction: column;
        border-top: 1px solid rgba(255,255,255,0.1);
        margin-top: 0.25rem;
        padding-top: 0.25rem;
        gap: 0.1rem;
    }

    .nav-register-btn {
        text-align: center;
        justify-content: center;
        margin-top: 0.1rem;
    }
}
