/* =========================================================
   7 KAIH - SMP Negeri 11 Banjarbaru  |  Tema kustom AdminLTE 4
   ========================================================= */
:root {
  --kaih-primary: #0f766e;
  --kaih-primary-2: #14b8a6;
  --kaih-accent: #f59e0b;
  --kaih-grad: linear-gradient(135deg, #0f766e 0%, #0d9488 45%, #14b8a6 100%);
  --kaih-grad-warm: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
  --bs-primary: #0f766e;
  --bs-primary-rgb: 15, 118, 110;
  --bs-link-color: #0f766e;
  --bs-link-color-rgb: 15, 118, 110;
  --bs-link-hover-color: #115e59;
  --bs-body-font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --radius: 1rem;
}
[data-bs-theme="dark"] {
  --bs-primary: #2dd4bf; --bs-primary-rgb: 45, 212, 191;
  --bs-link-color: #5eead4; --bs-link-color-rgb: 94, 234, 212;
  --bs-body-bg: #0b1220; --bs-tertiary-bg: #0f172a; --bs-secondary-bg: #162033;
}
body { font-family: var(--bs-body-font-family); letter-spacing: -.005em; }

/* ---------- Tombol & warna utama ---------- */
.btn-primary { --bs-btn-bg: #0f766e; --bs-btn-border-color: #0f766e; --bs-btn-hover-bg: #115e59; --bs-btn-hover-border-color: #115e59; --bs-btn-active-bg: #134e4a; --bs-btn-disabled-bg: #0f766e; --bs-btn-disabled-border-color: #0f766e; }
.btn-outline-primary { --bs-btn-color: #0f766e; --bs-btn-border-color: #0f766e; --bs-btn-hover-bg: #0f766e; --bs-btn-hover-border-color: #0f766e; --bs-btn-active-bg: #0f766e; }
[data-bs-theme="dark"] .btn-outline-primary { --bs-btn-color: #5eead4; --bs-btn-border-color: #5eead4; }
.text-bg-primary { background-color: #0f766e !important; color: #fff !important; }
.text-primary { color: var(--bs-primary) !important; }
.bg-primary { background-color: #0f766e !important; }
.btn { border-radius: .7rem; font-weight: 600; }
.btn-lg { border-radius: .9rem; }
.form-control, .form-select { border-radius: .7rem; }
.form-control:focus, .form-select:focus { border-color: #14b8a6; box-shadow: 0 0 0 .2rem rgba(20,184,166,.2); }
.form-check-input:checked { background-color: #0f766e; border-color: #0f766e; }

/* ---------- Header & Sidebar ---------- */
.app-header { backdrop-filter: saturate(180%) blur(8px); }
.app-sidebar { background: linear-gradient(180deg, #0f3d3a 0%, #0b2b29 100%) !important; }
.sidebar-brand { border-bottom: 1px solid rgba(255,255,255,.08) !important; height: 64px; }
.sidebar-brand .brand-link { display: flex; align-items: center; gap: .6rem; padding: .6rem 1rem; }
.sidebar-brand .brand-image { width: 38px; height: 38px; object-fit: contain; background: #fff; border-radius: 10px; padding: 3px; box-shadow: none !important; max-height: none; margin: 0 !important; float: none; opacity: 1; }
.sidebar-brand .brand-text { display: flex; flex-direction: column; line-height: 1.1; color: #fff; }
.sidebar-brand .brand-text b { font-size: 1.05rem; letter-spacing: .02em; }
.sidebar-brand .brand-text small { font-size: .7rem; opacity: .7; font-weight: 500; }
.sidebar-user { display: flex; align-items: center; gap: .7rem; margin: .9rem .6rem .2rem; padding: .7rem; border-radius: .9rem; background: rgba(255,255,255,.06); color: #fff; }
.sidebar-menu .nav-header { font-size: .68rem !important; letter-spacing: .08em; opacity: .55; font-weight: 700; padding-top: 1rem !important; }
.sidebar-menu .nav-link { border-radius: .7rem !important; margin: 2px .4rem; transition: all .15s; }
.sidebar-menu .nav-link p { display: inline-flex; align-items: center; width: calc(100% - 2.2rem); }
.sidebar-menu .nav-link.active { background: var(--kaih-grad) !important; color: #fff !important; box-shadow: 0 6px 16px -6px rgba(20,184,166,.7); }
.sidebar-menu .nav-link:not(.active):hover { background: rgba(255,255,255,.07) !important; }
.nav-badge { font-size: .7rem; }
.sidebar-collapse .sidebar-user > div, .sidebar-collapse .brand-text { display: none !important; }

.avatar-circle { width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--kaih-grad); color: #fff; font-weight: 700; flex-shrink: 0; }
.avatar-circle.lg { width: 42px; height: 42px; font-size: 1.1rem; }
.avatar-circle.xl { width: 72px; height: 72px; font-size: 1.8rem; }

.app-content-header { padding-top: 1.1rem; }
.page-title { font-size: 1.45rem; letter-spacing: -.02em; }

/* ---------- Kartu ---------- */
.card { border: 0; border-radius: var(--radius); box-shadow: 0 1px 2px rgba(16,24,40,.04), 0 4px 18px -6px rgba(16,24,40,.08); }
.card-header { background: transparent; border-bottom: 1px solid var(--bs-border-color-translucent); padding: 1rem 1.25rem; }
.card-header .card-title { font-weight: 700; font-size: 1.02rem; margin: 0; }
.card-body { padding: 1.25rem; }
[data-bs-theme="dark"] .card { background: #111a2c; box-shadow: none; border: 1px solid rgba(255,255,255,.05); }

.stat-card { position: relative; overflow: hidden; }
.stat-card .stat-icon { width: 48px; height: 48px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; color: #fff; flex-shrink: 0; }
.stat-card .stat-value { font-size: 1.65rem; font-weight: 800; line-height: 1.1; letter-spacing: -.02em; }
.stat-card .stat-label { font-size: .8rem; color: var(--bs-secondary-color); font-weight: 500; }
.stat-card::after { content: ''; position: absolute; right: -30px; bottom: -30px; width: 110px; height: 110px; border-radius: 50%; background: currentColor; opacity: .04; }

.hero { background: var(--kaih-grad); color: #fff; border-radius: 1.25rem; padding: 1.5rem; position: relative; overflow: hidden; }
.hero::before { content: ''; position: absolute; width: 260px; height: 260px; border-radius: 50%; background: rgba(255,255,255,.08); right: -60px; top: -90px; }
.hero::after  { content: ''; position: absolute; width: 160px; height: 160px; border-radius: 50%; background: rgba(255,255,255,.06); right: 120px; bottom: -80px; }
.hero > * { position: relative; z-index: 1; }
.hero .hero-title { font-weight: 800; font-size: 1.5rem; letter-spacing: -.02em; }
.hero-chip { display: inline-flex; align-items: center; gap: .35rem; background: rgba(255,255,255,.18); padding: .3rem .75rem; border-radius: 99px; font-size: .8rem; font-weight: 600; }

/* ---------- Kebiasaan ---------- */
.habit-tile { border-radius: 1rem; padding: 1rem; background: var(--bs-body-bg); border: 1px solid var(--bs-border-color-translucent); height: 100%; transition: transform .15s; }
.habit-tile:hover { transform: translateY(-2px); }
.habit-ico { width: 42px; height: 42px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.25rem; color: #fff; }
.habit-name { font-weight: 700; font-size: .88rem; }
.progress-thin { height: 7px; border-radius: 99px; background: var(--bs-secondary-bg); }
.progress-thin .progress-bar { border-radius: 99px; }

/* Cincin skor */
.ring { --p: 0; --c: #0f766e; width: 130px; height: 130px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), rgba(255,255,255,.2) 0); }
.ring::before { content: ''; grid-area: 1/1; width: 104px; height: 104px; border-radius: 50%; background: var(--ring-bg, #0f766e); }
.ring > div { grid-area: 1/1; z-index: 1; text-align: center; line-height: 1; }
.ring .ring-val { font-size: 2.2rem; font-weight: 800; }
.ring.sm { width: 64px; height: 64px; } .ring.sm::before { width: 50px; height: 50px; background: var(--bs-body-bg); } .ring.sm .ring-val { font-size: 1rem; }

/* ---------- Heatmap kalender ---------- */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal .cal-h { font-size: .7rem; text-align: center; font-weight: 700; color: var(--bs-secondary-color); }
.cal .cal-d { aspect-ratio: 1; border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: .78rem; font-weight: 600; background: var(--bs-secondary-bg); color: var(--bs-secondary-color); text-decoration: none; position: relative; }
.cal .cal-d small { font-size: .6rem; font-weight: 700; opacity: .9; }
.cal .cal-d.today { outline: 2px solid var(--kaih-accent); outline-offset: 1px; }
.cal .cal-d.empty { background: transparent; }
.cal .cal-d.future { opacity: .4; }
.heat-a { background: #059669 !important; color: #fff !important; }
.heat-b { background: #14b8a6 !important; color: #fff !important; }
.heat-c { background: #f59e0b !important; color: #fff !important; }
.heat-d { background: #ef4444 !important; color: #fff !important; }
.legend-dot { display: inline-block; width: 12px; height: 12px; border-radius: 4px; vertical-align: -1px; margin-right: 4px; }

/* ---------- Tabel ---------- */
.table { --bs-table-bg: transparent; }
.table > :not(caption) > * > * { padding: .7rem .75rem; vertical-align: middle; }
.table thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--bs-secondary-color); font-weight: 700; background: var(--bs-tertiary-bg); border-bottom: 0; white-space: nowrap; }
.table-hover tbody tr:hover > * { background: rgba(20,184,166,.05); }
.badge { font-weight: 600; }
.badge-status { padding: .4em .7em; }
.badge-skor { font-size: .8rem; min-width: 52px; }

/* Matriks rekap */
.rekap-wrap { overflow: auto; max-height: 72vh; border-radius: .8rem; }
.rekap { font-size: .78rem; border-collapse: separate; border-spacing: 0; }
.rekap th, .rekap td { padding: .35rem .3rem !important; text-align: center; border-bottom: 1px solid var(--bs-border-color-translucent); }
.rekap thead th { position: sticky; top: 0; z-index: 2; background: var(--bs-tertiary-bg); }
.rekap .sticky-col { position: sticky; left: 0; z-index: 1; background: var(--bs-body-bg); text-align: left; min-width: 200px; box-shadow: 1px 0 0 var(--bs-border-color-translucent); }
.rekap thead .sticky-col { z-index: 3; background: var(--bs-tertiary-bg); }
.rekap .cell { display: inline-block; min-width: 28px; padding: 3px 0; border-radius: 6px; font-weight: 700; font-size: .72rem; }
.rekap .weekend { background: rgba(239,68,68,.05); }

/* ---------- Form wizard jurnal ---------- */
.wizard-steps { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.wizard-steps::-webkit-scrollbar { display: none; }
.wizard-steps .ws { flex: 1 0 auto; min-width: 44px; display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; font-size: .68rem; font-weight: 600; color: var(--bs-secondary-color); border: 0; background: none; }
.wizard-steps .ws .dot { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; background: var(--bs-secondary-bg); color: var(--bs-secondary-color); transition: all .2s; }
.wizard-steps .ws.done .dot { background: rgba(20,184,166,.15); color: #0f766e; }
.wizard-steps .ws.active .dot { background: var(--sc, #0f766e); color: #fff; box-shadow: 0 6px 14px -6px var(--sc, #0f766e); transform: scale(1.06); }
.wizard-steps .ws.active { color: var(--bs-body-color); }
.step-pane { display: none; animation: fadeUp .25s ease; }
.step-pane.active { display: block; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.step-head { display: flex; align-items: center; gap: .8rem; margin-bottom: 1.1rem; }
.step-head .habit-ico { width: 52px; height: 52px; font-size: 1.5rem; border-radius: 16px; }
.step-head h4 { margin: 0; font-weight: 800; font-size: 1.2rem; }

/* Pilihan berupa kartu (checkbox/radio) */
.choice { position: relative; display: block; cursor: pointer; margin: 0; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice .choice-box { display: flex; align-items: center; gap: .65rem; padding: .8rem .9rem; border-radius: .9rem; border: 2px solid var(--bs-border-color); background: var(--bs-body-bg); transition: all .15s; font-weight: 600; font-size: .9rem; height: 100%; user-select: none; }
.choice .choice-box i.ic { font-size: 1.25rem; color: var(--bs-secondary-color); }
.choice .choice-box .chk { margin-left: auto; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--bs-border-color); display: flex; align-items: center; justify-content: center; font-size: .8rem; color: transparent; flex-shrink: 0; }
.choice input:checked + .choice-box { border-color: var(--cc, #0f766e); background: color-mix(in srgb, var(--cc, #0f766e) 9%, transparent); }
.choice input:checked + .choice-box i.ic { color: var(--cc, #0f766e); }
.choice input:checked + .choice-box .chk { background: var(--cc, #0f766e); border-color: var(--cc, #0f766e); color: #fff; }
.choice input:focus-visible + .choice-box { outline: 3px solid rgba(20,184,166,.35); }
.choice.vertical .choice-box { flex-direction: column; text-align: center; gap: .3rem; padding: .9rem .4rem; }
.choice.vertical .choice-box .chk { position: absolute; top: 8px; right: 8px; margin: 0; width: 18px; height: 18px; font-size: .65rem; }
.choice.vertical .choice-box i.ic { font-size: 1.6rem; }

.mood-pick .choice-box { font-size: 1.9rem; padding: .55rem; justify-content: center; flex-direction: column; gap: 0; }
.mood-pick .choice-box small { font-size: .65rem; font-weight: 600; }

.time-big { font-size: 1.8rem; font-weight: 800; text-align: center; letter-spacing: .04em; padding: .6rem; }
.chip-row { display: flex; gap: .4rem; flex-wrap: wrap; }
.chip { border: 1.5px solid var(--bs-border-color); background: var(--bs-body-bg); border-radius: 99px; padding: .3rem .8rem; font-size: .8rem; font-weight: 600; cursor: pointer; color: var(--bs-body-color); }
.chip:hover, .chip.on { border-color: #0f766e; color: #0f766e; background: rgba(20,184,166,.08); }
[data-bs-theme="dark"] .chip:hover, [data-bs-theme="dark"] .chip.on { color: #5eead4; border-color: #5eead4; }

.haid-box { border-radius: 1rem; border: 2px dashed #f472b6; background: rgba(244,114,182,.06); padding: .9rem 1rem; }
.haid-info { border-radius: 1rem; background: linear-gradient(135deg, rgba(244,114,182,.12), rgba(167,139,250,.12)); padding: 1.1rem; }
.form-switch.switch-lg .form-check-input { width: 3.1em; height: 1.6em; cursor: pointer; }
.form-switch.pink .form-check-input:checked { background-color: #ec4899; border-color: #ec4899; }

.date-chips { display: flex; gap: .5rem; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.date-chips::-webkit-scrollbar { display: none; }
.date-chip { flex: 0 0 auto; text-align: center; min-width: 62px; padding: .5rem .4rem; border-radius: .9rem; border: 2px solid var(--bs-border-color); text-decoration: none; color: var(--bs-body-color); background: var(--bs-body-bg); position: relative; }
.date-chip .d1 { font-size: .68rem; font-weight: 600; color: var(--bs-secondary-color); }
.date-chip .d2 { font-size: 1.25rem; font-weight: 800; line-height: 1.1; }
.date-chip.active { border-color: #0f766e; background: var(--kaih-grad); color: #fff; }
.date-chip.active .d1 { color: rgba(255,255,255,.85); }
.date-chip .filled { position: absolute; top: -5px; right: -5px; width: 18px; height: 18px; border-radius: 50%; background: #10b981; color: #fff; font-size: .62rem; display: flex; align-items: center; justify-content: center; border: 2px solid var(--bs-body-bg); }

.wizard-nav { position: sticky; bottom: 0; background: var(--bs-body-bg); padding: .8rem 0 0; margin-top: 1rem; border-top: 1px solid var(--bs-border-color-translucent); z-index: 5; }

/* ---------- Lencana ---------- */
.badge-medal { text-align: center; padding: 1rem .5rem; border-radius: 1rem; background: var(--bs-body-bg); border: 1px solid var(--bs-border-color-translucent); height: 100%; }
.badge-medal .medal { width: 64px; height: 64px; margin: 0 auto .5rem; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.8rem; color: #fff; box-shadow: 0 8px 18px -8px currentColor; }
.badge-medal.locked .medal { background: var(--bs-secondary-bg) !important; color: var(--bs-secondary-color); box-shadow: none; }
.badge-medal.locked { opacity: .75; }
.badge-medal .m-name { font-weight: 700; font-size: .85rem; }
.badge-medal .m-req { font-size: .7rem; color: var(--bs-secondary-color); }

/* ---------- Detail jurnal (modal) ---------- */
.jd-head { background: var(--kaih-grad); color: #fff; padding: 1.25rem 1.5rem; }
.jd-row { display: flex; gap: .9rem; padding: .85rem 1.25rem; border-bottom: 1px solid var(--bs-border-color-translucent); }
.jd-row .habit-ico { width: 38px; height: 38px; font-size: 1.05rem; flex-shrink: 0; }
.jd-row .jd-val { font-size: .86rem; color: var(--bs-secondary-color); }
.pill-mini { display: inline-flex; align-items: center; gap: .25rem; font-size: .72rem; font-weight: 600; padding: .15rem .55rem; border-radius: 99px; background: var(--bs-secondary-bg); margin: 2px; }
.pill-mini.ok { background: rgba(16,185,129,.14); color: #047857; }
.pill-mini.no { background: rgba(239,68,68,.1); color: #b91c1c; text-decoration: line-through; opacity: .8; }
[data-bs-theme="dark"] .pill-mini.ok { color: #6ee7b7; } [data-bs-theme="dark"] .pill-mini.no { color: #fca5a5; }

/* ---------- Bottom nav siswa ---------- */
.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1040; display: flex; justify-content: space-around; align-items: flex-end;
  background: var(--bs-body-bg); border-top: 1px solid var(--bs-border-color-translucent); padding: .4rem .3rem calc(.4rem + env(safe-area-inset-bottom)); box-shadow: 0 -6px 20px -10px rgba(0,0,0,.15); }
.bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px; font-size: .66rem; font-weight: 600; color: var(--bs-secondary-color); text-decoration: none; padding: .2rem 0; }
.bottom-nav a i { font-size: 1.3rem; }
.bottom-nav a.active { color: var(--bs-primary); }
.bottom-nav a.fab { flex: 0 0 auto; width: 58px; height: 58px; margin-top: -26px; border-radius: 50%; background: var(--kaih-grad); color: #fff; justify-content: center; box-shadow: 0 10px 22px -8px rgba(15,118,110,.8); border: 4px solid var(--bs-body-bg); }
.bottom-nav a.fab i { font-size: 1.6rem; }
@media (max-width: 991.98px) {
  body.role-siswa .app-main { padding-bottom: 84px; }
  body.role-siswa .app-footer { display: none; }
  .wizard-nav { bottom: 70px; }
}

/* ---------- Login ---------- */
.login-page-x { min-height: 100vh; display: flex; background: #f1f5f9; }
.login-side { flex: 1.1; background: var(--kaih-grad); color: #fff; padding: 3rem; display: none; position: relative; overflow: hidden; }
.login-side::before { content: ''; position: absolute; width: 520px; height: 520px; border-radius: 50%; background: rgba(255,255,255,.07); right: -160px; top: -160px; }
.login-side::after { content: ''; position: absolute; width: 320px; height: 320px; border-radius: 50%; background: rgba(255,255,255,.06); left: -100px; bottom: -120px; }
.login-side > * { position: relative; z-index: 1; }
.login-form { flex: 1; display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.login-card { width: 100%; max-width: 410px; }
.habit-list-login li { display: flex; align-items: center; gap: .75rem; padding: .45rem 0; font-weight: 600; }
.habit-list-login .habit-ico { width: 36px; height: 36px; font-size: 1rem; background: rgba(255,255,255,.18) !important; }
@media (min-width: 992px) { .login-side { display: flex; flex-direction: column; justify-content: space-between; } }
[data-bs-theme="dark"] .login-page-x { background: #0b1220; }

/* ---------- Lain-lain ---------- */
.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--bs-secondary-color); }
.empty-state i { font-size: 3rem; opacity: .35; display: block; margin-bottom: .5rem; }
.list-compact .list-group-item { padding: .7rem 1rem; border-color: var(--bs-border-color-translucent); }
.search-box { position: relative; } .search-box i { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--bs-secondary-color); } .search-box input { padding-left: 2.2rem; }
.table-responsive { border-radius: .8rem; }
.sticky-actions { position: sticky; bottom: 0; z-index: 4; }
.swal2-popup { border-radius: 1.2rem !important; font-family: var(--bs-body-font-family) !important; }
.swal2-confirm { background: #0f766e !important; border-radius: .7rem !important; }
.fw-800 { font-weight: 800; }
.small-2 { font-size: .75rem; }
.cursor-pointer { cursor: pointer; }

/* ---------- Cetak ---------- */
@media print {
  .app-sidebar, .app-header, .app-footer, .bottom-nav, .no-print, .app-content-header { display: none !important; }
  .app-main { margin: 0 !important; padding: 0 !important; }
  .card { box-shadow: none !important; border: 0 !important; }
  body { background: #fff !important; }
}
