/* =========================================================
   MATANYA BATAM v2 — SMART CCTV COMMAND CENTER DESIGN SYSTEM
   ========================================================= */

:root {
  --bg: #050b14;
  --bg-elev: #0a1424;
  --bg-card: rgba(12, 23, 40, 0.78);
  --bg-glass: rgba(9, 18, 34, 0.72);
  --border: rgba(148, 163, 184, 0.14);
  --border-strong: rgba(16, 185, 129, 0.35);
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --text-soft: #64748b;

  --accent: #10b981;
  --accent-2: #06b6d4;
  --accent-glow: rgba(16, 185, 129, 0.32);
  --danger: #ef4444;
  --warning: #f59e0b;

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --shadow-card: 0 12px 36px rgba(0, 0, 0, 0.35);
  --shadow-glow: 0 0 0 1px rgba(16, 185, 129, 0.25), 0 18px 44px -10px rgba(6, 182, 212, 0.24);

  --font-display: "Space Grotesk", system-ui, -apple-system, sans-serif;
  --font-sans: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  --ease-spring: cubic-bezier(0.22, 1, 0.36, 1);
  --mx: 50%;
  --my: 20%;
}

[data-theme="light"] {
  --bg: #f1f5f9;
  --bg-elev: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.88);
  --bg-glass: rgba(255, 255, 255, 0.82);
  --border: rgba(15, 23, 42, 0.1);
  --border-strong: rgba(5, 150, 105, 0.42);
  --text: #0f172a;
  --text-muted: #475569;
  --text-soft: #64748b;
  --accent: #059669;
  --accent-2: #0284c7;
  --accent-glow: rgba(5, 150, 105, 0.18);
  --shadow-card: 0 10px 30px rgba(15, 23, 42, 0.08);
  --shadow-glow: 0 0 0 1px rgba(5, 150, 105, 0.3), 0 16px 36px -10px rgba(2, 132, 199, 0.18);
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  color-scheme: dark;
}

[data-theme="light"] {
  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.5;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.mono { font-family: var(--font-mono); }
.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.container {
  width: min(1320px, calc(100% - 2rem));
  margin-inline: auto;
}

/* Ambient Grid & Cursor Spotlight */
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background-image:
    radial-gradient(rgba(148, 163, 184, 0.13) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(ellipse 85% 65% at 50% 20%, black 40%, transparent 100%);
}

.bg-spotlight {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(
    650px circle at var(--mx) var(--my),
    rgba(16, 185, 129, 0.11),
    rgba(6, 182, 212, 0.05) 38%,
    transparent 70%
  );
  transition: opacity 0.4s ease;
}

[data-theme="light"] .bg-spotlight {
  background: radial-gradient(
    650px circle at var(--mx) var(--my),
    rgba(5, 150, 105, 0.08),
    rgba(2, 132, 199, 0.04) 40%,
    transparent 70%
  );
}

/* ================= TOPBAR ================= */
.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  background: var(--bg-glass);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border-bottom: 1px solid var(--border);
  transition: box-shadow 0.25s ease, background-color 0.3s ease;
}

.topbar.scrolled {
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 70px;
  padding-block: 0.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
}

.brand-logo-wrap {
  position: relative;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(6, 182, 212, 0.12));
  border: 1px solid var(--border-strong);
}

.brand-logo {
  width: 26px;
  height: 26px;
  object-fit: contain;
  position: relative;
  z-index: 1;
}

.brand-ring {
  position: absolute;
  inset: -3px;
  border-radius: 14px;
  border: 1px solid rgba(16, 185, 129, 0.45);
  animation: pulseRing 3s ease-out infinite;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  font-weight: 500;
}

.brand-title strong {
  font-weight: 700;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand-sub {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  margin-top: 2px;
}

/* View Switcher */
.view-switcher {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 4px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid var(--border);
}

[data-theme="light"] .view-switcher {
  background: rgba(226, 232, 240, 0.7);
}

.view-indicator {
  position: absolute;
  top: 4px;
  left: 4px;
  height: calc(100% - 8px);
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 4px 16px var(--accent-glow);
  transition: transform 0.35s var(--ease-spring), width 0.35s var(--ease-spring);
  z-index: 0;
}

.view-tab {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.48rem 0.95rem;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.25s ease;
  white-space: nowrap;
}

.view-tab svg {
  width: 15px;
  height: 15px;
}

.view-tab.active {
  color: #ffffff;
}

.tab-badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  color: inherit;
}

/* Topbar Actions */
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.telemetry-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.42rem 0.78rem;
  border-radius: 999px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text);
  white-space: nowrap;
}

.weather-desc {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
  animation: blinkLive 1.8s ease-in-out infinite;
}

.icon-btn {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.2s var(--ease-spring), border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
  color: var(--accent);
}

[data-theme="dark"] .icon-moon { display: none; }
[data-theme="light"] .icon-sun { display: none; }

/* ================= HERO ================= */
.hero {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  padding: clamp(2.8rem, 6vw, 4.8rem) 0 clamp(2.4rem, 5vw, 3.6rem);
}

.hero-media {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.hero-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.34;
  transform: scale(1.04);
  filter: saturate(1.15) contrast(1.05);
}

[data-theme="light"] .hero-video {
  opacity: 0.16;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 75% 30%, rgba(6, 182, 212, 0.22), transparent 50%),
    radial-gradient(circle at 20% 80%, rgba(16, 185, 129, 0.18), transparent 45%),
    linear-gradient(180deg, rgba(5, 11, 20, 0.52) 0%, rgba(5, 11, 20, 0.88) 72%, var(--bg) 100%);
}

[data-theme="light"] .hero-overlay {
  background:
    radial-gradient(circle at 75% 30%, rgba(2, 132, 199, 0.14), transparent 50%),
    radial-gradient(circle at 20% 80%, rgba(5, 150, 105, 0.12), transparent 45%),
    linear-gradient(180deg, rgba(241, 245, 249, 0.65) 0%, rgba(241, 245, 249, 0.92) 78%, var(--bg) 100%);
}

.hero-scanline {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 3px,
    rgba(255, 255, 255, 0.018) 3px,
    rgba(255, 255, 255, 0.018) 4px
  );
  pointer-events: none;
}

/* Animated Radar Ornament */
.hero-radar {
  position: absolute;
  right: max(-60px, 4vw);
  top: 50%;
  width: 420px;
  height: 420px;
  transform: translateY(-50%);
  opacity: 0.36;
  pointer-events: none;
}

.radar-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(16, 185, 129, 0.28);
}

.radar-ring.r2 { inset: 18%; border-style: dashed; }
.radar-ring.r3 { inset: 38%; }

.radar-sweep {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(16, 185, 129, 0.36) 0deg, rgba(6, 182, 212, 0.08) 55deg, transparent 70deg);
  animation: spinRadar 7s linear infinite;
}

.hero-content {
  position: relative;
  z-index: 2;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.73rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  margin-bottom: 1.15rem;
}

.pulse-beacon {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  position: relative;
  flex-shrink: 0;
}

.pulse-beacon::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  animation: beaconPing 1.8s cubic-bezier(0, 0, 0.2, 1) infinite;
}

.hero-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.6vw, 3.6rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.025em;
  max-width: 17ch;
}

.gradient-text {
  background: linear-gradient(120deg, #34d399 0%, #22d3ee 50%, #38bdf8 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: gradientFlow 6s ease infinite;
}

[data-theme="light"] .gradient-text {
  background: linear-gradient(120deg, #059669 0%, #0284c7 55%, #0ea5e9 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

.hero-desc {
  margin: 1rem 0 0;
  max-width: 62ch;
  font-size: clamp(0.95rem, 1.3vw, 1.08rem);
  color: var(--text-muted);
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.6rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.75rem 1.25rem;
  border-radius: 13px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.22s var(--ease-spring), box-shadow 0.22s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.btn svg { width: 17px; height: 17px; }
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #ffffff;
  box-shadow: 0 10px 26px -6px var(--accent-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 32px -4px var(--accent-glow);
}

.btn-glass {
  background: var(--bg-card);
  border-color: var(--border-strong);
  color: var(--text);
  backdrop-filter: blur(12px);
}

.btn-glass:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 10px 26px rgba(16, 185, 129, 0.16);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-muted);
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--bg-card);
}

/* Hero Stats */
.hero-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.9rem;
  margin-top: 2rem;
}

.stat-card {
  padding: 1rem 1.15rem;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  backdrop-filter: blur(14px);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  transition: transform 0.25s var(--ease-spring), border-color 0.25s ease;
}

.stat-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-strong);
}

.stat-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  color: var(--text-soft);
}

.stat-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
}

.stat-value.status-online {
  color: var(--accent);
}

.stat-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ================= CONTROL DOCK ================= */
.control-dock {
  position: sticky;
  top: 70px;
  z-index: 45;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 0.9rem 0;
}

.control-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  flex: 1 1 320px;
  max-width: 520px;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  color: var(--text-soft);
  pointer-events: none;
}

.search-input {
  width: 100%;
  height: 42px;
  padding: 0 3.2rem 0 2.65rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-kbd {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  pointer-events: none;
}

.search-clear {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 50%;
  background: rgba(148, 163, 184, 0.2);
  color: var(--text);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.control-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.chip-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  height: 40px;
  padding: 0 0.85rem;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chip-toggle svg { width: 15px; height: 15px; }

.chip-toggle:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.chip-toggle[aria-pressed="true"] {
  background: rgba(16, 185, 129, 0.14);
  border-color: var(--accent);
  color: var(--accent);
}

.chip-toggle.spinning .spin-target {
  animation: spinSimple 0.85s linear infinite;
}

.chip-count {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.16);
}

.status-dot-sm {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.area-pills {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.75rem;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}

.area-pills::-webkit-scrollbar { display: none; }

.area-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.42rem 0.88rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.22s var(--ease-spring);
}

.area-pill:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.area-pill.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: #ffffff;
  box-shadow: 0 6px 18px -4px var(--accent-glow);
}

.area-pill .pill-num {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  opacity: 0.82;
}

/* ================= WORKSPACE & GRID ================= */
.workspace-section {
  padding: 1.8rem 0 3.5rem;
  animation: fadeSlideIn 0.35s var(--ease-spring);
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.35rem;
  flex-wrap: wrap;
}

.section-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 700;
}

.section-sub {
  margin: 0.2rem 0 0;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.sort-select {
  height: 38px;
  padding: 0 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.84rem;
  cursor: pointer;
}

.camera-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(305px, 1fr));
  gap: 1.15rem;
}

/* Camera Card */
.cam-card {
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition:
    transform 0.32s var(--ease-spring),
    border-color 0.28s ease,
    box-shadow 0.32s ease;
  opacity: 0;
  transform: translateY(18px) scale(0.985);
}

.cam-card.in-view {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.cam-card:hover {
  transform: translateY(-6px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-glow);
}

.cam-thumb-wrap {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #07101f;
  cursor: pointer;
}

.cam-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.6s var(--ease-spring), filter 0.35s ease;
}

.cam-card:hover .cam-thumb {
  transform: scale(1.07);
  filter: brightness(1.06);
}

.cam-thumb-grad {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(5, 11, 20, 0.45) 0%, transparent 40%, rgba(5, 11, 20, 0.78) 100%);
  pointer-events: none;
}

.cam-top-bar {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  z-index: 2;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  padding: 0.24rem 0.6rem;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  backdrop-filter: blur(8px);
  background: rgba(5, 11, 20, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #e2e8f0;
}

.status-badge.online {
  border-color: rgba(16, 185, 129, 0.5);
  color: #6ee7b7;
}

.status-badge.online .dot {
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}

.status-badge.offline {
  border-color: rgba(239, 68, 68, 0.45);
  color: #fca5a5;
}

.status-badge.offline .dot {
  background: #ef4444;
}

.status-badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #f59e0b;
}

.cam-code {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  padding: 0.22rem 0.5rem;
  border-radius: 7px;
  background: rgba(5, 11, 20, 0.68);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
}

/* Play Hover Overlay */
.cam-play-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(5, 11, 20, 0.28);
  opacity: 0;
  transition: opacity 0.28s ease;
  z-index: 2;
}

.cam-card:hover .cam-play-overlay,
.cam-thumb-wrap:focus-visible .cam-play-overlay {
  opacity: 1;
}

.play-circle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #ffffff;
  box-shadow: 0 0 0 8px rgba(16, 185, 129, 0.22), 0 12px 24px rgba(0, 0, 0, 0.4);
  transform: scale(0.84);
  transition: transform 0.3s var(--ease-spring);
}

.cam-card:hover .play-circle {
  transform: scale(1);
}

.play-circle svg {
  width: 22px;
  height: 22px;
  margin-left: 2px;
}

/* HUD Reticle Corners on Hover */
.cam-corner {
  position: absolute;
  width: 14px;
  height: 14px;
  border-color: var(--accent);
  border-style: solid;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
  z-index: 3;
}
.cam-corner.tl { top: 8px; left: 8px; border-width: 2px 0 0 2px; transform: translate(-4px, -4px); }
.cam-corner.br { bottom: 8px; right: 8px; border-width: 0 2px 2px 0; transform: translate(4px, 4px); }
.cam-card:hover .cam-corner { opacity: 0.9; transform: translate(0, 0); }

.cam-body {
  padding: 0.95rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  flex: 1;
}

.cam-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.cam-area-tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.cam-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.mini-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  height: 28px;
  padding: 0 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mini-btn svg { width: 13px; height: 13px; }
.mini-btn:hover { border-color: var(--border-strong); color: var(--text); }
.mini-btn.active {
  background: rgba(16, 185, 129, 0.16);
  border-color: var(--accent);
  color: var(--accent);
}
.mini-btn.fav-active {
  background: rgba(245, 158, 11, 0.16);
  border-color: rgba(245, 158, 11, 0.55);
  color: #f59e0b;
}

.cam-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.25;
  cursor: pointer;
}

.cam-title:hover { color: var(--accent); }

.cam-landmark {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 4rem 1.5rem;
  border-radius: var(--radius-lg);
  border: 1px dashed var(--border);
  background: var(--bg-card);
}
.empty-icon { font-size: 2.4rem; margin-bottom: 0.6rem; }
.empty-state h3 { margin: 0 0 0.4rem; font-family: var(--font-display); }
.empty-state p { margin: 0 0 1.2rem; color: var(--text-muted); }

/* ================= MAP VIEW ================= */
.map-shell {
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
}

.map-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.map-toolbar-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.9rem;
}

.map-counter {
  font-size: 0.76rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.14);
  color: var(--accent);
}

.map-quick-jump {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.jump-btn {
  padding: 0.35rem 0.72rem;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.jump-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.batam-map {
  height: clamp(460px, 68vh, 720px);
  width: 100%;
  background: #081221;
}

/* Custom Leaflet Marker */
.cctv-marker {
  position: relative;
  width: 24px;
  height: 24px;
}

.cctv-marker-core {
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: #10b981;
  border: 2px solid #ffffff;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.9);
}

.cctv-marker-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(16, 185, 129, 0.75);
  animation: beaconPing 2.2s ease-out infinite;
}

.cctv-marker.offline .cctv-marker-core { background: #ef4444; box-shadow: 0 0 10px rgba(239, 68, 68, 0.8); }
.cctv-marker.offline .cctv-marker-ring { border-color: rgba(239, 68, 68, 0.5); }

.leaflet-popup-content-wrapper {
  background: #0b1628 !important;
  color: #f1f5f9 !important;
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: 14px !important;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.5) !important;
}

.leaflet-popup-tip { background: #0b1628 !important; }

.map-popup {
  width: 230px;
}

.map-popup img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 9px;
  margin-bottom: 0.5rem;
}

.map-popup h4 {
  margin: 0 0 0.2rem;
  font-family: var(--font-display);
  font-size: 0.96rem;
}

.map-popup p {
  margin: 0 0 0.65rem;
  font-size: 0.78rem;
  color: #94a3b8;
}

.map-popup-actions {
  display: flex;
  gap: 0.4rem;
}

.map-popup-btn {
  flex: 1;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  border: 1px solid rgba(16, 185, 129, 0.45);
  background: linear-gradient(135deg, #10b981, #06b6d4);
  color: #ffffff;
  font-weight: 600;
  font-size: 0.78rem;
  cursor: pointer;
}

.map-popup-btn.secondary {
  background: rgba(148, 163, 184, 0.14);
  border-color: rgba(148, 163, 184, 0.25);
}

/* ================= MULTI-VIEW WALL ================= */
.multiview-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.preset-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.preset-btn {
  padding: 0.45rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.preset-btn:hover,
.preset-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(16, 185, 129, 0.12);
}

.multiview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.mv-tile {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #030712;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
}

.mv-stage {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #020617;
}

.mv-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.mv-hud {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  pointer-events: none;
}

.mv-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.65rem 0.85rem;
  background: var(--bg-elev);
  border-top: 1px solid var(--border);
}

.mv-select {
  flex: 1;
  min-width: 0;
  height: 34px;
  padding: 0 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.82rem;
}

.mv-btn {
  height: 34px;
  padding: 0 0.7rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.mv-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ================= MODAL PLAYER ================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(2, 6, 15, 0.82);
  backdrop-filter: blur(12px);
  animation: fadeIn 0.22s ease;
}

.modal-shell {
  width: min(1040px, 100%);
  max-height: 94vh;
  overflow-y: auto;
  border-radius: var(--radius-lg);
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.65);
  animation: modalPop 0.32s var(--ease-spring);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.modal-title-group {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  min-width: 0;
}

.modal-code {
  padding: 0.3rem 0.6rem;
  border-radius: 8px;
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
  flex-shrink: 0;
}

.modal-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.2rem;
  line-height: 1.2;
}

.modal-subtitle {
  margin: 0.15rem 0 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.modal-head-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.player-stage {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #020617;
  overflow: hidden;
}

.player-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #000;
}

.player-hud-top {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  pointer-events: none;
  z-index: 4;
}

.hud-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.32rem 0.75rem;
  border-radius: 999px;
  background: rgba(2, 6, 23, 0.72);
  border: 1px solid rgba(16, 185, 129, 0.45);
  color: #ecfdf5;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  backdrop-filter: blur(8px);
}

.hud-badge.error {
  border-color: rgba(239, 68, 68, 0.6);
  color: #fecaca;
}

.hud-telemetry {
  padding: 0.3rem 0.7rem;
  border-radius: 8px;
  background: rgba(2, 6, 23, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  font-size: 0.72rem;
  backdrop-filter: blur(8px);
}

.player-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  background: rgba(2, 6, 23, 0.72);
  color: #f8fafc;
  z-index: 3;
  transition: opacity 0.25s ease;
}

.spinner {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 3px solid rgba(16, 185, 129, 0.22);
  border-top-color: var(--accent);
  animation: spinSimple 0.8s linear infinite;
}

.overlay-msg {
  margin: 0;
  font-size: 0.9rem;
  color: #cbd5e1;
  text-align: center;
  padding-inline: 1rem;
}

.reticle {
  position: absolute;
  width: 22px;
  height: 22px;
  border-color: rgba(16, 185, 129, 0.55);
  border-style: solid;
  pointer-events: none;
  z-index: 2;
}
.reticle.tl { top: 10px; left: 10px; border-width: 2px 0 0 2px; }
.reticle.tr { top: 10px; right: 10px; border-width: 2px 2px 0 0; }
.reticle.bl { bottom: 10px; left: 10px; border-width: 0 0 2px 2px; }
.reticle.br { bottom: 10px; right: 10px; border-width: 0 2px 2px 0; }

.modal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  flex-wrap: wrap;
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--border);
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  height: 36px;
  padding: 0 0.8rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tool-btn svg { width: 15px; height: 15px; }
.tool-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  flex-wrap: wrap;
  padding: 0.75rem 1.25rem 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.modal-nearby {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.nearby-chip {
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nearby-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ================= TOASTS & FOOTER ================= */
.toast-stack {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 150;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  padding: 0.72rem 1rem;
  border-radius: 12px;
  background: #0b1628;
  color: #f8fafc;
  border: 1px solid rgba(16, 185, 129, 0.45);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
  font-size: 0.84rem;
  font-weight: 500;
  animation: toastIn 0.3s var(--ease-spring);
}

.toast.fade-out {
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.25s ease;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.8rem 0;
  background: var(--bg-elev);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.footer-logo {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.footer-left p {
  margin: 0.15rem 0 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.footer-left a {
  color: var(--accent);
  text-decoration: none;
}

.footer-right {
  font-size: 0.76rem;
  color: var(--text-soft);
}

.footer-right kbd {
  padding: 2px 6px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
}

/* ================= ANIMATIONS ================= */
.reveal-up {
  opacity: 0;
  transform: translateY(16px);
  animation: revealUp 0.65s var(--ease-spring) forwards;
  animation-delay: var(--delay, 0ms);
}

@keyframes revealUp {
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.95) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(14px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes spinRadar {
  to { transform: rotate(360deg); }
}

@keyframes spinSimple {
  to { transform: rotate(360deg); }
}

@keyframes pulseRing {
  0% { transform: scale(1); opacity: 0.65; }
  100% { transform: scale(1.26); opacity: 0; }
}

@keyframes beaconPing {
  0% { transform: scale(0.8); opacity: 0.9; }
  100% { transform: scale(2.1); opacity: 0; }
}

@keyframes blinkLive {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

@keyframes gradientFlow {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* ================= RESPONSIVE ================= */
@media (max-width: 1024px) {
  .hero-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .weather-desc { display: none; }
}

@media (max-width: 780px) {
  .topbar-inner { flex-wrap: wrap; gap: 0.65rem; }
  .view-switcher { order: 3; width: 100%; justify-content: space-between; }
  .view-tab { flex: 1; justify-content: center; padding: 0.48rem 0.5rem; }
  .clock-pill { display: none; }
  .control-dock { top: 112px; }
  .multiview-grid { grid-template-columns: 1fr; }
  .hero-radar { display: none; }
}

@media (max-width: 480px) {
  .hero-stats { grid-template-columns: 1fr 1fr; gap: 0.65rem; }
  .stat-value { font-size: 1.15rem; }
  .camera-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
