/* =====================================================
   Keuangan Yayasan SIT Al-Izzah — Custom CSS
   Tema Islami: Hijau #1a7a4a + Biru #1b3a6b
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  --primary:       #1a7a4a;
  --primary-dark:  #13593a;
  --primary-light: #d4f0e3;
  --secondary:     #1b3a6b;
  --secondary-light: #e8eef8;
  --accent:        #f0a500;
  --danger:        #dc3545;
  --success:       #198754;
  --warning:       #ffc107;
  --info:          #0dcaf0;
  --sidebar-width: 260px;
  --sidebar-bg:    #0f2744;
  --topbar-h:      64px;
  --card-radius:   12px;
  --shadow-sm:     0 2px 8px rgba(0,0,0,.08);
  --shadow-md:     0 4px 16px rgba(0,0,0,.12);
  --transition:    all .25s ease;
}

/* ===================== GLOBAL ===================== */
* { box-sizing: border-box; }
body {
  font-family: 'Inter', sans-serif;
  background: #f0f4f8;
  color: #2d3748;
  margin: 0;
  font-size: 14px;
}
a { text-decoration: none; }

/* ===================== SIDEBAR ===================== */
#sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-brand {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}
.sidebar-brand .brand-logo {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: white; flex-shrink: 0;
}
.sidebar-brand .brand-text { line-height: 1.2; }
.sidebar-brand .brand-name {
  font-size: 13px; font-weight: 700;
  color: #fff;
}
.sidebar-brand .brand-sub {
  font-size: 10px; color: rgba(255,255,255,.5);
  text-transform: uppercase; letter-spacing: .5px;
}

.sidebar-nav { flex: 1; padding: 12px 0; }
.nav-section-label {
  padding: 10px 20px 4px;
  font-size: 9px; font-weight: 700;
  color: rgba(255,255,255,.3);
  text-transform: uppercase; letter-spacing: 1px;
}
.sidebar-nav .nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px;
  color: rgba(255,255,255,.65);
  font-size: 13.5px; font-weight: 500;
  border-radius: 0; transition: var(--transition);
  border-left: 3px solid transparent;
}
.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link.active {
  color: #fff;
  background: rgba(255,255,255,.07);
  border-left-color: var(--primary);
}
.sidebar-nav .nav-link.active { background: rgba(26,122,74,.2); }
.sidebar-nav .nav-link i { width: 18px; text-align: center; font-size: 15px; }

.sidebar-footer {
  padding: 14px 20px;
  border-top: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}
.sidebar-footer .user-name { font-size: 13px; font-weight: 600; color: #fff; }
.sidebar-footer .user-role {
  font-size: 11px; color: rgba(255,255,255,.45);
  text-transform: capitalize;
}
.sidebar-footer .btn-logout {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  background: rgba(220,53,69,.15);
  border: 1px solid rgba(220,53,69,.3);
  color: #ff6b6b; border-radius: 8px;
  font-size: 12px; font-weight: 500;
  width: 100%; margin-top: 10px;
  cursor: pointer; transition: var(--transition);
}
.sidebar-footer .btn-logout:hover {
  background: rgba(220,53,69,.3); color: #fff;
}

/* ===================== MAIN CONTENT ===================== */
#main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex; flex-direction: column;
  transition: var(--transition);
}

/* ===================== TOPBAR ===================== */
#topbar {
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid #e8edf2;
  display: flex; align-items: center;
  padding: 0 24px; gap: 16px;
  position: sticky; top: 0; z-index: 500;
  box-shadow: var(--shadow-sm);
}
#topbar .topbar-title {
  font-size: 17px; font-weight: 700; color: var(--secondary);
  flex: 1;
}
#topbar .btn-sidebar-toggle {
  background: none; border: none;
  color: #64748b; font-size: 20px;
  cursor: pointer; padding: 6px;
  border-radius: 6px; display: none;
}
@media (max-width: 768px) {
  #topbar .btn-sidebar-toggle { display: flex; }
}

/* ===================== PAGE CONTENT ===================== */
.page-content {
  flex: 1;
  padding: 24px;
}

/* ===================== CARDS ===================== */
.card {
  border: none;
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-sm);
  background: #fff;
  transition: var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-header {
  background: none;
  border-bottom: 1px solid #f0f4f8;
  padding: 16px 20px;
  font-weight: 600; font-size: 15px;
  color: var(--secondary);
}

/* ===================== STAT CARDS ===================== */
.stat-card {
  border-radius: var(--card-radius);
  padding: 20px;
  color: #fff;
  position: relative; overflow: hidden;
  box-shadow: var(--shadow-md);
}
.stat-card::before {
  content: '';
  position: absolute; top: -20px; right: -20px;
  width: 100px; height: 100px;
  background: rgba(255,255,255,.1);
  border-radius: 50%;
}
.stat-card::after {
  content: '';
  position: absolute; bottom: -30px; right: 20px;
  width: 80px; height: 80px;
  background: rgba(255,255,255,.07);
  border-radius: 50%;
}
.stat-card.green  { background: linear-gradient(135deg, #1a7a4a, #2ecc71); }
.stat-card.red    { background: linear-gradient(135deg, #c0392b, #e74c3c); }
.stat-card.blue   { background: linear-gradient(135deg, #1b3a6b, #2980b9); }
.stat-card.orange { background: linear-gradient(135deg, #d35400, #f39c12); }
.stat-card.purple { background: linear-gradient(135deg, #6c3483, #9b59b6); }

.stat-card .stat-label {
  font-size: 11px; font-weight: 600; letter-spacing: .5px;
  opacity: .85; text-transform: uppercase; margin-bottom: 6px;
}
.stat-card .stat-value {
  font-size: 22px; font-weight: 800; margin-bottom: 2px;
}
.stat-card .stat-sub { font-size: 12px; opacity: .75; }
.stat-card .stat-icon {
  position: absolute; right: 16px; top: 16px;
  font-size: 32px; opacity: .25;
}

/* ===================== TABLES ===================== */
.table-responsive { border-radius: var(--card-radius); overflow: hidden; }
.table { margin-bottom: 0; }
.table thead th {
  background: #f8fafc;
  color: var(--secondary);
  font-weight: 700; font-size: 12px;
  text-transform: uppercase; letter-spacing: .5px;
  border-bottom: 2px solid #e8edf2;
  padding: 12px 16px;
}
.table tbody tr { transition: var(--transition); }
.table tbody tr:hover { background: #f8fafc; }
.table tbody td { padding: 11px 16px; vertical-align: middle; font-size: 13.5px; }

/* ===================== BADGES ===================== */
.badge-pemasukan  { background: #d4f0e3; color: #1a7a4a; }
.badge-pengeluaran{ background: #fde8e8; color: #c0392b; }
.badge-lunas      { background: #d4f0e3; color: #1a7a4a; }
.badge-sebagian   { background: #fff3cd; color: #856404; }
.badge-belum_lunas{ background: #fde8e8; color: #c0392b; }
.badge-role-admin    { background: #e8eef8; color: #1b3a6b; }
.badge-role-yayasan  { background: #e8f4fd; color: #1a5276; }
.badge-role-bendahara{ background: #d4f0e3; color: #1a7a4a; }
.badge-role-kepala_sekolah { background: #e0f2fe; color: #0369a1; } /* Light blue background with dark blue text */

/* ===================== FORMS ===================== */
.form-label { font-weight: 600; font-size: 13px; color: #4a5568; margin-bottom: 6px; }
.form-control, .form-select {
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  padding: 9px 14px;
  font-size: 14px;
  transition: var(--transition);
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,122,74,.12);
}
.input-group-text {
  background: #f8fafc; border-color: #e2e8f0;
  font-size: 13px;
}

/* ===================== BUTTONS ===================== */
.btn-primary-custom {
  background: linear-gradient(135deg, var(--primary), #2ecc71);
  border: none; color: #fff;
  padding: 10px 20px; border-radius: 8px;
  font-weight: 600; font-size: 13.5px;
  transition: var(--transition);
}
.btn-primary-custom:hover { 
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: #fff; transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(26,122,74,.35);
}
.btn-secondary-custom {
  background: #f0f4f8; border: 1.5px solid #e2e8f0;
  color: #4a5568; padding: 9px 18px; border-radius: 8px;
  font-weight: 600; font-size: 13.5px;
  transition: var(--transition);
}
.btn-secondary-custom:hover { background: #e2e8f0; color: #2d3748; }

/* ===================== ALERTS / TOAST ===================== */
.alert {
  border: none; border-radius: 10px;
  font-size: 13.5px; font-weight: 500;
}
.alert-success { background: #d4f0e3; color: #166534; }
.alert-danger   { background: #fde8e8; color: #991b1b; }
.alert-warning  { background: #fff3cd; color: #92400e; }
.alert-info     { background: #e0f2fe; color: #1e40af; }

/* ===================== PROGRESS BAR ===================== */
.progress { height: 8px; border-radius: 10px; background: #e8edf2; }
.progress-bar { border-radius: 10px; }

/* ===================== PIUTANG STATUS ===================== */
.piutang-progress { margin-top: 5px; }

/* ===================== LOGIN PAGE ===================== */
.login-wrapper {
  min-height: 100vh;
  background: linear-gradient(135deg, #0f2744 0%, #1a7a4a 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  position: relative; overflow: hidden;
}
.login-wrapper::before {
  content: '';
  position: absolute; top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: radial-gradient(circle at 30% 30%, rgba(26,122,74,.2) 0%, transparent 50%),
              radial-gradient(circle at 70% 70%, rgba(27,58,107,.3) 0%, transparent 50%);
}
.login-card {
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 25px 60px rgba(0,0,0,.3);
  padding: 40px;
  width: 100%; max-width: 420px;
  position: relative; z-index: 1;
}
.login-logo {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; color: #fff; margin: 0 auto 16px;
}

/* ===================== RESPONSIVE ===================== */
@media (max-width: 768px) {
  #sidebar {
    transform: translateX(-100%);
  }
  #sidebar.open {
    transform: translateX(0);
  }
  #main-content {
    margin-left: 0;
  }
  .stat-card .stat-value { font-size: 18px; }
  .page-content { padding: 16px; }
}

/* ===================== OVERLAY ===================== */
#sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 999;
}
#sidebar-overlay.show { display: block; }

/* ===================== SCROLL ===================== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #f0f4f8; }
::-webkit-scrollbar-thumb { background: #cbd5e0; border-radius: 3px; }

/* ===================== ANIMATIONS ===================== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: none; }
}
.fade-in-up { animation: fadeInUp .4s ease forwards; }

/* Currency format hint */
.currency-hint { font-size: 11px; color: #94a3b8; margin-top: 3px; }
