/* ==========================================================================
   VELORA NEXUS — Design System & Theme Engine
   ========================================================================== */

:root {
  --bg-main: #060911;
  --bg-surface: #0b1120;
  --bg-card: #0f172a;
  --bg-card-hover: #162038;
  --bg-card-glass: rgba(15, 23, 42, 0.75);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-medium: rgba(255, 255, 255, 0.16);
  --border-glow: rgba(16, 185, 129, 0.35);

  --accent-emerald: #10b981;
  --accent-emerald-light: #34d399;
  --accent-emerald-glow: rgba(16, 185, 129, 0.2);
  --accent-cyan: #06b6d4;
  --accent-indigo: #6366f1;
  --accent-purple: #8b5cf6;
  --accent-rose: #f43f5e;
  --accent-amber: #f59e0b;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --text-code: #38bdf8;

  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 30px rgba(16, 185, 129, 0.18);
  --shadow-cyan: 0 0 30px rgba(6, 182, 212, 0.15);

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;
  --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  background-image: 
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(99, 102, 241, 0.15), transparent),
    radial-gradient(circle 600px at 100% 20%, rgba(16, 185, 129, 0.08), transparent),
    radial-gradient(circle 500px at 0% 80%, rgba(6, 182, 212, 0.06), transparent);
  background-attachment: fixed;
}

/* Background Grid Overlay */
.grid-bg {
  position: fixed;
  inset: 0;
  background-size: 40px 40px;
  background-image: 
    linear-gradient(to right, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  pointer-events: none;
  z-index: 0;
}

/* Container */
.container {
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  z-index: 1;
}

/* ==========================================================================
   Navigation Bar
   ========================================================================== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(6, 9, 17, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 16px 0;
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-main);
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #10b981, #06b6d4, #6366f1);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.3);
}

.brand-icon-inner {
  width: 100%;
  height: 100%;
  background: #090d16;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #ffffff 40%, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-badge {
  font-size: 0.65rem;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald-light);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-link {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.nav-link:hover, .nav-link.active {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.06);
}

.nav-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
  background: rgba(15, 23, 42, 0.8);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-emerald);
  box-shadow: 0 0 10px var(--accent-emerald);
  animation: pulse-dot 2s infinite ease-in-out;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.2); }
}

/* ==========================================================================
   Hero Section
   ========================================================================== */
.hero {
  padding: 48px 0 32px;
  text-align: center;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.25);
  padding: 6px 16px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  color: #a5b4fc;
  margin-bottom: 20px;
}

.hero h1 {
  font-size: 2.8rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 16px;
}

.hero h1 span.gradient {
  background: linear-gradient(135deg, #34d399, #06b6d4, #818cf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: 1.125rem;
  color: var(--text-muted);
  max-width: 780px;
  margin: 0 auto 36px;
}

/* ==========================================================================
   Prompt Command Box
   ========================================================================== */
.command-card {
  background: var(--bg-card-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-md);
  margin-bottom: 32px;
  transition: var(--transition);
}

.command-card:focus-within {
  border-color: var(--accent-emerald);
  box-shadow: var(--shadow-glow);
}

.command-input-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(6, 9, 17, 0.9);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  margin-bottom: 16px;
}

.command-icon {
  color: var(--accent-emerald);
  flex-shrink: 0;
}

.command-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--font-sans);
  font-size: 1.05rem;
  color: var(--text-main);
}

.command-input::placeholder {
  color: var(--text-dim);
}

.btn-primary {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 24px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.6);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.14);
}

/* Prompt Presets */
.preset-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.preset-chip {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  border-radius: var(--radius-full);
  padding: 4px 12px;
  font-size: 0.775rem;
  cursor: pointer;
  transition: var(--transition);
}

.preset-chip:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--border-medium);
}

/* Real-Time Parsed Tokens */
.parsed-tokens-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}

.token-box {
  background: rgba(6, 9, 17, 0.5);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
}

.token-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  margin-bottom: 2px;
}

.token-value {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-code);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.token-value.emerald { color: var(--accent-emerald-light); }
.token-value.cyan { color: var(--accent-cyan); }
.token-value.indigo { color: #a5b4fc; }
.token-value.amber { color: var(--accent-amber); }

/* ==========================================================================
   Telemetry & Live Engine Section
   ========================================================================== */
.telemetry-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 32px;
}

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

.console-card {
  background: #080c14;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.console-header {
  background: #0d1322;
  border-bottom: 1px solid var(--border-subtle);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.console-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.console-controls {
  display: flex;
  gap: 8px;
}

.console-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.75rem;
}

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

.console-logs {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 16px;
  height: 240px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: #cbd5e1;
}

.log-entry {
  display: flex;
  gap: 12px;
  line-height: 1.4;
}

.log-time {
  color: var(--text-dim);
  flex-shrink: 0;
}

.log-badge {
  font-size: 0.7rem;
  padding: 1px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}

.log-badge.info { background: rgba(6, 182, 212, 0.15); color: var(--accent-cyan); }
.log-badge.success { background: rgba(16, 185, 129, 0.15); color: var(--accent-emerald-light); }
.log-badge.stealth { background: rgba(99, 102, 241, 0.15); color: #a5b4fc; }
.log-badge.warning { background: rgba(245, 158, 11, 0.15); color: var(--accent-amber); }

.log-msg {
  word-break: break-all;
}

/* Engine Radar & Stealth Card */
.stealth-card {
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.stealth-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.stealth-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--accent-emerald-light);
}

.stealth-metric {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.stealth-metric:last-child {
  border-bottom: none;
}

.progress-bar-wrap {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: 4px;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #06b6d4);
  width: 0%;
  transition: width 0.3s ease;
}

/* ==========================================================================
   KPI Stats Grid
   ========================================================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-medium);
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--border-glow), transparent);
}

.stat-card.emerald::after { background: var(--accent-emerald); }
.stat-card.cyan::after { background: var(--accent-cyan); }
.stat-card.indigo::after { background: var(--accent-indigo); }
.stat-card.amber::after { background: var(--accent-amber); }

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.stat-number {
  font-size: 2rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-main);
  line-height: 1.1;
}

.stat-sub {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 6px;
}

/* ==========================================================================
   Data Studio & Table View
   ========================================================================== */
.data-studio {
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 48px;
  box-shadow: var(--shadow-md);
}

.studio-toolbar {
  padding: 16px 24px;
  background: #0d1424;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.search-input-wrap {
  position: relative;
  width: 260px;
}

.search-input {
  width: 100%;
  background: #080c16;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 12px 8px 32px;
  color: var(--text-main);
  font-size: 0.85rem;
  outline: none;
}

.search-input:focus {
  border-color: var(--accent-emerald);
}

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
}

.select-filter {
  background: #080c16;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--text-muted);
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
}

.select-filter:focus {
  border-color: var(--accent-emerald);
  color: var(--text-main);
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Data Table */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

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

.leads-table th {
  background: rgba(8, 12, 22, 0.9);
  padding: 12px 18px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.leads-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.leads-table tr:hover td {
  background: var(--bg-card-hover);
}

.biz-name {
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 2px;
}

.biz-category {
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* Badges */
.badge-no-website {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald-light);
  border: 1px solid rgba(16, 185, 129, 0.35);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.1);
}

.badge-has-website {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(100, 116, 139, 0.15);
  color: var(--text-muted);
  border: 1px solid rgba(100, 116, 139, 0.25);
}

.star-rating {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 700;
  color: var(--accent-amber);
}

.reviews-count {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.phone-link {
  font-family: var(--font-mono);
  color: #38bdf8;
  text-decoration: none;
}

.phone-link:hover { text-decoration: underline; }

.action-btn-icon {
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

.action-btn-icon:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  border-color: var(--border-medium);
}

/* ==========================================================================
   Architecture & Production Bridge Section
   ========================================================================== */
.architecture-section {
  padding: 48px 0;
  border-top: 1px solid var(--border-subtle);
}

.arch-header {
  text-align: center;
  margin-bottom: 40px;
}

.arch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
}

.arch-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 24px;
  transition: var(--transition);
}

.arch-card:hover {
  border-color: var(--border-medium);
  box-shadow: var(--shadow-sm);
}

.arch-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.arch-icon.green { background: rgba(16, 185, 129, 0.15); color: var(--accent-emerald); }
.arch-icon.cyan { background: rgba(6, 182, 212, 0.15); color: var(--accent-cyan); }
.arch-icon.indigo { background: rgba(99, 102, 241, 0.15); color: var(--accent-indigo); }

.arch-card h3 {
  font-size: 1.15rem;
  margin-bottom: 10px;
}

.arch-card p {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ==========================================================================
   Modal Dialog
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: #0f172a;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  max-width: 600px;
  width: 100%;
  padding: 28px;
  box-shadow: var(--shadow-md);
  position: relative;
}

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

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 1.5rem;
  cursor: pointer;
}

.modal-close:hover { color: var(--text-main); }

/* ==========================================================================
   Footer
   ========================================================================== */
footer {
  border-top: 1px solid var(--border-subtle);
  padding: 36px 0;
  margin-top: 40px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-dim);
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 12px;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
}

.footer-links a:hover { color: var(--text-main); }
