/* =========================================================
   SIPPMU — SMA Muhammadiyah 2 Bandar Lampung
   Palet: hijau Muhammadiyah + aksen emas matahari
   Font: Plus Jakarta Sans (judul) / Inter (UI) / JetBrains Mono (data)
   ========================================================= */

:root {
    --green-900: #0F3D24;
    --green-800: #124A2C;
    --green-700: #16803C;
    --green-600: #1B9548;
    --green-500: #22A355;
    --green-100: #E4F3EA;
    --gold-500:  #E3A324;
    --gold-100:  #FBF0D9;
    --red-600:   #C0392B;
    --red-100:   #FBE7E4;
    --bg:        #F5F8F6;
    --surface:   #FFFFFF;
    --ink:       #16241C;
    --ink-muted: #64766D;
    --border:    #E4EAE6;

    --shadow-sm: 0 1px 2px rgba(15, 61, 36, 0.06);
    --shadow-md: 0 4px 14px rgba(15, 61, 36, 0.08), 0 1px 3px rgba(15, 61, 36, 0.06);
    --shadow-lg: 0 16px 40px rgba(15, 61, 36, 0.14), 0 4px 10px rgba(15, 61, 36, 0.08);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: 'Inter', -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: 'Plus Jakarta Sans', 'Inter', sans-serif; letter-spacing: -0.01em; }
a { color: var(--green-700); }
.mono { font-family: 'JetBrains Mono', monospace; }

/* =========================================================
   LOGIN — split screen, panel kiri identitas + pola geometris
   ========================================================= */
.login-page { background: var(--bg); }
.login-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.05fr 1fr;
}

.login-left {
    position: relative;
    background:
        radial-gradient(circle at 15% 20%, rgba(227,163,36,0.16), transparent 45%),
        linear-gradient(160deg, var(--green-900) 0%, var(--green-800) 55%, var(--green-700) 100%);
    color: #fff;
    display: flex;
    align-items: center;
    padding: 4rem;
    overflow: hidden;
}
/* Motif geometris 8-titik, samar, mengisi panel — identitas sekolah Islam tanpa berlebihan */
.login-left::before {
    content: "";
    position: absolute;
    inset: 0;
    opacity: 0.10;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='84' height='84' viewBox='0 0 84 84'%3E%3Cg fill='none' stroke='%23ffffff' stroke-width='1'%3E%3Crect x='22' y='22' width='40' height='40' transform='rotate(0 42 42)'/%3E%3Crect x='22' y='22' width='40' height='40' transform='rotate(45 42 42)'/%3E%3C/g%3E%3C/svg%3E");
    background-size: 84px 84px;
}
.login-left-inner { position: relative; z-index: 1; max-width: 420px; }
.login-mark {
    width: 54px; height: 54px; border-radius: 14px;
    background: var(--gold-500); color: var(--green-900);
    display: flex; align-items: center; justify-content: center;
    font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 800; font-size: 1.4rem;
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
    overflow: hidden;
}
.login-mark img { width: 100%; height: 100%; object-fit: contain; padding: 6px; background: #fff; }
.login-school { font-size: 1.9rem; font-weight: 800; line-height: 1.2; margin: 0 0 .8rem; }
.login-slogan { font-size: 1rem; color: rgba(255,255,255,0.78); line-height: 1.6; margin: 0 0 2.5rem; }
.login-meta { display: flex; gap: 2rem; border-top: 1px solid rgba(255,255,255,0.16); padding-top: 1.5rem; }
.login-meta-item { display: flex; flex-direction: column; gap: .25rem; }
.login-meta-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: rgba(255,255,255,0.55); }
.login-meta-value { font-weight: 600; font-size: .95rem; }

.login-right { display: flex; align-items: center; justify-content: center; padding: 2rem; }
.login-box {
    background: var(--surface);
    padding: 2.6rem 2.4rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 360px;
    border: 1px solid var(--border);
}
.login-box h2 { margin: 0 0 .3rem; font-size: 1.5rem; color: var(--green-900); }
.login-subtitle { color: var(--ink-muted); font-size: .88rem; margin: 0 0 1.5rem; }
.login-box label { display: block; margin-top: 1.1rem; font-size: .82rem; font-weight: 600; color: var(--ink); }
.login-box input {
    width: 100%; padding: .75rem .9rem; margin-top: .4rem;
    border: 1.5px solid var(--border); border-radius: var(--radius-sm);
    font-size: .92rem; transition: border-color .15s, box-shadow .15s;
}
.login-box input:focus {
    outline: none; border-color: var(--green-600);
    box-shadow: 0 0 0 4px var(--green-100);
}
.login-box button {
    width: 100%; margin-top: 1.8rem; padding: .8rem;
    background: var(--green-700); color: #fff; border: none; border-radius: var(--radius-sm);
    font-weight: 700; font-size: .95rem; letter-spacing: .01em;
    box-shadow: var(--shadow-md);
    transition: background .15s, transform .1s, box-shadow .15s;
}
.login-box button:hover { background: var(--green-600); box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.login-box button:active { transform: translateY(0); }
.login-footnote { text-align: center; font-size: .78rem; color: var(--ink-muted); margin: 1.2rem 0 0; }
.alert-error { background: var(--red-100); color: var(--red-600); padding: .65rem .9rem; border-radius: var(--radius-sm); font-size: .85rem; margin-top: 1rem; }
.alert-success { background: var(--green-100); color: var(--green-800); padding: .65rem .9rem; border-radius: var(--radius-sm); font-size: .88rem; margin-bottom: 1.2rem; box-shadow: var(--shadow-sm); }

@media (max-width: 860px) {
    .login-shell { grid-template-columns: 1fr; }
    .login-left { display: none; }
    .login-right { padding: 1.5rem; }
}

/* =========================================================
   LAYOUT UTAMA (dashboard)
   ========================================================= */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 250px; flex-shrink: 0;
    background: linear-gradient(180deg, var(--green-900) 0%, var(--green-800) 100%);
    color: #fff;
    display: flex; flex-direction: column;
    padding: 1.4rem 1rem;
    position: sticky; top: 0; height: 100vh;
}
.sidebar-brand { display: flex; align-items: center; gap: .7rem; padding: 0 .5rem 1.5rem; }
.brand-mark {
    width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
    background: var(--gold-500); color: var(--green-900);
    display: flex; align-items: center; justify-content: center;
    font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 800; font-size: 1.1rem;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.brand-mark img { width: 100%; height: 100%; object-fit: contain; padding: 4px; background: #fff; }
.brand-title { font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 800; font-size: 1.05rem; line-height: 1.1; }
.brand-sub { font-size: .68rem; color: rgba(255,255,255,0.55); letter-spacing: .06em; text-transform: uppercase; margin-top: 2px; }

.sidebar nav { flex: 1; overflow-y: auto; }
.sidebar nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .2rem; }
.sidebar nav a {
    display: flex; align-items: center; gap: .7rem;
    padding: .6rem .7rem; border-radius: var(--radius-sm);
    color: rgba(255,255,255,0.72); text-decoration: none;
    font-size: .87rem; font-weight: 500;
    border-left: 3px solid transparent;
    transition: background .15s, color .15s;
}
.sidebar nav a:hover { background: rgba(255,255,255,0.06); color: #fff; }
.sidebar nav a.active {
    background: rgba(255,255,255,0.1);
    color: #fff; font-weight: 600;
    border-left: 3px solid var(--gold-500);
}
.sidebar nav a .nav-icon { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-footer { border-top: 1px solid rgba(255,255,255,0.12); padding-top: 1rem; margin-top: .5rem; }
.logout-link { display: flex; align-items: center; gap: .7rem; color: rgba(255,255,255,0.65); text-decoration: none; font-size: .85rem; padding: .5rem .7rem; border-radius: var(--radius-sm); transition: background .15s, color .15s; }
.logout-link:hover { background: rgba(255,255,255,0.06); color: #fff; }
.logout-link .nav-icon { width: 18px; height: 18px; }

.content { flex: 1; min-width: 0; }
.content-inner { padding: 1.6rem 2rem 3rem; max-width: 1100px; }

.topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1rem 2rem; background: var(--surface); border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 5;
}
.topbar-greeting { font-size: .82rem; color: var(--ink-muted); }
.topbar-user { display: flex; align-items: center; gap: .7rem; }
.role-badge {
    font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
    background: var(--gold-100); color: #8A5E10; padding: .3rem .7rem; border-radius: 999px;
}
.user-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--green-700); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .85rem; box-shadow: var(--shadow-sm);
}
.user-name { font-size: .87rem; font-weight: 600; color: var(--ink); }

@media (max-width: 900px) {
    .layout { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: static; }
    .sidebar nav ul { flex-direction: row; flex-wrap: wrap; }
    .sidebar nav a span { display: none; }
    .sidebar-footer { display: none; }
    .content-inner { padding: 1.2rem; }
    .topbar { padding: .8rem 1.2rem; }
    .user-name { display: none; }
}

/* =========================================================
   KOMPONEN: kartu, form, tabel, tab, badge
   ========================================================= */
h2.page-title, .content-inner > h2:first-child {
    font-size: 1.4rem; font-weight: 700; color: var(--green-900); margin: 0 0 1.2rem;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.4rem 1.5rem;
    margin-bottom: 1.4rem;
    box-shadow: var(--shadow-sm);
    transition: box-shadow .15s;
}
.card:hover { box-shadow: var(--shadow-md); }
.card h3 { margin: 0 0 1rem; font-size: 1rem; color: var(--green-800); font-weight: 700; }
.muted { color: var(--ink-muted); font-size: .85rem; }

label { display: block; margin-top: .9rem; font-size: .82rem; font-weight: 600; color: var(--ink); }
input[type=text], input[type=password], input[type=date], input[type=time],
input[type=number], input[type=file], select, textarea {
    width: 100%; max-width: 420px; padding: .55rem .75rem; margin-top: .35rem;
    border: 1.5px solid var(--border); border-radius: var(--radius-sm);
    font-size: .88rem; font-family: inherit; background: var(--surface); color: var(--ink);
    transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--green-600); box-shadow: 0 0 0 4px var(--green-100);
}
textarea { resize: vertical; }

button { font-family: inherit; cursor: pointer; border: none; }
button[type=submit], button[name=simpan], button[name=simpan_manual], button[name=simpan_jadwal],
button[name=tambah_libur], button[name=import], button[name=arsip] {
    margin-top: 1.2rem; padding: .6rem 1.4rem;
    background: var(--green-700); color: #fff;
    border-radius: var(--radius-sm); font-weight: 700; font-size: .87rem;
    box-shadow: var(--shadow-sm);
    transition: background .15s, box-shadow .15s, transform .1s;
}
button[type=submit]:hover, button[name=simpan]:hover, button[name=simpan_manual]:hover,
button[name=simpan_jadwal]:hover, button[name=tambah_libur]:hover, button[name=import]:hover {
    background: var(--green-600); box-shadow: var(--shadow-md); transform: translateY(-1px);
}
button[name=arsip] { background: var(--red-600); }
button[name=arsip]:hover { background: #A5311F; }

.btn-danger-small {
    background: var(--red-100); color: var(--red-600);
    border-radius: 6px; padding: .35rem .7rem; font-size: .78rem; font-weight: 600;
    transition: background .15s;
}
.btn-danger-small:hover { background: #F5CFC9; }

.filter-form { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; }
.filter-form label { margin-top: 0; }
.filter-form input, .filter-form select { max-width: 190px; margin-top: .3rem; }
.filter-form button {
    margin-top: 0; padding: .55rem 1.2rem; background: var(--green-700); color: #fff;
    border-radius: var(--radius-sm); font-weight: 700; font-size: .85rem; box-shadow: var(--shadow-sm);
}
.filter-form button:hover { background: var(--green-600); }

/* ---- Tabel ---- */
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; margin-top: 1rem; font-size: .84rem; }
.data-table th {
    background: var(--green-100); color: var(--green-900);
    text-align: left; padding: .6rem .8rem; font-weight: 700;
    font-size: .74rem; text-transform: uppercase; letter-spacing: .03em;
}
.data-table th:first-child { border-radius: var(--radius-sm) 0 0 0; }
.data-table th:last-child { border-radius: 0 var(--radius-sm) 0 0; }
.data-table td { padding: .6rem .8rem; border-bottom: 1px solid var(--border); }
.data-table tbody tr:hover { background: #FAFCFA; }
.data-table tfoot td { border-top: 2px solid var(--border); font-weight: 700; }

/* ---- Tab ---- */
.tabs { display: flex; gap: .4rem; margin-bottom: 1.2rem; border-bottom: 2px solid var(--border); }
.tabs a {
    padding: .6rem 1.1rem; text-decoration: none; color: var(--ink-muted);
    font-size: .87rem; font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -2px;
    transition: color .15s, border-color .15s;
}
.tabs a:hover { color: var(--green-700); }
.tabs a.active { color: var(--green-700); border-bottom-color: var(--green-700); }

/* ---- Tombol mode scan sholat ---- */
#btn-hadir, #btn-halangan {
    padding: .45rem .9rem; border: 1.5px solid var(--green-600); background: var(--surface);
    color: var(--green-700); border-radius: var(--radius-sm); font-weight: 600; font-size: .82rem;
}
.btn-active { background: var(--green-700) !important; color: #fff !important; border-color: var(--green-700) !important; }

/* ---- Statistik dashboard ---- */
.stat-grid { display: flex; gap: 1rem; flex-wrap: wrap; }
.stat-box {
    flex: 1; min-width: 110px; background: var(--green-100);
    border-radius: var(--radius-md); padding: 1.1rem; text-align: center;
    box-shadow: var(--shadow-sm);
}
.stat-num { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 1.7rem; font-weight: 800; color: var(--green-800); }

/* ---- Kartu Murid (ID card) ---- */
.id-card {
    max-width: 400px; border-radius: var(--radius-lg); padding: 1.3rem;
    background: linear-gradient(160deg, var(--surface) 0%, var(--green-100) 130%);
    border: 1px solid var(--border); box-shadow: var(--shadow-md);
}
.id-card-header { display: flex; align-items: center; gap: .7rem; border-bottom: 1px solid var(--border); padding-bottom: .8rem; margin-bottom: .9rem; }
.id-card-header img { height: 40px; }
.id-card-school { font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 700; color: var(--green-900); font-size: .92rem; }
.id-card-address { font-size: .74rem; color: var(--ink-muted); }
.id-card-body { display: flex; gap: 1.1rem; align-items: center; }
.id-card-info div { margin-bottom: .3rem; font-size: .9rem; }

input[type=color] {
    width: 60px; height: 40px; padding: 3px; margin-top: .35rem;
    border: 1.5px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; background: var(--surface);
}
.color-row { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.color-row label { margin-top: 0; }

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table.compact th, .data-table.compact td { padding: .4rem .5rem; text-align: center; white-space: nowrap; }
.data-table.compact td:first-child, .data-table.compact th:first-child { text-align: left; position: sticky; left: 0; background: var(--surface); }
.data-table.compact td.symbol-hadir { color: var(--green-700); font-weight: 700; }
.data-table.compact td.symbol-halangan { color: var(--gold-500); font-weight: 700; }
.data-table.compact td.symbol-tidak { color: var(--ink-muted); }
@media print {
    .sidebar, .topbar, .no-print { display: none !important; }
    .layout { display: block; }
    .content-inner { padding: 0; max-width: none; }
    body { background: #fff; }
    .card { box-shadow: none; border: none; }
}
