/* ===== Simulador TC — console escuro estilo sala de comando ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0d1117;
  --panel: #161b22;
  --panel2: #1c2330;
  --border: #2d3748;
  --text: #d7dee8;
  --muted: #8b98a9;
  --accent: #2f81f7;
  --accent-hover: #4a95ff;
  --green: #3fb950;
  --amber: #d29922;
  --red: #f85149;
}

body {
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== topbar ===== */
#topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 10px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.logo { font-size: 22px; font-weight: 800; letter-spacing: 1px; color: var(--accent); }
.logo span { color: var(--text); font-weight: 300; }
.topbar-info { flex: 1; color: var(--muted); font-size: 14px; }
.topbar-status { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--green); display: inline-block; }
.status-dot.busy { background: var(--amber); animation: blink 0.8s infinite; }
.status-dot.xray { background: var(--red); animation: blink 0.4s infinite; }
@keyframes blink { 50% { opacity: 0.25; } }
.clock { font-variant-numeric: tabular-nums; margin-left: 12px; }

/* ===== steps nav ===== */
#steps {
  display: flex;
  background: var(--panel2);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.step {
  flex: 1;
  padding: 10px 8px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.step:disabled { opacity: 0.35; cursor: not-allowed; }
.step.active { color: var(--text); border-bottom-color: var(--accent); }
.step.done .step-num { background: var(--green); color: #fff; }
.step-num {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}
.step.active .step-num { background: var(--accent); color: #fff; }

/* ===== panels ===== */
#main { flex: 1; padding: 24px; max-width: 1100px; width: 100%; margin: 0 auto; }
.panel h2 { font-size: 20px; margin-bottom: 16px; font-weight: 600; }
.panel h3 { font-size: 16px; margin: 20px 0 12px; color: var(--accent); }
.panel h4 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); margin-bottom: 10px; }
.hidden { display: none !important; }
.hint { color: var(--muted); font-size: 13px; margin-bottom: 14px; }

/* ===== forms ===== */
.form-grid, .params-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
input, select {
  padding: 9px 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
}
input:focus, select:focus { outline: none; border-color: var(--accent); }
.form-actions { grid-column: 1 / -1; margin-top: 12px; }

/* ===== buttons ===== */
.btn {
  padding: 9px 18px;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s;
}
.btn:hover { background: var(--border); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.warning { background: var(--amber); border-color: var(--amber); color: #14100a; font-weight: 700; }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; font-weight: 700; }
.btn.big { padding: 14px 28px; font-size: 16px; }
.btn.small { padding: 5px 10px; font-size: 12px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ===== protocolos ===== */
.protocol-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
}
.protocol-card {
  padding: 18px 14px;
  background: var(--panel);
  border: 2px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, transform 0.1s;
}
.protocol-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.protocol-card.selected { border-color: var(--accent); background: var(--panel2); }
.protocol-card .icon { font-size: 30px; margin-bottom: 8px; }
.protocol-card .name { font-weight: 600; font-size: 14px; }
.protocol-card .region { font-size: 12px; color: var(--muted); margin-top: 4px; }

.dose-preview {
  display: flex;
  gap: 30px;
  margin-top: 16px;
  padding: 12px 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  color: var(--muted);
}
.dose-preview strong { color: var(--amber); }

/* ===== scout / planning ===== */
.scout-layout { display: flex; gap: 24px; flex-wrap: wrap; }
.scout-controls { flex: 1; min-width: 240px; display: flex; flex-direction: column; gap: 14px; }
.control-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.scout-display {
  background: #000;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}
canvas { display: block; max-width: 100%; }
#plan-canvas { cursor: grab; }
.table-pos { font-size: 15px; }
.table-pos strong { color: var(--accent); font-variant-numeric: tabular-nums; }

/* ===== progress ===== */
.progress {
  height: 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
.progress .bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #6cb2ff);
  transition: width 0.1s linear;
}

/* ===== aquisição ===== */
.scan-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 20px 0;
}
.gantry-anim { position: relative; width: 220px; height: 220px; }
.gantry-ring {
  position: absolute; inset: 0;
  border: 14px solid var(--panel2);
  border-top-color: var(--accent);
  border-radius: 50%;
}
.gantry-anim.spinning .gantry-ring { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.gantry-bore {
  position: absolute; inset: 40px;
  background: #000;
  border-radius: 50%;
  border: 2px solid var(--border);
}
.gantry-table {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 130px; height: 26px;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.scan-info { text-align: center; width: 100%; max-width: 460px; display: flex; flex-direction: column; gap: 12px; }
#scan-msg { font-size: 15px; color: var(--muted); min-height: 22px; }
#scan-slice-count { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.radiation-warn {
  padding: 10px 26px;
  background: var(--red);
  color: #fff;
  font-weight: 800;
  font-size: 17px;
  border-radius: 8px;
  animation: blink 0.5s infinite;
}

/* ===== viewer ===== */
.viewer-layout { display: flex; gap: 24px; flex-wrap: wrap; }
.viewer-side { width: 260px; display: flex; flex-direction: column; gap: 14px; }
.viewer-display {
  position: relative;
  flex: 1;
  min-width: 320px;
  background: #000;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}
#axial-canvas { cursor: crosshair; }
.wl-presets { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.slider-label { font-size: 12px; }
.slider-label span { color: var(--accent); }
input[type="range"] { padding: 0; accent-color: var(--accent); }

.overlay-info { position: absolute; inset: 10px; pointer-events: none; font-size: 11px; color: #9fd4a3; font-family: Consolas, monospace; }
.oi { position: absolute; white-space: pre-line; text-shadow: 0 0 4px #000; }
.oi.tl { top: 8px; left: 12px; }
.oi.tr { top: 8px; right: 12px; text-align: right; }
.oi.bl { bottom: 8px; left: 12px; }
.oi.br { bottom: 8px; right: 12px; text-align: right; }

/* ===== footer ===== */
#footer {
  padding: 10px 20px;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  border-top: 1px solid var(--border);
  background: var(--panel);
}

@media (max-width: 720px) {
  #main { padding: 14px; }
  .viewer-side { width: 100%; }
}
