/* ============================================================
   SI Murid - SMPN 1 Kuripan
   Tema: Pastel Hangat & Playful
   Font: Nunito (Google Fonts)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;500;600;700;800&family=Quicksand:wght@500;600;700&display=swap');

:root {
    /* Warna Utama */
    --primary:      #FF8C69;   /* salmon/coral hangat */
    --primary-soft: #FFB59A;
    --primary-pale: #FFF0EB;

    /* Aksen */
    --accent-teal:  #5BBFB5;
    --accent-yellow:#FFCF72;
    --accent-purple:#B39DDB;
    --accent-pink:  #F48FB1;

    /* Sidebar */
    --sidebar-bg:   #FFF8F5;
    --sidebar-w:    230px;

    /* Netral */
    --bg:           #FEF9F7;
    --card:         #FFFFFF;
    --border:       #F0E6E0;
    --text:         #4A3728;
    --text-muted:   #A08070;
    --text-light:   #C5A898;

    /* Status */
    --success:      #66BB6A;
    --warning:      #FFCA28;
    --danger:       #EF5350;
    --info:         #42A5F5;

    /* Misc */
    --radius:       14px;
    --radius-sm:    8px;
    --shadow:       0 2px 12px rgba(255,140,105,0.10);
    --shadow-md:    0 4px 20px rgba(255,140,105,0.15);
    --transition:   0.2s ease;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Nunito', sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    min-height: 100vh;
}

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

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    border-right: 1.5px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    transition: transform var(--transition);
}

.sidebar-brand {
    padding: 1.4rem 1.2rem 1rem;
    border-bottom: 1.5px solid var(--border);
}

.sidebar-brand .brand-icon {
    width: 40px; height: 40px;
    background: var(--primary);
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    box-shadow: 0 4px 12px rgba(255,140,105,0.35);
}

.sidebar-brand h1 {
    font-family: 'Quicksand', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.2;
}

.sidebar-brand p {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Tahun ajaran badge */
.ta-badge {
    margin: 0.8rem 1rem;
    background: var(--primary-pale);
    border: 1.5px solid var(--primary-soft);
    border-radius: 20px;
    padding: 0.35rem 0.75rem;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* Nav */
.sidebar-nav { padding: 0.5rem 0; flex: 1; }

.nav-group-label {
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-light);
    padding: 0.8rem 1.2rem 0.3rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.6rem 1.2rem;
    margin: 0.1rem 0.6rem;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.82rem;
    transition: all var(--transition);
}

.nav-item:hover {
    background: var(--primary-pale);
    color: var(--primary);
}

.nav-item.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(255,140,105,0.35);
}

.nav-item .nav-icon {
    font-size: 1rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

/* Sidebar bottom - user info */
.sidebar-footer {
    padding: 1rem;
    border-top: 1.5px solid var(--border);
}

.user-card {
    background: var(--primary-pale);
    border-radius: var(--radius-sm);
    padding: 0.65rem 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.user-avatar {
    width: 32px; height: 32px;
    background: var(--primary);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    font-weight: 800;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }
.user-name { font-weight: 700; font-size: 0.78rem; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 0.67rem; color: var(--text-muted); font-weight: 600; }

.logout-btn {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 1rem;
    padding: 0.2rem;
    border-radius: 6px;
    transition: color var(--transition);
    flex-shrink: 0;
}
.logout-btn:hover { color: var(--danger); }

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

/* Topbar */
.topbar {
    background: var(--card);
    border-bottom: 1.5px solid var(--border);
    padding: 0.85rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-title h2 {
    font-family: 'Quicksand', sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
}

.topbar-title p {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
}

.topbar-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    background: var(--primary-pale);
    padding: 0.35rem 0.8rem;
    border-radius: 20px;
}

/* Hamburger (mobile) */
.hamburger {
    display: none;
    background: none;
    border: none;
    font-size: 1.4rem;
    color: var(--text);
    cursor: pointer;
    padding: 0.2rem;
}

/* Content area */
.content {
    padding: 1.5rem;
    flex: 1;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: var(--card);
    border-radius: var(--radius);
    border: 1.5px solid var(--border);
    box-shadow: var(--shadow);
    padding: 1.2rem;
    margin-bottom: 1.2rem;
}

.card-title {
    font-family: 'Quicksand', sans-serif;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Stat Cards */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 1.2rem;
}

.stat-card {
    background: var(--card);
    border-radius: var(--radius);
    border: 1.5px solid var(--border);
    box-shadow: var(--shadow);
    padding: 1rem 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    transition: transform var(--transition), box-shadow var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.stat-icon.coral   { background: #FFF0EB; }
.stat-icon.teal    { background: #E8F8F7; }
.stat-icon.yellow  { background: #FFFBEA; }
.stat-icon.purple  { background: #F3F0FF; }
.stat-icon.pink    { background: #FEF0F5; }

.stat-val {
    font-family: 'Quicksand', sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.1;
}

.stat-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-top: 0.15rem;
}

/* ============================================================
   TABEL REKAP DASHBOARD
   ============================================================ */
.rekap-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.rekap-table th {
    background: var(--primary-pale);
    color: var(--primary);
    font-weight: 700;
    padding: 0.65rem 0.85rem;
    text-align: center;
    border: 1.5px solid var(--border);
    font-size: 0.78rem;
}

.rekap-table th:first-child { text-align: left; }

.rekap-table td {
    padding: 0.6rem 0.85rem;
    border: 1.5px solid var(--border);
    text-align: center;
    color: var(--text);
    font-weight: 600;
}

.rekap-table td:first-child { text-align: left; font-weight: 700; }

.rekap-table tr:hover td { background: var(--primary-pale); }

.rekap-table tfoot td {
    background: var(--primary);
    color: #fff;
    font-weight: 800;
    font-size: 0.85rem;
}

/* Mini bar chart */
.mini-bar-wrap { margin-top: 0.5rem; }

.mini-bar-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.5rem;
    font-size: 0.78rem;
}

.mini-bar-label { width: 70px; font-weight: 600; color: var(--text-muted); flex-shrink: 0; }
.mini-bar-track { flex: 1; height: 10px; background: var(--border); border-radius: 99px; overflow: hidden; }
.mini-bar-fill  { height: 100%; border-radius: 99px; transition: width 0.8s cubic-bezier(0.4,0,0.2,1); }
.mini-bar-val   { width: 45px; text-align: right; font-weight: 700; color: var(--text); font-size: 0.8rem; }

/* ============================================================
   TABEL DATA
   ============================================================ */
.data-table-wrap { overflow-x: auto; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.data-table thead th {
    background: var(--primary-pale);
    color: var(--primary);
    font-weight: 700;
    padding: 0.7rem 1rem;
    text-align: left;
    border-bottom: 2px solid var(--primary-soft);
    white-space: nowrap;
}

.data-table tbody td {
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: middle;
}

.data-table tbody tr:hover td { background: var(--primary-pale); }
.data-table tbody tr:last-child td { border-bottom: none; }

/* Badge */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.7rem;
    border-radius: 99px;
    font-size: 0.7rem;
    font-weight: 700;
}

.badge-l      { background: #E3F2FD; color: #1565C0; }
.badge-p      { background: #FCE4EC; color: #C62828; }
.badge-islam  { background: #E8F5E9; color: #2E7D32; }
.badge-hindu  { background: #FFF8E1; color: #F57F17; }
.badge-aktif  { background: #E8F5E9; color: #2E7D32; }
.badge-alumni { background: #E3F2FD; color: #1565C0; }
.badge-pindah { background: #FFF8E1; color: #F57F17; }
.badge-keluar { background: #FFEBEE; color: #C62828; }

/* ============================================================
   FORM
   ============================================================ */
.form-group { margin-bottom: 1rem; }

.form-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}

.form-control {
    width: 100%;
    padding: 0.6rem 0.85rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: 'Nunito', sans-serif;
    font-size: 0.85rem;
    color: var(--text);
    background: #fff;
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255,140,105,0.15);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-section-title {
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--primary);
    margin: 1.2rem 0 0.75rem;
    padding-bottom: 0.4rem;
    border-bottom: 1.5px dashed var(--primary-soft);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 1.1rem;
    border-radius: var(--radius-sm);
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    font-size: 0.82rem;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(255,140,105,0.3);
}
.btn-primary:hover { background: #e87a58; transform: translateY(-1px); }

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--border);
    color: var(--text-muted);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-pale); }

.btn-danger  { background: #FFEBEE; color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-success { background: #E8F5E9; color: var(--success); }
.btn-success:hover { background: var(--success); color: #fff; }

.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.75rem; }
.btn-icon { padding: 0.4rem 0.5rem; }

/* ============================================================
   SEARCH & FILTER BAR
   ============================================================ */
.filter-bar {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.search-wrap {
    position: relative;
    flex: 1;
    min-width: 200px;
}

.search-wrap .search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    font-size: 0.9rem;
}

.search-wrap .form-control {
    padding-left: 2.2rem;
}

/* ============================================================
   ALERT / FLASH MESSAGE
   ============================================================ */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: 0.82rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.alert-success { background: #E8F5E9; color: #2E7D32; border-left: 4px solid var(--success); }
.alert-danger  { background: #FFEBEE; color: #C62828; border-left: 4px solid var(--danger); }
.alert-warning { background: #FFFBEA; color: #F57F17; border-left: 4px solid var(--warning); }
.alert-info    { background: #E3F2FD; color: #1565C0; border-left: 4px solid var(--info); }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(74,55,40,0.35);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-overlay.open { display: flex; }

.modal {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(74,55,40,0.2);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalIn 0.25s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(-20px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    padding: 1.1rem 1.3rem;
    border-bottom: 1.5px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-family: 'Quicksand', sans-serif;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0.2rem;
    border-radius: 6px;
    transition: color var(--transition);
}
.modal-close:hover { color: var(--danger); }

.modal-body    { padding: 1.2rem 1.3rem; }
.modal-footer  { padding: 0.9rem 1.3rem; border-top: 1.5px solid var(--border); display: flex; gap: 0.6rem; justify-content: flex-end; }

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
    display: flex;
    gap: 0.3rem;
    align-items: center;
    justify-content: center;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.page-btn {
    min-width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border);
    background: var(--card);
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.78rem;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition);
    padding: 0 0.5rem;
}

.page-btn:hover, .page-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #FFF0EB 0%, #FFF8F5 50%, #E8F8F7 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.login-card {
    background: var(--card);
    border-radius: 20px;
    border: 1.5px solid var(--border);
    box-shadow: 0 20px 60px rgba(255,140,105,0.15);
    padding: 2rem 2rem;
    width: 100%;
    max-width: 380px;
}

.login-logo {
    text-align: center;
    margin-bottom: 1.5rem;
}

.login-logo .logo-icon {
    width: 60px; height: 60px;
    background: var(--primary);
    border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.8rem;
    margin: 0 auto 0.75rem;
    box-shadow: 0 8px 24px rgba(255,140,105,0.35);
}

.login-logo h1 {
    font-family: 'Quicksand', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary);
}

.login-logo p {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty-state .empty-icon {
    font-size: 3rem;
    margin-bottom: 0.75rem;
    opacity: 0.5;
}

.empty-state p {
    font-size: 0.85rem;
    font-weight: 600;
}

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

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(74,55,40,0.15);
    }

    .main {
        margin-left: 0;
    }

    .hamburger { display: block; }

    .form-row { grid-template-columns: 1fr; }

    .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================
   OVERLAY (mobile sidebar)
   ============================================================ */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(74,55,40,0.3);
    z-index: 99;
}

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

/* ============================================================
   UTILITIES
   ============================================================ */
.text-muted   { color: var(--text-muted); }
.text-primary { color: var(--primary); }
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.fw-bold      { font-weight: 700; }
.fw-bolder    { font-weight: 800; }
.mt-1  { margin-top: 0.5rem; }
.mt-2  { margin-top: 1rem; }
.mb-1  { margin-bottom: 0.5rem; }
.mb-2  { margin-bottom: 1rem; }
.gap-1 { gap: 0.5rem; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
