/* ============================================
   LAYOUT & SIDEBAR (Mobile First)
   ============================================ */

.app-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    padding: 1rem;
    min-width: 0;
    width: 100%;
}

/* ============================================
   MOBILE HEADER
   ============================================ */
.mobile-top-bar {
    display: flex;
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: var(--color-white);
    border-bottom: 1px solid var(--color-slate-100);
    z-index: 40;
    padding: 0 1rem;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
    width: 100%;
}

.burger-btn {
    background: none;
    border: none;
    color: var(--color-slate-600);
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
}

.burger-btn:active {
    background: var(--color-slate-100);
}

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

/* ============================================
   SIDEBAR (Hidden on mobile by default)
   ============================================ */
.sidebar {
    position: fixed;
    left: -280px;
    top: 0;
    height: 100%;
    width: 280px;
    background: var(--color-slate-900);
    color: var(--color-slate-400);
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.2);
    z-index: 50;
    transition: left 0.3s ease;
}

.sidebar.open {
    left: 0;
}

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

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

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.sidebar-logo-icon {
    width: 40px;
    height: 40px;
    background: var(--color-primary);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.4);
    flex-shrink: 0;
    transition: var(--transition);
}

.sidebar-logo span {
    font-size: 1.25rem;
    font-weight: 800;
    color: white;
    letter-spacing: -0.5px;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.nav-group-title {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--color-slate-500);
    padding: 0 0.75rem;
    margin-bottom: 0.5rem;
}

.nav-links {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-xl);
    color: var(--color-slate-400);
    font-weight: 500;
    font-size: 0.9rem;
    transition: var(--transition);
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.07);
    color: white;
}

.nav-link.active {
    background: var(--color-primary);
    color: white;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
}

.nav-link.active-danger {
    background: #dc2626;
    color: white;
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.3);
}

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

.sidebar-user {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: var(--radius-xl);
    background: rgba(255, 255, 255, 0.05);
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    background: var(--color-primary-light);
    color: var(--color-primary);
    font-weight: 800;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    flex-shrink: 0;
}

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

.user-name {
    font-weight: 700;
    font-size: 0.9rem;
    color: white;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-role {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-slate-500);
}

.user-logout {
    color: var(--color-slate-500);
    transition: var(--transition);
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    cursor: pointer;
}

.user-logout:hover {
    color: var(--color-white);
    background: var(--color-danger);
}

.user-logout svg {
    width: 20px;
    height: 20px;
}

/* ============================================
   PAGE HEADER
   ============================================ */
.page-header {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--color-slate-800);
    letter-spacing: -0.5px;
}

.page-header p {
    color: var(--color-slate-500);
    margin-top: 4px;
}

.header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    width: 100%;
    flex-wrap: wrap;
}

.header-actions .btn {
    flex: 1;
    min-width: 120px;
    justify-content: center;
}

/* ============================================
   TABLET & DESKTOP OVERRIDES
   ============================================ */
@media (min-width: 768px) {
    .main-content {
        padding: 1.5rem;
    }

    .page-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    .page-header h1 {
        font-size: 2rem;
    }

    .header-actions {
        width: auto;
    }

    .header-actions .btn {
        flex: none;
    }
}

@media (min-width: 1024px) {
    .app-layout {
        flex-direction: row;
    }

    .mobile-top-bar {
        display: none;
    }

    .sidebar {
        left: 0;
        width: var(--sidebar-width);
    }

    .main-content {
        margin-left: var(--sidebar-width);
        padding: 2.5rem;
    }

    .sidebar-overlay {
        display: none !important;
    }
}