@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');

html {
  font-size: 135%;
}

: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-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -4px rgba(0, 0, 0, 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-md: 0 4px 20px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.55);
}

/* ══ POWERPUFF (Buttercup) THEME ══ */
.powerpuff {
  --bg-main: #EDFDF2;      /* Saturated light mint green */
  --bg-panel: #F4FDF6;     /* Light mint-panel background */
  --bg-card: #FFFFFF;
  --bg-quaternary: #E1FCE7;
  --border-thin: #111111;  /* Neubrutalist black outlines */
  --border-thick: #111111; /* Neubrutalist black outlines */
  --txt-main: #111111;     /* Cartoon black text */
  --txt-muted: #2C5E3B;    /* Dark forest green for secondary details */
  --accent-col: #22C55E;   /* Buttercup Green */
  --accent-hover: #16A34A;
  --accent-dim: rgba(34, 197, 94, 0.12);
  --st-ok: #22C55E;        /* Buttercup Green */
  --st-crit: #EC4899;      /* Blossom Pink for warning/errors! */
  --st-crit-dim: rgba(236, 72, 153, 0.12);
  --shadow-md: 4px 4px 0px #111111; /* Neubrutalist cartoon hard shadow */
  --shadow-lg: 6px 6px 0px #111111; /* Neubrutalist cartoon hard shadow */
}

/* Show Buttercup mascot only in powerpuff/buttercup theme */
.powerpuff #buttercup-mascot {
  display: flex !important;
}

/* 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 retro cartoon dots pattern background */
.powerpuff body {
  background-color: var(--bg-main);
  background-image: 
    radial-gradient(rgba(34, 197, 94, 0.12) 2px, transparent 2px), 
    radial-gradient(rgba(34, 197, 94, 0.12) 2px, transparent 2px);
  background-size: 24px 24px;
  background-position: 0 0, 12px 12px;
}

/* 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);
}

/* Metric card unit labels (rpm, %, °C, g) — always small regardless of parent font size */
.mc-unit {
  font-size: 0.6rem;
  font-weight: 500;
  color: var(--txt-muted);
  font-family: var(--font-mono);
  vertical-align: middle;
  margin-left: 0.15em;
}

/* 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;
}

/* ══ KAWAII THEME ══ */
.kawaii {
  --bg-main: #FFF0F5;      /* Lavender blush */
  --bg-panel: #FFF5F8;     /* Soft pastel pink panel */
  --bg-card: #FFFFFF;      /* White cards */
  --bg-quaternary: #FFEAF2;
  --border-thin: #FFD1E6;  /* Sweet strawberry pink borders */
  --border-thick: #FFA6D0; /* Strawberry milkshake */
  --txt-main: #5C3A4E;     /* Soft chocolate-plum text */
  --txt-muted: #9F758D;
  --accent-col: #FF75B5;   /* Sweet strawberry accent */
  --accent-hover: #E85A9B;
  --accent-dim: rgba(255, 117, 181, 0.12);
  --st-ok: #22C55E;        /* Sweet green */
  --st-crit: #FF5C8A;      /* Sweet red */
  --st-crit-dim: rgba(255, 92, 138, 0.12);
  --shadow-md: 0 8px 20px rgba(255, 117, 181, 0.15);
  --shadow-lg: 0 16px 32px rgba(255, 117, 181, 0.25);
}

.kawaii body {
  background:
    radial-gradient(circle at 10% 20%, rgba(255, 182, 193, 0.3), transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(221, 160, 221, 0.3), transparent 40%),
    var(--bg-main);
}

/* SVG Gauge Base Arc */
.kawaii .g-bg-arc { stroke: rgba(255, 117, 181, 0.12); }

/* Card overrides for Kawaii theme */
.kawaii .card-vitesse { background-color: #FFEAF2 !important; border-top-color: #FF75B5 !important; }
.kawaii .card-erreur { background-color: #FFF0F5 !important; border-top-color: #FF5C8A !important; }
.kawaii .card-commande { background-color: #F3E8FF !important; border-top-color: #C084FC !important; }
.kawaii .card-accel { background-color: #F3E8FF !important; border-top-color: #A78BFA !important; }
.kawaii .card-temp { background-color: #FFF0F5 !important; border-top-color: #FF5C8A !important; }
.kawaii .card-vib { background-color: #E0F2FE !important; border-top-color: #38BDF8 !important; }

.kawaii .card-graph-vitesse { background-color: rgba(255, 117, 181, 0.04) !important; border-top-color: #FF75B5 !important; }
.kawaii .card-graph-erreur { background-color: rgba(255, 92, 138, 0.04) !important; border-top-color: #FF5C8A !important; }
.kawaii .card-gauge-temp { background-color: rgba(255, 92, 138, 0.04) !important; border-top-color: #FF5C8A !important; }
.kawaii .card-gauge-vib { background-color: rgba(56, 189, 248, 0.04) !important; border-top-color: #38BDF8 !important; }
.kawaii .card-graph-commande { background-color: rgba(192, 132, 252, 0.04) !important; border-top-color: #C084FC !important; }
.kawaii .card-graph-tv { background-color: rgba(167, 139, 250, 0.04) !important; border-top-color: #A78BFA !important; }