/* === RTRange Dark Theme — matched to secbysrg.com === */
:root {
  --bg-primary: #0d0f0d;
  --bg-secondary: #141814;
  --bg-tertiary: #1c211c;
  --bg-hover: #242a24;
  --border: #2e362e;
  --text-primary: #e9e9e9;
  --text-secondary: #8a8f8a;
  --text-muted: #4e554e;
  --green: #00ff88;
  --green-dim: #00cc6a;
  --amber: #ffb000;
  --amber-dim: #cc8800;
  --red: #ff4444;
  --red-dim: #cc2222;
  --blue: #4488ff;
  --cyan: #00cccc;
  --purple: #aa66ff;
  --font-mono: 'Cascadia Code', 'Fira Code', 'JetBrains Mono', 'Consolas', monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-mono);
  height: 100vh;
  overflow: hidden;
}

/* === Site Nav Bar — matches secbysrg main site nav === */
.site-nav {
  display: flex;
  align-items: center;
  padding: 0 24px;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  height: 64px;
  font-family: var(--font-sans);
  flex-shrink: 0;
}
.site-nav-back {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
  font-family: var(--font-sans);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: color 0.15s;
}
.site-nav-back:hover { color: var(--text-primary); }

.view { display: flex; flex-direction: column; height: calc(100vh - 37px); }
.hidden { display: none !important; }

/* === Top Bar === */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  min-height: 48px;
  gap: 16px;
}

.logo {
  font-size: 16px;
  color: var(--green);
  font-weight: 700;
  letter-spacing: 1px;
}

.top-bar-left { display: flex; align-items: center; gap: 12px; }
.top-bar-center { display: flex; align-items: center; }
.top-bar-right { display: flex; align-items: center; gap: 16px; }

.btn-back {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 18px;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--font-mono);
}
.btn-back:hover { border-color: var(--green); color: var(--green); }

.scenario-title {
  font-size: 14px;
  color: var(--amber);
  font-weight: 600;
}

.timer {
  font-size: 18px;
  color: var(--text-secondary);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.score {
  font-size: 14px;
  color: var(--green);
  font-weight: 600;
}

/* === Dashboard === */
.dashboard-main {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.dashboard-header h2 {
  font-size: 18px;
  color: var(--text-primary);
}

.tier-tabs { display: flex; gap: 4px; }

.tier-tab {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 6px 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.15s;
}
.tier-tab:hover { border-color: var(--text-secondary); }
.tier-tab.active {
  background: var(--bg-hover);
  border-color: var(--green);
  color: var(--green);
}
.tier-tab.locked {
  opacity: 0.4;
  cursor: not-allowed;
}

.alert-queue {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* === Alert Card === */
.alert-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  transition: all 0.15s;
}
.alert-card:hover {
  border-color: var(--green-dim);
  background: var(--bg-tertiary);
}
.alert-card.completed {
  border-color: var(--green-dim);
  opacity: 0.7;
}
.alert-card.locked {
  opacity: 0.35;
  cursor: not-allowed;
}

.alert-severity {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 3px;
  text-transform: uppercase;
  min-width: 60px;
  text-align: center;
}
.severity-critical { background: var(--red); color: #fff; }
.severity-high { background: #cc4400; color: #fff; }
.severity-medium { background: var(--amber-dim); color: #fff; }
.severity-low { background: var(--blue); color: #fff; }

.alert-info { flex: 1; }
.alert-title { font-size: 14px; color: var(--text-primary); margin-bottom: 4px; }
.alert-meta { font-size: 11px; color: var(--text-secondary); }

.alert-status {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 3px;
  font-weight: 600;
}
.status-new { border: 1px solid var(--amber); color: var(--amber); }
.status-completed { border: 1px solid var(--green); color: var(--green); }
.status-locked { border: 1px solid var(--text-muted); color: var(--text-muted); }

.progress-label {
  font-size: 12px;
  color: var(--text-secondary);
}

/* === Tier Headers === */
.tier-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 8px 4px;
  margin-top: 8px;
}
.tier-header:first-child { margin-top: 0; }
.tier-label {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.tier-beginner { background: var(--green-dim); color: #000; }
.tier-intermediate { background: var(--amber-dim); color: #000; }
.tier-advanced { background: var(--red-dim); color: #fff; }
.tier-progress { font-size: 11px; color: var(--text-secondary); }
.tier-locked { font-size: 11px; color: var(--red); font-style: italic; }
.alert-card.locked:hover {
  border-color: var(--border);
  background: var(--bg-secondary);
}

/* === Investigation Layout === */
.investigation-main {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.terminal-pane {
  flex: 0 0 60%;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: #000;
}

#terminal-container {
  flex: 1;
  padding: 4px;
}

.sidebar-pane {
  flex: 0 0 40%;
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  overflow: hidden;
}

.sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
}

.sidebar-tab {
  flex: 1;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  padding: 10px 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
}
.sidebar-tab:hover { color: var(--text-primary); }
.sidebar-tab.active {
  color: var(--green);
  border-bottom-color: var(--green);
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.tab-panel { display: block; }
.tab-panel.hidden { display: none; }

/* === Objectives === */
.objective-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.objective-item:last-child { border-bottom: none; }

.objective-check {
  width: 18px;
  height: 18px;
  border: 2px solid var(--text-muted);
  border-radius: 3px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}
.objective-check.done {
  border-color: var(--green);
  background: var(--green);
  color: var(--bg-primary);
  font-size: 12px;
  font-weight: bold;
}

.objective-text { font-size: 12px; color: var(--text-primary); line-height: 1.4; }
.objective-text.done { color: var(--text-secondary); text-decoration: line-through; }
.objective-points { font-size: 11px; color: var(--amber); margin-top: 2px; }

/* === Machine Info === */
.machine-detail {
  font-size: 12px;
  margin-bottom: 12px;
}
.machine-detail .label {
  color: var(--text-secondary);
  display: block;
  margin-bottom: 2px;
  font-size: 11px;
  text-transform: uppercase;
}
.machine-detail .value {
  color: var(--green);
  font-size: 13px;
}

/* === Alert Detail === */
.alert-detail-section {
  margin-bottom: 16px;
}
.alert-detail-section h4 {
  color: var(--amber);
  font-size: 12px;
  margin-bottom: 8px;
  text-transform: uppercase;
}
.alert-detail-section p,
.alert-detail-section li {
  font-size: 12px;
  color: var(--text-primary);
  line-height: 1.5;
}
.alert-detail-section ul {
  list-style: none;
  padding: 0;
}
.alert-detail-section li::before {
  content: '> ';
  color: var(--green);
}
.ioc-value {
  color: var(--red);
  font-weight: 600;
}

/* === Notes === */
#investigation-notes {
  width: 100%;
  height: 100%;
  min-height: 300px;
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  resize: none;
}
#investigation-notes:focus {
  outline: none;
  border-color: var(--green-dim);
}

/* === Bottom Bar === */
.bottom-bar {
  display: flex;
  align-items: center;
  padding: 8px 16px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  gap: 16px;
}

.btn-hint {
  background: var(--bg-tertiary);
  border: 1px solid var(--amber-dim);
  color: var(--amber);
  padding: 6px 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.15s;
}
.btn-hint:hover { background: var(--bg-hover); border-color: var(--amber); }
.btn-hint:disabled { opacity: 0.3; cursor: not-allowed; }

.score-summary {
  margin-left: auto;
  font-size: 14px;
  color: var(--green);
  font-weight: 600;
}

/* === Toast === */
.toast-container {
  flex: 1;
  display: flex;
  justify-content: center;
}

.toast {
  padding: 8px 20px;
  border-radius: 4px;
  font-size: 12px;
  font-family: var(--font-mono);
  animation: toast-in 0.3s ease, toast-out 0.3s ease 2.7s forwards;
  position: relative;
}
.toast-success { background: rgba(0,255,136,0.15); border: 1px solid var(--green); color: var(--green); }
.toast-error { background: rgba(255,68,68,0.15); border: 1px solid var(--red); color: var(--red); }
.toast-info { background: rgba(68,136,255,0.15); border: 1px solid var(--blue); color: var(--blue); }
.toast-hint { background: rgba(255,176,0,0.15); border: 1px solid var(--amber); color: var(--amber); }

@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toast-out { from { opacity: 1; } to { opacity: 0; } }

/* === Modal === */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 32px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-content h2 {
  color: var(--green);
  margin-bottom: 20px;
  font-size: 20px;
}

.debrief-stat {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.debrief-stat .label { color: var(--text-secondary); }
.debrief-stat .value { color: var(--green); font-weight: 600; }

.debrief-section { margin: 16px 0; }
.debrief-section h3 { color: var(--amber); font-size: 14px; margin-bottom: 8px; }
.debrief-section p { font-size: 12px; color: var(--text-primary); line-height: 1.6; }

.btn-primary {
  background: var(--green-dim);
  color: var(--bg-primary);
  border: none;
  padding: 10px 24px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  border-radius: 4px;
  cursor: pointer;
  margin-top: 20px;
  transition: background 0.15s;
}
.btn-primary:hover { background: var(--green); }

/* === Reset Button === */
.btn-reset {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 4px 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-reset:hover { border-color: var(--red); color: var(--red); }

/* === EDR Console Panel === */
#edr-panel h4 {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}

.edr-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.edr-platform-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--cyan);
}

.edr-status {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.edr-connected { background: rgba(0,255,136,0.15); color: var(--green); border: 1px solid var(--green-dim); }
.edr-isolated { background: rgba(255,68,68,0.15); color: var(--red); border: 1px solid var(--red-dim); }

.edr-btn-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 12px;
}

.edr-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 8px 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.15s;
  text-align: center;
}
.edr-btn:hover {
  border-color: var(--cyan);
  color: var(--cyan);
  background: var(--bg-hover);
}

.edr-action-form {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 12px;
  margin-bottom: 12px;
}
.edr-action-form label {
  font-size: 11px;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 4px;
}
.edr-action-form input {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 6px 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  border-radius: 3px;
  margin-bottom: 8px;
}
.edr-action-form input:focus { outline: none; border-color: var(--cyan); }

.edr-btn-submit {
  background: var(--cyan);
  color: var(--bg-primary);
  border: none;
  padding: 6px 16px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  border-radius: 3px;
  cursor: pointer;
  transition: opacity 0.15s;
}
.edr-btn-submit:hover { opacity: 0.85; }
.edr-btn-danger { background: var(--red); }

.edr-confirm-text { font-size: 12px; color: var(--text-primary); margin-bottom: 10px; line-height: 1.5; }
.edr-confirm-warn { color: var(--amber); font-size: 11px; }

.edr-detections { margin-bottom: 12px; }
.edr-detection {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 6px 10px;
  margin-bottom: 4px;
  font-size: 11px;
}
.edr-detection-type {
  color: var(--amber);
  font-weight: 700;
  margin-right: 6px;
}
.edr-detection-value {
  color: var(--red);
  font-weight: 600;
  margin-right: 6px;
}
.edr-detection-context {
  color: var(--text-secondary);
  display: block;
  margin-top: 2px;
}
.edr-no-detections { font-size: 11px; color: var(--text-muted); }

.edr-log-entry {
  font-size: 10px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(42,58,74,0.5);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.edr-log-time { color: var(--text-muted); min-width: 65px; }
.edr-log-action { color: var(--cyan); font-weight: 600; min-width: 80px; }
.edr-log-msg { color: var(--text-primary); flex: 1; }
.edr-log-success .edr-log-msg { color: var(--green); }
.edr-log-error .edr-log-msg { color: var(--red); }

.edr-progress {
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: 2px;
  overflow: hidden;
}
.edr-progress-bar {
  height: 100%;
  background: var(--cyan);
  border-radius: 2px;
  animation: edr-progress-fill 2s ease forwards;
}
@keyframes edr-progress-fill { from { width: 0; } to { width: 100%; } }

/* === Scrollbar === */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
