/* MODERN GLASSMORPHIC CYBER-ECO DESIGN SYSTEM */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;700&family=Outfit:wght@400;600;700;800&display=swap');

:root {
  --bg-dark: #070d12;
  --bg-card: rgba(14, 23, 31, 0.78);
  --bg-card-hover: rgba(20, 32, 44, 0.88);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-accent: rgba(16, 185, 129, 0.35);
  
  --primary-emerald: #10b981;
  --primary-cyan: #06b6d4;
  --primary-blue: #3b82f6;
  --accent-amber: #f59e0b;
  --accent-red: #ef4444;
  --accent-purple: #8b5cf6;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --shadow-lg: 0 16px 36px -8px rgba(0, 0, 0, 0.6);
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* UTILITY CONTROLS (USED IN SIDEBAR QUICK BAR) */
.btn-icon {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--text-main);
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: inset 0 1px 0.5px rgba(255, 255, 255, 0.35), 0 4px 10px rgba(0, 0, 0, 0.15);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.45);
  transform: translateY(-1px) scale(1.02);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.6), 0 6px 16px rgba(0, 0, 0, 0.25);
}

.btn-icon:active {
  transform: scale(0.97);
}

.time-speed-group {
  display: flex;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 9999px;
  padding: 2px;
  box-shadow: inset 0 1px 0.5px rgba(255, 255, 255, 0.3);
  overflow: hidden;
}

.speed-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 5px 10px;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-family: 'JetBrains Mono', monospace;
  cursor: pointer;
  transition: all 0.18s ease;
}

.speed-btn.active {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4), inset 0 1px 0.5px rgba(255, 255, 255, 0.6);
}

/* APP MAIN LAYOUT (FULL SCREEN IMMERSIVE 3D) */
main.app-layout {
  width: 100vw;
  height: 100vh;
  position: relative;
  overflow: hidden;
  margin: 0;
  padding: 0;
}

/* 3D VIEWPORT CONTAINER */
#viewport-container {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  background: radial-gradient(circle at center, #11202b 0%, #060a0e 100%);
  cursor: grab;
  overflow: hidden;
}

#viewport-container:active {
  cursor: grabbing;
}

#viewport-container canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100% !important;
  height: 100% !important;
  display: block;
}

/* 3D LOADING OVERLAY */
.model-loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(7, 13, 18, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 40;
  transition: opacity 0.4s ease, visibility 0.4s ease;
  pointer-events: auto;
  cursor: pointer;
}

.model-loading-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none !important;
}

.btn-skip-loading {
  margin-top: 22px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #8eff93;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  padding: 10px 22px;
  border-radius: 9px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-skip-loading:hover {
  background: rgba(142, 255, 147, 0.18);
  border-color: #8eff93;
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(16, 185, 129, 0.15);
  border-top-color: var(--primary-emerald);
  border-right-color: var(--primary-cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 16px;
}

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

.loading-text {
  font-family: 'Outfit', sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 8px;
}

.loading-subtext {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  margin-bottom: 14px;
}

.loading-bar-wrap {
  width: 260px;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
}

.loading-bar-progress {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--primary-emerald), var(--primary-cyan));
  border-radius: 4px;
  transition: width 0.2s ease;
}

/* BUTTON KEMBALI KE BERANDA UTAMA */
.btn-back-home {
  position: absolute;
  top: 16px;
  left: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 9999px;
  padding: 8px 16px;
  color: #f8fafc;
  font-family: 'Outfit', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  z-index: 30;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.45), inset 0 1px 1px rgba(255, 255, 255, 0.35);
  transition: all 0.25s ease;
}

.btn-back-home:hover {
  background: rgba(30, 41, 59, 0.95);
  border-color: rgba(56, 189, 248, 0.8);
  color: #38bdf8;
  transform: translateY(-2px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6), inset 0 1px 1.5px #ffffff;
}

/* 3D VIEW TOGGLE BAR (SMOKED LIQUID GLASS PILL - HIGH CONTRAST) */
.view-mode-toggle {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 9999px;
  padding: 4px;
  gap: 4px;
  z-index: 25;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.45), inset 0 1px 1px rgba(255, 255, 255, 0.35);
}

.view-mode-btn {
  background: transparent;
  border: 1px solid transparent;
  color: #cbd5e1;
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.view-mode-btn.active {
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.5);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3), inset 0 1px 1px #ffffff;
}

.view-mode-btn:hover:not(.active) {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.viewport-hint {
  display: none !important;
}

/* FLOATING TOGGLE PILL FOR CITRA TANAMAN (SMOKED LIQUID GLASS) */
.pip-toggle-pill {
  position: absolute;
  top: 16px;
  right: 20px;
  z-index: 25;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 9999px;
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(36px) saturate(160%);
  -webkit-backdrop-filter: blur(36px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.24);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.45), inset 0 1px 1px rgba(255, 255, 255, 0.35);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.pip-toggle-pill.hidden {
  opacity: 0;
  transform: scale(0.85);
  pointer-events: none;
}

.pip-toggle-pill:hover {
  transform: translateY(-2px) scale(1.05);
  border-color: rgba(6, 182, 212, 0.65);
  box-shadow: 0 20px 40px rgba(6, 182, 212, 0.35), inset 0 1px 2px rgba(255, 255, 255, 0.8);
}

.pip-toggle-pill:active {
  transform: scale(0.96);
}

.pip-pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: pulse 1.5s infinite;
}

/* PICTURE-IN-PICTURE (PiP) KAMERA RPI (APPLE LIQUID GLASS HOUSING) */
.pip-camera-widget {
  position: absolute;
  top: 16px;
  right: 20px;
  width: 290px;
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(40px) saturate(160%);
  -webkit-backdrop-filter: blur(40px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 22px;
  box-shadow: 0 24px 50px -10px rgba(0, 0, 0, 0.55), inset 0 1px 1px rgba(255, 255, 255, 0.35);
  overflow: hidden;
  z-index: 20;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
  transform-origin: top right;
}

.pip-camera-widget.minimized {
  transform: scale(0.8) translate(30px, -30px);
  opacity: 0;
  pointer-events: none;
}

.pip-header {
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}

.pip-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary-cyan);
  display: flex;
  align-items: center;
  gap: 6px;
}

.pip-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-pip-toggle {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text-main);
  padding: 3px 8px;
  border-radius: 9999px;
  font-size: 0.65rem;
  font-family: 'JetBrains Mono', monospace;
  cursor: pointer;
  box-shadow: inset 0 1px 0.5px rgba(255, 255, 255, 0.3);
  transition: all 0.2s ease;
}

.btn-pip-toggle:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.4);
}

.btn-pip-close {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #cbd5e1;
  font-size: 0.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-pip-close:hover {
  background: rgba(239, 68, 68, 0.85);
  border-color: rgba(239, 68, 68, 1);
  color: #fff;
  transform: scale(1.1);
}

.pip-canvas-wrap {
  width: 100%;
  height: 180px;
  position: relative;
  background: #000;
}

#camera-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.pip-footer {
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.06);
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.pixel-meter {
  display: flex;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  background: #222;
  margin-top: 2px;
}

.meter-g { background: #2ecc71; transition: width 0.3s ease; }
.meter-y { background: #f1c40f; transition: width 0.3s ease; }
.meter-b { background: #8B4513; transition: width 0.3s ease; }

/* BOTTOM SCENARIO PRESETS BAR (INDIVIDUAL FLOATING LIQUID GLASS PILLS - NO OUTER CONTAINER BAR) */
.scenario-presets-bar {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 4px;
  border-radius: 0;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: none;
  box-shadow: none;
  z-index: 25;
  pointer-events: none;
  max-width: 95vw;
  overflow-x: auto;
}

.scenario-presets-bar::-webkit-scrollbar {
  display: none;
}

.preset-chip {
  pointer-events: auto;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(36px) saturate(160%);
  -webkit-backdrop-filter: blur(36px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.24);
  color: #ffffff;
  padding: 8px 16px;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 10px 24px -4px rgba(0, 0, 0, 0.45), inset 0 1px 1px rgba(255, 255, 255, 0.35);
  transition: all 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.preset-chip:hover {
  background: rgba(30, 41, 59, 0.88);
  border-color: rgba(255, 255, 255, 0.45);
  color: #ffffff;
  transform: translateY(-3px) scale(1.04);
  box-shadow: 0 14px 28px -2px rgba(0, 0, 0, 0.5), inset 0 1px 1.5px rgba(255, 255, 255, 0.6);
}

.preset-chip:active {
  transform: translateY(0px) scale(0.96);
}

.preset-chip.active-rain {
  background: rgba(37, 99, 235, 0.5);
  border-color: rgba(96, 165, 250, 0.9);
  color: #ffffff;
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.6), inset 0 1px 2px #ffffff;
}

.preset-chip.active-maintenance {
  background: rgba(217, 119, 6, 0.65);
  border-color: rgba(251, 191, 36, 0.95);
  color: #ffffff;
  box-shadow: 0 0 22px rgba(245, 158, 11, 0.65), inset 0 1px 2px #ffffff;
}

/* FLOATING ATTACHED DRAWER TAB (CLEAN ARROW-ONLY TAB, ALWAYS ACCESSIBLE AT SCREEN CENTER) */
.sidebar-toggle-btn {
  position: absolute;
  top: 50%;
  left: -38px; /* Outside left edge of sidebar */
  transform: translateY(-50%);
  width: 38px;
  height: 52px;
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(40px) saturate(160%);
  -webkit-backdrop-filter: blur(40px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-right: none;
  border-radius: 16px 0 0 16px;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 50;
  pointer-events: auto; /* ALWAYS clickable even when parent is pointer-events: none */
  box-shadow: -8px 8px 25px rgba(0, 0, 0, 0.4), inset 0 1px 1.5px rgba(255, 255, 255, 0.35);
  transition: all 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.sidebar-toggle-btn:hover {
  background: rgba(30, 41, 59, 0.9);
  border-color: rgba(255, 255, 255, 0.45);
  box-shadow: -10px 8px 30px rgba(0, 0, 0, 0.5), inset 0 1px 2px #ffffff;
}

.sidebar-toggle-btn .arrow-icon {
  font-size: 1.15rem;
  color: #34d399;
  transition: transform 0.3s ease;
}

/* RIGHT SIDEBAR: POP-UP DRAWER WRAPPER (OVERFLOW VISIBLE SO TAB IS NEVER CLIPPED) */
aside.control-sidebar {
  position: fixed;
  top: 16px;
  right: 16px;
  bottom: 16px;
  width: 430px;
  max-width: calc(100vw - 32px);
  background: transparent;
  border: none;
  box-shadow: none;
  z-index: 40;
  transition: transform 0.38s cubic-bezier(0.16, 1, 0.3, 1);
  transform: translateX(calc(100% + 24px)); /* Default tertutup */
  pointer-events: none;
  overflow: visible !important; /* CRITICAL: ensures toggle tab is NEVER clipped */
}

aside.control-sidebar.open {
  transform: translateX(0);
  pointer-events: auto;
}

/* SCROLLABLE BODY WRAPPER: SMOKED FROSTED OBSIDIAN GLASS (CLEAR CONTRAST AGAINST ANY SKY/LIGHT) */
.sidebar-scroll-body {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  border-radius: 28px;
  background: rgba(15, 23, 42, 0.74); /* Smoked frosted obsidian glass - crisp & readable */
  backdrop-filter: blur(48px) saturate(160%);
  -webkit-backdrop-filter: blur(48px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.20);
  box-shadow: 0 30px 70px -10px rgba(0, 0, 0, 0.65), inset 0 1px 1.5px rgba(255, 255, 255, 0.3);
  display: flex;
  flex-direction: column;
  pointer-events: auto;
}

.sidebar-scroll-body::-webkit-scrollbar {
  width: 5px;
}
.sidebar-scroll-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.25);
  border-radius: 4px;
}

/* STICKY HEADER BAR: ALWAYS VISIBLE WHILE SCROLLING */
.sidebar-header-bar {
  position: sticky;
  top: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  background: rgba(255, 255, 255, 0.10); /* Bening frosted glass */
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}

.sidebar-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Outfit', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: #ffffff;
}

.btn-sidebar-close {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #f1f5f9;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.15rem;
  transition: all 0.2s;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.5);
}

.btn-sidebar-close:hover {
  background: rgba(239, 68, 68, 0.4);
  border-color: #ef4444;
  color: #fff;
  transform: scale(1.1);
}

.sidebar-quick-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 20px;
  background: rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-section {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.section-title {
  font-family: 'Outfit', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

/* GAUGES & SLIDERS (BENING LIQUID GLASS CARDS) */
.param-card {
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 18px;
  padding: 14px 16px;
  margin-bottom: 12px;
  box-shadow: inset 0 1px 1.5px rgba(255, 255, 255, 0.45), 0 6px 18px rgba(0, 0, 0, 0.12);
}

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

.param-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.param-badge {
  font-size: 0.68rem;
  font-family: 'JetBrains Mono', monospace;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 600;
}

.badge-optimal { background: rgba(16, 185, 129, 0.18); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.35); }
.badge-warning { background: rgba(245, 158, 11, 0.18); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.35); }
.badge-danger { background: rgba(239, 68, 68, 0.18); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.35); }

.param-value-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 6px;
}

.param-big-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.35rem;
  font-weight: 700;
  color: #fff;
}

.param-unit {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-left: 4px;
}

.param-slider {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
  outline: none;
}

.param-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--primary-emerald);
  cursor: pointer;
  box-shadow: 0 0 10px var(--primary-emerald);
}

/* REKOMENDASI SPK CARD (BENING LIQUID GLASS) */
.spk-card {
  background: rgba(255, 255, 255, 0.10); /* Pure frosted clear liquid glass */
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 20px;
  padding: 18px;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 1px 1.5px rgba(255, 255, 255, 0.45), 0 8px 24px rgba(0, 0, 0, 0.15);
}

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

.spk-title {
  font-family: 'Outfit', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 6px;
}

.spk-recommendation-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 14px;
  margin-bottom: 12px;
}

.spk-z-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 2.1rem;
  font-weight: 800;
  color: #fff;
}

.spk-details {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.spk-action-buttons {
  display: flex;
  gap: 10px;
}

/* MILKY FROSTED GLASS ACTION BUTTON (MATCHING REFERENCE IMAGE) */
.btn-confirm {
  flex: 1;
  background: rgba(255, 255, 255, 0.90);
  color: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.95);
  padding: 11px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25), inset 0 1px 2px #ffffff;
  transition: all 0.2s ease;
}

.btn-confirm:hover:not(:disabled) {
  background: #ffffff;
  transform: translateY(-1px) scale(1.02);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.3), inset 0 1px 2px #ffffff;
}

.btn-confirm:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.btn-reject {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.4);
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-reject:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.35);
  border-color: rgba(239, 68, 68, 0.6);
  color: #fff;
}

.btn-reject:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-maintenance-card {
  width: 100%;
  background: rgba(245, 158, 11, 0.15);
  color: #fde68a;
  border: 1px solid rgba(245, 158, 11, 0.45);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.25s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25), inset 0 1px 1px rgba(255, 255, 255, 0.15);
}

.btn-maintenance-card:hover {
  background: rgba(245, 158, 11, 0.28);
  border-color: rgba(251, 191, 36, 0.7);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(245, 158, 11, 0.3), inset 0 1px 1px rgba(255, 255, 255, 0.3);
}

.btn-maintenance-card.active {
  background: rgba(245, 158, 11, 0.85);
  color: #0f172a;
  border-color: #fef08a;
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.7), inset 0 1px 2px #ffffff;
}

/* ACTUATORS & GUARDS (BENING GLASS TILES) */
.actuators-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.actuator-tile {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.actuator-name {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.actuator-state {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  font-weight: 700;
}

.actuator-state.active {
  color: var(--primary-emerald);
}

.actuator-state.inactive {
  color: var(--text-dim);
}

/* LOGS CONSOLE */
.log-console {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px;
  height: 120px;
  overflow-y: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.log-entry {
  display: flex;
  gap: 8px;
  color: #a0aec0;
}

.log-time {
  color: var(--text-dim);
}

.log-type {
  font-weight: 700;
}

.log-type.SYSTEM_BOOT { color: var(--primary-cyan); }
.log-type.ACTUATOR { color: var(--primary-emerald); }
.log-type.WEATHER { color: #60a5fa; }
.log-type.GUARD { color: var(--accent-amber); }
.log-type.EMERGENCY { color: var(--accent-red); }
.log-type.SUCCESS { color: #34d399; }

/* MODAL STYLES (VISIONOS LIQUID GLASS SHEET) */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 9, 14, 0.65);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(48px) saturate(120%) brightness(1.1);
  -webkit-backdrop-filter: blur(48px) saturate(120%) brightness(1.1);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 28px;
  width: 90%;
  max-width: 820px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 32px 80px -10px rgba(0, 0, 0, 0.5), inset 0 1.5px 2px rgba(255, 255, 255, 0.8);
  overflow: hidden;
  transform: scale(0.96) translateY(12px);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.open .modal-card {
  transform: scale(1) translateY(0);
}

.modal-header {
  padding: 18px 26px;
  background: rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.15rem;
  color: #fff;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  font-size: 0.85rem;
  color: #f1f5f9;
  line-height: 1.6;
}

.rules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.rule-chip {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 0.72rem;
  font-family: 'JetBrains Mono', monospace;
  transition: all 0.2s ease;
}

.rule-chip.firing {
  background: rgba(16, 185, 129, 0.15);
  border-color: var(--primary-emerald);
  color: #a7f3d0;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.2);
}

.btn-close-modal {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.3rem;
  cursor: pointer;
}

/* COMPONENT HOTSPOT EXPLANATION MODAL (FROSTED GLASS CARD - SCREENSHOT 1 STYLE) */
.modal-card.hotspot-card {
  max-width: 480px;
  background: rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(48px) saturate(200%) brightness(1.15);
  -webkit-backdrop-filter: blur(48px) saturate(200%) brightness(1.15);
  border: 1.5px solid rgba(255, 255, 255, 0.42);
  border-radius: 28px;
  box-shadow: 0 32px 70px -10px rgba(0, 0, 0, 0.6), inset 0 1.5px 2px rgba(255, 255, 255, 0.8), inset 0 -1.5px 2px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  padding: 0;
}

.hotspot-badge-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hotspot-icon {
  font-size: 1.2rem;
}

.hotspot-badge-title h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.3px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.hotspot-card .modal-header {
  padding: 20px 24px 14px 24px;
  background: transparent;
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
}

.hotspot-card .modal-body {
  padding: 20px 24px 24px 24px;
  color: #f1f5f9;
  font-size: 0.88rem;
  line-height: 1.65;
}

.hotspot-description-text {
  color: #f1f5f9;
  font-size: 0.88rem;
  line-height: 1.65;
}

.hotspot-spec-box {
  margin-top: 18px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 18px;
  font-size: 0.78rem;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.35);
}

.hotspot-action-btn {
  width: 100%;
  margin-top: 20px;
  padding: 14px 20px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.95);
  color: #0c1a11;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25), inset 0 1px 1.5px #ffffff;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.hotspot-action-btn:hover {
  background: #ffffff;
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.32), inset 0 1px 2px #ffffff;
}

.hotspot-action-btn:active {
  transform: translateY(0) scale(0.98);
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

/* RESPONSIVE DESIGN */
@media (max-width: 1024px) {
  aside.control-sidebar {
    width: 340px;
  }
  .pip-camera-widget {
    width: 240px;
  }
}

/* ==========================================================================
   FLOATING MINI DASHBOARD (SIMULASI CARA KERJA ALAT VIEWPORT OVERLAY)
   ========================================================================== */
.mini-dashboard-panel {
  position: absolute;
  top: 68px;
  left: 16px;
  width: 326px;
  max-height: calc(100vh - 88px);
  background: rgba(15, 23, 42, 0.84);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 20px;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.55), inset 0 1px 1px rgba(255, 255, 255, 0.3);
  z-index: 28;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: max-height 0.35s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s ease;
}

.mini-dashboard-panel.is-minimized {
  max-height: 48px;
  overflow: hidden;
}

.mini-dash-header {
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
}

.mini-dash-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mini-dash-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 10px #10b981;
}

.mini-dash-title {
  font-family: 'Outfit', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.2;
}

.mini-dash-sub {
  font-size: 0.65rem;
  color: #94a3b8;
  line-height: 1.2;
}

.mini-dash-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mini-dash-btn-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 700;
  transition: all 0.2s ease;
}

.mini-dash-btn-icon:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.05);
}

.mini-dash-body {
  padding: 12px 14px;
  overflow-y: auto;
  overflow-x: hidden;
  max-height: calc(100vh - 146px);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mini-dash-body::-webkit-scrollbar {
  width: 4px;
}
.mini-dash-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
}

.mini-dash-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.mini-section-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.62rem;
  font-weight: 700;
  color: #38bdf8;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.mini-param-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 6px 10px;
}

.mini-param-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mini-param-name {
  font-size: 0.72rem;
  color: #e2e8f0;
  font-weight: 600;
}

.mini-param-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.76rem;
  font-weight: 700;
  color: #ffffff;
}

/* SPK Sugeno Response Card */
.mini-spk-box {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 12px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mini-spk-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.mini-spk-z-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.15rem;
  font-weight: 800;
  color: #34d399;
}

.mini-spk-desc {
  font-size: 0.7rem;
  color: #cbd5e1;
  line-height: 1.35;
}

.mini-spk-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.68rem;
  color: #94a3b8;
  font-family: 'JetBrains Mono', monospace;
  background: rgba(0, 0, 0, 0.25);
  padding: 4px 8px;
  border-radius: 6px;
}

.mini-btn-action {
  width: 100%;
  margin-top: 4px;
  padding: 7px 12px;
  font-size: 0.75rem;
}

/* Actuator 3-tile grid */
.mini-actuators-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}

.mini-actuator-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mini-actuator-header {
  display: flex;
  align-items: center;
  gap: 4px;
}

.mini-actuator-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #64748b;
}

.mini-actuator-dot.active {
  background: #10b981;
  box-shadow: 0 0 6px #10b981;
}

.mini-actuator-title {
  font-size: 0.62rem;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-actuator-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  font-weight: 700;
  color: #64748b;
}

.mini-actuator-val.active {
  color: #34d399;
}

/* Presets & Drawer Button */
.mini-presets-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.mini-chip {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  color: #e2e8f0;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 5px 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.mini-chip:hover {
  background: rgba(56, 189, 248, 0.2);
  border-color: rgba(56, 189, 248, 0.5);
  color: #ffffff;
}

.mini-chip.active {
  background: rgba(16, 185, 129, 0.25);
  border-color: rgba(16, 185, 129, 0.6);
  color: #34d399;
}

.mini-btn-drawer {
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 8px;
  color: #38bdf8;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 7px 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  margin-top: 4px;
}

.mini-btn-drawer:hover {
  background: rgba(56, 189, 248, 0.25);
  border-color: rgba(56, 189, 248, 0.6);
  color: #ffffff;
}

@media (max-width: 768px) {
  .mini-dashboard-panel {
    width: calc(100vw - 32px);
    max-width: 326px;
  }
}
