/* ========== App Layout ========== */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ========== Sidebar ========== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--gray-900);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform var(--transition-slow);
}

.sidebar-logo {
    padding: var(--space-lg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.sidebar-logo-img {
    max-width: 160px;
    height: auto;
}

.sidebar-logo-fallback {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.sidebar-logo h1 {
    font-size: var(--font-xl);
    color: white;
    font-weight: 700;
}

.sidebar-logo .logo-icon {
    width: 36px;
    height: 36px;
    background: var(--primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.sidebar-nav {
    flex: 1;
    padding: var(--space-md) 0;
    overflow-y: auto;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    color: var(--gray-400);
    font-size: var(--font-sm);
    font-weight: 500;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    transition: all var(--transition);
}

.sidebar-nav-item:hover {
    color: white;
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-nav-item.active {
    color: white;
    background: rgba(79, 70, 229, 0.3);
    border-right: 3px solid var(--primary);
}

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

.sidebar-footer {
    padding: var(--space-md) var(--space-lg);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

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

/* ========== Header ========== */
.app-header {
    height: var(--header-height);
    background: white;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-xl);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-title {
    font-size: var(--font-lg);
    font-weight: 600;
}

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

.header-user {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    cursor: pointer;
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-md);
    border: none;
    background: none;
    font-size: var(--font-sm);
    color: var(--gray-700);
}

.header-user:hover {
    background: var(--gray-100);
}

.header-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: var(--primary-100);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: var(--font-sm);
}

/* ========== Page Content ========== */
.page-content {
    flex: 1;
    padding: var(--space-xl);
    max-width: 1200px;
    width: 100%;
}

/* ========== Mobile ========== */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    padding: var(--space-sm);
    color: var(--gray-700);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

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

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

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

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

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

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

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