/*
  ============================================================
  STYLESHEET (style.css)
  ============================================================
  Gaya visual untuk frontend dashboard.
  Tanpa framework CSS — murni CSS vanilla.

  Konsep:
    - CSS Grid & Flexbox untuk layout
    - Bar chart dibuat dengan CSS (div + width %)
    - Responsive: 1 kolom di layar kecil
  ============================================================
*/

/* Reset — hapus margin/padding bawaan browser */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ============================================================
   BASE / TATA DASAR
   ============================================================ */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f0f2f5;
  color: #1a1a2e;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ============================================================
   NAVBAR — header gelap di atas
   ============================================================ */
.navbar {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  color: #fff;
  padding: 1rem 2rem;
  display: flex;
  align-items: baseline;
  gap: 1rem;
}
.nav-brand {
  font-size: 1.4rem;
  font-weight: 700;
}
.nav-subtitle {
  font-size: 0.85rem;
  opacity: 0.7;
}

/* ============================================================
   CONTAINER — pembatas lebar maksimal
   ============================================================ */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
  flex: 1;
}

/* ============================================================
   STATS CARDS — 4 kotak ringkasan
   Grid: auto-fit agar rapi di berbagai ukuran layar
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: #fff;
  border-radius: 10px;
  padding: 1.25rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  text-align: center;
}
.stat-label {
  font-size: 0.8rem;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.4rem;
}
.stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: #1a1a2e;
}

/* ============================================================
   DASHBOARD GRID — 2 kolom (kiri: grafik, kanan: tabel)
   Di layar HP jadi 1 kolom (media query di bawah)
   ============================================================ */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

/* ============================================================
   CARDS — kotak putih berisi konten
   ============================================================ */
.card {
  background: #fff;
  border-radius: 10px;
  padding: 1.25rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.card h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: #374151;
}

/* ============================================================
   BAR CHARTS — grafik batang CSS murni
   Struktur HTML:
     .bar-item
       .bar-label (nama kategori/bulan)
       .bar-track (background abu-abu)
         .bar-fill (batang warna, lebarnya di-set JS)
   ============================================================ */
.bar-item {
  display: flex;
  align-items: center;
  margin-bottom: 0.6rem;
  gap: 0.5rem;
}
.bar-label {
  width: 110px;
  font-size: 0.82rem;
  text-align: right;
  flex-shrink: 0;
  color: #374151;
}
.bar-track {
  flex: 1;
  height: 22px;
  background: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #fff;
  min-width: fit-content;
  transition: width 0.4s ease; /* animasi saat render */
}

/* Warna batang — dipilih oleh JS */
.bar-fill.blue { background: #3b82f6; }
.bar-fill.green { background: #10b981; }
.bar-fill.purple { background: #8b5cf6; }
.bar-fill.orange { background: #f59e0b; }
.bar-fill.red { background: #ef4444; }
.bar-fill.teal { background: #14b8a6; }
.bar-fill.pink { background: #ec4899; }
.bar-fill.indigo { background: #6366f1; }

/* ============================================================
   TABLES — untuk data tabular
   ============================================================ */
.table-wrap {
  overflow-x: auto;    /* scroll horizontal di HP */
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  font-weight: 600;
  color: #6b7280;
  border-bottom: 2px solid #e5e7eb;
  white-space: nowrap;
}
td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #f3f4f6;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f9fafb; }
.number {
  text-align: right;
  font-variant-numeric: tabular-nums; /* angka sejajar vertikal */
}

/* ============================================================
   PYTHON ANALYSIS TABS
   ============================================================ */
.analysis-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
}
.tab {
  padding: 0.4rem 0.9rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  color: #374151;
  transition: all 0.15s;
}
.tab:hover { border-color: #3b82f6; color: #3b82f6; }
.tab.active {
  background: #3b82f6;
  border-color: #3b82f6;
  color: #fff;
}
.analysis-content {
  font-size: 0.88rem;
  line-height: 1.6;
  min-height: 80px;
}
.analysis-content table { font-size: 0.82rem; }
.text-muted { color: #9ca3af; }

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  text-align: center;
  padding: 1rem;
  font-size: 0.8rem;
  color: #6b7280;
  border-top: 1px solid #e5e7eb;
  display: flex;
  justify-content: center;
  gap: 1.5rem;
}

/* ============================================================
   RESPONSIVE — untuk layar HP (<768px)
   Dashboard grid jadi 1 kolom, label bar lebih kecil
   ============================================================ */
@media (max-width: 768px) {
  .dashboard-grid {
    grid-template-columns: 1fr; /* 1 kolom */
  }
  .bar-label { width: 80px; font-size: 0.75rem; }
}
