/* CSS variables for consistent enterprise branding */
:root {
  --bg-main: #0a0c10;
  --bg-panel: rgba(18, 22, 32, 0.65);
  --border-color: rgba(255, 255, 255, 0.07);
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  
  /* Glowing Brand Palette */
  --primary: #06b6d4;      /* Cyan */
  --primary-glow: rgba(6, 182, 212, 0.3);
  --success: #10b981;      /* Emerald Green */
  --success-glow: rgba(16, 185, 129, 0.3);
  --warning: #f59e0b;      /* Amber */
  --warning-glow: rgba(245, 158, 11, 0.3);
  --danger: #ef4444;       /* Rose Red */
  --danger-glow: rgba(239, 68, 68, 0.3);
  --purple: #8b5cf6;       /* Violet */
  --purple-glow: rgba(139, 92, 246, 0.3);
  
  --font-sans: 'Outfit', sans-serif;
  --font-mono: 'Space Grotesk', monospace;
}

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

body {
  background-color: var(--bg-main);
  background-image: radial-gradient(circle at 10% 20%, rgba(6, 182, 212, 0.05) 0%, transparent 60%),
                    radial-gradient(circle at 90% 80%, rgba(139, 92, 246, 0.05) 0%, transparent 60%);
  color: var(--text-main);
  font-family: var(--font-sans);
  min-height: 100vh;
  line-height: 1.5;
  padding: 2rem;
  overflow-x: hidden;
}

.app-container {
  max-width: 1400px;
  margin: 0 auto;
}

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

.logo-area {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo-shield {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--primary), var(--purple));
  border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
  position: relative;
  box-shadow: 0 0 15px var(--primary-glow);
  animation: logo-float 4s ease-in-out infinite alternate;
}

.logo-shield::after {
  content: '🛡️';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.25rem;
}

@keyframes logo-float {
  0% { transform: translateY(0) rotate(0deg); }
  100% { transform: translateY(-4px) rotate(5deg); }
}

.logo-text h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.05em;
  background: linear-gradient(to right, #ffffff, #9ca3af);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

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

.system-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(16, 185, 129, 0.05);
  border: 1px solid rgba(16, 185, 129, 0.15);
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.05);
}

.status-pulse {
  width: 8px;
  height: 8px;
  background-color: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--success);
  animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(0.9); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.5; }
  100% { transform: scale(0.9); opacity: 1; }
}

.status-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--success);
}

/* Glassmorphism Panel styles */
.glass {
  background: var(--bg-panel);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.glass:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

/* Grid Layout */
.dashboard-grid {
  display: grid;
  grid-template-columns: 350px 1fr;
  grid-template-rows: auto auto;
  gap: 1.5rem;
}

.control-panel {
  grid-column: 1;
  grid-row: 1 / 3;
}

.map-panel {
  grid-column: 2;
  grid-row: 1;
}

.details-panel {
  grid-column: 2;
  grid-row: 2;
}

/* General Panel Headings */
.panel h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  letter-spacing: -0.02em;
}

.panel-desc {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
}

/* Control actions & inputs */
.control-actions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.input-group label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.input-group select, .input-group input {
  background: rgba(10, 12, 16, 0.6);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-main);
  padding: 0.6rem 0.8rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input-group select:focus, .input-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 8px var(--primary-glow);
}

/* Company scrape — primary input, visually distinct */
.company-scrape-group {
  background: rgba(6, 182, 212, 0.04);
  border: 1px solid rgba(6, 182, 212, 0.2);
  border-radius: 8px;
  padding: 0.75rem;
}

.company-scrape-group label {
  font-size: 0.85rem !important;
  color: var(--primary) !important;
  font-weight: 600 !important;
  letter-spacing: 0.01em;
}

.company-scrape-group input {
  font-size: 1rem !important;
  padding: 0.75rem 1rem !important;
  border-color: rgba(6, 182, 212, 0.3) !important;
}

.company-scrape-group input:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 12px var(--primary-glow) !important;
}

.input-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.75rem 1rem;
  cursor: pointer;
  border: none;
  font-family: var(--font-sans);
  transition: all 0.2s ease;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--purple));
  color: #ffffff;
  box-shadow: 0 4px 15px rgba(6, 182, 212, 0.2);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(6, 182, 212, 0.35);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.separator {
  border: 0;
  height: 1px;
  background: var(--border-color);
  margin: 1.5rem 0;
}

/* Bright Data tools section */
.brightdata-status h3 {
  font-size: 0.95rem;
  color: var(--text-main);
  margin-bottom: 0.75rem;
  font-weight: 600;
}

.tool-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.tool-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
}

.tool-name {
  font-size: 0.8rem;
  font-weight: 500;
}

.badge {
  font-size: 0.7rem;
  padding: 0.25rem 0.5rem;
  border-radius: 9999px;
  font-weight: 600;
}

.badge-success {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

/* State Coordinator Map */
.pipeline-visualizer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 2rem 0;
  position: relative;
  padding: 0 1rem;
}

.step-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  z-index: 2;
  width: 120px;
  transition: all 0.3s ease;
}

.node-icon {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.03);
  border: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
}

.node-label {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.15rem;
}

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

.node-status {
  font-size: 0.65rem;
  font-weight: 600;
  margin-top: 0.35rem;
  text-transform: uppercase;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  border: 1px solid var(--border-color);
}

.step-connector {
  flex-grow: 1;
  height: 2px;
  background: var(--border-color);
  margin: 0 -10px;
  margin-top: -35px;
  position: relative;
  z-index: 1;
  transition: all 0.3s ease;
}

/* Visual Node States (Active, Done, Failed) */
.step-node.active .node-icon {
  border-color: var(--primary);
  background: rgba(6, 182, 212, 0.1);
  box-shadow: 0 0 15px var(--primary-glow);
  animation: node-pulse 1.5s infinite alternate;
}

.step-node.active .node-status {
  color: var(--primary);
  border-color: rgba(6, 182, 212, 0.3);
  background: rgba(6, 182, 212, 0.1);
}

.step-node.completed .node-icon {
  border-color: var(--success);
  background: rgba(16, 185, 129, 0.1);
  box-shadow: 0 0 15px var(--success-glow);
}

.step-node.completed .node-status {
  color: var(--success);
  border-color: rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.1);
}

.step-node.failed .node-icon {
  border-color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
  box-shadow: 0 0 15px var(--danger-glow);
}

.step-node.failed .node-status {
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.1);
}

.step-connector.completed {
  background: linear-gradient(90deg, var(--success), var(--success));
  box-shadow: 0 0 8px var(--success);
}

.step-connector.active {
  background: linear-gradient(90deg, var(--success), var(--primary));
  box-shadow: 0 0 8px var(--primary-glow);
}

@keyframes node-pulse {
  0% { transform: scale(1); }
  100% { transform: scale(1.05); }
}

/* Orchestration Console */
.simulation-console {
  background: #07090d;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-family: var(--font-mono);
  overflow: hidden;
  margin-top: 1.5rem;
}

.console-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border-color);
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

.console-header button {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font-mono);
}

.console-header button:hover {
  color: var(--text-main);
}

.console-body {
  padding: 0.8rem 1.2rem;
  max-height: 150px;
  overflow-y: auto;
  font-size: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.log-line {
  line-height: 1.4;
  word-break: break-all;
}

.log-success { color: var(--success); }
.log-info { color: var(--primary); }
.log-warning { color: var(--warning); }
.log-danger { color: var(--danger); }
.text-muted { color: var(--text-muted); }

/* Details Tab Section */
.tabs-header {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1rem;
  padding-bottom: 0.25rem;
}

.tab-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  cursor: pointer;
  position: relative;
  transition: color 0.2s ease;
}

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

.tab-btn.active {
  color: var(--primary);
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -0.3rem;
  left: 0;
  right: 0;
  height: 2px;
  background-color: var(--primary);
  box-shadow: 0 0 8px var(--primary-glow);
}

.tab-content h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.tab-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.json-viewer {
  background: #07090d;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 1rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  max-height: 250px;
  overflow-y: auto;
  color: #a7f3d0; /* Soft green */
  white-space: pre-wrap;
  line-height: 1.5;
}

.hidden {
  display: none !important;
}

/* Metric cards inside tabs */
.risk-summary {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}

.metric-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  padding: 0.75rem 1.25rem;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 120px;
}

.metric-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 500;
}

.metric-value {
  font-size: 1.5rem;
  font-weight: 700;
  font-family: var(--font-mono);
}

.text-glow {
  text-shadow: 0 0 10px var(--primary-glow);
}

/* Scrape callback panel details */
.scrape-job-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(6, 182, 212, 0.05);
  border: 1px solid rgba(6, 182, 212, 0.15);
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
}

.job-id-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.scrape-job-info code {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
}

/* Outreach card list */
.outreach-drafts-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: 250px;
  overflow-y: auto;
}

.outreach-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: border-color 0.2s ease;
}

.outreach-card:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

.outreach-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.4rem;
  font-weight: 500;
}

.outreach-subject {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
}

.outreach-body {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: pre-wrap;
  background: #07090d;
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
}

/* Layman View Styles */
.layman-view {
  margin-bottom: 1rem;
}

.layman-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  line-height: 1.6;
}

.layman-card h4 {
  font-size: 1.05rem;
  color: var(--text-main);
  font-weight: 600;
}

.layman-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.layman-prop {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.layman-prop-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 500;
}

.layman-prop-value {
  font-size: 0.88rem;
  color: var(--text-main);
  font-weight: 500;
}

.layman-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  background: rgba(10, 12, 16, 0.4);
  padding: 0.75rem;
  border-radius: 6px;
  border-left: 3px solid var(--primary);
}

.compliance-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.compliance-chip {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  background: rgba(139, 92, 246, 0.15);
  color: var(--purple);
  border: 1px solid rgba(139, 92, 246, 0.3);
}

/* Enriched targets table */
.layman-table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: rgba(10, 12, 16, 0.4);
}

.layman-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.85rem;
}

.layman-table th {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-muted);
  font-weight: 600;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.75rem;
  text-transform: uppercase;
}

.layman-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  vertical-align: middle;
}

.layman-table tr:last-child td {
  border-bottom: none;
}

.tech-tag {
  display: inline-block;
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  background: rgba(6, 182, 212, 0.1);
  color: var(--primary);
  border: 1px solid rgba(6, 182, 212, 0.25);
  margin-right: 0.25rem;
  margin-bottom: 0.25rem;
}

.developer-json-toggle {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.5rem;
}

.toggle-json-btn {
  font-size: 0.75rem !important;
  padding: 0.4rem 0.8rem !important;
  background: rgba(255, 255, 255, 0.04) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 4px !important;
}

.toggle-json-btn:hover {
  background: rgba(255, 255, 255, 0.08) !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
}

