/* style.css — Timses Mang Sansan — Pilkades Kasomalang Kulon */
:root {
  --sidebar-w: 250px;
  --brand: #14532d;
  --brand-2: #166534;
  --brand-light: #dcfce7;
}

body {
  background: #f1f5f9;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

/* ===== Login ===== */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--brand) 0%, #15803d 100%);
  padding: 1rem;
}
.login-card { width: 100%; max-width: 400px; border: none; border-radius: 1rem; }
.login-icon {
  width: 64px; height: 64px; margin: 0 auto;
  background: var(--brand-light); color: var(--brand);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem;
}
.login-foto {
  width: 88px; height: 88px; margin: 0 auto; display: block;
  border-radius: 50%; object-fit: cover;
  border: 3px solid var(--brand); box-shadow: 0 2px 10px rgba(0,0,0,.15);
}
.sidebar-foto {
  width: 42px; height: 42px; flex-shrink: 0;
  border-radius: 50%; object-fit: cover;
  border: 2px solid rgba(255,255,255,.55);
}

/* ===== Layout ===== */
.app-topbar { background: var(--brand); position: sticky; top: 0; z-index: 1040; }
.app-layout { display: flex; min-height: 100vh; }
.app-sidebar {
  width: var(--sidebar-w);
  /* !important: menimpa background transparan/putih bawaan .offcanvas-lg Bootstrap */
  background: var(--brand) !important;
  color: #fff !important;
  flex-shrink: 0;
}
.app-sidebar .offcanvas-body { background: var(--brand); color: #fff; }
@media (min-width: 992px) {
  .app-sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; }
  .offcanvas-body { height: 100%; }
}
.app-content { flex: 1; min-width: 0; }

.sidebar-brand {
  padding: 1rem 1.25rem;
  font-weight: 700; font-size: 1.05rem;
  border-bottom: 1px solid rgba(255,255,255,.15);
}
.sidebar-user {
  padding: .75rem 1.25rem;
  background: rgba(0,0,0,.18);
  border-bottom: 1px solid rgba(255,255,255,.1);
  font-size: .9rem;
}
.sidebar-menu { padding: .5rem 0; }
.sidebar-menu .nav-link {
  color: rgba(255,255,255,.85);
  padding: .6rem 1.25rem;
  font-size: .93rem;
  display: flex; align-items: center; gap: .6rem;
  border-left: 3px solid transparent;
}
.sidebar-menu .nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar-menu .nav-link.active {
  background: rgba(255,255,255,.14); color: #fff;
  border-left-color: #86efac; font-weight: 600;
}

/* ===== Kartu statistik ===== */
.stat-card { border: none; border-radius: .8rem; overflow: hidden; }
.stat-card .card-body { display: flex; align-items: center; gap: .9rem; }
.stat-icon {
  width: 48px; height: 48px; border-radius: .7rem;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.35rem; flex-shrink: 0;
}
.stat-value { font-size: 1.35rem; font-weight: 700; line-height: 1.1; }
.stat-label { font-size: .8rem; color: #64748b; }

/* ===== Tabel & umum ===== */
.card { border: none; border-radius: .8rem; }
.card-header { background: #fff; border-bottom: 1px solid #e2e8f0; font-weight: 600; border-radius: .8rem .8rem 0 0 !important; }
.table th { font-size: .8rem; text-transform: uppercase; color: #64748b; white-space: nowrap; }
.table td { vertical-align: middle; font-size: .9rem; }
.table-responsive { border-radius: 0 0 .8rem .8rem; }

.badge-calon1 { background: #2563eb; }
.badge-calon2 { background: #d97706; }
.badge-calon3 { background: #7c3aed; }
.badge-abu_abu { background: #6b7280; }

.page-title { font-weight: 700; color: #1e293b; }
.chart-box { position: relative; min-height: 260px; }

/* Kegiatan */
.event-date {
  width: 56px; flex-shrink: 0; text-align: center;
  background: var(--brand-light); color: var(--brand);
  border-radius: .6rem; padding: .35rem 0;
}
.event-date .d { font-size: 1.25rem; font-weight: 700; line-height: 1; }
.event-date .m { font-size: .7rem; text-transform: uppercase; }

/* Kalender bulanan penuh */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-head div {
  text-align: center; font-size: .75rem; font-weight: 700;
  color: #64748b; text-transform: uppercase; padding: .25rem 0;
}
.cal-head div:first-child { color: #dc2626; } /* Minggu merah */
.cal-cell {
  min-height: 72px; border: 1px solid #e2e8f0; border-radius: .5rem;
  padding: .3rem .4rem; cursor: pointer; position: relative;
  transition: background .15s, border-color .15s;
}
.cal-cell:hover { background: #f0fdf4; border-color: var(--brand); }
.cal-empty { border: none; cursor: default; background: transparent; }
.cal-empty:hover { background: transparent; }
.cal-num { font-size: .85rem; font-weight: 600; color: #334155; }
.cal-cell:nth-child(7n+1) .cal-num { color: #dc2626; } /* kolom Minggu */
.cal-today { background: var(--brand-light); border-color: var(--brand); }
.cal-today .cal-num {
  background: var(--brand); color: #fff; border-radius: 50%;
  width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center;
}
.cal-has-event { border-color: #86efac; }
.cal-dots { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 2px; align-items: center; }
.cal-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.cal-more { font-size: .65rem; color: #64748b; font-weight: 600; }
.cal-count { font-size: .68rem; color: #16a34a; margin-top: 2px; }
/* Warna per kategori kegiatan */
.k-rapat { background: #2563eb; }
.k-sosialisasi { background: #16a34a; }
.k-kunjungan { background: #d97706; }
.k-lainnya { background: #6b7280; }

/* Legenda kecil (kalender & rekap) */
.legend-dot {
  width: 10px; height: 10px; border-radius: 50%;
  display: inline-block; margin: 0 3px 0 8px; vertical-align: baseline;
}
.legend-dot.b1 { background: #2563eb; }
.legend-dot.b2 { background: #d97706; }
.legend-dot.b3 { background: #7c3aed; }
.legend-dot.b0 { background: #9ca3af; }

/* Rekap drill-down */
.rekap-row { cursor: pointer; }
.rekap-row:hover td { background: #f0fdf4; }
.rekap-caret { display: inline-block; transition: transform .15s; font-size: .8rem; color: #64748b; }
.rekap-row.open .rekap-caret { transform: rotate(90deg); }
.rekap-table .lv-rw td { background: #f8fafc; }
.rekap-table .lv-rt td { background: #fcfcfd; font-size: .85rem; }
.rekap-bar {
  display: flex; height: 6px; border-radius: 3px; overflow: hidden;
  background: #f1f5f9; margin-top: 4px; max-width: 220px;
}
.rekap-bar .b1 { background: #2563eb; }
.rekap-bar .b2 { background: #d97706; }
.rekap-bar .b3 { background: #7c3aed; }
.rekap-bar .b0 { background: #9ca3af; }

@media (max-width: 576px) {
  .stat-value { font-size: 1.1rem; }
  .page-title { font-size: 1.2rem; }
  .table td, .table th { font-size: .8rem; }
  .cal-cell { min-height: 48px; padding: .2rem .25rem; }
  .cal-num { font-size: .75rem; }
  .cal-dot { width: 6px; height: 6px; }
}

/* Saat cetak laporan: tampilkan semua baris drill-down */
@media print {
  .rekap-table tr.d-none { display: table-row !important; }
  .rekap-caret, #btnExpandAll { display: none !important; }
}

/* Kartu drill-down wilayah (pemilih & aspirasi) */
.drill-card { cursor: pointer; transition: transform .12s, box-shadow .12s; }
.drill-card:hover { transform: translateY(-2px); box-shadow: 0 .5rem 1rem rgba(0,0,0,.12) !important; border-color: #16a34a; }

/* Avatar inisial user tanpa foto */
.avatar-initial {
  display: inline-flex; align-items: center; justify-content: center;
  background: #dcfce7; color: #16a34a; font-weight: 600; vertical-align: middle;
}

/* Notifikasi: lonceng mengambang + panel */
.notif-fab {
  position: fixed; right: 18px; bottom: 18px; z-index: 1055;
  width: 52px; height: 52px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.notif-badge { position: absolute; top: -4px; right: -4px; font-size: .68rem; }
.notif-panel {
  position: fixed; right: 18px; bottom: 80px; z-index: 1055;
  width: 340px; max-width: calc(100vw - 36px);
}
.notif-body { max-height: 55vh; overflow-y: auto; }
.notif-item { padding: .6rem .85rem; border-bottom: 1px solid #f1f5f9; }
.notif-item:last-child { border-bottom: none; }

/* Bulatan merah penanda laporan baru di kartu drill-down */
.notif-dot {
  position: absolute; top: -8px; right: -8px; z-index: 2;
  min-width: 22px; height: 22px; padding: 0 6px;
  display: inline-flex; align-items: center; justify-content: center;
  background: #dc3545; color: #fff; border-radius: 999px;
  font-size: .72rem; font-weight: 700;
  box-shadow: 0 1px 4px rgba(0,0,0,.3);
}

@media print {
  .notif-fab, .notif-panel { display: none !important; }
}
