/*=====================================================
    POLITICAL INTELLIGENCE DASHBOARD
    Layout Enterprise Style (Power BI Inspired)
=====================================================*/

/*=====================================================
  PAGE LAYOUT
=====================================================*/

body {
  margin: 0;

  display: flex;

  background: #f5f7fb;

  font-family: "Poppins", sans-serif;
}

/* NOTE: lebar & posisi .sidebar sepenuhnya diatur oleh style.css
   (termasuk breakpoint tablet/mobile). Di sini kita cuma pastikan
   sidebar tidak ikut menyusut sebagai flex item. */
.sidebar {
  flex-shrink: 0;
}

main {
  flex: 1;

  min-width: 0;

  display: flex;

  flex-direction: column;

  min-height: 100vh;
}

.topbar {
  flex-shrink: 0;
}

.content {
  flex: 1;
}

/*==========================
  CONTENT WRAPPER
==========================*/

.content {
  display: flex;
  flex-direction: column;
  gap: 25px;
  padding: 25px;
}

/*==========================
  GRID SYSTEM
==========================*/

.dashboard-grid {
  display: grid;

  grid-template-columns: repeat(12, 1fr);

  gap: 24px;

  align-items: stretch;
}

/*==========================
  KPI CARDS
==========================*/

#dashboard-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 25px;
}

/*==========================
  GRID AREA
==========================*/

#dashboard-line-chart {
  grid-column: span 8;
}

#dashboard-ai-widget {
  grid-column: span 4;
}

#dashboard-map {
  grid-column: span 12;
}

#dashboard-quick-stat {
  grid-column: span 4;
}

#dashboard-column-chart {
  grid-column: span 6;
}

#dashboard-donut-chart {
  grid-column: span 6;
}

#dashboard-progress {
  grid-column: span 12;
}

#dashboard-timeline {
  grid-column: span 6;
}

#dashboard-table {
  width: 100%;
}

/*==========================
  DEFAULT WIDGET
==========================*/

.dashboard-widget {
  position: relative;

  background: #ffffff;

  border-radius: 20px;

  padding: 24px;

  border: 1px solid var(--border);

  box-shadow: var(--shadow, 0 12px 28px -8px rgba(30, 41, 59, 0.1));

  overflow: hidden;

  height: 100%;

  min-height: auto;
}

.dashboard-widget::before {
  content: "";

  position: absolute;

  top: 0;

  left: 0;

  right: 0;

  height: 4px;

  background: var(--gradient-brand, #4f46e5);
}

/*==========================
  HEADER
==========================*/

.dashboard-widget-header {
  display: flex;

  justify-content: space-between;

  align-items: center;

  margin-bottom: 20px;
}

.dashboard-widget-header h3 {
  font-size: 18px;

  font-weight: 600;

  color: #111827;
}

.dashboard-widget-header span {
  font-size: 12px;

  color: #6b7280;

  font-weight: 600;

  text-transform: uppercase;

  letter-spacing: 0.04em;
}

/*=====================================================
  AI PANEL IMPROVEMENT
=====================================================*/

.ai-score {
  display: flex;
  align-items: center;
  justify-content: center;

  width: 120px;
  height: 120px;

  margin: auto;

  border-radius: 50%;

  background: linear-gradient(135deg, var(--primary), var(--accent-purple, #8b5cf6));

  color: #ffffff;

  font-size: 48px;

  font-weight: 700;

  box-shadow: 0 10px 30px rgba(139, 92, 246, 0.35);
}

.ai-status {
  margin: auto;

  display: flex;

  align-items: center;

  gap: 8px;
}

.ai-panel ul {
  margin-top: 20px;

  padding-left: 18px;
}

.ai-panel li {
  line-height: 1.7;

  margin-bottom: 12px;

  color: #4b5563;
}

/*=====================================================
  QUICK STAT
=====================================================*/

.quick-stat {
  display: flex;

  flex-direction: column;

  gap: 22px;
}

.quick-item {
  display: flex;

  flex-direction: column;

  gap: 12px;
}

.quick-info {
  display: flex;

  justify-content: space-between;

  align-items: center;
}

.quick-info span {
  font-size: 14px;

  color: #6b7280;
}

.quick-info strong {
  font-size: 20px;

  color: var(--primary, #4f46e5);

  font-weight: 700;
}

.quick-progress {
  display: grid;

  grid-template-columns: 1fr auto;

  gap: 10px;

  align-items: center;
}

.progress-bar {
  width: 100%;

  height: 10px;

  background: #ececec;

  border-radius: 999px;

  overflow: hidden;
}

.progress-fill {
  display: block;

  height: 100%;

  border-radius: 999px;

  transition: width 0.4s ease;
}

.progress-fill.blue {
  background: #2563eb;
}

.progress-fill.green {
  background: #059669;
}

.progress-fill.orange {
  background: #d97706;
}

.progress-fill.red {
  background: #dc2626;
}

.quick-progress small {
  min-width: 40px;

  text-align: right;

  font-size: 13px;

  color: #6b7280;

  font-weight: 600;
}

/*==========================
  TABLE
==========================*/

#dashboard-table .table-card {
  width: 100%;
}

/*==========================
  CHART PLACEHOLDER
==========================*/

.chart-container {
  width: 100%;

  height: 380px;
}

/* .map-container {
  width: 100%;

  height: 420px;
} */

.timeline-container {
  min-height: 350px;
}

.progress-container {
  min-height: 320px;
}

/*==========================
  RESPONSIVE
==========================*/

@media (max-width: 1200px) {
  #dashboard-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  #dashboard-line-chart,
  #dashboard-ai-widget,
  #dashboard-map,
  #dashboard-quick-stat,
  #dashboard-column-chart,
  #dashboard-donut-chart,
  #dashboard-progress,
  #dashboard-timeline {
    grid-column: span 12;
  }
}

@media (max-width: 768px) {
  .content {
    padding: 15px;
  }

  #dashboard-cards {
    grid-template-columns: 1fr;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;

    gap: 15px;
  }

  .dashboard-widget,
  .kpi-card {
    padding: 18px;
  }

  .chart-container {
    height: 280px;
  }

  .map-container {
    height: 360px;
  }
}

/*=====================================================
  KPI CARD
=====================================================*/

.kpi-card {
  position: relative;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--shadow, 0 12px 28px -8px rgba(30, 41, 59, 0.1));
  transition: 0.25s ease;
  overflow: hidden;
}

.kpi-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gradient-brand, #4f46e5);
}

.kpi-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover, 0 20px 40px -12px rgba(79, 70, 229, 0.2));
}

/*=====================================================
  KPI CARD - VARIASI WARNA & CORAK PER KARTU
  -----------------------------------------------------
  Tiap kartu KPI (urutan ke-1, ke-2, ke-3, ke-4, lalu
  berulang) dapat tint warna + corak dot-grid halus di
  background-nya biar tampilannya beda-beda, tanpa
  menyentuh HTML/isi konten sama sekali.
=====================================================*/

.kpi-card {
  --kpi-accent: var(--primary, #4f46e5);
  --kpi-accent-light: var(--primary-light, #6366f1);
  --kpi-tint: rgba(79, 70, 229, 0.16);

  background-image:
    radial-gradient(circle at 1px 1px, var(--kpi-tint) 1.4px, transparent 0),
    linear-gradient(135deg, color-mix(in srgb, var(--kpi-accent) 6%, white) 0%, #ffffff 55%);
  background-size: 15px 15px, 100% 100%;
  background-repeat: repeat, no-repeat;
  background-color: #ffffff;
}

.kpi-card::before {
  background: linear-gradient(90deg, var(--kpi-accent), var(--kpi-accent-light));
}

#dashboard-cards .kpi-card:nth-child(4n + 2) {
  --kpi-accent: var(--secondary, #ec4899);
  --kpi-accent-light: var(--secondary-light, #f472b6);
  --kpi-tint: rgba(236, 72, 153, 0.16);
}

#dashboard-cards .kpi-card:nth-child(4n + 3) {
  --kpi-accent: var(--accent-teal, #06b6d4);
  --kpi-accent-light: var(--accent-teal-light, #22d3ee);
  --kpi-tint: rgba(6, 182, 212, 0.16);
}

#dashboard-cards .kpi-card:nth-child(4n + 4) {
  --kpi-accent: var(--accent-amber, #f59e0b);
  --kpi-accent-light: var(--accent-amber-light, #fbbf24);
  --kpi-tint: rgba(245, 158, 11, 0.18);
}

.kpi-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.kpi-header span {
  font-size: 12px;
  color: #6b7280;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.kpi-header i {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--kpi-accent, var(--primary, #4f46e5)) 15%, white);
  color: var(--kpi-accent, var(--primary, #4f46e5));
  font-size: 18px;
}

.kpi-card h2 {
  font-size: 34px;
  font-weight: 700;
  color: #111827;
  margin-bottom: 16px;
}

.kpi-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
}

.kpi-footer.positive {
  color: #16a34a;
}

.kpi-footer.warning {
  color: #d97706;
}

.kpi-footer.info {
  color: #2563eb;
}

/*=====================================================
  WIDGET ACTION
=====================================================*/

.btn-icon {
  width: 38px;

  height: 38px;

  border: none;

  border-radius: 10px;

  background: #f3f4f6;

  cursor: pointer;

  transition: 0.25s;
}

.btn-icon:hover {
  background: #2563eb;

  color: #ffffff;
}

/*=====================================================
  MAP TOOLBAR
=====================================================*/

.map-toolbar {
  display: flex;

  gap: 10px;

  margin-bottom: 20px;

  flex-wrap: wrap;
}

.map-filter {
  border: none;

  background: #f3f4f6;

  color: #4b5563;

  padding: 8px 16px;

  border-radius: 10px;

  cursor: pointer;

  font-size: 13px;

  font-weight: 500;

  transition: 0.25s;
}

.map-filter:hover {
  background: var(--gradient-primary, #4f46e5);

  color: #ffffff;
}

.map-filter.active {
  background: var(--gradient-primary, #4f46e5);

  color: #ffffff;
}

/*=====================================================
  MAP
=====================================================*/

.map-container {
  width: 100%;

  height: 520px;

  border-radius: 14px;

  overflow: hidden;

  border: 1px solid var(--border);
}

/*=====================================================
  MAP LEGEND
=====================================================*/

.map-legend {
  background: #ffffff;

  padding: 12px 16px;

  border-radius: 12px;

  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);

  font-size: 13px;

  line-height: 1.8;
}

.map-legend h4 {
  margin: 0 0 8px;

  font-size: 14px;

  color: var(--primary, #4f46e5);
}

/* Label nama wilayah di tengah tiap polygon area pada peta */

.map-area-label {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  font-weight: 600;
  font-size: 12px;
  color: #111827;
  text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 3px #fff;
}

.map-area-label::before {
  display: none;
}

/*=====================================================
  CAMPAIGN PROGRESS
=====================================================*/

.campaign-progress {
  display: flex;

  flex-direction: column;

  gap: 22px;
}

.progress-item {
  display: flex;

  flex-direction: column;

  gap: 10px;
}

.progress-header {
  display: flex;

  justify-content: space-between;

  align-items: center;
}

.progress-header span {
  font-size: 14px;

  color: #4b5563;

  font-weight: 500;
}

.progress-header strong {
  color: #111827;

  font-size: 15px;
}

.campaign-progress-bar {
  width: 100%;

  height: 12px;

  background: #edf2f7;

  border-radius: 999px;

  overflow: hidden;
}

.campaign-progress-fill {
  height: 100%;

  border-radius: 999px;

  transition: width 0.4s ease;
}

/* Colors */

.campaign-progress-fill.primary {
  background: #4f46e5;
}

.campaign-progress-fill.success {
  background: #16a34a;
}

.campaign-progress-fill.warning {
  background: #d97706;
}

.campaign-progress-fill.info {
  background: #0891b2;
}

.campaign-progress-fill.danger {
  background: #dc2626;
}

/*=====================================================
  ACTIVITY TIMELINE
=====================================================*/

.timeline {
  position: relative;

  padding-left: 18px;
}

.timeline::before {
  content: "";

  position: absolute;

  left: 8px;

  top: 0;

  bottom: 0;

  width: 2px;

  background: var(--border);
}

.timeline-item {
  position: relative;

  display: flex;

  gap: 18px;

  margin-bottom: 28px;
}

.timeline-item:last-child {
  margin-bottom: 0;
}

.timeline-dot {
  width: 16px;

  height: 16px;

  border-radius: 50%;

  margin-left: -18px;

  margin-top: 4px;

  flex-shrink: 0;

  border: 3px solid #ffffff;

  box-shadow: 0 0 0 2px var(--border);
}

/* ===== Colors ===== */

.timeline-dot.primary {
  background: #4f46e5;
}

.timeline-dot.success {
  background: #16a34a;
}

.timeline-dot.warning {
  background: #d97706;
}

.timeline-dot.info {
  background: #0891b2;
}

.timeline-dot.danger {
  background: #dc2626;
}

.timeline-content {
  flex: 1;
}

.timeline-content h4 {
  margin: 0;

  font-size: 15px;

  color: #111827;

  font-weight: 600;
}

.timeline-content p {
  margin: 6px 0;

  font-size: 14px;

  color: #6b7280;

  line-height: 1.6;
}

.timeline-content small {
  color: #9ca3af;

  font-size: 12px;
}

/*=====================================================
  DATA TABLE
=====================================================*/

.table-responsive {
  width: 100%;

  overflow-x: auto;
}

.dashboard-table {
  width: 100%;

  border-collapse: collapse;
}

.dashboard-table thead {
  background: rgba(79, 70, 229, 0.06);
}

.dashboard-table th {
  text-align: left;

  padding: 16px;

  font-size: 14px;

  font-weight: 600;

  color: #374151;

  border-bottom: 1px solid var(--border);
}

.dashboard-table td {
  padding: 16px;

  border-bottom: 1px solid #f1f5f9;

  font-size: 14px;

  color: #4b5563;
}

.dashboard-table tbody tr {
  transition: 0.25s;
}

.dashboard-table tbody tr:hover {
  background: rgba(79, 70, 229, 0.04);
}

/*=====================================================
  BADGE
=====================================================*/

.badge {
  display: inline-block;

  padding: 6px 12px;

  border-radius: 999px;

  font-size: 12px;

  font-weight: 600;
}

.badge.success {
  background: #dcfce7;

  color: #15803d;

  box-shadow: inset 0 0 0 1px rgba(21, 128, 61, 0.15);
}

.badge.primary {
  background: #e0e7ff;

  color: #4338ca;

  box-shadow: inset 0 0 0 1px rgba(67, 56, 202, 0.15);
}

.badge.warning {
  background: #fef3c7;

  color: #b45309;

  box-shadow: inset 0 0 0 1px rgba(180, 83, 9, 0.15);
}

.badge.danger {
  background: #fee2e2;

  color: #dc2626;

  box-shadow: inset 0 0 0 1px rgba(220, 38, 38, 0.15);
}

.badge.info {
  background: #cffafe;

  color: #0891b2;

  box-shadow: inset 0 0 0 1px rgba(8, 145, 178, 0.15);
}