/* =========================================================
   SiHADIR — tema kustom di atas AdminLTE 4 / Bootstrap 5
   ========================================================= */
:root {
    --brand: #0f766e;
    --brand-600: #0d6b63;
    --brand-700: #0f5f55;
    --brand-soft: #ccfbf1;
    --accent: #f59e0b;
    --bs-primary: #0f766e;
    --bs-primary-rgb: 15, 118, 110;
    --bs-link-color: #0f766e;
    --bs-link-color-rgb: 15, 118, 110;
    --bs-link-hover-color: #0f5f55;
    --bs-body-font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --radius: 14px;
}
[data-bs-theme="dark"] {
    --bs-primary: #2dd4bf;
    --bs-primary-rgb: 45, 212, 191;
    --bs-link-color: #5eead4;
    --bs-link-color-rgb: 94, 234, 212;
    --brand-soft: #134e4a;
}
body { font-family: var(--bs-body-font-family); }

/* Tombol & komponen utama memakai warna brand */
.btn-primary {
    --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand);
    --bs-btn-hover-bg: var(--brand-700); --bs-btn-hover-border-color: var(--brand-700);
    --bs-btn-active-bg: var(--brand-700); --bs-btn-active-border-color: var(--brand-700);
    --bs-btn-disabled-bg: var(--brand); --bs-btn-disabled-border-color: var(--brand);
}
.btn-outline-primary {
    --bs-btn-color: var(--brand); --bs-btn-border-color: var(--brand);
    --bs-btn-hover-bg: var(--brand); --bs-btn-hover-border-color: var(--brand);
    --bs-btn-active-bg: var(--brand); --bs-btn-active-border-color: var(--brand);
}
[data-bs-theme="dark"] .btn-outline-primary { --bs-btn-color: #5eead4; }
.text-bg-primary { background-color: var(--brand) !important; color: #fff !important; }
.bg-primary { background-color: var(--brand) !important; }
.text-primary { color: var(--bs-primary) !important; }
.form-control:focus, .form-select:focus { border-color: #5eead4; box-shadow: 0 0 0 .2rem rgba(20, 184, 166, .2); }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.nav-pills .nav-link.active { background-color: var(--brand); }
.page-link { color: var(--brand); }
.active > .page-link, .page-link.active { background-color: var(--brand); border-color: var(--brand); }

/* Sidebar */
.sidebar-sihadir { background: linear-gradient(180deg, #0f3d3a 0%, #0b2e2c 100%) !important; }
.sidebar-sihadir .sidebar-brand { border-bottom: 1px solid rgba(255, 255, 255, .08); }
.sidebar-sihadir .brand-image { border-radius: 10px; background: #fff; padding: 2px; }
.sidebar-sihadir .nav-header { font-size: .68rem; letter-spacing: .08em; color: rgba(255, 255, 255, .45) !important; padding-top: 1rem; }
.sidebar-sihadir .sidebar-menu .nav-link { border-radius: 10px; margin: 1px 8px; width: auto; }
.sidebar-sihadir .sidebar-menu .nav-link.active { background: linear-gradient(90deg, #14b8a6, #0f766e) !important; color: #fff !important; box-shadow: 0 6px 16px -6px rgba(20, 184, 166, .7); }
.sidebar-sihadir .sidebar-menu .nav-link:hover:not(.active) { background: rgba(255, 255, 255, .07); }

.app-header .user-header { min-height: 175px; }
.app-content-header { padding-top: 1.1rem; padding-bottom: .6rem; }

/* Kartu */
.card { border: 0; border-radius: var(--radius); box-shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .08); }
.card > .card-header { background: transparent; border-bottom: 1px solid var(--bs-border-color-translucent); padding: .9rem 1.1rem; }
.card > .card-header .card-title { font-weight: 700; font-size: 1rem; margin: 0; }
.card-header .card-tools { margin-left: auto; }
.card-header.d-flex .card-title { float: none; }

/* Kartu statistik */
.stat-card { position: relative; overflow: hidden; border-radius: var(--radius); padding: 1rem 1.1rem; color: #fff; min-height: 112px; box-shadow: 0 10px 24px -14px rgba(0, 0, 0, .45); }
.stat-card .stat-value { font-size: 2rem; font-weight: 800; line-height: 1.1; }
.stat-card .stat-label { font-weight: 600; opacity: .92; font-size: .9rem; }
.stat-card .stat-sub { font-size: .78rem; opacity: .85; }
.stat-card .stat-icon { position: absolute; right: -6px; bottom: -14px; font-size: 5rem; opacity: .18; transform: rotate(-12deg); }
.stat-card a { color: inherit; }
.bg-grad-teal   { background: linear-gradient(135deg, #14b8a6, #0f766e); }
.bg-grad-green  { background: linear-gradient(135deg, #22c55e, #15803d); }
.bg-grad-amber  { background: linear-gradient(135deg, #f59e0b, #d97706); }
.bg-grad-red    { background: linear-gradient(135deg, #f43f5e, #be123c); }
.bg-grad-blue   { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.bg-grad-purple { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }
.bg-grad-slate  { background: linear-gradient(135deg, #64748b, #334155); }

/* Avatar inisial */
.avatar-initial { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: #fff; font-weight: 700; letter-spacing: .02em; }

/* Tabel */
.table > :not(caption) > * > * { padding: .6rem .75rem; }
.table thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--bs-secondary-color); font-weight: 700; white-space: nowrap; }
.table-hover tbody tr:hover { --bs-table-hover-bg: rgba(20, 184, 166, .06); }
.table-sm > :not(caption) > * > * { padding: .35rem .5rem; }

/* Rekap bulanan (matriks) */
.table-matrix { font-size: .78rem; }
.table-matrix th, .table-matrix td { text-align: center; padding: .25rem .3rem !important; white-space: nowrap; }
.table-matrix td.nama { text-align: left; position: sticky; left: 0; background: var(--bs-body-bg); z-index: 1; }
.table-matrix .libur { background: rgba(148, 163, 184, .18) !important; }
.sel-H { color: #15803d; font-weight: 700; } .sel-T { color: #b45309; font-weight: 700; background: #fef3c7; }
.sel-S { color: #0369a1; font-weight: 700; background: #e0f2fe; } .sel-I { color: #4338ca; font-weight: 700; background: #e0e7ff; }
.sel-D { color: #475569; font-weight: 700; background: #f1f5f9; } .sel-A { color: #be123c; font-weight: 700; background: #ffe4e6; }
[data-bs-theme="dark"] .sel-T, [data-bs-theme="dark"] .sel-S, [data-bs-theme="dark"] .sel-I, [data-bs-theme="dark"] .sel-D, [data-bs-theme="dark"] .sel-A { background: transparent; }

/* Kalender kehadiran siswa */
.kalender { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.kalender .kh { font-size: .7rem; text-align: center; color: var(--bs-secondary-color); font-weight: 700; }
.kalender .kd { aspect-ratio: 1; border-radius: 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: .8rem; background: var(--bs-tertiary-bg); position: relative; }
.kalender .kd small { font-size: .6rem; font-weight: 700; }
.kalender .kd.st-H { background: #dcfce7; color: #166534; } .kalender .kd.st-T { background: #fef3c7; color: #92400e; }
.kalender .kd.st-S { background: #e0f2fe; color: #075985; } .kalender .kd.st-I { background: #e0e7ff; color: #3730a3; }
.kalender .kd.st-D { background: #f1f5f9; color: #334155; } .kalender .kd.st-A { background: #ffe4e6; color: #9f1239; }
.kalender .kd.libur { opacity: .45; } .kalender .kd.kosong { background: transparent; }
.kalender .kd.hari-ini { outline: 2px solid var(--brand); }

/* Progress kelas */
.progress-stack { height: 10px; border-radius: 99px; }

/* Kotak scan (halaman izin) */
.scan-box { border: 2px dashed rgba(20, 184, 166, .5); border-radius: var(--radius); background: rgba(20, 184, 166, .05); }
.scan-box input { font-size: 1.25rem; letter-spacing: .06em; }
.pulse-dot { width: 10px; height: 10px; border-radius: 50%; background: #22c55e; display: inline-block; box-shadow: 0 0 0 0 rgba(34, 197, 94, .7); animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, .6); } 70% { box-shadow: 0 0 0 10px rgba(34, 197, 94, 0); } 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); } }

/* List item siswa */
.list-siswa .item { display: flex; align-items: center; gap: .75rem; padding: .6rem .9rem; border-bottom: 1px solid var(--bs-border-color-translucent); }
.list-siswa .item:last-child { border-bottom: 0; }
.list-siswa .item .meta { font-size: .78rem; color: var(--bs-secondary-color); }
.min-w-0 { min-width: 0; }

/* Navigasi bawah (HP) */
.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1040; display: flex; background: var(--bs-body-bg); border-top: 1px solid var(--bs-border-color); box-shadow: 0 -4px 18px rgba(0, 0, 0, .06); padding-bottom: env(safe-area-inset-bottom); }
.bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; padding: .45rem 0 .4rem; font-size: .68rem; color: var(--bs-secondary-color); text-decoration: none; font-weight: 600; }
.bottom-nav a i { font-size: 1.25rem; line-height: 1.2; }
.bottom-nav a.active { color: var(--bs-primary); }
@media (max-width: 991.98px) {
    .app-wrapper { padding-bottom: 64px; }
    .app-footer { display: none; }
}
@media (max-width: 575.98px) {
    .app-content-header h3 { font-size: 1.25rem; }
    .stat-card { min-height: 96px; padding: .8rem .9rem; }
    .stat-card .stat-value { font-size: 1.6rem; }
    .container-fluid { padding-left: .75rem; padding-right: .75rem; }
    .card > .card-header { padding: .75rem .9rem; }
}

/* Login */
.login-page-sihadir { min-height: 100vh; background: radial-gradient(1200px 600px at 10% -10%, #5eead4 0%, transparent 60%), radial-gradient(900px 500px at 110% 110%, #fbbf24 0%, transparent 55%), linear-gradient(135deg, #0f766e, #0b2e2c); }
.login-card { max-width: 420px; border-radius: 20px; }
.login-card .logo { width: 72px; height: 72px; object-fit: contain; }

/* Cetak */
.kop { border-bottom: 3px double #000; padding-bottom: .5rem; margin-bottom: 1rem; }
.hanya-cetak { display: none; }
@media print {
    .app-sidebar, .app-header, .app-footer, .bottom-nav, .btn, .d-print-none, form.filter { display: none !important; }
    .app-main, .app-wrapper { margin: 0 !important; padding: 0 !important; }
    .app-wrapper { display: block !important; }
    .card { box-shadow: none !important; border: 0 !important; }
    .hanya-cetak { display: block !important; }
    body { background: #fff !important; font-size: 11px; }
    .table-matrix { font-size: 9px; }
    .table-matrix td.nama { position: static; }
    a { text-decoration: none !important; color: #000 !important; }
    @page { margin: 12mm; }
}

/* Kesiswaan */
.text-bg-orange { background-color: #ea580c !important; color: #fff !important; }
.text-orange { color: #ea580c !important; }
.btn-outline-orange { --bs-btn-color: #ea580c; --bs-btn-border-color: #ea580c; --bs-btn-hover-bg: #ea580c; --bs-btn-hover-border-color: #ea580c; --bs-btn-hover-color: #fff; --bs-btn-active-bg: #ea580c; --bs-btn-active-color: #fff; }
.bg-grad-orange { background: linear-gradient(135deg, #fb923c, #c2410c); }
.bg-grad-gold { background: linear-gradient(135deg, #fbbf24, #b45309); }
.poin-bar { height: 8px; border-radius: 99px; background: var(--bs-tertiary-bg); position: relative; overflow: visible; }
.poin-bar .isi { height: 100%; border-radius: 99px; }
.poin-bar .tanda { position: absolute; top: -3px; width: 2px; height: 14px; background: var(--bs-secondary-color); opacity: .5; }
.medali { width: 46px; height: 46px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 1.35rem; color: #fff; flex-shrink: 0; box-shadow: inset 0 -3px 0 rgba(0,0,0,.15); }
.medali.m1 { background: linear-gradient(135deg, #fde047, #ca8a04); } .medali.m2 { background: linear-gradient(135deg, #e2e8f0, #64748b); }
.medali.m3 { background: linear-gradient(135deg, #fdba74, #b45309); } .medali.m0 { background: linear-gradient(135deg, #5eead4, #0f766e); }
.kartu-prestasi { border-radius: var(--radius); overflow: hidden; height: 100%; }
.kartu-prestasi .pita { height: 6px; }
.jenis-opsi .list-group-item { cursor: pointer; }
.jenis-opsi .list-group-item.active { background: var(--brand); border-color: var(--brand); }
