:root {
    --primary: #0d6efd;
    --primary-dark: #0a58ca;
    --sidebar-width: 260px;
    --sidebar-bg: #1e293b;
    --sidebar-hover: #334155;
    --sidebar-active: #0d6efd;
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    margin: 0;
    background-color: #f1f5f9;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ========== LOGIN ========== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0d6efd 0%, #0a58ca 50%, #084298 100%);
}

.login-card {
    max-width: 420px;
    width: 100%;
    border: none;
    border-radius: 1rem;
    box-shadow: 0 1rem 2rem rgba(0,0,0,0.25);
}

.login-card .card-header {
    background: transparent;
    border: none;
    padding-top: 2rem;
}

/* ========== SIDEBAR LAYOUT ========== */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: #e2e8f0;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    transition: transform 0.25s ease;
    overflow-y: auto;
}

.sidebar-brand {
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: #fff;
    flex-shrink: 0;
}

.sidebar-brand img {
    height: 36px;
    width: 36px;
    object-fit: contain;
    border-radius: 6px;
    background: #fff;
    padding: 2px;
}

.sidebar-brand .brand-text {
    font-weight: 700;
    font-size: 0.95rem;
    line-height: 1.25;
    color: #fff;
}

.sidebar-brand .brand-sub {
    font-size: 0.7rem;
    font-weight: 400;
    opacity: 0.7;
    display: block;
}

.sidebar-nav {
    flex: 1;
    padding: 0.75rem 0;
    list-style: none;
    margin: 0;
}

.sidebar-nav .nav-label {
    padding: 0.5rem 1.25rem 0.25rem;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #94a3b8;
    font-weight: 600;
}

.sidebar-nav .nav-item {
    margin: 2px 0.5rem;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.55rem 0.85rem;
    color: #cbd5e1;
    text-decoration: none;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    transition: all 0.15s;
}

.sidebar-nav .nav-link:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.sidebar-nav .nav-link.active {
    background: var(--sidebar-active);
    color: #fff;
    font-weight: 500;
}

.sidebar-nav .nav-link i {
    font-size: 1.1rem;
    width: 1.35rem;
    text-align: center;
    opacity: 0.9;
}

/* Dropdown / Collapse di sidebar */
.sidebar-nav .nav-group > .nav-link {
    justify-content: space-between;
}

.sidebar-nav .nav-group > .nav-link .chevron {
    font-size: 0.75rem;
    transition: transform 0.2s;
}

.sidebar-nav .nav-group.open > .nav-link .chevron {
    transform: rotate(90deg);
}

.sidebar-nav .submenu {
    list-style: none;
    margin: 0;
    padding: 0 0 0.25rem 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
}

.sidebar-nav .nav-group.open > .submenu {
    max-height: 400px;
}

.sidebar-nav .submenu .nav-link {
    padding-left: 2.6rem;
    font-size: 0.85rem;
    color: #94a3b8;
}

.sidebar-nav .submenu .nav-link:hover,
.sidebar-nav .submenu .nav-link.active {
    color: #fff;
    background: rgba(13, 110, 253, 0.35);
}

.sidebar-footer {
    padding: 0.85rem 1rem;
    border-top: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}

.sidebar-footer .user-info {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: #e2e8f0;
    font-size: 0.85rem;
}

.sidebar-footer .user-info .avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: #fff;
    font-size: 0.9rem;
}

.sidebar-footer .logout-btn {
    display: block;
    margin-top: 0.5rem;
    text-align: center;
    padding: 0.4rem;
    border-radius: 0.4rem;
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    text-decoration: none;
    font-size: 0.8rem;
    transition: background 0.15s;
}

.sidebar-footer .logout-btn:hover {
    background: rgba(239, 68, 68, 0.3);
    color: #fff;
}

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

.topbar {
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    padding: 0.65rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.topbar .page-title {
    font-weight: 600;
    font-size: 1.05rem;
    margin: 0;
    color: #1e293b;
}

.topbar .btn-toggle-sidebar {
    display: none;
    background: none;
    border: none;
    font-size: 1.4rem;
    color: #475569;
    padding: 0.25rem 0.5rem;
}

.content-area {
    flex: 1;
    padding: 1.5rem;
}

.main-footer {
    background: #fff;
    border-top: 1px solid #e2e8f0;
    padding: 0.75rem 1.5rem;
    text-align: center;
    color: #64748b;
    font-size: 0.8rem;
}

/* ========== CARDS & STATS ========== */
.stat-card {
    border: none;
    border-radius: 0.75rem;
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-3px);
}

.stat-card .icon {
    font-size: 2.5rem;
    opacity: 0.8;
}

.card-menu-siswa {
    border: none;
    border-radius: 1rem;
    transition: all 0.2s;
    text-decoration: none;
    color: inherit;
}

.card-menu-siswa:hover {
    transform: translateY(-5px);
    box-shadow: 0 0.5rem 1.5rem rgba(0,0,0,0.12);
    color: inherit;
}

.table th {
    white-space: nowrap;
    font-weight: 600;
    font-size: 0.875rem;
}

.badge-status-aktif { background-color: #198754; }
.badge-status-nonaktif { background-color: #6c757d; }
.badge-status-lulus { background-color: #0d6efd; }
.badge-status-pindah { background-color: #fd7e14; }

/* Overlay mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 1035;
}

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

/* ========== RESPONSIVE ========== */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .topbar .btn-toggle-sidebar {
        display: inline-block;
    }
}

@media (max-width: 768px) {
    .stat-card .icon { font-size: 2rem; }
    .content-area { padding: 1rem; }
}
