/* =========================================================
   ABSENSISWA — Design tokens
   Palet terinspirasi papan tulis kelas & buku rapor:
   hijau tua sebagai warna utama, aksen status yang jelas.
   ========================================================= */
:root {
    --ink:        #16302B;   /* hijau papan tulis tua - sidebar & heading */
    --ink-soft:   #24463E;   /* hover state di atas ink */
    --paper:      #F6F7F5;   /* latar halaman, putih sejuk (bukan cream) */
    --surface:    #FFFFFF;
    --line:       #E3E7E3;   /* garis tipis pemisah kartu */
    --text:       #1E2521;
    --text-muted: #66756E;

    --teal:       #1F8A72;   /* Hadir / aksen utama */
    --teal-dark:  #146A57;
    --amber:      #E2A63B;   /* Sakit */
    --blue:       #3E6AE1;   /* Izin */
    --coral:      #E1584B;   /* Alpa / danger */

    --radius-card: 14px;
    --radius-sm: 8px;
    --font-display: 'Fraunces', Georgia, serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    background: var(--paper);
    margin: 0;
    color: var(--text);
    font-size: .95rem;
}

h1, h2, h3, h4, h5, h6 { font-family: var(--font-body); font-weight: 700; color: var(--ink); }

a { color: var(--teal-dark); }
a:hover { color: var(--teal); }

:focus-visible {
    outline: 2px solid var(--teal);
    outline-offset: 2px;
}

.app-wrapper { display: flex; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
    width: 254px;
    background: var(--ink);
    color: #C9D6D1;
    flex-shrink: 0;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    overflow-y: auto;
    transition: transform .28s ease;
    z-index: 1030;
}
.sidebar-brand {
    display: flex; align-items: center; gap: 11px;
    padding: 24px 22px 20px;
    font-family: var(--font-display);
    font-weight: 600; font-size: 1.4rem;
    color: #fff;
    letter-spacing: .01em;
}
.sidebar-brand i { color: var(--teal); font-size: 1.3rem; }
.sidebar-nav { padding: 6px 12px 20px; display: flex; flex-direction: column; gap: 2px; }
.sidebar-nav a {
    display: flex; align-items: center; gap: 12px;
    color: #B7C4BE; text-decoration: none;
    padding: 10px 14px; font-size: .89rem; font-weight: 500;
    border-radius: var(--radius-sm);
    transition: background .15s ease, color .15s ease;
}
.sidebar-nav a i { width: 18px; text-align: center; opacity: .85; font-size: .95rem; }
.sidebar-nav a:hover { background: var(--ink-soft); color: #fff; }
.sidebar-nav a.active {
    background: var(--teal);
    color: #fff;
    font-weight: 600;
}
.sidebar-nav a.active i { opacity: 1; }
.sidebar-section-title {
    font-size: .72rem; font-weight: 600;
    color: #6E8078; padding: 16px 14px 6px;
}
.sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(10, 20, 17, .45);
    z-index: 1020;
}

/* ---------- Main content ---------- */
.main-content { margin-left: 254px; flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    background: var(--surface);
    padding: 14px 26px;
    display: flex; align-items: center; gap: 16px;
    border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 900;
}
.btn-toggle {
    border: none; background: none; font-size: 1.15rem; color: var(--ink);
    display: none; cursor: pointer; width: 34px; height: 34px; border-radius: var(--radius-sm);
}
.btn-toggle:hover { background: var(--paper); }
.topbar-title { font-weight: 700; color: var(--ink); font-size: 1.05rem; }
.topbar-user { margin-left: auto; display: flex; align-items: center; gap: 10px; color: var(--text-muted); font-size: .87rem; }
.avatar-circle {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--teal); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .85rem; flex-shrink: 0;
}
.content-area { padding: 24px 26px 40px; flex: 1; }

/* ---------- Cards ---------- */
.card {
    border: 1px solid var(--line);
    border-radius: var(--radius-card);
    box-shadow: none;
    background: var(--surface);
}

/* Stat cards: garis aksen kiri berwarna status, angka besar bergaya serif */
.stat-card {
    border-radius: var(--radius-card);
    padding: 18px 20px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-left: 4px solid var(--teal);
    position: relative;
    display: flex; flex-direction: column; gap: 2px;
    color: var(--text);
}
.stat-card i.bg-icon { position: absolute; right: 16px; top: 16px; font-size: 1.3rem; opacity: .35; color: var(--text-muted); }
.stat-card h3 {
    font-family: var(--font-display);
    font-size: 2rem; font-weight: 600; margin: 0 0 2px; line-height: 1;
    color: var(--ink);
}
.stat-card span.label { font-size: .82rem; color: var(--text-muted); font-weight: 500; }

.stat-blue  { border-left-color: var(--blue); }
.stat-green { border-left-color: var(--teal); }
.stat-orange{ border-left-color: var(--amber); }
.stat-red   { border-left-color: var(--coral); }

.card-title-section {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 18px; flex-wrap: wrap; gap: 10px;
}
.card-title-section h5 { font-weight: 700; margin: 0; font-size: 1.02rem; }

/* ---------- Buttons ---------- */
.btn { border-radius: var(--radius-sm); font-weight: 600; font-size: .87rem; padding: .5rem 1rem; }
.btn-primary { background: var(--teal); border-color: var(--teal); }
.btn-primary:hover, .btn-primary:focus { background: var(--teal-dark); border-color: var(--teal-dark); }
.btn-outline-primary { color: var(--teal-dark); border-color: var(--teal); }
.btn-outline-primary:hover { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn-outline-success { color: var(--teal-dark); border-color: var(--teal); }
.btn-outline-success:hover { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn-sm { font-size: .8rem; }

/* ---------- Forms ---------- */
.form-control, .form-select {
    border-radius: var(--radius-sm);
    border-color: var(--line);
    font-size: .89rem;
}
.form-control:focus, .form-select:focus {
    border-color: var(--teal);
    box-shadow: 0 0 0 .18rem rgba(31,138,114,.15);
}
.form-label { font-weight: 600; font-size: .85rem; color: var(--ink); margin-bottom: 5px; }

/* ---------- Tables ---------- */
.table { font-size: .88rem; }
.table thead th {
    font-size: .75rem; text-transform: uppercase; letter-spacing: .04em;
    color: var(--text-muted); font-weight: 700;
    border-bottom-width: 1px; white-space: nowrap;
}
.table td { vertical-align: middle; }
.table-responsive { border-radius: var(--radius-sm); }

/* ---------- Badges ---------- */
.badge { font-weight: 600; font-size: .74rem; padding: .4em .65em; border-radius: 6px; }

/* ---------- Nav tabs (laporan) ---------- */
.nav-tabs { border-bottom-color: var(--line); flex-wrap: nowrap; overflow-x: auto; }
.nav-tabs .nav-link {
    color: var(--text-muted); font-weight: 600; font-size: .87rem;
    border: none; border-bottom: 2px solid transparent; white-space: nowrap;
}
.nav-tabs .nav-link.active { color: var(--teal-dark); border-bottom-color: var(--teal); background: none; }

/* ---------- Alerts ---------- */
.alert { border-radius: var(--radius-sm); border: 1px solid transparent; font-size: .88rem; }

/* =========================================================
   LOGIN PAGE — split screen
   ========================================================= */
.login-page {
    min-height: 100vh;
    display: flex;
    background: var(--paper);
}
.login-hero {
    flex: 1.1;
    background: var(--ink);
    color: #fff;
    padding: 56px 52px;
    display: flex; flex-direction: column; justify-content: space-between;
    position: relative;
    overflow: hidden;
}
.login-hero::before {
    content: "";
    position: absolute; inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.06) 1px, transparent 1px);
    background-size: 34px 34px;
    mask-image: radial-gradient(circle at 30% 30%, black 0%, transparent 70%);
    pointer-events: none;
}
.login-hero-brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-size: 1.3rem; font-weight: 600; position: relative; z-index: 1; }
.login-hero-brand i { color: var(--teal); }
.login-hero h1 {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(1.9rem, 3.4vw, 2.7rem);
    color: #fff; line-height: 1.15; max-width: 15ch;
    position: relative; z-index: 1;
}
.login-hero p { color: #A9BAB3; max-width: 38ch; font-size: .95rem; position: relative; z-index: 1; }
.login-hero-foot { color: #7F978D; font-size: .8rem; position: relative; z-index: 1; }

.login-form-panel {
    flex: 1;
    display: flex; align-items: center; justify-content: center;
    padding: 40px 32px;
}
.login-form-box { width: 100%; max-width: 360px; }
.login-form-box h4 { font-weight: 700; margin-bottom: 4px; }
.login-form-box .sub { color: var(--text-muted); font-size: .88rem; margin-bottom: 26px; }

@media (max-width: 900px) {
    .login-page { flex-direction: column; }
    .login-hero { padding: 32px 28px; flex: none; min-height: 190px; }
    .login-hero h1 { max-width: none; font-size: 1.6rem; }
    .login-hero p { display: none; }
    .login-form-panel { padding: 32px 24px 48px; }
}

/* =========================================================
   RESPONSIVE — sidebar & layout for tablet/mobile
   ========================================================= */
@media (max-width: 992px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.show { transform: translateX(0); }
    .sidebar-overlay.show { display: block; }
    .main-content { margin-left: 0; }
    .btn-toggle { display: inline-flex; align-items: center; justify-content: center; }
    .content-area { padding: 18px 16px 32px; }
    .topbar { padding: 12px 16px; }
    .topbar-title { font-size: .95rem; }
}

@media (max-width: 576px) {
    .stat-card h3 { font-size: 1.6rem; }
    .card { border-radius: 12px; }
    .content-area { padding: 14px 12px 28px; }
    .topbar-user span { display: none; }
    .card-title-section { align-items: flex-start; }
    .card-title-section .d-flex { width: 100%; }
}

@media print {
    .sidebar, .sidebar-overlay, .topbar, .no-print { display: none !important; }
    .main-content { margin-left: 0 !important; }
    .card { border: 1px solid #ccc; }
    body { background: #fff; }
}
