:root {
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 75px;
    --topbar-height: 64px;
    --bg-sidebar: #1e293b;
    --accent-color: #2563eb;
    --accent-hover: #38bdf8;
    --text-muted: #94a3b8;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: #f8fafc;
    overflow-x: hidden;
}

/* ==========================================
   1. Topbar Styling (Dark Slate Gradient)
   ========================================== */
.topbar {
    height: var(--topbar-height);
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0 20px;
    position: fixed;
    width: 100%;
    top: 0;
    left: 0;
    z-index: 1030;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

.toggle-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 1.1rem;
    cursor: pointer;
    color: #f8fafc;
    background-color: rgba(255, 255, 255, 0.1);
    transition: all 0.2s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.toggle-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
    color: var(--accent-hover);
}

.profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.profile-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #2563eb;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4);
}

.profile-info {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.profile-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: #ffffff;
}

.profile-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ==========================================
   2. Sidebar Base Styling
   ========================================== */
.sidebar {
    width: var(--sidebar-width);
    height: calc(100vh - var(--topbar-height));
    position: fixed;
    left: 0;
    top: var(--topbar-height);
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1020;
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.03);
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-brand {
    padding: 20px 22px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    white-space: nowrap;
}

.brand-icon {
    font-size: 1.35rem;
    color: var(--accent-hover);
    min-width: 24px;
    text-align: center;
}

.brand-text {
    font-size: 1.05rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.3px;
}

.sidebar-menu {
    padding: 16px 12px;
    flex-grow: 1;
}

.menu-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: #64748b;
    padding: 10px 14px 6px;
    white-space: nowrap;
}

.sidebar-menu a, .logout-link {
    display: flex;
    align-items: center;
    padding: 11px 14px;
    margin-bottom: 4px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 8px;
    white-space: nowrap;
    transition: all 0.2s ease-in-out;
}

.sidebar-menu a i, .logout-link i {
    font-size: 1.05rem;
    min-width: 24px;
    margin-right: 12px;
    text-align: center;
    color: #64748b;
    transition: color 0.2s ease;
}

.sidebar-menu a:hover {
    background-color: rgba(255, 255, 255, 0.06);
    color: #f8fafc;
}

.sidebar-menu a:hover i {
    color: var(--accent-hover);
}

.sidebar-menu a.active {
    background-color: var(--accent-color);
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.sidebar-menu a.active i {
    color: #ffffff;
}

.sidebar-footer {
    padding: 16px 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.logout-link {
    color: #f87171;
}

.logout-link:hover {
    background-color: rgba(248, 113, 113, 0.12);
    color: #ef4444;
}

.content {
    margin-left: var(--sidebar-width);
    padding-top: calc(var(--topbar-height) + 20px);
    padding-bottom: 40px;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 100vh;
}

/* ==========================================
   3. DESKTOP COLLAPSED STATE (Slim Stacked Icon Rail)
   ========================================== */
@media (min-width: 769px) {
    .sidebar.collapsed {
        width: var(--sidebar-collapsed-width) !important;
    }

    .content.collapsed {
        margin-left: var(--sidebar-collapsed-width) !important;
    }

    .sidebar.collapsed .brand-text,
    .sidebar.collapsed .menu-label {
        display: none !important;
    }

    .sidebar.collapsed .sidebar-brand {
        justify-content: center;
        padding: 18px 0;
    }

    .sidebar.collapsed .sidebar-menu a,
    .sidebar.collapsed .logout-link {
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        padding: 10px 4px !important;
        text-align: center;
    }

    .sidebar.collapsed .sidebar-menu a i,
    .sidebar.collapsed .logout-link i {
        margin-right: 0 !important;
        margin-bottom: 4px;
        font-size: 1.2rem;
    }

    .sidebar.collapsed .sidebar-menu a span,
    .sidebar.collapsed .logout-link span {
        font-size: 0.68rem;
        font-weight: 500;
        line-height: 1.1;
        display: block !important;
    }
}

/* ==========================================
   4. MOBILE / SMALL DEVICE OVERLAY
   ========================================== */
@media (max-width: 768px) {
    .sidebar {
        left: calc(-1 * var(--sidebar-width)) !important;
        z-index: 1040;
    }

    .sidebar.mobile-open {
        left: 0 !important;
    }

    .content {
        margin-left: 0 !important;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(15, 23, 42, 0.6);
        backdrop-filter: blur(3px);
        z-index: 1035;
    }

    .sidebar-overlay.show {
        display: block !important;
    }
}
