:root {
  --bg-primary: #07070c;
  --bg-card: rgba(18, 18, 28, 0.85);
  --bg-surface: #10101a;
  --border-color: rgba(239, 68, 68, 0.2);
  --border-glow: rgba(239, 68, 68, 0.4);
  --accent-crimson: #ef4444;
  --accent-purple: #7928ca;
  --accent-cyan: #00c7b7;
  --accent-amber: #f59e0b;
  --accent-emerald: #10b981;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(239, 68, 68, 0.08) 0%, transparent 45%),
    radial-gradient(circle at 90% 80%, rgba(121, 40, 202, 0.08) 0%, transparent 45%);
}

.app-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.5rem;
  width: 100%;
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.shield-pulse {
  width: 44px;
  height: 44px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid var(--accent-crimson);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-crimson);
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.35);
}

h1 {
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.highlight {
  color: var(--accent-crimson);
  text-shadow: 0 0 14px rgba(239, 68, 68, 0.4);
}

.tagline {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.header-badges {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.badge {
  font-family: 'Fira Code', monospace;
  font-size: 0.75rem;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  border: 1px solid rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
}

.github-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-main);
  text-decoration: none;
  background: var(--bg-surface);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  font-size: 0.85rem;
  transition: all 0.2s ease;
}

.github-btn:hover {
  border-color: var(--accent-crimson);
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.3);
}

/* Grid Layout */
.main-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 1.5rem;
  flex: 1;
}

@media (max-width: 950px) {
  .main-grid {
    grid-template-columns: 1fr;
  }
}

.panel {
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Sample Buttons */
.sample-picker {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.sample-btn {
  background: var(--bg-surface);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  padding: 0.25rem 0.5rem;
  border-radius: 5px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sample-btn:hover {
  border-color: var(--accent-crimson);
  background: rgba(239, 68, 68, 0.15);
}

/* Textarea Input */
.textarea-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
}

textarea {
  width: 100%;
  background: rgba(8, 8, 14, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 1rem;
  color: #fff;
  font-family: 'Fira Code', monospace;
  font-size: 0.9rem;
  resize: vertical;
  min-height: 180px;
  transition: border-color 0.2s ease;
  line-height: 1.5;
}

textarea:focus {
  outline: none;
  border-color: var(--accent-crimson);
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.25);
}

.input-meta {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
  font-family: 'Fira Code', monospace;
}

/* Action Bar */
.action-bar {
  display: flex;
  gap: 0.8rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.4rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}

.btn-scan {
  background: linear-gradient(135deg, #b91c1c, var(--accent-crimson));
  color: #fff;
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
  flex: 1;
}

.btn-scan:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.6);
}

.btn-secondary {
  background: var(--bg-surface);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
}

.btn-secondary:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.25);
}

/* Sanitizer Box */
.sanitizer-box {
  background: rgba(16, 185, 129, 0.05);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 10px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sanitizer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sanitizer-header h4 {
  color: var(--accent-emerald);
  font-size: 0.9rem;
}

.copy-btn {
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid var(--accent-emerald);
  color: #fff;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  font-size: 0.75rem;
  cursor: pointer;
}

.sanitized-text {
  font-family: 'Fira Code', monospace;
  font-size: 0.85rem;
  color: #d1fae5;
  background: rgba(0, 0, 0, 0.4);
  padding: 0.75rem;
  border-radius: 6px;
  white-space: pre-wrap;
  word-break: break-word;
}

.sanitizer-note {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Telemetry & Threat Meter */
.threat-status {
  font-family: 'Fira Code', monospace;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
}

.threat-status.safe { background: rgba(16, 185, 129, 0.2); color: var(--accent-emerald); }
.threat-status.low { background: rgba(0, 199, 183, 0.2); color: var(--accent-cyan); }
.threat-status.medium { background: rgba(245, 158, 11, 0.2); color: var(--accent-amber); }
.threat-status.critical { background: rgba(239, 68, 68, 0.2); color: var(--accent-crimson); box-shadow: 0 0 10px rgba(239, 68, 68, 0.4); }

.meter-card {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 1.25rem;
  border-radius: 12px;
}

.meter-circle {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: conic-gradient(var(--accent-crimson) 0%, rgba(255, 255, 255, 0.05) 0%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.6);
  position: relative;
  flex-shrink: 0;
}

.meter-circle::before {
  content: '';
  position: absolute;
  width: 78px;
  height: 78px;
  border-radius: 50%;
  background: var(--bg-surface);
}

.meter-score {
  position: relative;
  font-family: 'Fira Code', monospace;
  font-size: 1.3rem;
  font-weight: 800;
}

.meter-label {
  position: relative;
  font-size: 0.6rem;
  color: var(--text-muted);
}

.meter-info h4 {
  font-size: 1.1rem;
  margin-bottom: 0.3rem;
}

.meter-info p {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Vectors List */
.vectors-card, .audit-card {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 1rem;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.vectors-card h4, .audit-card h4 {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.vector-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.vector-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.6rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.02);
  font-size: 0.8rem;
}

.vector-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  margin-right: 0.6rem;
}

.vector-item.triggered .vector-status-dot {
  background: var(--accent-crimson);
  box-shadow: 0 0 8px var(--accent-crimson);
}

.vector-item.triggered {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.vector-name {
  flex: 1;
}

.vector-badge {
  font-family: 'Fira Code', monospace;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Audit Findings */
.audit-findings {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.8rem;
  max-height: 140px;
  overflow-y: auto;
}

.finding-item {
  padding: 0.4rem 0.6rem;
  background: rgba(239, 68, 68, 0.08);
  border-left: 3px solid var(--accent-crimson);
  border-radius: 4px;
}

.finding-empty {
  color: var(--text-muted);
  font-style: italic;
  padding: 0.4rem 0;
}

/* Footer */
.app-footer {
  text-align: center;
  padding-top: 1.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.app-footer a {
  color: var(--accent-crimson);
  text-decoration: none;
}
