/* ============================================================
   SDIT AL-MUNAWWARAH v11 — style.css
   Tema: Islami Modern | Hijau #198754 + Emas #c9a84c
   ============================================================ */

:root {
  --hijau:       #198754;
  --hijau-muda:  #d1f0e1;
  --hijau-tua:   #0f5132;
  --emas:        #c9a84c;
  --emas-muda:   #fff3cd;
  --putih:       #ffffff;
  --bg-soft:     #f4f8f5;
  --abu:         #6c757d;
  --teks:        #1a2e1a;
  --sidebar-w:   240px;
  --topbar-h:    62px;
  --radius:      14px;
  --shadow:      0 2px 12px rgba(0,0,0,.07);
  --shadow-lg:   0 8px 32px rgba(0,0,0,.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Plus Jakarta Sans', sans-serif; background: var(--bg-soft); color: var(--teks); }
body.admin-body { height: 100vh; overflow: hidden; }

/* ── SIDEBAR ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w); height: 100vh;
  background: var(--hijau-tua);
  position: fixed; left: 0; top: 0; z-index: 200;
  display: flex; flex-direction: column;
  overflow: hidden; transition: transform .28s ease;
}
.sidebar-menu {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding-bottom: 24px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.3) rgba(255,255,255,.05);
}
.sidebar-menu::-webkit-scrollbar { width: 4px; }
.sidebar-menu::-webkit-scrollbar-track { background: rgba(255,255,255,.05); }
.sidebar-menu::-webkit-scrollbar-thumb { background: rgba(255,255,255,.3); border-radius: 2px; }
.sidebar-menu::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.5); }
.sidebar-logo { padding: 18px 16px; border-bottom: 1px solid rgba(255,255,255,.1); flex-shrink: 0; }
.logo-icon { width: 36px; height: 36px; background: var(--emas); border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  color: var(--hijau-tua); font-size: 17px; flex-shrink: 0; }
.logo-name { color: #fff; font-weight: 800; font-size: 13px; line-height: 1.2; }
.logo-sub  { color: rgba(255,255,255,.55); font-size: 10px; }

/* Sidebar nav menu - dengan section headers lebih clean */
.sidebar-section {
  color: rgba(255,255,255,.38); font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px;
  padding: 14px 18px 5px; margin-top: 4px;
}
.sidebar-section:first-child { margin-top: 0; }
.sidebar-menu a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 18px; color: rgba(255,255,255,.72);
  text-decoration: none; font-size: 13px; font-weight: 500;
  border-left: 3px solid transparent; transition: all .15s;
  white-space: nowrap; overflow: hidden;
}
.sidebar-menu a:hover { color: #fff; background: rgba(255,255,255,.07); }
.sidebar-menu a.active { color: #fff; background: rgba(255,255,255,.1); border-left-color: var(--emas); }
.sidebar-menu a i { font-size: 16px; width: 18px; flex-shrink: 0; }
.badge-notif {
  background: #e53935; color: #fff;
  border-radius: 10px; padding: 1px 6px;
  font-size: 10px; font-weight: 700; margin-left: auto; flex-shrink: 0;
}

/* ── MAIN WRAPPER ─────────────────────────────────────────── */
.main-wrapper {
  margin-left: var(--sidebar-w); height: 100vh;
  overflow-y: auto; overflow-x: hidden;
  display: flex; flex-direction: column;
  scroll-behavior: smooth; -webkit-overflow-scrolling: touch;
  scrollbar-width: thin; scrollbar-color: var(--emas) rgba(0,0,0,.05);
}
.main-wrapper::-webkit-scrollbar { width: 6px; }
.main-wrapper::-webkit-scrollbar-thumb { background: var(--emas); border-radius: 3px; }

/* ── TOPBAR ───────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h); background: #fff;
  border-bottom: 1px solid #e9ecef;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 22px; position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow); flex-shrink: 0;
}
.topbar-title { font-weight: 700; font-size: 17px; color: var(--hijau-tua); }
.btn-hamburger {
  background: none; border: none; cursor: pointer;
  font-size: 22px; color: var(--hijau-tua); padding: 4px;
  display: none; align-items: center; justify-content: center;
}
.btn-notif {
  background: var(--bg-soft); border: none; border-radius: 10px;
  width: 40px; height: 40px; position: relative;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: var(--hijau-tua); cursor: pointer;
}
.btn-notif .badge-notif { position: absolute; top: -4px; right: -4px; margin: 0; }
.btn-user {
  background: none; border: none; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: 10px; transition: background .15s;
}
.btn-user:hover { background: var(--bg-soft); }
.user-avatar {
  width: 36px; height: 36px; background: var(--hijau); color: #fff;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; flex-shrink: 0;
}

/* ── PAGE CONTENT ─────────────────────────────────────────── */
.page-content { padding: 22px; flex: 1; min-height: 0; }

/* ── CARD BOX ─────────────────────────────────────────────── */
.card-box {
  background: #fff; border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px; margin-bottom: 20px;
}
.card-title { font-weight: 700; font-size: 15px; color: var(--hijau-tua); margin-bottom: 16px; }

/* Stat cards */
.stat-card  { border-radius: var(--radius); padding: 20px; }
.stat-card .s-icon { width: 46px; height: 46px; border-radius: 11px; display: flex; align-items: center; justify-content: center; font-size: 21px; margin-bottom: 12px; }
.stat-card .s-num  { font-size: 1.9rem; font-weight: 700; line-height: 1; }
.stat-card .s-lbl  { font-size: 13px; font-weight: 600; color: #555; margin-top: 4px; }
.stat-card .s-trend{ font-size: 12px; margin-top: 6px; }
.sc-green  { background: #e8f5e9; } .sc-green  .s-icon { background: var(--hijau);  color: #fff; } .sc-green  .s-num { color: var(--hijau-tua); }
.sc-blue   { background: #e3f2fd; } .sc-blue   .s-icon { background: #1976d2; color: #fff; }    .sc-blue   .s-num { color: #0d47a1; }
.sc-orange { background: #fff8e1; } .sc-orange .s-icon { background: var(--emas);    color: #fff; } .sc-orange .s-num { color: #7a5c00; }
.sc-red    { background: #fce4ec; } .sc-red    .s-icon { background: #d32f2f; color: #fff; }    .sc-red    .s-num { color: #b71c1c; }
.sc-purple { background: #f3e5f5; } .sc-purple .s-icon { background: #7b1fa2; color: #fff; }    .sc-purple .s-num { color: #4a148c; }

/* ── TABLE ────────────────────────────────────────────────── */
.tbl-wrap  { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 20px; }
.tbl-head  { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; padding: 16px 20px; border-bottom: 1px solid #f0f0f0; }
.tbl-title { font-weight: 700; font-size: 15px; color: var(--hijau-tua); }
.table-resp { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tbl  { width: 100%; border-collapse: collapse; }
table.tbl th { background: var(--hijau); color: #fff; padding: 11px 14px; font-size: 12.5px; font-weight: 600; text-align: left; white-space: nowrap; }
table.tbl td { padding: 10px 14px; font-size: 13px; border-bottom: 1px solid #f5f5f5; vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tr:hover td { background: #f8fff9; }
.tbl-footer { padding: 12px 20px; border-top: 1px solid #f0f0f0; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }

/* ── STATUS BADGES ────────────────────────────────────────── */
.badge-lunas    { background: #d1f0e1; color: #0f5132; border-radius: 20px; padding: 3px 10px; font-size: 11px; font-weight: 600; }
.badge-tunggak  { background: #fce4ec; color: #b71c1c; border-radius: 20px; padding: 3px 10px; font-size: 11px; font-weight: 600; }
.badge-sebagian { background: #fff8e1; color: #7a5c00; border-radius: 20px; padding: 3px 10px; font-size: 11px; font-weight: 600; }
.badge-aktif    { background: #d1f0e1; color: #0f5132; border-radius: 20px; padding: 3px 10px; font-size: 11px; font-weight: 600; }
.badge-nonaktif { background: #f5f5f5; color: #666;    border-radius: 20px; padding: 3px 10px; font-size: 11px; font-weight: 600; }

/* ── BUTTONS ──────────────────────────────────────────────── */
.btn-hijau  { background: var(--hijau); color: #fff; border: none; border-radius: 8px; padding: 8px 18px; font-weight: 600; font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; transition: background .15s; }
.btn-hijau:hover  { background: #157347; color: #fff; }
.btn-emas   { background: var(--emas); color: #5a3e0a; border: none; border-radius: 8px; padding: 8px 18px; font-weight: 600; font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; transition: background .15s; }
.btn-emas:hover   { background: #b8941e; color: #5a3e0a; }
.btn-merah  { background: #d32f2f; color: #fff; border: none; border-radius: 8px; padding: 8px 18px; font-weight: 600; font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.btn-merah:hover  { background: #b71c1c; }
.btn-wa     { background: #25d366; color: #fff; border: none; border-radius: 8px; padding: 6px 12px; font-weight: 600; font-size: 12px; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.btn-sm-edit { background: var(--hijau); color: #fff; border: none; border-radius: 6px; padding: 4px 12px; font-size: 12px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; transition: background .15s; }
.btn-sm-edit:hover { background: #157347; }
.btn-sm-del  { background: #d32f2f; color: #fff; border: none; border-radius: 6px; padding: 4px 12px; font-size: 12px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; transition: background .15s; }
.btn-sm-del:hover  { background: #b71c1c; }
.btn-sm-view { background: #1976d2; color: #fff; border: none; border-radius: 6px; padding: 4px 12px; font-size: 12px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }

/* ── FORMS ────────────────────────────────────────────────── */
.form-label { font-size: 13px; font-weight: 600; color: #444; margin-bottom: 5px; }
.form-control, .form-select {
  border-radius: 8px; border: 1px solid #dee2e6;
  font-size: 13.5px; padding: 9px 12px;
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus, .form-select:focus {
  border-color: var(--hijau); box-shadow: 0 0 0 .2rem rgba(25,135,84,.18); outline: none;
}
.search-box { border: 1px solid #dee2e6; border-radius: 8px; padding: 8px 14px; font-size: 13px; min-width: 200px; }
.search-box:focus { outline: none; border-color: var(--hijau); }

/* ── ALERTS ───────────────────────────────────────────────── */
.alert-custom { border-radius: 10px; border: none; padding: 12px 16px; font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 10px; }
.alert-green  { background: var(--hijau-muda); color: var(--hijau-tua); }
.alert-red    { background: #fce4ec; color: #b71c1c; }
.alert-yellow { background: #fff8e1; color: #7a5c00; }

/* ── ICON PICKER (fasilitas/keunggulan) ───────────────────── */
.ikon-opt { border: 2px solid #e9ecef; border-radius: 8px; padding: 8px 4px; text-align: center; cursor: pointer; transition: all .15s; background: #fff; }
.ikon-opt:hover { border-color: var(--hijau); background: #f0fff4; }
.ikon-opt.ikon-selected { border-color: var(--hijau); background: #d1f0e1; }

/* ── PROGRESS ─────────────────────────────────────────────── */
.prog-bar  { background: #e9ecef; border-radius: 10px; height: 8px; overflow: hidden; }
.prog-fill { height: 100%; border-radius: 10px; background: var(--hijau); transition: width .4s; }
.prog-emas { background: var(--emas); }
.prog-red  { background: #d32f2f; }

/* ── PAGINATION ───────────────────────────────────────────── */
.pagination .page-link { border-radius: 7px !important; margin: 0 2px; font-size: 13px; color: var(--hijau); border-color: #dee2e6; }
.pagination .page-item.active .page-link { background: var(--hijau); border-color: var(--hijau); color: #fff; }

/* ── CHART BARS (CSS only) ────────────────────────────────── */
.chart-wrap { display: flex; align-items: flex-end; gap: 10px; height: 160px; margin-top: 14px; }
.chart-bar  { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.chart-bar .bar { width: 100%; border-radius: 6px 6px 0 0; background: var(--hijau); min-height: 8px; }
.chart-bar .lbl { font-size: 10px; color: var(--abu); }
.chart-bar .val { font-size: 11px; font-weight: 700; color: var(--hijau-tua); }

/* ── CHAT ─────────────────────────────────────────────────── */
.chat-layout { display: grid; grid-template-columns: 260px 1fr; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; height: calc(100vh - 130px); }
.chat-sidebar{ border-right: 1px solid #f0f0f0; overflow-y: auto; }
.chat-item   { padding: 12px 14px; border-bottom: 1px solid #f8f8f8; cursor: pointer; display: flex; align-items: center; gap: 10px; transition: background .15s; }
.chat-item:hover, .chat-item.active { background: var(--hijau-muda); }
.chat-avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--hijau); display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 14px; flex-shrink: 0; }
.chat-main   { display: flex; flex-direction: column; }
.chat-hdr    { background: #fff; padding: 12px 16px; border-bottom: 1px solid #f0f0f0; display: flex; align-items: center; gap: 10px; }
.chat-msgs   { flex: 1; padding: 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; background: #f8fff9; }
.bubble      { max-width: 68%; padding: 9px 14px; border-radius: 14px; font-size: 13px; line-height: 1.55; }
.bubble-in   { background: #fff; border-radius: 14px 14px 14px 4px; align-self: flex-start; box-shadow: 0 1px 4px rgba(0,0,0,.07); }
.bubble-out  { background: var(--hijau); color: #fff; border-radius: 14px 14px 4px 14px; align-self: flex-end; }
.chat-input-area { background: #fff; padding: 12px 14px; border-top: 1px solid #f0f0f0; display: flex; gap: 8px; }
.chat-input  { flex: 1; border: 1px solid #dee2e6; border-radius: 20px; padding: 9px 16px; font-size: 13px; outline: none; }
.chat-input:focus { border-color: var(--hijau); }
.btn-send    { background: var(--hijau); color: #fff; border: none; border-radius: 50%; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; cursor: pointer; }

/* ── ABSENSI ──────────────────────────────────────────────── */
.absen-wrap { display: flex; gap: 5px; flex-wrap: wrap; }
.absen-opt  { border: 1px solid #dee2e6; border-radius: 6px; padding: 4px 8px; font-size: 11px; cursor: pointer; user-select: none; transition: all .15s; }
.absen-opt:hover { border-color: var(--hijau); }
.opt-hadir { border-color: var(--hijau); background: var(--hijau-muda); color: var(--hijau-tua); font-weight: 700; }
.opt-izin  { border-color: #1976d2; background: #e3f2fd; color: #0d47a1; font-weight: 700; }
.opt-sakit { border-color: var(--emas);  background: var(--emas-muda);  color: #7a5c00; font-weight: 700; }
.opt-alpha { border-color: #d32f2f; background: #fce4ec; color: #b71c1c; font-weight: 700; }

/* ── NILAI / GRADE ────────────────────────────────────────── */
.grade-a { color: var(--hijau-tua); font-weight: 700; }
.grade-b { color: #1565c0; font-weight: 700; }
.grade-c { color: #e65100; font-weight: 700; }
.grade-d { color: #b71c1c; font-weight: 700; }

/* ── RAPOR ────────────────────────────────────────────────── */
.rapor-kop { background: linear-gradient(135deg, var(--hijau-tua), var(--hijau)); color: #fff; border-radius: var(--radius); padding: 24px; margin-bottom: 16px; text-align: center; }

/* ── JADWAL PILLS ─────────────────────────────────────────── */
.mapel-pill { display: inline-block; border-radius: 6px; padding: 3px 8px; font-size: 11px; font-weight: 600; }
.mp-green  { background: var(--hijau-muda); color: var(--hijau-tua); }
.mp-yellow { background: var(--emas-muda);  color: #7a5c00; }
.mp-blue   { background: #e3f2fd; color: #0d47a1; }
.mp-red    { background: #fce4ec; color: #880e4f; }

/* ── RESPONSIVE ───────────────────────────────────────────── */
@media (max-width: 991px) {
  .sidebar      { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 20px rgba(0,0,0,.3); }
  .main-wrapper { margin-left: 0; width: 100%; }
  .portal-wrap  { margin-left: 0 !important; }
  .portal-nav   { transform: translateX(-100%); }
  .portal-nav.open { transform: translateX(0); box-shadow: 4px 0 20px rgba(0,0,0,.3); }
  .btn-hamburger { display: flex !important; }
  .topbar-title  { font-size: 15px; }
  .chat-layout   { grid-template-columns: 1fr; }
  .chat-sidebar  { display: none; }
}
@media (max-width: 576px) {
  .page-content { padding: 14px; }
  .stat-card .s-num { font-size: 1.5rem; }
  .tbl-head { flex-direction: column; align-items: flex-start; }
  .search-box { min-width: 100%; width: 100%; }
  .d-flex.gap-2 { flex-wrap: wrap; }
}

/* ── DROPDOWN OVERRIDE ─────────────────────────────────────── */
.dropdown-menu { border: none !important; box-shadow: 0 8px 30px rgba(0,0,0,.15) !important; border-radius: 12px !important; }
.dropdown-item { font-size: 13px; padding: 8px 16px; }
.dropdown-item:hover { background: var(--hijau-muda); color: var(--hijau-tua); }
.dropdown-toggle::after { vertical-align: middle; }

/* ── MODAL ────────────────────────────────────────────────── */
.modal-content { border: none; border-radius: 16px; }
.modal-header  { border-bottom: 1px solid #f0f0f0; padding: 16px 20px; }
.modal-footer  { border-top: 1px solid #f0f0f0; padding: 12px 20px; }

/* ── PRINT ────────────────────────────────────────────────── */
@media print {
  .sidebar, .topbar, .btn-hamburger, .no-print { display: none !important; }
  .main-wrapper { margin-left: 0 !important; height: auto !important; overflow: visible !important; }
  .page-content { padding: 0 !important; }
  body.admin-body { height: auto !important; overflow: visible !important; }
}
