/* ============================================================
   Admin App Layout — sidebar + main content
   ============================================================ */

html, body {
    height: 100%;
    overflow: hidden;
}

.app-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
    background: var(--bg-color);
}

/* ============================================================
   Sidebar
   ============================================================ */

.sidebar {
    width: 220px;
    flex-shrink: 0;
    background: var(--surface-color);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-brand {
    padding: 18px 16px 14px;
    border-bottom: 1px solid var(--border-color);
}

.brand-name {
    display: block;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-color);
    letter-spacing: -0.3px;
}

.brand-sub {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 1px;
}

/* ── Nav items ── */

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 0;
    transition: background 0.12s, color 0.12s;
    text-decoration: none;
    position: relative;
    user-select: none;
}

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

.nav-item.active {
    color: var(--primary-color);
    background: #eff6ff;
    font-weight: 600;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--primary-color);
    border-radius: 0 2px 2px 0;
}

.nav-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: 0.7;
}

.nav-item.active .nav-icon {
    opacity: 1;
}

.nav-badge {
    margin-left: auto;
    background: var(--danger-color);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 99px;
    min-width: 18px;
    text-align: center;
}

.nav-divider {
    height: 1px;
    background: var(--border-color);
    margin: 6px 16px;
}

/* ── Sidebar footer (user chip + logout) ── */

.sidebar-footer {
    padding: 12px 14px;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

.sidebar-user {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.sidebar-user-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    overflow: hidden;
}

.sidebar-user-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-icon {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 3px 7px;
    font-size: 14px;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
    flex-shrink: 0;
}

.btn-icon:hover {
    background: var(--bg-color);
    color: var(--text-color);
}

.sidebar-logout-btn {
    width: 100%;
    justify-content: center;
    color: var(--text-muted);
}

/* ============================================================
   Main Content
   ============================================================ */

.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 28px 32px;
    min-width: 0;
}

/* ── Section ── */

.section {
    max-width: 1100px;
}

.section.hidden {
    display: none !important;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 12px;
}

.section-header h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-color);
    margin: 0;
}

/* ============================================================
   Responsive — collapse sidebar on narrow viewports
   ============================================================ */

@media (max-width: 700px) {
    .sidebar {
        width: 56px;
    }
    .brand-name, .brand-sub, .sidebar-user-info,
    .sidebar-logout-btn, .nav-item span:not(.nav-icon):not(.nav-badge) {
        display: none;
    }
    .nav-item {
        justify-content: center;
        padding: 10px;
    }
    .nav-icon {
        opacity: 1;
    }
    .main-content {
        padding: 20px 16px;
    }
}
