/* ═══════════════════════════════════════════════════
   CZElectro — Design Tokens & Base Reset
   Variables, colors, typography, and global resets
   ═══════════════════════════════════════════════════ */

/* System fonts only — no external loading */

/* ── Reset ── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ── Dark Theme (Default) ── */
:root {
    --bg-primary: #0f0f1a;
    --bg-secondary: rgba(20, 20, 35, 0.85);
    --bg-card: rgba(0, 0, 0, 0.4);
    --bg-workspace: #0f0f1a;
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(74, 222, 128, 0.4);
    --accent: #4ade80;
    --accent-glow: rgba(74, 222, 128, 0.3);
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #60a5fa;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --glass-blur: 18px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-heavy: 0 20px 60px rgba(0, 0, 0, 0.8);
    --transition-smooth: cubic-bezier(0.25, 0.8, 0.25, 1);
    --grid-minor: rgba(74, 222, 128, 0.12);
    --grid-major: rgba(74, 222, 128, 0.25);
    --ctx-bg: rgba(20, 20, 35, 0.95);
    --tooltip-bg: rgba(15, 15, 30, 0.95);
    --toast-bg: rgba(17, 24, 39, 0.95);
    --body-dots-1: rgba(74, 222, 128, 0.03);
    --body-dots-2: rgba(96, 165, 250, 0.02);
    --sidebar-header-gradient: rgba(74, 222, 128, 0.06);
    --wire-handle-fill: rgba(148, 163, 184, 0.5);
    --wire-handle-stroke: rgba(255, 255, 255, 0.25);
    --selection-bg: rgba(74, 222, 128, 0.06);
}

/* ── Light Theme ── */
[data-theme="light"] {
    --bg-primary: #f1f5f9;
    --bg-secondary: rgba(255, 255, 255, 0.92);
    --bg-card: rgba(255, 255, 255, 0.7);
    --bg-workspace: #f1f5f9;
    --border-subtle: rgba(0, 0, 0, 0.1);
    --border-hover: rgba(22, 163, 74, 0.4);
    --accent: #16a34a;
    --accent-glow: rgba(22, 163, 74, 0.2);
    --danger: #dc2626;
    --warning: #d97706;
    --info: #2563eb;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --glass-blur: 12px;
    --shadow-heavy: 0 10px 40px rgba(0, 0, 0, 0.12);
    --grid-minor: rgba(0, 80, 60, 0.12);
    --grid-major: rgba(0, 100, 60, 0.25);
    --ctx-bg: rgba(255, 255, 255, 0.97);
    --tooltip-bg: rgba(255, 255, 255, 0.97);
    --toast-bg: rgba(255, 255, 255, 0.97);
    --body-dots-1: rgba(22, 163, 74, 0.04);
    --body-dots-2: rgba(37, 99, 235, 0.03);
    --sidebar-header-gradient: rgba(22, 163, 74, 0.06);
    --wire-handle-fill: rgba(71, 85, 105, 0.5);
    --wire-handle-stroke: rgba(0, 0, 0, 0.2);
    --selection-bg: rgba(22, 163, 74, 0.08);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background-color: var(--bg-primary);
    background-image:
        radial-gradient(var(--body-dots-1) 1px, transparent 1px),
        radial-gradient(var(--body-dots-2) 1px, transparent 1px);
    background-size: 20px 20px, 30px 30px;
    background-position: 0 0, 15px 15px;
    color: var(--text-primary);
    display: flex;
    height: 100vh;
    overflow: hidden;
    user-select: none;
}

/* Light theme overrides for hardcoded colors */
[data-theme="light"] .item-name {
    color: #1e293b;
}

[data-theme="light"] .sidebar-item::before {
    background: linear-gradient(135deg, rgba(22, 163, 74, 0.08), transparent);
}

[data-theme="light"] .copy-toast {
    background: var(--toast-bg);
    color: var(--accent);
    border-color: rgba(22, 163, 74, 0.3);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .ctx-menu {
    background: var(--ctx-bg);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .tooltip {
    background: var(--tooltip-bg);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .burn-notice {
    box-shadow: 0 4px 15px rgba(220, 38, 38, 0.3);
}

[data-theme="light"] .comp-badge {
    background: rgba(255, 255, 255, 0.85);
    color: var(--text-secondary);
}


[data-theme="light"] .power-badge {
    background: rgba(255, 255, 255, 0.85);
    color: #0891b2;
    border-color: rgba(8, 145, 178, 0.2);
}

[data-theme="light"] .battery-bar {
    background: #e2e8f0;
    border-color: #94a3b8;
}

[data-theme="light"] .battery-pct {
    color: #1e293b;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

[data-theme="light"] .scc-status {
    background: rgba(255, 255, 255, 0.9);
}

[data-theme="light"] .no-ac-badge {
    background: rgba(255, 255, 255, 0.9);
}

[data-theme="light"] .vm-badge {
    background: rgba(255, 255, 255, 0.9);
    color: #15803d;
    border-color: rgba(22, 163, 74, 0.3);
    text-shadow: none;
}

[data-theme="light"] .group-label-badge {
    color: #7c3aed;
    background: rgba(139, 92, 246, 0.1);
    text-shadow: none;
    border: 1px solid rgba(139, 92, 246, 0.2);
}

[data-theme="light"] .group-label-badge.group-selected {
    background: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.4);
    box-shadow: 0 2px 12px rgba(139, 92, 246, 0.15);
}

[data-theme="light"] .group-label-input {
    color: #6d28d9;
    caret-color: #7c3aed;
}

[data-theme="light"] .group-label-input::placeholder {
    color: rgba(109, 40, 217, 0.35);
}

[data-theme="light"] .motor-dir-badge {
    background: rgba(255, 255, 255, 0.9);
    color: #7c3aed;
    border-color: rgba(139, 92, 246, 0.2);
}

[data-theme="light"] .motor-dir-badge.reversed {
    color: #ea580c;
    border-color: rgba(234, 88, 12, 0.2);
}

/* ── Arduino IDE Light Theme ── */
[data-theme="light"] .ard-ide-container {
    background: #ffffff; border-color: #d1d5db;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15), 0 0 40px rgba(22,163,74,0.08);
}
[data-theme="light"] .ard-ide-header {
    background: #f8fafc; border-color: #e2e8f0;
}
[data-theme="light"] .ard-ide-title { color: #1e293b; }
[data-theme="light"] .ard-ide-comp-id {
    color: #64748b; background: #e2e8f0;
}
[data-theme="light"] .ard-flash-badge {
    color: #16a34a; background: rgba(22,163,74,0.08);
    border-color: rgba(22,163,74,0.25);
}
[data-theme="light"] .ard-toolbar-sep { background: #e2e8f0; }
[data-theme="light"] .ard-ide-status-inline { color: #64748b; }
[data-theme="light"] .ard-preset-select {
    color: #1e293b; background: #f1f5f9; border-color: #d1d5db;
}
[data-theme="light"] .ard-preset-select:hover { border-color: #16a34a; }
[data-theme="light"] .ard-btn-close {
    color: #64748b; border-color: #d1d5db;
}
[data-theme="light"] .ard-btn-close:hover {
    color: #dc2626; border-color: #dc2626;
}
[data-theme="light"] .ard-btn-erase {
    background: #f1f5f9; color: #64748b; border-color: #d1d5db;
}
[data-theme="light"] .ard-btn-erase:hover {
    background: #dc2626; color: #fff; border-color: #dc2626;
}
[data-theme="light"] .ard-ide-editor-pane { border-color: #e2e8f0; }
[data-theme="light"] .ard-ide-pane-header {
    color: #475569; background: #f8fafc; border-color: #e2e8f0;
}
[data-theme="light"] .ard-btn-mini {
    color: #475569; background: #f1f5f9; border-color: #d1d5db;
}
[data-theme="light"] .ard-btn-mini:hover {
    color: #1e293b; border-color: #16a34a;
}
[data-theme="light"] .ard-code-editor {
    background: #fafbfc; color: #24292f;
}
[data-theme="light"] .ard-code-editor::selection { background: #b6d7ff; }
[data-theme="light"] .ard-serial-output {
    background: #f8f9fa; color: #15803d;
}
[data-theme="light"] .ard-ide-status {
    background: #f8fafc; border-color: #e2e8f0; color: #64748b;
}
[data-theme="light"] .ard-status-dot { background: #94a3b8; }
[data-theme="light"] .ard-status-dot.running {
    background: #16a34a; box-shadow: 0 0 6px rgba(22,163,74,0.4);
}
[data-theme="light"] .ard-ide-container ::-webkit-scrollbar-track { background: #fafbfc; }
[data-theme="light"] .ard-ide-container ::-webkit-scrollbar-thumb {
    background: #d1d5db; border-color: #fafbfc;
}
[data-theme="light"] .ard-ide-container ::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
[data-theme="light"] .ard-serial-output::-webkit-scrollbar-track { background: #f8f9fa; }
[data-theme="light"] .ard-serial-output::-webkit-scrollbar-thumb { border-color: #f8f9fa; }
[data-theme="light"] .ard-ide-backdrop { background: rgba(0,0,0,0.3); }

