/* ==========================================================================
   Team14 Mecanum Simulator & Live Firmware Studio — Stylesheet
   ========================================================================== */

:root {
  --bg-base: #000000;
  --bg-panel: #0e0e0e;
  --bg-sub: #141414;
  --border-line: #262626;
  --text-main: #ffffff;
  --text-muted: #8a8a8a;
  --thumb-size: clamp(38px, 11dvh, 48px);
}

* {
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background-color: var(--bg-base);
  color: var(--text-main);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overflow-x: hidden;
}

@media (min-width: 1024px) {
  body.view-sim, body.view-split {
    height: 100dvh;
    overflow: hidden;
  }
}

body.view-ctrl {
  height: 100dvh;
  background-color: #000000;
  overflow: hidden;
  touch-action: none;
}

.mono {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-variant-numeric: tabular-nums;
}

/* ==================== MINIMALIST DARK SHELL PANELS ==================== */
.min-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-line);
  border-radius: 10px;
}

.min-btn {
  background: #000000;
  color: #ffffff;
  border: 1px solid #2e2e2e;
  border-radius: 7px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.min-btn:hover {
  border-color: #666666;
}
.min-btn.active {
  background: #ffffff;
  color: #000000;
  border-color: #ffffff;
}
.min-btn.mode-host-on {
  background: #052e16;
  color: #4ade80;
  border-color: #22c55e;
}
.min-btn.mode-closed-on {
  background: #1f0909;
  color: #f87171;
  border-color: #ef4444;
}

/* ==================== ARDUINO IDE 2.x DEFAULT LIGHT THEME BLOCKS ==================== */
.arduino-card {
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  color: #24292e;
}

.arduino-tabbar {
  background: #f3f4f6;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-right: 8px;
  gap: 6px;
  flex-shrink: 0;
}

.arduino-tab {
  background: #ffffff;
  border-top: 2.5px solid #00979c;
  border-right: 1px solid #e5e7eb;
  padding: 5px 11px;
  font-size: 11px;
  font-weight: 700;
  color: #111827;
  display: flex;
  align-items: center;
  gap: 6px;
}

.arduino-editor {
  background: #ffffff;
  overflow-x: auto;
  overflow-y: auto;
  flex: 1;
  position: relative;
}

.ard-lines-wrap {
  min-width: 100%;
  width: max-content;
}

.arduino-textarea {
  width: 100%;
  background: #ffffff;
  color: #111827;
  border: none;
  outline: none;
  resize: vertical;
  padding: 8px 10px;
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  line-height: 1.5;
  tab-size: 2;
  user-select: text;
  -webkit-user-select: text;
}

.ard-mode-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 5px;
  border: 1px solid #2e2e2e;
  background: #000000;
  color: #a3a3a3;
}
.ard-mode-pill.is-split {
  border-color: #22c55e;
  color: #4ade80;
  background: #052e16;
}
.ard-mode-pill.is-edit {
  border-color: #f59e0b;
  color: #fbbf24;
  background: #271704;
}

.ard-row {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 20px;
  padding-right: 8px;
  border-left: 3px solid transparent;
  font-size: 11px;
  line-height: 1.45;
  transition: background-color 0.07s ease, border-color 0.07s ease;
  white-space: nowrap;
}

.ard-gutter {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #f8f9fa;
  color: #9ca3af;
  border-right: 1px solid #eceef1;
  width: 28px;
  padding: 1px 6px 1px 0;
  text-align: right;
  flex-shrink: 0;
  font-size: 10px;
  margin-right: 8px;
}

.ard-code {
  flex: 1 0 auto;
  color: #24292e;
  white-space: pre;
  padding-right: 12px;
}

.ard-val {
  position: sticky;
  right: 8px;
  z-index: 2;
  flex-shrink: 0;
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  padding: 0 5px;
  border-radius: 4px;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  color: #6b7280;
  box-shadow: -4px 0 6px -3px rgba(0, 0, 0, 0.14);
  transition: background-color 0.07s ease, border-color 0.07s ease, color 0.07s ease;
}

/* Arduino IDE 2.x Authentic Syntax Highlighting */
.ard-type { color: #00979c; font-weight: 600; }
.ard-ctrl { color: #d35400; font-weight: 600; }
.ard-num  { color: #005cc5; }
.ard-cm   { color: #7e8e91; font-style: italic; }
.ard-prep { color: #5c6370; font-weight: 600; }

/* Live Execution Line Highlights on Arduino White Canvas */
.ard-row.exec-teal {
  background: #e0f7fa;
  border-left-color: #00979c;
}
.ard-row.exec-teal .ard-val {
  background: #ccf2f4;
  border-color: #00979c;
  color: #006669;
}

.ard-row.exec-green {
  background: #dcfce7;
  border-left-color: #16a34a;
}
.ard-row.exec-green .ard-val {
  background: #bbf7d0;
  border-color: #16a34a;
  color: #14532d;
}

.ard-row.exec-amber {
  background: #fef3c7;
  border-left-color: #d97706;
}
.ard-row.exec-amber .ard-val {
  background: #fde68a;
  border-color: #d97706;
  color: #78350f;
}

.ard-row.exec-red {
  background: #fee2e2;
  border-left-color: #dc2626;
}
.ard-row.exec-red .ard-val {
  background: #fecaca;
  border-color: #dc2626;
  color: #7f1d1d;
}

/* ==================== MINIMALIST WEB CONTROLLER UI ==================== */
.ctrl-app {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  background: #000000;
  color: #ffffff;
  padding: max(8px, env(safe-area-inset-top))
           max(10px, env(safe-area-inset-right))
           max(8px, env(safe-area-inset-bottom))
           max(10px, env(safe-area-inset-left));
  gap: 6px;
}

.ctrl-topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  background: #0e0e0e;
  border: 1px solid #262626;
  border-radius: 10px;
  padding: 6px 8px;
  overflow-x: auto;
  scrollbar-width: none;
}
.ctrl-topbar::-webkit-scrollbar { display: none; }

.ctrl-pin-input {
  background: #000000;
  color: #ffffff;
  border: 1px solid #2e2e2e;
  border-radius: 7px;
  padding: 5px 5px;
  font-size: 11px;
  font-weight: 700;
  width: 52px;
  text-align: center;
  outline: none;
  user-select: text;
  -webkit-user-select: text;
}
.ctrl-pin-input:focus { border-color: #ffffff; }

.ctrl-conn-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 3px 10px;
  border-radius: 999px;
  background: #0e0e0e;
  border: 1px solid #333333;
  color: #8a8a8a;
}
.ctrl-conn-pill.connected { color: #22c55e; border-color: #22c55e; }
.ctrl-conn-pill.pending   { color: #f59e0b; border-color: #f59e0b; }
.ctrl-conn-pill.rejected  { color: #ef4444; border-color: #ef4444; }

.ctrl-track {
  position: relative;
  background: #0e0e0e;
  border: 1.5px solid #2e2e2e;
  border-radius: 999px;
  touch-action: none;
  transition: opacity 0.2s;
}
.ctrl-track-v {
  width: clamp(50px, 13dvh, 66px);
  height: clamp(120px, 46dvh, 190px);
}
.ctrl-track-h {
  width: clamp(115px, 28vw, 195px);
  height: clamp(46px, 13dvh, 62px);
}
.ctrl-joy-pad {
  position: relative;
  width: clamp(130px, 46dvh, 190px);
  height: clamp(130px, 46dvh, 190px);
  background: radial-gradient(circle, #141414 60%, #050505 100%);
  border: 1.5px solid #2e2e2e;
  border-radius: 50%;
  touch-action: none;
  transition: opacity 0.2s;
}

/* Compact sizing when docked in Split View */
.split-docked .ctrl-track-v {
  width: 50px;
  height: clamp(125px, 34dvh, 170px);
}
.split-docked .ctrl-track-h {
  width: clamp(100px, 10.5vw, 140px);
  height: 46px;
}
.split-docked .ctrl-joy-pad {
  width: clamp(120px, 24dvh, 155px);
  height: clamp(120px, 24dvh, 155px);
}
.split-docked .ctrl-act-btn {
  width: 76px;
  height: 44px;
  font-size: 12px;
}
.split-docked .ctrl-thumb {
  width: 36px;
  height: 36px;
}

.ctrl-thumb {
  position: absolute;
  top: 50%; left: 50%;
  width: var(--thumb-size);
  height: var(--thumb-size);
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.ctrl-act-btn {
  width: clamp(82px, 15vw, 108px);
  height: clamp(46px, 17dvh, 60px);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.06em;
  background: #0e0e0e;
  color: #ffffff;
  border: 1.5px solid #2e2e2e;
  outline: none;
  cursor: pointer;
}
.ctrl-act-btn.pressed {
  background: #ffffff;
  color: #000000;
  border-color: #ffffff;
  transform: scale(0.96);
}
.ctrl-disabled { opacity: 0.25; pointer-events: none; }

/* Custom Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #333333; border-radius: 99px; }

#qrContainer img, #qrContainer canvas {
  display: block;
  margin: 0 auto;
  border-radius: 6px;
}

.selectable-input {
  user-select: text;
  -webkit-user-select: text;
}
