/* =====================================================
   LPM — Navbar & Topbar Styles (Redesign)
   Navy Blue & Gold Theme
   ===================================================== */

/* ─── Variables ─── */
:root {
    --topbar-h: 36px;
    --navbar-h: 68px;
    --header-total: calc(var(--topbar-h) + var(--navbar-h));
}

/* =====================================================
   TOP BAR
   ===================================================== */
.topbar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 1010;
    height: var(--topbar-h);
    background: var(--dark);
    border-bottom: 1px solid rgba(255,255,255,.06);
}
.topbar-inner {
    max-width: 1320px; margin: 0 auto; padding: 0 1.5rem;
    height: 100%; display: flex; align-items: center; justify-content: space-between;
}
.topbar-left { display: flex; align-items: center; gap: .25rem; min-width: 0; flex-shrink: 1; }
.topbar-right { display: flex; align-items: center; gap: .35rem; flex-shrink: 0; margin-left: auto; }
.topbar-univ-name {
    display: inline-block;
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
}
.topbar-link {
    display: flex; align-items: center; gap: .3rem;
    font-size: .72rem; font-weight: 500; color: rgba(255,255,255,.6);
    padding: .25rem .6rem; border-radius: 4px;
    transition: color .15s, background .15s;
    white-space: nowrap;
}
.topbar-link i { font-size: .65rem; }
.topbar-link:hover { color: var(--secondary-light); background: rgba(255,255,255,.05); }
.topbar-sep { color: rgba(255,255,255,.18); font-size: .7rem; padding: 0 .1rem; }

/* Language switcher (topbar) */
.lang-switcher { position: relative; }
.lang-active {
    display: flex; align-items: center; gap: .35rem;
    background: none; border: 1px solid rgba(255,255,255,.12);
    border-radius: 4px; padding: .2rem .6rem;
    font-size: .72rem; font-weight: 600; color: rgba(255,255,255,.75);
    cursor: pointer; transition: border-color .15s, color .15s;
}
.lang-active img { width: 16px; border-radius: 2px; }
.lang-active i { font-size: .55rem; opacity: .7; }
.lang-active:hover { border-color: var(--secondary); color: var(--secondary-light); }
.lang-list {
    display: none;
    position: absolute; top: calc(100% + 6px); right: 0;
    background: var(--bg-surface); border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,.2); border: 1px solid var(--border-light);
    overflow: hidden; min-width: 120px;
    animation: dropIn .15s ease;
}
.lang-switcher:hover .lang-list { display: block; }
.lang-opt {
    display: flex; align-items: center; gap: .5rem;
    padding: .5rem .75rem; font-size: .77rem; font-weight: 600; color: var(--txt2);
    transition: background .15s, color .15s;
}
.lang-opt img { width: 16px; border-radius: 2px; }
.lang-opt:hover { background: var(--bg2); color: var(--primary); }

/* Theme btn (topbar) */
.topbar-theme-btn {
    width: 28px; height: 28px; border-radius: 50%;
    background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.1);
    color: rgba(255,255,255,.65); cursor: pointer; font-size: .75rem;
    display: flex; align-items: center; justify-content: center;
    margin-left: .25rem;
    transition: background .2s, color .2s, transform .3s;
}
.topbar-theme-btn:hover { background: var(--secondary); color: var(--dark); transform: rotate(20deg); }

/* =====================================================
   MAIN NAVBAR
   ===================================================== */
.navbar {
    position: fixed; top: var(--topbar-h); left: 0; right: 0; z-index: 1000;
    height: var(--navbar-h);
    background: rgba(6, 29, 19, 0.96);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border-bottom: 1px solid rgba(255,255,255,.08);
    transition: background .3s, box-shadow .3s;
    overflow: visible; /* PENTING: agar dropdown tidak terpotong */
}
.navbar.scrolled {
    background: rgba(4, 20, 13, 0.99);
    box-shadow: 0 4px 24px rgba(0,0,0,.35);
    border-bottom-color: rgba(197,155,39,.25);
}
[data-theme="dark"] .navbar { background: rgba(3, 18, 11, 0.97); }

.navbar-inner {
    max-width: 1320px; margin: 0 auto; padding: 0 1.5rem;
    height: 100%; display: flex; align-items: center; gap: 1.5rem;
    overflow: visible; /* PENTING: agar dropdown tidak terpotong */
}

/* ─── Brand ─── */
.navbar-brand {
    display: flex; align-items: center; gap: 10px;
    flex-shrink: 0; text-decoration: none;
}
.navbar-brand img { height: 40px; width: auto; flex-shrink: 0; }
.brand-text { display: flex; flex-direction: column; }
.brand-name {
    font-size: .88rem; font-weight: 700; color: #fff;
    line-height: 1.2; letter-spacing: -.01em; white-space: nowrap;
}
.brand-sub {
    font-size: .67rem; color: var(--secondary-light); font-weight: 500;
    letter-spacing: .2px; white-space: nowrap;
}

/* ─── Nav Menu ─── */
.nav-menu {
    display: flex; align-items: center; gap: .1rem;
    flex: 1; list-style: none; margin: 0; padding: 0;
    overflow: visible; /* PENTING: agar dropdown tidak terpotong */
}
.nav-item {
    position: relative;
}
/* Bridge pseudo-element: mengisi celah antara nav-link dan dropdown
 * sehingga hover tidak terputus saat mouse berpindah ke dropdown */
.nav-item.has-dropdown::after,
.nav-item.has-mega::after {
    content: '';
    position: absolute;
    bottom: -10px; /* sama dengan padding-top dropdown */
    left: 0; right: 0;
    height: 10px;
    background: transparent;
}

/* Nav Link */
.nav-link {
    display: flex; align-items: center; gap: .35rem;
    padding: .5rem .7rem;
    font-size: .8rem; font-weight: 600; color: rgba(255,255,255,.82);
    border-radius: 8px; text-decoration: none; white-space: nowrap;
    transition: color .2s, background .2s;
    cursor: pointer; position: relative;
}
.nav-link::after {
    content: ''; position: absolute; bottom: 0; left: 50%; right: 50%;
    height: 2px; background: var(--secondary);
    border-radius: 1px; transition: left .25s, right .25s;
}
.nav-item:hover .nav-link::after,
.nav-link.active::after { left: .7rem; right: .7rem; }
.nav-icon { font-size: .7rem; opacity: .7; }
.nav-arrow {
    font-size: .55rem; opacity: .6; margin-left: .1rem;
    transition: transform .25s;
}
.nav-item:hover .nav-arrow { transform: rotate(180deg); color: var(--secondary); }
.nav-item:hover .nav-link { color: #fff; background: rgba(255,255,255,.07); }

/* ─── Standard Dropdown ─── */
/*
 * Fix: Ganti gap fisik dengan padding transparan di atas dropdown
 * supaya mouse tidak pernah 'keluar' dari zona hover.
 */
.dropdown {
    display: none; position: absolute;
    top: 100%; left: 0;
    padding-top: 10px;          /* jarak transparan, hover tetap terjaga */
    min-width: 230px; z-index: 990;
}
.nav-item:hover .dropdown { display: block; }
.nav-item:hover .dropdown .dropdown-inner { animation: dropIn .2s ease; }

.dropdown-inner {
    background: var(--bg-surface);
    border-radius: 14px;
    box-shadow: 0 12px 48px rgba(0,0,0,.18), 0 0 0 1px var(--border-light);
    padding: .5rem;
    overflow: hidden;
}

.dropdown-header {
    display: flex; align-items: center; gap: .4rem;
    padding: .5rem .75rem .4rem;
    font-size: .68rem; font-weight: 800; letter-spacing: .6px;
    text-transform: uppercase; color: var(--primary);
    border-bottom: 1px solid var(--border-light);
    margin-bottom: .35rem;
}
[data-theme="dark"] .dropdown-header { color: var(--secondary); border-bottom-color: rgba(255,255,255,.08); }

.dropdown-item {
    display: flex; align-items: center; gap: .55rem;
    padding: .5rem .75rem; border-radius: 8px;
    font-size: .8rem; font-weight: 500; color: var(--txt2);
    transition: background .15s, color .15s, padding-left .15s;
    text-decoration: none;
}
.dropdown-item i { font-size: .75rem; color: var(--txt3); width: 14px; flex-shrink: 0; transition: color .15s; }
.dropdown-item:hover {
    background: rgba(30,58,95,.07); color: var(--primary);
    padding-left: 1.1rem;
}
.dropdown-item:hover i { color: var(--primary); }
[data-theme="dark"] .dropdown-item:hover { background: rgba(196,149,58,.08); color: var(--secondary); }
[data-theme="dark"] .dropdown-item:hover i { color: var(--secondary); }

.dropdown-divider {
    height: 1px; background: var(--border-light);
    margin: .35rem .75rem;
}

/* ─── Mega Menu ─── */
.mega-menu {
    display: none; position: absolute;
    top: 100%; left: 50%; transform: translateX(-50%);
    padding-top: 10px;          /* jarak transparan, hover tetap terjaga */
    z-index: 990;
    min-width: 620px;
}
.has-mega:hover .mega-menu { display: block; }
.has-mega:hover .mega-menu .mega-inner { animation: dropIn .2s ease; }
/* Mega menu posisi untuk item di ujung kanan */
.nav-item:nth-last-child(-n+3) .mega-menu { left: auto; right: 0; transform: none; }

.mega-inner {
    background: var(--bg-surface);
    border-radius: 16px;
    box-shadow: 0 12px 48px rgba(0,0,0,.18), 0 0 0 1px var(--border-light);
    padding: 1rem;
    display: grid; grid-template-columns: 1fr 1px 1fr 1px 1fr; gap: .5rem;
    overflow: hidden;
}

.mega-col { padding: .25rem .5rem; }
.mega-col-header {
    display: flex; align-items: center; gap: .4rem;
    font-size: .68rem; font-weight: 800; letter-spacing: .6px;
    text-transform: uppercase; color: var(--primary);
    padding: .3rem 0 .5rem;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: .4rem;
}
[data-theme="dark"] .mega-col-header { color: var(--secondary); border-bottom-color: rgba(255,255,255,.08); }

.mega-divider {
    width: 1px; background: var(--border-light);
    margin: .5rem 0;
}

/* ─── Navbar Actions ─── */
.navbar-actions { display: flex; align-items: center; gap: .5rem; flex-shrink: 0; margin-left: auto; }

/* ─── User Dropdown (Topbar) ─── */
.user-dropdown {
    position: relative;
    display: inline-block;
}
.user-dropdown-toggle {
    display: flex;
    align-items: center;
    gap: .35rem;
    background: rgba(255, 255, 255, .1);
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 20px;
    padding: .2rem .75rem;
    font-size: .73rem;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    transition: background .2s, border-color .2s;
    font-family: inherit;
}
.user-dropdown-toggle:hover {
    background: rgba(197, 155, 39, .25);
    border-color: var(--secondary);
    color: var(--secondary-light);
}
.user-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: var(--bg-surface);
    border-radius: 10px;
    box-shadow: 0 10px 32px rgba(0,0,0,.25);
    border: 1px solid var(--border-light);
    min-width: 170px;
    z-index: 1100;
    overflow: hidden;
    animation: dropIn .15s ease;
}
.user-dropdown:hover .user-dropdown-menu,
.user-dropdown.open .user-dropdown-menu {
    display: block;
}
.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .6rem .9rem;
    font-size: .78rem;
    font-weight: 600;
    color: var(--txt1);
    text-decoration: none;
    transition: background .15s, color .15s;
}
.user-dropdown-item:hover {
    background: var(--bg2);
    color: var(--primary);
}
.user-dropdown-item.text-danger {
    color: #ef4444;
}
.user-dropdown-item.text-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}
.user-dropdown-divider {
    height: 1px;
    background: var(--border-light);
    margin: .25rem 0;
}

/* Search */
.nav-search { display: flex; align-items: center; gap: .5rem; }
.search-toggle-btn {
    width: 36px; height: 36px; border-radius: 50%;
    background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.12);
    color: rgba(255,255,255,.8); cursor: pointer; font-size: .85rem;
    display: flex; align-items: center; justify-content: center;
    transition: background .2s, color .2s;
    flex-shrink: 0;
    box-sizing: border-box;
}
.search-toggle-btn:hover { background: var(--secondary); color: var(--dark); }

.search-expand {
    display: flex; align-items: center;
    height: 36px;
    max-width: 0; overflow: hidden; opacity: 0;
    transition: max-width .35s ease, opacity .3s ease;
}
.search-expand.open { max-width: 220px; opacity: 1; }
.search-input-field {
    height: 36px;
    background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.18);
    border-right: none;
    border-radius: 18px 0 0 18px; padding: 0 1rem;
    color: #fff; font-size: .8rem; outline: none; width: 150px;
    font-family: inherit;
    box-sizing: border-box;
    line-height: 34px;
}
.search-input-field::placeholder { color: rgba(255,255,255,.45); }
.search-submit {
    height: 36px; width: 36px;
    background: var(--secondary); border: 1px solid var(--secondary);
    border-radius: 0 18px 18px 0;
    color: var(--dark);
    cursor: pointer; font-size: .85rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    transition: background .2s, border-color .2s;
    box-sizing: border-box;
    flex-shrink: 0;
}
.search-submit:hover { background: var(--accent); border-color: var(--accent); }

/* Login Button */
.nav-login-btn {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    height: 36px;
    padding: 0 1rem;
    border-radius: 18px;
    background: var(--grad-gold);
    color: var(--dark);
    font-size: .8rem;
    font-weight: 700;
    text-decoration: none;
    transition: transform .2s, box-shadow .2s, opacity .2s;
    box-shadow: 0 2px 10px rgba(197, 155, 39, 0.3);
    white-space: nowrap;
    flex-shrink: 0;
}
.nav-login-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(197, 155, 39, 0.5);
    color: var(--dark);
}
.nav-login-btn i {
    font-size: .85rem;
}

/* Hamburger */
.hamburger {
    display: none; flex-direction: column; gap: 5px;
    cursor: pointer; padding: 6px; background: none; border: none;
}
.hamburger span {
    display: block; width: 22px; height: 2.5px;
    background: rgba(255,255,255,.85); border-radius: 2px;
    transition: all .3s cubic-bezier(.25,.8,.25,1);
    transform-origin: center;
}
.hamburger.open span:nth-child(1) { transform: translateY(7.5px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger.open span:nth-child(3) { transform: translateY(-7.5px) rotate(-45deg); }

/* =====================================================
   MOBILE SIDEBAR
   ===================================================== */
.mobile-sidebar {
    position: fixed; top: 0; right: -320px; bottom: 0;
    width: 300px; z-index: 1100;
    background: #061d13;
    display: flex; flex-direction: column;
    transition: right .35s cubic-bezier(.25,.8,.25,1);
    overflow: hidden;
}
.mobile-sidebar.open { right: 0; }

.sidebar-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1rem 1.25rem;
    background: rgba(0,0,0,.3);
    border-bottom: 1px solid rgba(255,255,255,.08);
    flex-shrink: 0;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; }
.sidebar-close {
    width: 32px; height: 32px; border-radius: 8px;
    background: rgba(255,255,255,.08); border: none;
    color: rgba(255,255,255,.7); cursor: pointer; font-size: .9rem;
    display: flex; align-items: center; justify-content: center;
    transition: background .15s, color .15s;
    flex-shrink: 0;
}
.sidebar-close:hover { background: rgba(239,68,68,.3); color: #fff; }

.sidebar-search { padding: .75rem 1.25rem; flex-shrink: 0; }
.sidebar-search-input {
    width: 100%; background: rgba(255,255,255,.07);
    border: 1px solid rgba(255,255,255,.1); border-radius: 8px;
    padding: .55rem 2.5rem .55rem 1rem;
    color: #fff; font-size: .82rem; outline: none;
    font-family: inherit;
}
.sidebar-search-input::placeholder { color: rgba(255,255,255,.4); }
.sidebar-search-icon {
    position: absolute; right: 1.8rem; top: 50%; transform: translateY(-50%);
    color: rgba(255,255,255,.4); font-size: .82rem; pointer-events: none;
}
.sidebar-search { position: relative; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: .5rem; }
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 2px; }

.sidebar-item { border-radius: 10px; overflow: hidden; margin-bottom: .2rem; }

.sidebar-trigger {
    width: 100%; display: flex; align-items: center; justify-content: space-between;
    padding: .65rem 1rem;
    background: none; border: none; color: rgba(255,255,255,.8);
    font-size: .82rem; font-weight: 600; cursor: pointer;
    border-radius: 10px; font-family: inherit;
    transition: background .15s, color .15s;
    text-align: left;
}
.sidebar-trigger span { display: flex; align-items: center; gap: .6rem; }
.sidebar-trigger span i { font-size: .8rem; color: var(--secondary-light); width: 16px; }
.sidebar-trigger:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar-trigger.open { background: rgba(196,149,58,.12); color: var(--secondary-light); }
.sidebar-arrow { font-size: .6rem; opacity: .6; transition: transform .25s; flex-shrink: 0; }
.sidebar-trigger.open .sidebar-arrow { transform: rotate(180deg); }

.sidebar-submenu {
    display: none; padding: .25rem .5rem .5rem 1rem;
    border-left: 2px solid rgba(196,149,58,.25);
    margin-left: 1.6rem; margin-bottom: .25rem;
}
.sidebar-submenu.open { display: block; }
.sidebar-link {
    display: block; padding: .45rem .75rem;
    font-size: .78rem; font-weight: 500; color: rgba(255,255,255,.6);
    border-radius: 6px; transition: background .15s, color .15s;
    text-decoration: none;
}
.sidebar-link:hover { background: rgba(255,255,255,.06); color: rgba(255,255,255,.9); }

.sidebar-direct-link {
    display: flex; align-items: center; gap: .6rem;
    padding: .65rem 1rem;
    font-size: .82rem; font-weight: 600; color: rgba(255,255,255,.75);
    border-radius: 10px; text-decoration: none;
    transition: background .15s, color .15s;
}
.sidebar-direct-link i { font-size: .8rem; color: var(--secondary-light); width: 16px; }
.sidebar-direct-link:hover { background: rgba(255,255,255,.06); color: #fff; }

.sidebar-footer {
    padding: .75rem 1.25rem; flex-shrink: 0;
    border-top: 1px solid rgba(255,255,255,.08);
    background: rgba(0,0,0,.2);
}
.sidebar-lang { display: flex; gap: .5rem; }
.sidebar-lang-btn {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: .4rem;
    padding: .45rem; border-radius: 8px;
    font-size: .75rem; font-weight: 700; color: rgba(255,255,255,.6);
    border: 1px solid rgba(255,255,255,.1); text-decoration: none;
    transition: background .15s, color .15s, border-color .15s;
}
.sidebar-lang-btn img { width: 16px; border-radius: 2px; }
.sidebar-lang-btn:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar-lang-btn.active { background: var(--secondary); color: var(--dark); border-color: var(--secondary); }

.sidebar-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.55); z-index: 1099;
    backdrop-filter: blur(4px);
}
.sidebar-overlay.open { display: block; }

/* =====================================================
   HERO OFFSET (account for topbar + navbar)
   ===================================================== */
.hero {
    padding-top: var(--header-total) !important;
}

/* =====================================================
   SCROLL INDICATOR (below topbar)
   ===================================================== */
.scroll-indicator { top: var(--topbar-h) !important; z-index: 1001 !important; }

/* =====================================================
   ANIMATIONS
   ===================================================== */
@keyframes dropIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}
[data-theme="dark"] .mega-inner,
[data-theme="dark"] .dropdown-inner {
    background: #0f172a;
    box-shadow: 0 12px 48px rgba(0,0,0,.5), 0 0 0 1px rgba(255,255,255,.06);
}

/* =====================================================
   RESPONSIVE MEDIA QUERIES
   ===================================================== */
@media (max-width: 1280px) {
    .nav-link { padding: .5rem .55rem; font-size: .76rem; }
    .nav-icon { display: none; }
}

@media (max-width: 1024px) {
    .hamburger { display: flex; }
    .nav-menu { display: none; }
    .brand-sub { display: none; }
    .nav-search { display: none; }
}

@media (max-width: 640px) {
    .topbar-inner { padding: 0 .85rem; }
    .topbar-left .topbar-sep,
    .topbar-left .topbar-complaint { display: none; }
    .topbar-univ-name { max-width: 140px; }
    .topbar-link { padding: .2rem .35rem; font-size: .7rem; }
    .lang-active { padding: .18rem .5rem; font-size: .7rem; }
    .user-dropdown-toggle { padding: .18rem .55rem; font-size: .7rem; }
    .brand-name { font-size: .82rem; }
}

@media (max-width: 480px) {
    .topbar-inner { padding: 0 .65rem; }
    .topbar-univ-name { max-width: 105px; }
    .brand-name { font-size: .76rem; max-width: 160px; white-space: normal; line-height: 1.1; }
    .brand-sub { display: none; }
}
