/* ========================================
   SIDEBAR — Translucent Glassmorphism
   ======================================== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(28px) saturate(1.6);
    -webkit-backdrop-filter: blur(28px) saturate(1.6);
    border-right: 1px solid rgba(16, 185, 129, 0.1);
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform var(--transition-slow);
    box-shadow:
        4px 0 16px rgba(0, 0, 0, 0.03),
        8px 0 32px rgba(16, 185, 129, 0.04);
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(16, 185, 129, 0.25);
    border-radius: 4px;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 20px 18px 18px;
    border-bottom: 1px solid rgba(16, 185, 129, 0.08);
}

.sidebar-logo {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    object-fit: contain;
    background: rgba(16, 185, 129, 0.06);
    padding: 4px;
    border: 2px solid rgba(16, 185, 129, 0.2);
    flex-shrink: 0;
    transition: var(--transition-base);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.1);
}

.sidebar-logo:hover {
    border-color: var(--emerald-500);
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.2);
}

.sidebar-title {
    display: flex;
    flex-direction: column;
}

.sidebar-faculty {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
    line-height: 1.2;
}

.sidebar-university {
    font-size: 0.72rem;
    color: var(--emerald-600);
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.sidebar-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 16px 18px 18px;
    padding: 10px 16px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(16, 185, 129, 0.04));
    border: 1px solid rgba(16, 185, 129, 0.15);
    border-radius: 100px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--emerald-700);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.06);
}

.sidebar-badge i {
    color: var(--emerald-500);
    font-size: 0.9rem;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.nav-accordion {
    margin-bottom: 0;
}

.nav-accordion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    margin-bottom: 0;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s var(--transition-base);
    user-select: none;
    min-height: 44px;
}

.nav-accordion-header:active {
    transform: scale(0.98);
}

.nav-accordion-header:hover,
.nav-accordion.open .nav-accordion-header {
    background: rgba(16, 185, 129, 0.08);
}

.nav-accordion-header .nav-label {
    margin: 0;
    padding: 0;
    border: none;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--emerald-600);
    line-height: 1.2;
}

.accordion-chevron {
    font-size: 0.7rem;
    color: var(--emerald-500);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    margin-left: 8px;
}

.nav-accordion.open .accordion-chevron {
    transform: rotate(180deg);
}

.nav-accordion-content {
    height: 0;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-4px);
    will-change: height, opacity, transform;
    transition: height 0.34s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.22s ease, transform 0.34s cubic-bezier(0.22, 1, 0.36, 1);
    overflow: hidden;
}

.nav-accordion.open .nav-accordion-content {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.nav-accordion-inner {
    min-height: 0;
    padding: 6px 0 12px 0;
}

.nav-accordion:not(.open) .nav-accordion-inner {
    padding: 0;
}

.nav-accordion-inner>div,
.nav-accordion-inner>a {
    overflow: hidden;
}

.nav-divider-sidebar {
    height: 1px;
    background: rgba(16, 185, 129, 0.1);
    margin: 8px 4px;
    flex-shrink: 0;
}

.nav-label {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    padding: 8px 8px 6px;
    margin-bottom: 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px 10px 14px;
    margin-bottom: 1px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
    transition: var(--transition-base);
    position: relative;
    overflow: hidden;
    min-height: 42px;
}

.nav-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%) scaleY(0);
    width: 3px;
    height: 60%;
    background: var(--emerald-500);
    border-radius: 0 3px 3px 0;
    transition: var(--transition-base);
}

.nav-link:hover {
    background: rgba(16, 185, 129, 0.06);
    color: var(--text-primary);
}

.nav-link:hover::before {
    transform: translateY(-50%) scaleY(1);
}

.nav-link.active {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(16, 185, 129, 0.04));
    color: var(--emerald-800);
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.06);
}

.nav-link.active::before {
    transform: translateY(-50%) scaleY(1);
    background: linear-gradient(180deg, var(--emerald-400), var(--emerald-600));
}

.nav-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    border-radius: var(--radius-sm);
    background: rgba(16, 185, 129, 0.08);
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--emerald-600);
    flex-shrink: 0;
    transition: var(--transition-base);
}

.nav-link.active .nav-number {
    background: linear-gradient(135deg, var(--emerald-500), var(--emerald-600));
    color: var(--white);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.nav-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.35;
}

.sidebar-footer {
    padding: 14px 18px 16px;
    border-top: 1px solid rgba(16, 185, 129, 0.08);
    font-size: 0.6875rem;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.5;
}

/* Mobile sidebar toggle */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 200;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(16, 185, 129, 0.15);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--emerald-600);
    font-size: 1.1rem;
    cursor: pointer;
    transition: var(--transition-base);
    box-shadow: var(--shadow-float-sm);
}

.sidebar-toggle:hover {
    background: var(--white);
    border-color: var(--emerald-400);
    box-shadow: var(--shadow-float-md);
    transform: translateY(-1px);
}

/* ========================================
   FLOATING NAV HEADER (Anti-Gravity)
   ======================================== */
.floating-header {
    position: fixed;
    top: 0.85rem;
    right: 1.25rem;
    z-index: 50;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(18px) saturate(1.2);
    -webkit-backdrop-filter: blur(18px) saturate(1.2);
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 9999px;
    padding: 0.45rem 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    box-shadow:
        0 8px 24px rgba(15, 23, 42, 0.08),
        0 2px 6px rgba(15, 23, 42, 0.05);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    margin: -0.2rem -0.4rem;
    border-radius: 9999px;
    transition: background-color 0.25s ease, box-shadow 0.25s ease;
}

.user-profile:hover {
    background: rgba(16, 185, 129, 0.07);
    box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.12);
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1.5px solid rgba(16, 185, 129, 0.52);
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e9fbf4;
    color: #0f9d73;
    font-weight: 600;
    font-size: 0.82rem;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 0.92rem;
    font-weight: 600;
    color: #115845;
    line-height: 1.1;
}

.user-role {
    font-size: 0.72rem;
    font-weight: 400;
    color: #6b7280;
    line-height: 1.1;
}

.user-prodi-badge {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    margin-top: 3px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.2px;
    text-transform: none;
    border: 1px solid transparent;
    line-height: 1.15;
}

.user-prodi-badge.badge-sarjana {
    background: rgba(16, 185, 129, 0.12);
    color: #065f46;
    border-color: rgba(16, 185, 129, 0.25);
}

.user-prodi-badge.badge-apoteker {
    background: rgba(59, 130, 246, 0.12);
    color: #1d4ed8;
    border-color: rgba(59, 130, 246, 0.25);
}

.user-prodi-badge.badge-admin {
    background: #f8f3e4;
    color: #7a5d12;
    border-color: #e8dcae;
}

.nav-divider {
    width: 1px;
    height: 22px;
    background: rgba(15, 23, 42, 0.1);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-sync {
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.18);
    color: #10b981;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.25s ease;
    padding: 0.34rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
}

.btn-sync:hover {
    color: #059669;
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.35);
}

.logout-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-logout {
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.18);
    color: #10b981;
    font-size: 0.94rem;
    cursor: pointer;
    transition: all 0.25s ease;
    padding: 0.34rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
}

.btn-logout:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
}

.btn-logout:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18);
}

.logout-tooltip {
    position: absolute;
    top: 130%;
    right: 50%;
    transform: translateX(50%) translateY(5px);
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(8px);
    color: #f8fafc;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.73rem;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    pointer-events: none;
}

.logout-wrapper:hover .logout-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(50%) translateY(0);
}

/* Overlay for mobile sidebar */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 90;
    opacity: 0;
    transition: opacity var(--transition-base);
}

.sidebar-overlay.show {
    display: block;
    opacity: 1;
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 8px 0 40px rgba(0, 0, 0, 0.08);
    }

    .sidebar-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

@media (max-width: 640px) {
    .sidebar-nav {
        padding: 8px 12px 12px;
    }

    .nav-accordion-header {
        padding: 9px 12px;
        min-height: 40px;
    }

    .nav-divider-sidebar {
        margin: 6px 2px;
    }

    .nav-link {
        padding: 9px 12px;
        min-height: 40px;
    }
}
