/* ============ CCTV Indonesia — tema terang colorful ============ */
:root {
  --bg: #f7f9fc;
  --card: #ffffff;
  --ink: #1a2233;
  --muted: #6b7a90;
  --line: #e6ecf4;
  --grad-warm: linear-gradient(135deg, #ff5e62 0%, #ff9966 55%, #fbc02d 100%);
  --grad-cool: linear-gradient(135deg, #00bfa6 0%, #2962ff 100%);
  --grad-hero: linear-gradient(120deg, #ff5e62, #ff9966 30%, #fbc02d 50%, #00bfa6 75%, #2962ff 100%);
  --green: #00c853;
  --red: #ff1744;
  --radius: 16px;
  --shadow: 0 6px 24px rgba(26, 34, 51, 0.08);
  --shadow-hover: 0 14px 36px rgba(26, 34, 51, 0.14);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: #2962ff; text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1100px; margin: 0 auto; padding: 0 18px; }

/* ---------- header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1100;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
}
.header-nav {
  display: flex;
  gap: 1.5rem;
  margin-left: 2rem;
}
.header-nav a {
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  padding: 0.5rem 0;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}
.header-nav a:hover, .header-nav a.active {
  color: #2962ff;
  border-bottom-color: #2962ff;
}
.site-header img { width: 42px; height: 42px; }
.brand {
  font-weight: 800;
  font-size: 1.18rem;
  letter-spacing: -0.02em;
}
.brand .id {
  background: var(--grad-warm);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.header-spacer { flex: 1; }
.live-dot {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--green);
  background: rgba(0, 200, 83, 0.1);
  padding: 6px 13px;
  border-radius: 999px;
}
.live-dot::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 1.6s infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0, 200, 83, 0.5); }
  60% { box-shadow: 0 0 0 7px rgba(0, 200, 83, 0); }
}

/* ---------- hero ---------- */
.hero {
  position: relative;
  text-align: center;
  padding: 52px 18px 30px;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: -40% -20% auto;
  height: 130%;
  background:
    radial-gradient(40% 55% at 18% 30%, rgba(255, 94, 98, 0.12), transparent 70%),
    radial-gradient(38% 50% at 82% 25%, rgba(41, 98, 255, 0.10), transparent 70%),
    radial-gradient(45% 60% at 55% 80%, rgba(0, 191, 166, 0.10), transparent 70%);
  pointer-events: none;
}
.hero h1 {
  position: relative;
  font-size: clamp(1.7rem, 4.5vw, 2.7rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0 0 10px;
}
.hero h1 .grad {
  background: var(--grad-hero);
  background-size: 220% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 7s linear infinite;
}
@keyframes shimmer {
  to { background-position: 220% center; }
}
.hero p {
  position: relative;
  color: var(--muted);
  max-width: 620px;
  margin: 0 auto;
  font-size: 1.02rem;
}

/* ---------- statistik ---------- */
.stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  margin: 26px auto 8px;
  position: relative;
}
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 26px;
  min-width: 132px;
  transition: transform 0.25s, box-shadow 0.25s;
}
.stat:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.stat b {
  display: block;
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.stat span { color: var(--muted); font-size: 0.84rem; font-weight: 600; }
.stat.warm b { color: #ff5e62; }
.stat.cool b { color: #2962ff; }
.stat.teal b { color: #00bfa6; }
.stat.gold b { color: #f9a825; }

/* ---------- kartu umum & peta ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.section { margin: 26px auto 40px; }
.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.25rem;
  font-weight: 800;
  margin: 0 0 14px;
  letter-spacing: -0.02em;
}
.section-title::before {
  content: "";
  width: 7px;
  height: 26px;
  border-radius: 4px;
  background: var(--grad-warm);
}

#map { height: 520px; width: 100%; background: #eaf2fb; }
.leaflet-container { font: inherit; }

.map-hint {
  padding: 11px 16px;
  font-size: 0.88rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(255, 153, 102, 0.06), rgba(41, 98, 255, 0.06));
}

.prov-tip { font-weight: 700; }
.prov-tip small { display: block; font-weight: 500; color: #475569; }

/* legenda */
.legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  font-size: 0.82rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
}
.legend .sw {
  display: inline-block;
  width: 15px;
  height: 15px;
  border-radius: 4px;
  margin-right: 5px;
  vertical-align: -3px;
}

/* ---------- tabel cctv ---------- */
.table-wrap { overflow-x: auto; }
table.cctv {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
table.cctv th {
  text-align: left;
  padding: 12px 14px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  background: #f2f6fb;
  position: sticky;
  top: 0;
}
table.cctv td {
  padding: 11px 14px;
  border-top: 1px solid var(--line);
  vertical-align: middle;
}
table.cctv tbody tr {
  transition: background 0.18s;
  animation: fadeUp 0.5s both;
}
table.cctv tbody tr:hover { background: #f6f9ff; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 4px 11px;
  border-radius: 999px;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; }
.badge.aktif { color: #00833c; background: rgba(0, 200, 83, 0.12); }
.badge.aktif::before { background: var(--green); animation: pulse 1.6s infinite; }
.badge.mati { color: #c4001d; background: rgba(255, 23, 68, 0.1); }
.badge.mati::before { background: var(--red); }
.badge.unknown { color: #8a6d00; background: rgba(251, 192, 45, 0.16); }
.badge.unknown::before { background: #fbc02d; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-size: 0.83rem;
  font-weight: 700;
  color: #fff;
  background: var(--grad-cool);
  padding: 8px 16px;
  border-radius: 999px;
  transition: transform 0.18s, box-shadow 0.18s, opacity 0.18s;
  box-shadow: 0 4px 14px rgba(41, 98, 255, 0.25);
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(41, 98, 255, 0.35); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn.warm { background: var(--grad-warm); box-shadow: 0 4px 14px rgba(255, 94, 98, 0.3); }

/* filter & pencarian tabel */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.toolbar input, .toolbar select {
  font: inherit;
  font-size: 0.9rem;
  padding: 9px 14px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: #fbfdff;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.toolbar input:focus, .toolbar select:focus {
  border-color: #2962ff;
  box-shadow: 0 0 0 3px rgba(41, 98, 255, 0.12);
}
.toolbar input { flex: 1; min-width: 170px; }
.toolbar .count { font-size: 0.84rem; color: var(--muted); font-weight: 600; }

/* breadcrumb halaman provinsi */
.crumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  margin: 20px 0 12px;
  color: var(--muted);
}
.crumbs a { font-weight: 700; }

/* ---------- modal player ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(15, 22, 36, 0.72);
  backdrop-filter: blur(4px);
  padding: 18px;
}
.modal-backdrop.open { display: flex; animation: fadeIn 0.22s; }
@keyframes fadeIn { from { opacity: 0; } }
.modal {
  width: min(860px, 100%);
  background: #0e1420;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  animation: popIn 0.26s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
@keyframes popIn { from { opacity: 0; transform: scale(0.94) translateY(12px); } }
.modal-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 18px;
  color: #fff;
}
.modal-head h3 { margin: 0; font-size: 1rem; flex: 1; }
.modal-head .sub { color: #94a3b8; font-size: 0.8rem; }
.modal-close {
  border: 0;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 1.05rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}
.modal-close:hover { background: rgba(255, 255, 255, 0.22); transform: rotate(90deg); }
.modal video, .modal img.mjpeg {
  display: block;
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: contain;
  background: #000;
}
.modal-foot {
  padding: 11px 18px;
  font-size: 0.8rem;
  color: #94a3b8;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
}
.modal-foot a { color: #7da2ff; }
.player-msg {
  color: #fbc02d;
  text-align: center;
  padding: 14px;
  font-size: 0.88rem;
  display: none;
}

/* ---------- footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  background: #fff;
  margin-top: 30px;
}
.site-footer .inner {
  padding: 26px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  font-size: 0.86rem;
  color: var(--muted);
}
.site-footer .inner .f-brand { display: flex; align-items: center; gap: 9px; font-weight: 800; color: var(--ink); }
.site-footer img { width: 30px; height: 30px; }

/* animasi reveal saat scroll */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.6s, transform 0.6s; }
.reveal.show { opacity: 1; transform: none; }

/* ---------- responsif ---------- */
@media (max-width: 720px) {
  #map { height: 380px; }
  .hero { padding-top: 34px; }
  .stat { padding: 11px 18px; min-width: 104px; }
  .stat b { font-size: 1.3rem; }

  /* tabel jadi kartu */
  table.cctv thead { display: none; }
  table.cctv tbody tr {
    display: block;
    border-top: 1px solid var(--line);
    padding: 12px 14px;
  }
  table.cctv td {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    border: 0;
    padding: 3px 0;
    font-size: 0.88rem;
  }
  table.cctv td::before {
    content: attr(data-label);
    font-weight: 700;
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
  }
  table.cctv td.aksi { justify-content: flex-end; }
  table.cctv td.aksi::before { content: none; }
}
