/* =========================================================
   Hallo Ustadz — Shared Design Tokens & Base Components
   Dipakai di: login.html, dashboard-jamaah.html,
   dashboard-ustadz.html, dashboard-masjid.html
   Konsisten dengan landing.html (hijau islami + emas)
   ========================================================= */

:root {
  --hijau: #1B6B36;
  --hijau-mid: #2E7D32;
  --hijau-light: #4CAF50;
  --hijau-muda: #E8F5E9;
  --hijau-muda2: #C8E6C9;
  --emas: #D4A017;
  --emas-light: #F5D76E;
  --krem: #FFFDF7;
  --abu: #F5F5F5;
  --abu-mid: #ECEFEC;
  --teks: #1A2B1E;
  --teks2: #4A5E50;
  --teks3: #8A9E8E;
  --putih: #ffffff;
  --merah: #D32F2F;
  --biru: #1565C0;
  --ungu: #6A1B9A;
  --shadow-sm: 0 2px 12px rgba(27,107,54,0.08);
  --shadow-md: 0 8px 32px rgba(27,107,54,0.12);
  --shadow-lg: 0 20px 60px rgba(27,107,54,0.18);
  --radius: 16px;
  --radius-sm: 10px;
  --sidebar-w: 264px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--abu);
  color: var(--teks);
}

a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
ul { list-style: none; }
input, select, textarea { font-family: inherit; font-size: 14px; }

/* ---------- Layout shell (sidebar + topbar) ---------- */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, #0D3B1E 0%, #1B6B36 100%);
  color: white;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform 0.25s ease;
}

.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 22px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-logo {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--emas), var(--emas-light));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Amiri', serif;
  color: #1A1A1A; font-size: 16px; font-weight: 700;
  flex-shrink: 0;
}
.sidebar-name { font-size: 16px; font-weight: 800; line-height: 1.2; }
.sidebar-role {
  font-size: 11px; color: var(--emas-light); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px; margin-top: 2px;
}

.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }
.sidebar-section-label {
  font-size: 11px; font-weight: 700; color: rgba(255,255,255,0.4);
  text-transform: uppercase; letter-spacing: 0.6px;
  padding: 12px 12px 6px;
}
.sidebar-link {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: 10px;
  color: rgba(255,255,255,0.75);
  font-size: 14px; font-weight: 500;
  margin-bottom: 2px;
  transition: background 0.2s, color 0.2s;
}
.sidebar-link .ic { font-size: 17px; width: 20px; text-align: center; flex-shrink: 0; }
.sidebar-link:hover { background: rgba(255,255,255,0.08); color: white; }
.sidebar-link.active {
  background: rgba(212,160,23,0.18);
  color: var(--emas-light);
  font-weight: 700;
}

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid rgba(255,255,255,0.1);
}
.sidebar-logout {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: 10px;
  color: #FFCDD2; font-size: 14px; font-weight: 600;
  width: 100%;
  transition: background 0.2s;
}
.sidebar-logout:hover { background: rgba(211,47,47,0.15); }

.main-area {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 72px;
  background: var(--putih);
  border-bottom: 1px solid rgba(27,107,54,0.08);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px;
  position: sticky; top: 0; z-index: 50;
}
.topbar-title { font-size: 19px; font-weight: 800; color: var(--teks); }
.topbar-sub { font-size: 12.5px; color: var(--teks3); margin-top: 1px; }
.topbar-right { display: flex; align-items: center; gap: 18px; }
.topbar-icon-btn {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--abu); font-size: 17px;
  position: relative;
  transition: background 0.2s;
}
.topbar-icon-btn:hover { background: var(--hijau-muda); }
.topbar-badge {
  position: absolute; top: 4px; right: 4px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--merah); border: 1.5px solid white;
}
.topbar-user { display: flex; align-items: center; gap: 10px; }
.topbar-user-name { font-size: 13.5px; font-weight: 700; }
.topbar-user-role { font-size: 11px; color: var(--teks3); }
.topbar-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--hijau-muda); color: var(--hijau);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px;
}

.content { padding: 28px; flex: 1; }

.menu-toggle {
  display: none;
  width: 40px; height: 40px;
  align-items: center; justify-content: center;
  font-size: 20px; border-radius: 8px;
  background: var(--abu);
}

/* ---------- Generic components ---------- */
.card {
  background: var(--putih);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 22px;
}

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--putih);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  display: flex; align-items: center; gap: 14px;
}
.stat-icon {
  width: 46px; height: 46px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 21px; flex-shrink: 0;
}
.stat-value { font-size: 22px; font-weight: 800; color: var(--teks); line-height: 1.1; }
.stat-label { font-size: 12px; color: var(--teks3); margin-top: 2px; }
.stat-delta { font-size: 11px; font-weight: 700; margin-top: 4px; }
.stat-delta.up { color: var(--hijau); }
.stat-delta.down { color: var(--merah); }

.section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.section-head h2 { font-size: 16.5px; font-weight: 800; }
.section-head .link { font-size: 13px; font-weight: 700; color: var(--hijau); }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 20px; border-radius: 10px;
  font-size: 13.5px; font-weight: 700;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}
.btn-primary { background: var(--hijau); color: white; }
.btn-primary:hover { background: var(--hijau-mid); transform: translateY(-1px); }
.btn-gold { background: var(--emas); color: #1A1A1A; }
.btn-gold:hover { transform: translateY(-1px); }
.btn-outline { background: white; color: var(--hijau); border: 1.5px solid var(--hijau-muda2); }
.btn-outline:hover { background: var(--hijau-muda); }
.btn-sm { padding: 7px 14px; font-size: 12.5px; }
.btn-danger-outline { background: white; color: var(--merah); border: 1.5px solid #FFCDD2; }
.btn-danger-outline:hover { background: #FFEBEE; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 700;
  padding: 3px 10px; border-radius: 20px;
}
.badge-green { background: var(--hijau-muda); color: var(--hijau); }
.badge-gold { background: #FFF3D6; color: #946200; }
.badge-red { background: #FFEBEE; color: var(--merah); }
.badge-blue { background: #E3F2FD; color: var(--biru); }
.badge-grey { background: var(--abu-mid); color: var(--teks3); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  text-align: left; font-size: 11.5px; font-weight: 700;
  color: var(--teks3); text-transform: uppercase; letter-spacing: 0.4px;
  padding: 10px 14px; border-bottom: 1.5px solid var(--abu-mid);
  white-space: nowrap;
}
td { padding: 14px; border-bottom: 1px solid var(--abu-mid); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(232,245,233,0.4); }

.empty-state {
  text-align: center; padding: 48px 20px; color: var(--teks3);
}
.empty-state .ic { font-size: 40px; margin-bottom: 12px; display: block; }
.empty-state .title { font-size: 14.5px; font-weight: 700; color: var(--teks); margin-bottom: 4px; }
.empty-state .desc { font-size: 13px; max-width: 320px; margin: 0 auto; }

.modal-overlay {
  position: fixed; inset: 0; background: rgba(13,43,20,0.55);
  display: none; align-items: center; justify-content: center;
  z-index: 1000; padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: white; border-radius: var(--radius);
  max-width: 460px; width: 100%; padding: 28px;
  box-shadow: var(--shadow-lg);
  max-height: 88vh; overflow-y: auto;
}
.modal-box h3 { font-size: 17px; font-weight: 800; margin-bottom: 6px; }
.modal-box .sub { font-size: 13px; color: var(--teks3); margin-bottom: 18px; }
.modal-close-row { display: flex; gap: 10px; margin-top: 20px; }
.modal-close-row .btn { flex: 1; justify-content: center; }

.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; font-size: 12.5px; font-weight: 700;
  color: var(--teks2); margin-bottom: 6px;
}
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 11px 14px; border-radius: 10px;
  border: 1.5px solid var(--abu-mid); background: var(--abu);
  transition: border-color 0.2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: var(--hijau-light); background: white;
}

.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--teks); color: white;
  padding: 14px 20px; border-radius: 12px;
  font-size: 13.5px; font-weight: 600;
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 10px;
  transform: translateY(20px); opacity: 0;
  transition: transform 0.3s, opacity 0.3s;
  pointer-events: none;
  z-index: 2000;
}
.toast.show { transform: translateY(0); opacity: 1; }

.toggle {
  width: 44px; height: 24px; border-radius: 30px;
  background: var(--abu-mid); position: relative;
  transition: background 0.2s; flex-shrink: 0;
}
.toggle::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: white; transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle.on { background: var(--hijau); }
.toggle.on::after { transform: translateX(20px); }

.tabs { display: flex; gap: 4px; background: var(--abu); padding: 4px; border-radius: 12px; width: fit-content; margin-bottom: 20px; }
.tab-btn {
  padding: 9px 18px; border-radius: 9px; font-size: 13px; font-weight: 700;
  color: var(--teks2); transition: background 0.2s, color 0.2s;
}
.tab-btn.active { background: var(--hijau); color: white; }

/* Mobile responsive */
@media (max-width: 980px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-area { margin-left: 0; }
  .menu-toggle { display: flex; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .content { padding: 18px; }
}
@media (max-width: 600px) {
  .stat-grid { grid-template-columns: 1fr; }
  .topbar-user-name, .topbar-user-role { display: none; }
}
