/* =====================================================
   POLITICAL INTELLIGENCE DASHBOARD
   MASTER STYLE
===================================================== */

:root {
  /* Primary Color */

  --primary: #4f46e5;
  --primary-light: #6366f1;
  --primary-dark: #3730a3;

  /* Colorful Accents */

  --secondary: #ec4899;
  --secondary-light: #f472b6;
  --accent-teal: #06b6d4;
  --accent-teal-light: #22d3ee;
  --accent-purple: #8b5cf6;
  --accent-amber: #f59e0b;
  --accent-amber-light: #fbbf24;

  /* Status */

  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;

  /* Signature accent: gradient tipis (monokrom, tidak "ramai") dipakai
     terbatas hanya di garis aksen kartu, tombol utama, dan sidebar aktif. */

  --gradient-brand: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
  --gradient-primary: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);

  /* Background */

  --bg: #f4f7fc;
  --white: #ffffff;

  /* Text */

  --text: #111827;
  --text-light: #6b7280;

  /* Border */

  --border: #edf0f6;

  /* Sidebar */

  --sidebar-width: 270px;
  --sidebar-width-collapsed: 80px;

  /* Radius */

  --radius: 20px;
  --radius-sm: 12px;

  /* Shadow: soft & layered ala modern SaaS card (bukan shadow keras) */

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 12px 28px -8px rgba(30, 41, 59, 0.10);
  --shadow-hover: 0 20px 40px -12px rgba(79, 70, 229, 0.20);
}

/* ================================= */

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

html {
  scroll-behavior: smooth;
}

body {
  background: radial-gradient(circle at 15% 0%, rgba(79, 70, 229, 0.05), transparent 45%), var(--bg);
  background-attachment: fixed;

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

  color: var(--text);
}

body.no-scroll {
  overflow: hidden;
}

/* ======================================
SIDEBAR
====================================== */

.sidebar {
  position: fixed;

  left: 0;

  top: 0;

  width: var(--sidebar-width);

  height: 100vh;

  background: linear-gradient(180deg, #171340 0%, #241b57 100%);

  color: white;

  overflow: auto;

  box-shadow: var(--shadow);

  z-index: 1000;

  transition: transform 0.3s ease, width 0.3s ease;

  display: flex;

  flex-direction: column;
}

/* LOGO */

.logo {
  height: 80px;

  display: flex;

  align-items: center;

  justify-content: center;

  gap: 12px;

  font-size: 22px;

  font-weight: 700;

  border-bottom: 1px solid rgba(255, 255, 255, 0.08);

  position: relative;

  flex-shrink: 0;
}

.logo i {
  font-size: 28px;

  color: #38bdf8;

  filter: drop-shadow(0 0 10px rgba(56, 189, 248, 0.55));
}

.sidebar-close-btn {
  display: none;

  position: absolute;

  right: 18px;

  top: 50%;

  transform: translateY(-50%);

  background: transparent;

  border: none;

  color: #fff;

  font-size: 20px;

  cursor: pointer;

  width: 36px;

  height: 36px;

  border-radius: 8px;
}

.sidebar-close-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* MENU */

.sidebar ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar > ul {
  flex: 1;
}

.sidebar > ul > li {
  list-style: none;
  cursor: pointer;
  transition: 0.3s;
  font-size: 15px;
}

.sidebar > ul > li:not(.has-submenu) {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 14px 20px;
  margin: 3px 14px;
  border-radius: var(--radius-sm);
}

.sidebar > ul > li:not(.has-submenu):hover {
  background: rgba(255, 255, 255, 0.08);
  padding-left: 20px;
  color: #a5b4fc;
}

.sidebar > ul > li.active {
  background: var(--gradient-brand);
  box-shadow: 0 8px 20px rgba(79, 70, 229, 0.35);
}

.sidebar li i {
  width: 20px;

  text-align: center;
}

/*=====================================================
  SIDEBAR FOOTER (user mini-profile + logout)
=====================================================*/

.sidebar-footer {
  flex-shrink: 0;

  padding: 16px 20px 20px;

  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-user {
  display: flex;

  align-items: center;

  gap: 10px;

  margin-bottom: 12px;

  min-width: 0;
}

.sidebar-user img {
  width: 36px;

  height: 36px;

  border-radius: 50%;

  object-fit: cover;

  flex-shrink: 0;
}

.sidebar-user-info {
  min-width: 0;
}

.sidebar-user-info strong {
  display: block;

  font-size: 13px;

  color: #fff;

  white-space: nowrap;

  overflow: hidden;

  text-overflow: ellipsis;
}

.sidebar-user-info small {
  display: block;

  font-size: 11px;

  color: rgba(255, 255, 255, 0.5);

  white-space: nowrap;

  overflow: hidden;

  text-overflow: ellipsis;
}

.logout-btn {
  width: 100%;

  display: flex;

  align-items: center;

  justify-content: center;

  gap: 10px;

  background: rgba(255, 255, 255, 0.08);

  border: 1px solid rgba(255, 255, 255, 0.12);

  color: #fff;

  padding: 10px 14px;

  border-radius: 10px;

  cursor: pointer;

  font-family: inherit;

  font-size: 13px;

  font-weight: 500;

  transition: 0.2s;
}

.logout-btn:hover {
  background: #dc2626;

  border-color: #dc2626;
}

/*=====================================================
  SIDEBAR SUBMENU
=====================================================*/

.has-submenu {
  list-style: none;
}

.menu-toggle {
  display: flex;

  justify-content: space-between;

  align-items: center;

  padding: 16px 30px;

  transition: 0.3s;

  cursor: pointer;
}

.menu-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
}

.menu-left {
  display: flex;

  align-items: center;

  gap: 15px;
}

.submenu {
  list-style: none;

  padding: 0;

  margin: 0;

  max-height: 0;

  overflow: hidden;

  transition: max-height 0.35s ease;
}

.submenu li {
  display: flex;

  align-items: center;

  gap: 12px;

  padding: 12px 30px 12px 62px;

  font-size: 14px;

  color: #d1d5db;

  transition: 0.25s;
}

.submenu li:hover {
  background: rgba(255, 255, 255, 0.06);

  color: #fff;

  padding-left: 68px;
}

.submenu li.active{
    background: rgba(56,189,248,.18);
    color:#38bdf8;
    border-right:3px solid #38bdf8;
}

.has-submenu.active .submenu {
  max-height: 350px;
}

.has-submenu.active > .menu-toggle {
    background: var(--gradient-brand);
}

.submenu-arrow {
  transition: 0.3s;
}

.has-submenu.active .submenu-arrow {
  transform: rotate(90deg);
}

/*=====================================================
  SIDEBAR OVERLAY (mobile backdrop)
=====================================================*/

.sidebar-overlay {
  display: none;

  position: fixed;

  inset: 0;

  background: rgba(17, 24, 39, 0.55);

  z-index: 999;

  opacity: 0;

  transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
  display: block;

  opacity: 1;
}

/* ======================================
MAIN
====================================== */

main {
  margin-left: var(--sidebar-width);

  min-height: 100vh;

  transition: margin-left 0.3s ease;
}

/* ======================================
TOPBAR
====================================== */

.topbar {
  height: 80px;

  background: white;

  display: flex;

  justify-content: space-between;

  align-items: center;

  padding: 0 35px;

  box-shadow: var(--shadow-sm);

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

  position: relative;

  gap: 15px;
}

.topbar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--gradient-brand);
  opacity: 0.55;
}

.topbar-left {
  display: flex;

  align-items: center;

  gap: 18px;

  min-width: 0;
}

.topbar-title {
  min-width: 0;
}

.topbar-title h2 {
  white-space: nowrap;

  overflow: hidden;

  text-overflow: ellipsis;
}

.topbar h2 {
  font-size: 24px;
}

.sidebar-toggle-btn {
  display: none;

  align-items: center;

  justify-content: center;

  width: 42px;

  height: 42px;

  flex-shrink: 0;

  border: none;

  background: var(--gradient-primary);

  color: #ffffff;

  border-radius: 10px;

  font-size: 18px;

  cursor: pointer;

  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.3);
}

.sidebar-toggle-btn:hover {
  filter: brightness(1.08);
}

.right {
  display: flex;

  align-items: center;

  gap: 20px;

  flex-shrink: 0;
}

.right i {
  font-size: 20px;

  cursor: pointer;

  color: var(--text-light);

  transition: 0.25s;
}

.right i:hover {
  transform: translateY(-2px) scale(1.1);
}

.right .fa-bell {
  color: var(--accent-amber);
}

.right .fa-envelope {
  color: var(--accent-teal);
}

.right img {
  box-shadow: 0 0 0 3px var(--white), 0 0 0 5px var(--primary-light);
}

.right img {
  width: 45px;

  height: 45px;

  border-radius: 50%;
}

/* ======================================
BREADCRUMB
====================================== */

.breadcrumb {
  padding: 20px 35px;

  color: var(--text-light);

  font-size: 14px;
}

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

.content {
  padding: 0 35px 40px;
}

/* ======================================
WELCOME
====================================== */

.welcome {
  background: white;

  border-radius: var(--radius);

  padding: 35px;

  box-shadow: var(--shadow);
}

.welcome h1 {
  font-size: 34px;

  margin-bottom: 10px;
}

.welcome p {
  color: var(--text-light);

  font-size: 16px;
}

/* ======================================
SCROLLBAR
====================================== */

::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-thumb {
  background: var(--gradient-primary);

  border-radius: 20px;
}

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

/* TABLET: sidebar menyempit jadi icon-only, tetap statis (bukan overlay) */
@media (max-width: 992px) and (min-width: 769px) {
  .sidebar {
    width: var(--sidebar-width-collapsed);
  }

  .logo span {
    display: none;
  }

  .sidebar-close-btn {
    display: none;
  }

  .sidebar li span,
  .menu-left span {
    display: none;
  }

  .sidebar > ul > li:not(.has-submenu) {
    margin: 3px 8px;
  }

  .submenu-arrow {
    display: none;
  }

  .sidebar-user-info,
  .logout-btn span {
    display: none;
  }

  .sidebar-user {
    justify-content: center;
    margin-bottom: 10px;
  }

  .logout-btn {
    padding: 10px;
  }

  main {
    margin-left: var(--sidebar-width-collapsed);
  }

  .sidebar-overlay {
    display: none !important;
  }
}

/* MOBILE: sidebar jadi off-canvas (tersembunyi, muncul lewat tombol hamburger) */
@media (max-width: 768px) {
  .sidebar {
    width: var(--sidebar-width);

    transform: translateX(-100%);
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .sidebar-close-btn {
    display: block;
  }

  main {
    margin-left: 0;
  }

  .sidebar-toggle-btn {
    display: flex;
  }

  .topbar {
    padding: 0 16px;
  }

  .topbar h2 {
    font-size: 17px;
  }

  .topbar-title small {
    font-size: 12px;
  }

  .right {
    gap: 14px;
  }

  .right i {
    font-size: 17px;
  }

  .right img {
    width: 36px;

    height: 36px;
  }

  .content {
    padding: 15px;
  }

  .welcome h1 {
    font-size: 24px;
  }
}

@media (max-width: 420px) {
  .right .fa-envelope {
    display: none;
  }

  .topbar-title small {
    display: none;
  }
}

/*=====================================================
CARD COMPONENT
=====================================================*/

.card-grid {
  display: grid;

  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));

  gap: 25px;
}

.stat-card {
  position: relative;

  background: #fff;

  border-radius: 20px;

  padding: 25px;

  display: flex;

  align-items: center;

  gap: 18px;

  box-shadow: var(--shadow);

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

  transition: 0.35s;

  cursor: pointer;

  overflow: hidden;
}

.stat-card::before {
  content: "";

  position: absolute;

  top: 0;

  left: 0;

  right: 0;

  height: 4px;

  background: var(--gradient-brand);
}

.stat-card:hover {
  transform: translateY(-8px);

  box-shadow: var(--shadow-hover);
}

.card-icon {
  width: 70px;

  height: 70px;

  border-radius: 20px;

  display: flex;

  align-items: center;

  justify-content: center;

  color: #fff;

  font-size: 28px;
}

.card-info {
  flex: 1;
}

.card-info span {
  color: #6b7280;

  font-size: 12px;

  font-weight: 600;

  text-transform: uppercase;

  letter-spacing: 0.04em;
}

.card-info h2 {
  margin: 8px 0;

  font-size: 30px;

  font-weight: 700;
}

.card-info small {
  color: #9ca3af;
}

/* WARNA */

.blue {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
}

.green {
  background: linear-gradient(135deg, #059669, #10b981);
}

.orange {
  background: linear-gradient(135deg, #d97706, #f59e0b);
}

.red {
  background: linear-gradient(135deg, #dc2626, #ef4444);
}

.purple {
  background: linear-gradient(135deg, #7c3aed, #8b5cf6);
}

.cyan {
  background: linear-gradient(135deg, #0891b2, #06b6d4);
}

.yellow {
  background: linear-gradient(135deg, #ca8a04, #eab308);
}

.dark {
  background: linear-gradient(135deg, #1f2937, #374151);
}

/*=====================================================
HIGHCHARTS
=====================================================*/

.chart-grid {
  display: grid;

  grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));

  gap: 25px;
}

.chart-card {
  position: relative;

  background: #fff;

  border-radius: 20px;

  padding: 25px;

  box-shadow: var(--shadow);

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

  overflow: hidden;
}

.chart-card::before {
  content: "";

  position: absolute;

  top: 0;

  left: 0;

  right: 0;

  height: 4px;

  background: var(--gradient-brand);
}

.chart-header {
  display: flex;

  justify-content: space-between;

  align-items: center;

  margin-bottom: 20px;
}

.chart-header h3 {
  font-size: 18px;

  font-weight: 600;
}

#lineChart,
#columnChart,
#pieChart,
#barChart {
  width: 100%;

  height: 350px;
}

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

.table-card {
  position: relative;

  background: #fff;

  border-radius: 20px;

  padding: 25px;

  box-shadow: var(--shadow);

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

  overflow: hidden;
}

.table-card::before {
  content: "";

  position: absolute;

  top: 0;

  left: 0;

  right: 0;

  height: 4px;

  background: var(--gradient-brand);
}

.table-header {
  display: flex;

  justify-content: space-between;

  align-items: center;

  margin-bottom: 25px;
}

.table-action {
  display: flex;

  gap: 15px;
}

.table-action input {
  width: 260px;

  padding: 12px 15px;

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

  border-radius: 10px;

  outline: none;
}

.btn-primary {
  background: var(--gradient-primary);

  color: #fff;

  border: none;

  padding: 12px 20px;

  border-radius: 10px;

  cursor: pointer;

  box-shadow: 0 8px 18px rgba(79, 70, 229, 0.3);

  transition: 0.25s;
}

.btn-primary:hover {
  filter: brightness(1.08);

  transform: translateY(-1px);
}

table {
  width: 100%;

  border-collapse: collapse;
}

thead {
  background: rgba(79, 70, 229, 0.06);
}

th {
  padding: 16px;

  text-align: left;

  font-size: 14px;
}

td {
  padding: 16px;

  border-bottom: 1px solid #eee;
}

tbody tr {
  transition: 0.3s;
}

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

.progress {
  height: 8px;

  background: var(--border);

  border-radius: 20px;

  overflow: hidden;
}

.progress-bar {
  height: 100%;

  background: #059669;
}

.w80 {
  width: 80%;
}

.w50 {
  width: 50%;
}

.w30 {
  width: 30%;
}

.badge {
  padding: 6px 14px;

  border-radius: 50px;

  color: #fff;

  font-size: 12px;
}

.success {
  background: #10b981;
}

.warning {
  background: #f59e0b;
}

.danger {
  background: #ef4444;
}

.btn-icon {
  width: 36px;

  height: 36px;

  border: none;

  border-radius: 10px;

  cursor: pointer;

  color: #fff;

  background: var(--gradient-primary);
}

.btn-icon.warning {
  background: #d97706;
}

/*=====================================================
PROGRESS COMPONENT
=====================================================*/

.progress-grid {
  display: grid;

  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));

  gap: 25px;
}

.progress-card {
  position: relative;

  background: #fff;

  padding: 25px;

  border-radius: 20px;

  box-shadow: var(--shadow);

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

  overflow: hidden;
}

.progress-card::before {
  content: "";

  position: absolute;

  top: 0;

  left: 0;

  right: 0;

  height: 4px;

  background: var(--gradient-brand);
}

.progress-title {
  display: flex;

  justify-content: space-between;

  align-items: center;

  margin-bottom: 15px;
}

.progress-title span {
  font-size: 15px;

  font-weight: 500;
}

.progress-title strong {
  font-size: 18px;
}

.progress-box {
  width: 100%;

  height: 12px;

  background: #edf2f7;

  border-radius: 20px;

  overflow: hidden;

  margin-bottom: 12px;
}

.progress-fill {
  height: 100%;

  border-radius: 20px;
}

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

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

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

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

.progress-fill.purple {
  background: #7c3aed;
}

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

.progress-card small {
  color: #6b7280;
}

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

.map-grid {
  display: grid;

  grid-template-columns: 2fr 1fr;

  gap: 25px;
}

.map-card {
  position: relative;

  background: #fff;

  border-radius: 20px;

  padding: 20px;

  box-shadow: var(--shadow);

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

  overflow: hidden;
}

.map-card::before {
  content: "";

  position: absolute;

  top: 0;

  left: 0;

  right: 0;

  height: 4px;

  background: var(--gradient-brand);
}

.map-header {
  display: flex;

  justify-content: space-between;

  align-items: center;

  margin-bottom: 15px;
}

#map {
  width: 100%;

  height: 600px;

  border-radius: 15px;

  overflow: hidden;
}

.map-info {
  background: #fff;

  border-radius: 20px;

  padding: 25px;

  box-shadow: var(--shadow);
}

.map-info h3 {
  margin-bottom: 15px;
}

.info-item {
  display: flex;

  justify-content: space-between;

  padding: 15px 0;

  border-bottom: 1px solid #ececec;
}

.info-item:last-child {
  border-bottom: none;
}

.info-item span {
  color: #6b7280;
}

.info-item strong {
  color: #111827;
}

@media (max-width: 992px) {
  .map-grid {
    grid-template-columns: 1fr;
  }

  #map {
    height: 450px;
  }
}

/*=====================================================
WIDGET COMPONENT
=====================================================*/

.widget-grid {
  display: grid;

  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));

  gap: 25px;
}

.widget-card {
  position: relative;

  background: #fff;

  border-radius: 20px;

  padding: 25px;

  box-shadow: var(--shadow);

  transition: 0.3s;

  overflow: hidden;
}

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

  position: absolute;

  top: 0;

  left: 0;

  right: 0;

  height: 4px;

  background: var(--gradient-brand);
}

.widget-card:hover {
  transform: translateY(-6px);

  box-shadow: var(--shadow-hover);
}

.widget-title {
  display: flex;

  align-items: center;

  gap: 10px;

  font-size: 18px;

  font-weight: 600;

  margin-bottom: 20px;
}

.widget-title i {
  color: var(--primary);
}

.widget-card ul,
.widget-card ol {
  padding-left: 20px;
}

.widget-card li {
  margin-bottom: 12px;

  color: #4b5563;
}

.mini-stat {
  display: flex;

  justify-content: space-between;

  padding: 12px 0;

  border-bottom: 1px solid #ececec;
}

.mini-stat:last-child {
  border-bottom: none;
}

.mini-stat strong {
  color: var(--primary);
}

/*=====================================================
TIMELINE COMPONENT
=====================================================*/

.timeline-card {
  position: relative;

  background: #fff;

  border-radius: 20px;

  padding: 30px;

  box-shadow: var(--shadow);

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

  overflow: hidden;
}

.timeline-card::before {
  content: "";

  position: absolute;

  top: 0;

  left: 0;

  right: 0;

  height: 4px;

  background: var(--gradient-brand);
}

.timeline {
  position: relative;

  margin-left: 25px;
}

.timeline::before {
  content: "";

  position: absolute;

  left: 22px;

  top: 0;

  bottom: 0;

  width: 3px;

  background: var(--border);
}

.timeline-item {
  position: relative;

  display: flex;

  gap: 25px;

  margin-bottom: 35px;
}

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

.timeline-icon {
  width: 48px;

  height: 48px;

  border-radius: 50%;

  display: flex;

  align-items: center;

  justify-content: center;

  color: #fff;

  z-index: 2;

  flex-shrink: 0;

  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
}

.timeline-content {
  flex: 1;

  background: #f8fafc;

  border-radius: 15px;

  padding: 20px;

  border-left: 5px solid var(--primary);
}

.timeline-date {
  font-size: 13px;

  color: #6b7280;

  margin-bottom: 8px;
}

.timeline-content h3 {
  font-size: 18px;

  margin-bottom: 10px;

  color: #111827;
}

.timeline-content p {
  color: #4b5563;

  line-height: 1.7;
}

@media (max-width: 768px) {
  .timeline {
    margin-left: 0;
  }

  .timeline::before {
    left: 18px;
  }

  .timeline-item {
    gap: 15px;
  }

  .timeline-icon {
    width: 40px;

    height: 40px;

    font-size: 14px;
  }

  .timeline-content {
    padding: 15px;
  }
}