/* ============================================
   DASHBOARD LAYOUT
   ============================================ */

.app-layout {
    display: flex;
    min-height: 100dvh;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100dvh;
    background: var(--color-bg-sidebar);
    display: flex;
    flex-direction: column;
    z-index: var(--z-sidebar);
    transition: transform var(--transition-base);
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-5) var(--space-5);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-logo {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--color-primary), #6366f1);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-logo svg {
    width: 20px;
    height: 20px;
    color: white;
}

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

.sidebar-brand-name {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-bold);
    color: white;
    letter-spacing: -0.3px;
}

.sidebar-brand-sub {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
}

/* Role selector */
.sidebar-role-selector {
    padding: var(--space-3) var(--space-5);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.role-selector-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-2) var(--space-3);
    background: var(--color-bg-sidebar-hover);
    border-radius: var(--radius-sm);
    color: var(--color-primary-light);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    transition: background var(--transition-fast);
}

.role-selector-btn:hover {
    background: rgba(59, 130, 246, 0.15);
}

.role-selector-btn svg {
    width: 14px;
    height: 14px;
}

/* Navigation */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-3) var(--space-3);
}

.nav-section {
    margin-bottom: var(--space-4);
}

.nav-section-title {
    font-size: 10px;
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: var(--space-2) var(--space-3);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-3);
    border-radius: var(--radius-sm);
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    transition: all var(--transition-fast);
    cursor: pointer;
}

.nav-item:hover {
    background: var(--color-bg-sidebar-hover);
    color: var(--color-text-inverse);
}

.nav-item.active {
    background: rgba(59, 130, 246, 0.15);
    color: var(--color-primary-light);
}

.nav-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.nav-item-badge {
    margin-left: auto;
    background: var(--color-error);
    color: white;
    font-size: 10px;
    font-weight: var(--font-weight-bold);
    padding: 2px 7px;
    border-radius: var(--radius-full);
    line-height: 1.3;
}

/* Sidebar footer */
.sidebar-footer {
    padding: var(--space-4) var(--space-5);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.sidebar-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--color-primary), #6366f1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: white;
    flex-shrink: 0;
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user-name {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-inverse);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
}

.sidebar-logout {
    color: var(--color-text-muted);
    padding: var(--space-2);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.sidebar-logout:hover {
    color: var(--color-error);
    background: rgba(239, 68, 68, 0.1);
}

.sidebar-logout svg {
    width: 18px;
    height: 18px;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
}

/* Header */
.main-header {
    position: sticky;
    top: 0;
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--color-border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-6);
    z-index: var(--z-header);
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.mobile-menu-btn {
    display: none;
    color: var(--color-text);
    padding: var(--space-2);
}

.mobile-menu-btn svg {
    width: 24px;
    height: 24px;
}

.header-title {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text);
}

.header-breadcrumb {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

/* Page content */
.page-content {
    flex: 1;
    padding: var(--space-6);
    max-width: var(--max-content-width);
    width: 100%;
}

/* Mobile overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--color-bg-overlay);
    z-index: calc(var(--z-sidebar) - 1);
}

/* ============================================
   RESPONSIVE (Mobile-First Breakpoints)
   ============================================ */

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

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar.open + .sidebar-overlay {
        display: block;
    }

    .main-content {
        margin-left: 0;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .page-content {
        padding: var(--space-4);
    }

    .main-header {
        padding: 0 var(--space-4);
    }
}

@media (max-width: 480px) {
    .page-content {
        padding: var(--space-3);
    }
}
