/* ==== FONT & BASE ==== */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap");

body {
  font-family: "Inter", sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  padding: 0;
  transition:
    background 0.3s ease,
    color 0.3s ease;
}

/* ==== THEME VARIABLES ==== */
:root {
  --bg: #f5f1ed;
  --card-bg: #ffffff;
  --text: #333333;
  --muted: #7d7d7d;
  --accent: #2a9d8f;
  --accent-dark: #21867e;
  --shadow-light: rgba(0, 0, 0, 0.1);
  --shadow-dark: rgba(0, 0, 0, 0.4);
}

body.theme-dark {
  --bg: #1c1a17;
  --card-bg: #2c2a25;
  --text: #f0f0f0;
  --muted: #bbbbbb;
  --accent: #66c7b9;
  --accent-dark: #4fb1a5;
  --shadow-light: rgba(0, 0, 0, 0.5);
  --shadow-dark: rgba(0, 0, 0, 0.7);
}

/* ==== HEADER ==== */
.site-header {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 16px var(--shadow-light);
  /* position: sticky; */
  top: 0;
  z-index: 100;
  /* border-radius: 0 0 16px 16px; */
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all 0.3s ease-in-out;
}

.site-header::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #4caf50, #2196f3);
  border-radius: 0 0 4px 4px;
  z-index: 1;
}

/* ==== HEADER CONTAINER ==== */
.site-header .container-fluid {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

/* ==== HEADER TITLE ==== */
.site-header h4 {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  letter-spacing: -0.3px;
  transition: color 0.3s ease;
}

#pbbtext {
  font-size: 0.92rem;
  color: var(--accent);
  font-weight: 600;
  margin-top: 2px;
}

/* ==== THEME TOGGLE ==== */
#themeToggle {
  cursor: pointer;
  transition: all 0.3s ease;
}

#themeToggle:checked {
  accent-color: var(--accent);
}

/* ==== REFRESH INFO ==== */
#lastRefresh,
#countdown {
  font-size: 0.75rem;
  color: var(--muted);
  font-style: italic;
  margin-top: 4px;
}

#refreshStatus {
  font-size: 0.75rem;
  font-weight: 600;
}

/* ==== TAB CONTAINER ==== */
#mainTabs {
  justify-content: center;
  padding: 10px 15px;
}

/* ==== TAB BUTTON ==== */
#mainTabs .nav-link {
  color: #555;
  font-weight: 500;
  border-radius: 30px;
  padding: 8px 20px;
  margin: 0 6px;
  background: transparent;
  transition:
    background-color 0.3s ease,
    color 0.3s ease,
    border-color 0.3s ease;
  border: 1px solid transparent;
}

/* Hover effect for tabs */
#mainTabs .nav-link:hover {
  background-color: #e0f7f4;
  color: #2a9d8f;
  border-color: #9de0d6;
}

/* Active tab */
#mainTabs .nav-link.active {
  background-color: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 4px 10px rgba(25, 118, 210, 0.2);
}

/* ==== RESPONSIVE IMPROVEMENTS ==== */
@media (max-width: 576px) {
  #mainTabs {
    flex-wrap: wrap;
  }

  #mainTabs .nav-link {
    margin: 4px 4px;
    flex: 1 1 auto;
    text-align: center;
  }
}

/* ==== CARD BASE ==== */
.card {
  background: linear-gradient(135deg, #ffffff, #f0f4f8);
  border-radius: 20px;
  border: 1px solid rgba(0, 0, 0, 0.05);
  box-shadow: 0 8px 24px var(--shadow-light);
  backdrop-filter: blur(20px) saturate(180%);
  transition: all 0.35s ease;
  padding: 20px;
  animation: fadeUp 0.6s ease;
  color: #1f2937;
}

/* .card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 12px 36px rgba(139, 92, 246, 0.25), 0 0 12px rgba(99, 179, 237, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.3);
} */

.card-title {
  font-weight: 700;
  font-size: 1.2rem;
  margin-bottom: 0.75rem;
  color: #111827;
  letter-spacing: -0.3px;
}

/* ==== CARD DARK MODE ==== */
body.theme-dark .card {
  background: linear-gradient(135deg, #1e1e1e, #2a2a2a);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #f3f4f6;
  box-shadow: 0 6px 20px var(--shadow-dark);
}

/* body.theme-dark .card:hover {
    box-shadow: 0 12px 36px rgba(168, 85, 247, 0.35), 0 0 14px rgba(59, 130, 246, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.15);
} */

body.theme-dark .card-title,
body.theme-dark .nav-link,
body.theme-dark #pbbtext {
  color: #f9fafb;
}

/* ==== SMALL MUTED TEXT ==== */

.text-muted {
  color: var(--muted) !important;
}

.small-muted {
  font-size: 0.8rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0.8;
  transition:
    opacity 0.25s ease,
    color 0.25s ease;
}

.small-muted:hover {
  opacity: 1;
  color: var(--accent);
}

/* ==== DATE INPUT GROUP ==== */
.input-group-sm {
  max-width: 260px;
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 14px var(--shadow-light);
  backdrop-filter: blur(8px);
  transition: all 0.3s ease;
}

body.theme-dark .input-group-sm {
  background: rgba(31, 41, 55, 0.7);
  box-shadow: 0 4px 18px var(--shadow-dark);
}

.input-group-text {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.45rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s ease;
}

.input-group-text:hover {
  background: var(--accent-dark);
}

.form-control-sm {
  border: none;
  font-size: 0.85rem;
  padding: 0.45rem 0.75rem;
  background: transparent;
  color: inherit;
  flex: 1;
  transition: all 0.3s ease;
}

.form-control-sm:focus {
  outline: none;
  box-shadow: none;
  background: rgba(255, 255, 255, 0.3);
}

body.theme-dark .form-control-sm:focus {
  background: rgba(255, 255, 255, 0.05);
}

/* ==== Theme toggle switch ==== */
.form-check-input {
  width: 42px;
  height: 22px;
  border-radius: 20px;
  border: none;
  background-color: #ccc;
  transition: all 0.3s ease;
  cursor: pointer;
}

.form-check-input:checked {
  background-color: var(--accent);
  box-shadow: 0 0 6px rgba(13, 110, 253, 0.4);
}

/* ==== ANIMATION ==== */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(15px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==== Input box ==== */
#pbbRange {
  border-radius: 10px;
  border: 1px solid #ddd;
  padding: 6px 12px;
  font-size: 14px;
  min-width: 230px;
  transition: all 0.25s ease;
  background: #fff;
}

#pbbRange:focus {
  border-color: #4dabf7;
  box-shadow: 0 0 0 3px rgba(77, 171, 247, 0.25);
  outline: none;
}

/* ==== Calendar popup ==== */
.flatpickr-calendar {
  border-radius: 14px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.15);
  border: none;
  font-family: "Inter", sans-serif;
  overflow: hidden;
}

/* ==== Header bulan ==== */
.flatpickr-months {
  background: linear-gradient(135deg, #2a9d8f, #f4a261);
  border-radius: 12px 12px 0 0;
  color: #fff;
}

.flatpickr-current-month .cur-month {
  font-weight: 600;
  font-size: 15px;
}

/* ==== Hari yang dipilih ==== */
.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange {
  background: linear-gradient(135deg, #4caf50, #2196f3) !important;
  color: #fff !important;
  border-radius: 8px !important;
  font-weight: 600;
}

/* ==== Range highlight ==== */
.flatpickr-day.inRange {
  background: rgba(77, 171, 247, 0.15) !important;
  border-radius: 0 !important;
}

/* ==== Hover efek ==== */
.flatpickr-day:hover {
  background: rgba(77, 171, 247, 0.25) !important;
  color: #000;
  border-radius: 6px;
}

.spin {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.dashboard-card {
  border-radius: 12px;
  transition: 0.2s ease-in-out;
}

.dashboard-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.icon-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.progress {
  height: 6px;
  border-radius: 10px;
}

#loadingOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  perspective: 600px;
  /* memberi efek kedalaman */
}

#loadingLogo {
  width: 120px;
  height: auto;
  animation: spinBack 2s linear infinite;
  transform-style: preserve-3d;
}

@keyframes spinBack {
  0% {
    transform: rotateY(0deg);
  }

  100% {
    transform: rotateY(360deg);
  }

  /* berputar ke arah belakang */
}
/* Efek animasi angka bertambah */
.counter-animate {
  animation: counterFlash 0.6s ease-out;
}

@keyframes counterFlash {
  0% {
    color: #000;
    transform: scale(1);
  }
  30% {
    color: #28a745;
    transform: scale(1.12);
  }
  100% {
    color: inherit;
    transform: scale(1);
  }
}

/* Efek highlight card ketika nilai diperbarui */
.card-updated {
  animation: pulseGlow 1s ease-out;
}

@keyframes pulseGlow {
  0% {
    box-shadow: 0 0 0 rgba(255, 193, 7, 0);
  }
  50% {
    box-shadow: 0 0 18px rgba(255, 193, 7, 0.7);
  }
  100% {
    box-shadow: 0 0 0 rgba(255, 193, 7, 0);
  }
}

/* Chart entrance animation wrapper */
.pbb-chart-wrap {
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 420ms ease,
    transform 420ms cubic-bezier(0.2, 0.9, 0.2, 1);
}

/* when visible: show */
.pbb-chart-wrap.visible {
  opacity: 1;
  transform: translateY(0);
}

.card.updated {
  box-shadow:
    0 8px 30px rgba(72, 166, 255, 0.18),
    0 6px 18px rgba(0, 0, 0, 0.06);
  transition:
    box-shadow 450ms cubic-bezier(0.2, 0.9, 0.2, 1),
    transform 350ms cubic-bezier(0.2, 0.9, 0.2, 1);
}

.number-pop {
  display: inline-block;
  transform-origin: center;
  transition: transform 360ms cubic-bezier(0.2, 0.9, 0.2, 1);
}

.lbl_nilai {
  text-align: right;
}

.card-info-payment {
  padding: 10px !important;
  height: 115px;
  display: flex;
  align-items: center;
}

.card-info-payment .card-body {
  width: 100%;
  height: 100%;
  padding: 5px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.card-info-payment img {
  object-fit: contain;
}

.card-info-payment .card-body > div:first-child {
  min-height: 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dashboard-card {
  border-radius: 12px;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
  cursor: pointer;
}

.dashboard-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.card-info-payment {
  background-color: #f8f9fa;
  /* warna lembut */
}

.card-body label {
  font-weight: 600;
  font-size: 0.9rem;
  color: #555;
}

.lbl_nilai {
  font-weight: bold;
  font-size: 0.9rem;
  color: #007bff;
  margin-top: 4px;
}

.lbl_nilai[data-field="count"] {
  font-size: 0.8rem;
  color: #28a745;
}

.custom-label {
  display: inline-block;
  font-weight: 600;
  font-size: 14px;
  color: #1a73e8;
  background-color: #e8f0fe;
  padding: 5px 10px;
  border-radius: 5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

#topMenu .menu-link {
  padding: 6px 16px;
  border-radius: 20px;
  text-decoration: none;
  font-weight: 500;
  color: #555;
  transition: all 0.2s ease;
  white-space: nowrap;
}

#topMenu .menu-link:hover {
  background: #e9f2ff;
  color: #0d6efd;
}

#topMenu .menu-link.active {
  background: #0d6efd;
  color: #fff;
}

.bphtb-chart-card {
  height: 320px;
  display: flex;
  flex-direction: column;
}
.bphtb-chart-card canvas {
  flex: 1;
  max-height: 240px;
}
.bphtb-tabs .nav-link {
  border-radius: 999px;
  padding: 0.6rem 1.4rem;
  font-weight: 500;
  color: #6c757d;
  background: #f1f3f5;
  transition: all 0.25s ease;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.03);
}

.bphtb-tabs .nav-link:hover {
  background: #e9f2ff;
  color: #0d6efd;
  transform: translateY(-1px);
}

.bphtb-tabs .nav-link.active {
  background: linear-gradient(135deg, #0d6efd, #2b8cff);
  color: #fff;
  box-shadow: 0 6px 14px rgba(13, 110, 253, 0.35);
}

.bphtb-tabs .nav-link i {
  font-size: 1rem;
  opacity: 0.85;
}

.dashboard-card {
  padding: 14px 16px !important;
}

.dashboard-card .h4 {
  font-size: 1.45rem;
  letter-spacing: -0.4px;
}

.dashboard-card .badge {
  font-size: 0.65rem;
  padding: 0.25em 0.6em;
  border-radius: 999px;
  opacity: 0.85;
}

.dashboard-card .small {
  font-size: 0.75rem;
}

@media (max-width: 576px) {
  .dashboard-card .h4 {
    font-size: 1.25rem;
  }
}

.mbr-valid-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 6px;
}

.mbr-valid-item {
  background: #f1f5f9;
  border-radius: 10px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.mbr-valid-item .label {
  font-size: 0.75rem;
  color: #6c757d;
  text-align: center;
}

.mbr-valid-item .value {
  font-size: 1.1rem;
  font-weight: 700;
  color: #0d6efd;
}

/* ===============================
   OPSEN DASHBOARD STYLE
================================ */

/* HEADER */
.opsen-header {
  background: linear-gradient(135deg, #1e88e5, #1565c0);
  color: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 30px rgba(30, 136, 229, 0.35);
}

/* CARD UMUM */
.dashboard-card,
.trend-card {
  border: none;
  border-radius: 18px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.08);
}
/* KPI ICON */
.kpi-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}

.kpi-success {
  background: rgba(46, 204, 113, 0.15);
  color: #2ecc71;
}

/* TREND CARD */
.trend-card {
  border-radius: 16px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.08);
}
