/* Modern Dark Glassmorphic Design System for MicroAttribution Playground */
:root {
  --bg-primary: #070b14;
  --bg-secondary: #0d1424;
  --bg-card: rgba(15, 23, 42, 0.75);
  --bg-card-hover: rgba(26, 38, 66, 0.85);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(99, 102, 241, 0.5);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-indigo: #6366f1;
  --accent-purple: #8b5cf6;
  --accent-cyan: #06b6d4;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
}

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

body {
  background-color: var(--bg-primary);
  background-image:
    radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.12) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(6, 182, 212, 0.08) 0px, transparent 50%);
  color: var(--text-primary);
  font-family: var(--font-sans);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Header & Hero Section */
.app-header {
  border-bottom: 1px solid var(--border-color);
  background: rgba(7, 11, 20, 0.85);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 1rem 2rem;
}

.header-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

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

.logo-badge {
  background: linear-gradient(135deg, var(--accent-indigo), var(--accent-purple));
  color: #fff;
  font-weight: 800;
  font-size: 0.875rem;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.4);
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.brand-subtitle {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.meta-pill {
  font-size: 0.75rem;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.meta-pill.highlight {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
  border-color: rgba(16, 185, 129, 0.3);
  font-weight: 600;
}

.header-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  transition: color 0.2s;
}

.header-links a:hover {
  color: var(--text-primary);
}

/* Main Layout Grid */
.main-container {
  max-width: 1400px;
  margin: 1.5rem auto;
  padding: 0 1.5rem 3rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 1024px) {
  .dashboard-grid {
    display: grid;
    grid-template-columns: 460px 1fr;
    gap: 1.5rem;
    align-items: start;
  }
}

/* Glass Card */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  margin-bottom: 1.5rem;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.card-title {
  font-size: 1.125rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-badge {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-indigo);
  border: 1px solid rgba(99, 102, 241, 0.3);
}

/* Preset Scenario Bar */
.preset-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.btn-preset {
  font-size: 0.75rem;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-preset:hover {
  background: rgba(99, 102, 241, 0.15);
  color: var(--text-primary);
  border-color: var(--accent-indigo);
}

/* Touchpoint Button Matrix */
.button-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.625rem;
  margin-bottom: 1.25rem;
}

.btn-touchpoint {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
  font-size: 0.8125rem;
  font-weight: 500;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.btn-touchpoint span.cost {
  font-size: 0.6875rem;
  color: var(--text-muted);
}

.btn-touchpoint:hover {
  border-color: var(--accent-indigo);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.btn-touchpoint:active {
  transform: translateY(0);
}

/* Conversion Control Bar */
.conversion-bar {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: var(--radius-md);
  padding: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.conversion-input-group {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.conversion-input-group label {
  font-size: 0.75rem;
  color: var(--accent-emerald);
  font-weight: 600;
}

.conversion-input {
  background: var(--bg-primary);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  width: 90px;
}

.btn-convert {
  background: linear-gradient(135deg, #10b981, #059669);
  border: none;
  color: #fff;
  font-weight: 600;
  font-size: 0.8125rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
  transition: all 0.2s;
}

.btn-convert:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-clear {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-left: auto;
  transition: all 0.2s;
}

.btn-clear:hover {
  color: var(--accent-rose);
  border-color: var(--accent-rose);
}

/* Visual Timeline */
.timeline-container {
  max-height: 280px;
  overflow-y: auto;
  padding-right: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.timeline-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  animation: slideIn 0.2s ease-out;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-8px); }
  to { opacity: 1; transform: translateX(0); }
}

.timeline-step {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--text-muted);
  width: 24px;
}

.timeline-badge {
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
}

.badge-organic_search { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.badge-paid_search { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.badge-social { background: rgba(236, 72, 153, 0.2); color: #f472b6; }
.badge-email { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.badge-referral { background: rgba(139, 92, 246, 0.2); color: #a78bfa; }
.badge-direct { background: rgba(148, 163, 184, 0.2); color: #cbd5e1; }
.badge-conversion { background: rgba(16, 185, 129, 0.3); color: #10b981; font-weight: 700; border: 1px solid #10b981; }

.timeline-time {
  margin-left: auto;
  font-size: 0.6875rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Attribution Comparison Section */
.attribution-table-wrapper {
  overflow-x: auto;
  margin-bottom: 1.5rem;
}

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

.attribution-table th,
.attribution-table td {
  padding: 0.75rem 0.875rem;
  border-bottom: 1px solid var(--border-color);
}

.attribution-table th {
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(255, 255, 255, 0.02);
}

.attribution-table tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

.attribution-table td.numeric {
  font-family: var(--font-mono);
  font-weight: 500;
}

.attribution-table tr.total-row td {
  font-weight: 700;
  border-top: 2px solid var(--border-color);
  color: var(--accent-emerald);
}

/* Visual Bar Charts */
.chart-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.chart-row {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.bar-track {
  height: 20px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  position: relative;
}

.bar-segment {
  height: 100%;
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.625rem;
  font-weight: 600;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Status Indicator Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.875rem;
  margin-bottom: 1.25rem;
}

.stat-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem;
}

.stat-label {
  font-size: 0.6875rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
}

.stat-value.online {
  color: var(--accent-emerald);
}

.stat-value.offline {
  color: var(--accent-amber);
}

/* Network Toggle Switch */
.network-toggle-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
}

.toggle-label-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-emerald);
  box-shadow: 0 0 8px var(--accent-emerald);
  transition: all 0.3s;
}

.status-dot.offline {
  background: var(--accent-amber);
  box-shadow: 0 0 8px var(--accent-amber);
}

.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
}

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

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

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--accent-emerald);
}

input:checked + .slider:before {
  transform: translateX(22px);
}

/* Privacy Inspector Inputs */
.inspector-group {
  margin-bottom: 1.25rem;
}

.inspector-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.inspector-input {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  transition: border-color 0.2s;
}

.inspector-input:focus {
  outline: none;
  border-color: var(--accent-indigo);
}

.inspector-output {
  margin-top: 0.4rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent-cyan);
  word-break: break-all;
}

/* Action Console Log */
.console-box {
  background: #050811;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  height: 120px;
  overflow-y: auto;
  color: var(--text-secondary);
}

.log-entry {
  margin-bottom: 0.25rem;
}

.log-entry.success { color: var(--accent-emerald); }
.log-entry.warn { color: var(--accent-amber); }
.log-entry.error { color: var(--accent-rose); }
.log-entry.info { color: var(--accent-cyan); }
