:root {
  --bg-primary: #080b11;
  --bg-secondary: #0f131a;
  --bg-tertiary: #171d26;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --accent-amber: #f59e0b;
  --accent-red: #ef4444;
  --accent-green: #22c55e;
  --accent-blue: #06b6d4;
  --border-color: rgba(239, 68, 68, 0.15);
  --border-glow: 0 0 10px rgba(239, 68, 68, 0.2);
  --success-glow: 0 0 15px rgba(34, 197, 94, 0.3);
}

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

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background-image: 
    radial-gradient(at 0% 0%, rgba(31, 15, 15, 0.6) 0, transparent 50%),
    radial-gradient(at 100% 0%, rgba(15, 23, 42, 0.8) 0, transparent 50%);
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  background-color: rgba(15, 19, 26, 0.85);
  border-bottom: 1px solid var(--border-color);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
  z-index: 10;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  font-size: 24px;
  color: var(--accent-red);
  text-shadow: var(--border-glow);
  animation: pulse-glow-red 2s infinite alternate;
}

h1 {
  font-family: 'Share Tech Mono', monospace;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 1px;
  background: linear-gradient(90deg, #ffffff, var(--accent-red));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.system-status {
  display: flex;
  align-items: center;
  gap: 24px;
}

.score-display {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(239, 68, 68, 0.05);
  padding: 6px 16px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  box-shadow: var(--border-glow);
}

.score-label {
  font-size: 11px;
  font-weight: bold;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.score-value {
  font-family: 'Share Tech Mono', monospace;
  font-size: 18px;
  color: var(--accent-red);
  font-weight: bold;
}

main {
  display: grid;
  grid-template-columns: 290px 1fr 330px;
  flex: 1;
  overflow: hidden;
}

/* Sidebar Alerts Queue */
.alert-sidebar {
  background-color: rgba(15, 19, 26, 0.6);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.section-title {
  font-family: 'Share Tech Mono', monospace;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--accent-red);
  padding: 16px 20px 8px;
  border-bottom: 1px solid rgba(239, 68, 68, 0.08);
}

.scan-action-box {
  padding: 16px 20px;
}

.btn-scan {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(150, 0, 0, 0.1));
  border: 1px solid var(--accent-red);
  border-radius: 4px;
  color: var(--accent-red);
  font-family: 'Share Tech Mono', monospace;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  letter-spacing: 1px;
  text-shadow: var(--border-glow);
  box-shadow: var(--border-glow);
  transition: all 0.3s ease;
}

.btn-scan:hover:not(:disabled) {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.3), rgba(150, 0, 0, 0.2));
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
}

.btn-scan:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  border-color: var(--text-muted);
  color: var(--text-muted);
  box-shadow: none;
}

.alert-list {
  list-style: none;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.alert-item {
  background-color: var(--bg-secondary);
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-radius: 6px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.alert-item:hover {
  background-color: var(--bg-tertiary);
  border-color: rgba(239, 68, 68, 0.3);
}

.alert-item.active {
  background-color: rgba(239, 68, 68, 0.05);
  border-color: var(--accent-red);
  box-shadow: inset 0 0 8px rgba(239, 68, 68, 0.1);
}

.alert-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.alert-item-name {
  font-family: 'Share Tech Mono', monospace;
  font-size: 14px;
  font-weight: bold;
}

.alert-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: bold;
  text-transform: uppercase;
}

.badge-unknown {
  background-color: rgba(148, 163, 184, 0.15);
  color: var(--text-muted);
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.badge-critical {
  background-color: rgba(239, 68, 68, 0.15);
  color: var(--accent-red);
  border: 1px solid rgba(239, 68, 68, 0.3);
  animation: alert-pulse 1.5s infinite alternate;
}

.badge-mitigated {
  background-color: rgba(34, 197, 94, 0.15);
  color: var(--accent-green);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.alert-item-type {
  font-size: 11px;
  color: var(--text-muted);
}

/* Center Workspace */
.center-workspace {
  display: flex;
  flex-direction: column;
  background-color: rgba(8, 11, 17, 0.5);
  overflow-y: auto;
  position: relative;
}

.scanner-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(8, 11, 17, 0.96);
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 20;
  gap: 20px;
}

.scan-radar {
  width: 120px;
  height: 120px;
  border: 2px solid var(--accent-red);
  border-radius: 50%;
  position: relative;
  animation: spin 3s linear infinite;
  box-shadow: var(--border-glow);
}

.scan-radar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 50%;
  height: 50%;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.5), transparent);
  border-radius: 100% 0 0 0;
  transform-origin: 100% 100%;
}

.scanner-text {
  font-family: 'Share Tech Mono', monospace;
  color: var(--accent-red);
  font-size: 15px;
  letter-spacing: 2px;
  text-shadow: var(--border-glow);
}

.scanner-progress-bar {
  width: 300px;
  height: 4px;
  background-color: var(--bg-tertiary);
  border-radius: 2px;
  overflow: hidden;
}

.scanner-progress-fill {
  height: 100%;
  width: 0%;
  background-color: var(--accent-red);
  box-shadow: var(--border-glow);
}

/* Welcome page */
.welcome-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  flex: 1;
  text-align: center;
  padding: 40px;
  gap: 20px;
}

.welcome-icon {
  font-size: 64px;
  color: var(--accent-red);
  text-shadow: var(--border-glow);
  opacity: 0.8;
}

.welcome-title {
  font-family: 'Share Tech Mono', monospace;
  font-size: 26px;
  color: var(--text-main);
}

.welcome-desc {
  max-width: 500px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* Details Panel */
.incident-detail-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 24px;
  gap: 20px;
}

.incident-header {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 16px;
}

.incident-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 8px;
}

.severity-badge {
  font-family: 'Share Tech Mono', monospace;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: bold;
}

.sev-critical {
  background-color: rgba(239, 68, 68, 0.2);
  color: var(--accent-red);
  border: 1px solid var(--accent-red);
}

.sev-high {
  background-color: rgba(245, 158, 11, 0.2);
  color: var(--accent-amber);
  border: 1px solid var(--accent-amber);
}

.indicator-source {
  font-family: 'Share Tech Mono', monospace;
  font-size: 13px;
  color: var(--text-muted);
}

.incident-desc-card {
  background-color: var(--bg-secondary);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  padding: 16px;
}

.card-title {
  font-family: 'Share Tech Mono', monospace;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.incident-desc-text {
  font-size: 14px;
  line-height: 1.6;
}

/* Sandbox and Forms */
.remediation-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sandbox-area {
  background-color: #04060b;
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 6px;
  padding: 20px;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.9);
}

.sandbox-ui {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ui-description {
  font-size: 13px;
  color: var(--text-muted);
}

.code-editor {
  font-family: 'Fira Code', monospace;
  font-size: 13px;
  color: #a6accd;
  line-height: 1.6;
  overflow-x: auto;
}

.code-line {
  display: flex;
  gap: 12px;
  padding: 2px 4px;
  border-radius: 3px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.code-line:hover {
  background-color: rgba(255, 255, 255, 0.04);
}

.code-line.vulnerable-line {
  background-color: rgba(239, 68, 68, 0.06);
  border-left: 2px solid var(--accent-red);
}

.code-line.selected-line {
  background-color: rgba(239, 68, 68, 0.1) !important;
  border-left: 2px solid var(--accent-red) !important;
}

.line-num {
  width: 20px;
  text-align: right;
  color: #4b526d;
}

.code-content {
  white-space: pre;
}

.config-toggle-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.config-card {
  background-color: var(--bg-secondary);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.config-label {
  font-size: 12px;
  font-weight: bold;
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 22px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-tertiary);
  transition: .4s;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: var(--text-muted);
  transition: .4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: rgba(34, 197, 94, 0.2);
  border-color: var(--accent-green);
}

input:checked + .slider:before {
  transform: translateX(22px);
  background-color: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
}

.patch-selector-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.patch-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background-color: var(--bg-secondary);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.patch-option:hover {
  background-color: var(--bg-tertiary);
  border-color: rgba(239, 68, 68, 0.25);
}

.patch-option input[type="radio"] {
  accent-color: var(--accent-red);
}

.patch-option-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.patch-version {
  font-family: 'Share Tech Mono', monospace;
  font-size: 13px;
  font-weight: bold;
}

.patch-desc {
  font-size: 11px;
  color: var(--text-muted);
}

.sandbox-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 16px;
  margin-top: 12px;
}

.btn-action {
  padding: 8px 18px;
  border-radius: 4px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary {
  background-color: transparent;
  border: 1px solid var(--text-muted);
  color: var(--text-muted);
}

.btn-secondary:hover {
  border-color: var(--text-main);
  color: var(--text-main);
}

.btn-primary {
  background-color: rgba(239, 68, 68, 0.1);
  border: 1px solid var(--accent-red);
  color: var(--accent-red);
  box-shadow: var(--border-glow);
}

.btn-primary:hover:not(:disabled) {
  background-color: rgba(239, 68, 68, 0.2);
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.3);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Terminal Console logs */
.terminal-console {
  background-color: #030509;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  padding: 12px 16px;
  font-family: 'Fira Code', monospace;
  font-size: 12px;
  height: 120px;
  overflow-y: auto;
  color: #94a3b8;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.terminal-line {
  line-height: 1.4;
  white-space: pre-wrap;
}

.term-cmd {
  color: var(--accent-red);
}

.term-success {
  color: var(--accent-green);
}

.term-error {
  color: var(--accent-red);
}

.term-info {
  color: var(--accent-amber);
}

/* Reference Study Cards */
.reference-sidebar {
  background-color: rgba(15, 19, 26, 0.6);
  border-left: 1px solid var(--border-color);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
}

.reference-card {
  background-color: var(--bg-secondary);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 6px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ref-title {
  font-family: 'Share Tech Mono', monospace;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent-red);
  border-bottom: 1px solid rgba(239, 68, 68, 0.08);
  padding-bottom: 6px;
}

.ref-term {
  font-weight: bold;
  font-size: 12px;
  color: var(--text-main);
  margin-top: 4px;
}

.ref-definition {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Visual Remediation Explanations and Diffs */
.remediation-explanation {
  font-size: 13px;
  line-height: 1.6;
  margin-top: 10px;
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.02);
  padding: 14px;
  border-radius: 6px;
  border-left: 3px solid var(--accent-red);
}

.diff-box {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-family: 'Fira Code', monospace;
  font-size: 12px;
}

.diff-title {
  font-family: 'Share Tech Mono', monospace;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.diff-line-item {
  display: flex;
  flex-direction: column;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.diff-before {
  background-color: rgba(239, 68, 68, 0.1);
  border-left: 3px solid var(--accent-red);
  padding: 8px 12px;
  color: #ff9999;
  white-space: pre-wrap;
}

.diff-after {
  background-color: rgba(34, 197, 94, 0.08);
  border-left: 3px solid var(--accent-green);
  padding: 8px 12px;
  color: #b3ffa6;
  white-space: pre-wrap;
}

/* Animations */
@keyframes spin {
  100% {
    transform: rotate(360deg);
  }
}

@keyframes pulse-glow-red {
  0% {
    text-shadow: 0 0 5px rgba(239, 68, 68, 0.2);
  }
  100% {
    text-shadow: 0 0 15px rgba(239, 68, 68, 0.6);
  }
}

@keyframes alert-pulse {
  0% {
    box-shadow: 0 0 2px rgba(239, 68, 68, 0.1);
    background-color: rgba(239, 68, 68, 0.1);
  }
  100% {
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.35);
    background-color: rgba(239, 68, 68, 0.25);
  }
}
