@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;500;600;700;800&family=Inter:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600;700&display=swap');

:root {
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
  --font-sans: 'Inter', system-ui, sans-serif;
  --font-display: 'Sora', 'Inter', system-ui, sans-serif;

  /* Default Light theme variable values (Neubrutalist colors) */
  --bg-main: #FAF6EE;
  --bg-panel: #FFFDF9;
  --bg-card: #FFFFFF;
  --bg-quaternary: #FFFDF9;
  --border-thin: #E2D8CF;
  --border-thick: #D4C7BA;
  --txt-main: #1E1B18;
  --txt-muted: #6B5E54;
  --accent-col: #F97316;
  --accent-hover: #EA580C;
  --accent-dim: rgba(249, 115, 22, 0.08);
  --st-ok: #10B981;
  --st-crit: #EF4444;
  --st-crit-dim: rgba(239, 68, 68, 0.08);
  --shadow: 0 4px 16px rgba(30, 27, 24, 0.05);
}

.dark {
  /* Dark theme variable values */
  --bg-main: #0D0D0F;
  --bg-panel: #161618;
  --bg-card: #1D1D20;
  --bg-quaternary: #28282b;
  --border-thin: rgba(244, 240, 232, 0.06);
  --border-thick: rgba(244, 240, 232, 0.12);
  --txt-main: #F4F0E8;
  --txt-muted: #86837e;
  --accent-col: #CDA86A;
  --accent-hover: #E8D2A0;
  --accent-dim: rgba(205, 168, 106, 0.12);
  --st-ok: #5E8C76;
  --st-crit: #C2594A;
  --st-crit-dim: rgba(194, 89, 74, 0.14);
  --shadow: 0 4px 28px rgba(0, 0, 0, 0.55);
}

/* ══ POWERPUFF (Buttercup) THEME ══ */
.powerpuff {
  --bg-main: #F0FFF4;
  --bg-panel: #F7FFF9;
  --bg-card: #FFFFFF;
  --bg-quaternary: #ECFDF5;
  --border-thin: #BBF7D0;
  --border-thick: #86EFAC;
  --txt-main: #052e16;
  --txt-muted: #166534;
  --accent-col: #16a34a;
  --accent-hover: #15803d;
  --accent-dim: rgba(22, 163, 74, 0.10);
  --st-ok: #22c55e;
  --st-crit: #dc2626;
  --st-crit-dim: rgba(220, 38, 38, 0.10);
  --shadow: 0 4px 16px rgba(22, 163, 74, 0.08);
}

/* Background layout for dark mode */
.dark body {
  background:
    radial-gradient(circle at 18% 0%, rgba(205, 168, 106, 0.05), transparent 45%),
    radial-gradient(circle at 100% 100%, rgba(94, 140, 118, 0.04), transparent 50%),
    var(--bg-main);
}

/* Powerpuff subtle background shimmer */
.powerpuff body {
  background:
    radial-gradient(circle at 20% 0%, rgba(34, 197, 94, 0.07), transparent 50%),
    radial-gradient(circle at 90% 100%, rgba(22, 163, 74, 0.05), transparent 45%),
    var(--bg-main);
}

/* SVG Gauge Base Arc */
.g-bg-arc {
  stroke: rgba(40, 33, 20, 0.08);
}
.dark .g-bg-arc {
  stroke: rgba(244, 240, 232, 0.07);
}
.powerpuff .g-bg-arc {
  stroke: rgba(22, 163, 74, 0.12);
}

/* Custom indicator pulse and layout animations */
.diag-panel.panic {
  background: var(--st-crit-dim) !important;
  border-color: var(--st-crit) !important;
  animation: pulseRed 1.5s infinite alternate;
}

@keyframes pulseRed {
  from { box-shadow: 0 0 4px rgba(194, 89, 74, 0.2); }
  to { box-shadow: 0 0 18px rgba(194, 89, 74, 0.45); }
}

.alert-lamp.warn {
  border-color: rgba(255, 255, 255, .4);
  background: rgba(255, 255, 255, .08);
  box-shadow: 0 0 8px rgba(255, 255, 255, .3);
}

.alert-lamp.crit {
  border-color: rgba(194, 89, 74, .7);
  background: rgba(194, 89, 74, .16);
  animation: lampPulse 1s ease-in-out infinite alternate;
}

@keyframes lampPulse {
  from {
    box-shadow: 0 0 3px rgba(194, 89, 74, .4);
    transform: scale(1);
  }
  to {
    box-shadow: 0 0 14px rgba(194, 89, 74, .95);
    transform: scale(1.08);
  }
}

/* Emergency Stop Cover Styling */
.emg-shell::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 8px;
  border: 1px solid rgba(194, 89, 74, .25);
  pointer-events: none;
}

.emg-track {
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, .3);
}

.emg-track.tripped {
  background: rgba(194, 89, 74, .08);
  border-color: rgba(194, 89, 74, .5);
}

.emg-track.tripped .emg-knob {
  transform: translateX(calc(100% + 6px));
  background: linear-gradient(160deg, #C2594A, #8f3b30);
  border-color: #C2594A;
  box-shadow: 0 0 16px -2px rgba(194, 89, 74, .7);
}

.emg-track.tripped .emg-knob::after {
  background: #fff;
  box-shadow: 0 0 8px rgba(255, 255, 255, .6);
}

.emg-track:active .emg-knob {
  transform: scale(.94);
}

.emg-track.tripped:active .emg-knob {
  transform: translateX(calc(100% + 6px)) scale(.94);
}

/* Range input slider customized thumb styles */
input[type=range] {
  appearance: none;
  background: var(--border-thick);
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--bg-panel);
  background: var(--accent-hover);
  box-shadow: 0 0 0 3px var(--accent-dim);
  transition: transform .15s, box-shadow .15s;
  cursor: pointer;
}
input[type=range]:active::-webkit-slider-thumb {
  transform: scale(1.3);
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 4px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-thick);
  border-radius: 2px;
}

/* Mobile Sidebar Panel Transitions */
#sidebar-panel.open {
  translate: 0 0 !important;
  transform: none !important;
}
#sidebar-overlay.open {
  display: block !important;
}