@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Outfit:wght@500;600;700&display=swap");

:root {
  --bg: #030712;
  --surface: #0f172a;
  --glass: rgba(255, 255, 255, 0.03);
  --glass-strong: rgba(255, 255, 255, 0.06);
  --glass-border: rgba(255, 255, 255, 0.1);
  --text: #f8fafc;
  --muted: #94a3b8;
  --brand: #22d3ee;
  --brand-glow: rgba(34, 211, 238, 0.25);
  --accent-purple: #a855f7;
  --accent-green: #10b981;
  --accent-red: #ef4444;
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.5);
  --speed: 0.3s;
}

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

body {
  min-height: 100vh;
  background-color: var(--bg);
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(34, 211, 238, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(168, 85, 247, 0.08) 0%, transparent 40%);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  line-height: 1.5;
  overflow-x: hidden;
}

/* Dashboard Layout */
.dashboard-root {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

aside.sidebar {
  background: var(--glass);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border-right: 1px solid var(--glass-border);
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.brand-section h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  background: linear-gradient(to right, var(--brand), var(--accent-purple));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

main.content {
  padding: 40px;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

/* Glass Components */
.glass-panel {
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--shadow-lg);
  transition: transform var(--speed) ease;
}

.glass-panel:hover {
  transform: translateY(-2px);
}

/* Typography Overrides */
h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.75rem;
  margin-bottom: 24px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
}

.section-title span {
  width: 32px;
  height: 2px;
  background: var(--brand);
}

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

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

.form-group label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

input, textarea, select {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 12px 16px;
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  transition: all var(--speed);
}

input:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 0 4px var(--brand-glow);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--speed);
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--brand);
  color: var(--bg);
}

.btn-primary:hover {
  background: #67e8f9;
  transform: scale(1.02);
  box-shadow: 0 0 20px var(--brand-glow);
}

.btn-secondary {
  background: var(--glass-strong);
  color: var(--text);
  border-color: var(--glass-border);
}

.btn-secondary:hover {
  background: var(--glass-border);
}

/* Campaign Cards */
.campaign-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 24px;
}

.campaign-card {
  position: relative;
  overflow: hidden;
}

.campaign-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--brand);
}

.campaign-status {
  display: flex;
  justify-content: space-between;
  margin-top: 16px;
  font-size: 0.875rem;
}

.progress-bar-bg {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  margin-top: 12px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(to right, var(--brand), var(--accent-purple));
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Status Pills */
.pill {
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.pill-pending { background: rgba(148, 163, 184, 0.1); color: var(--muted); }
.pill-running { background: rgba(34, 211, 238, 0.1); color: var(--brand); animation: pulse 2s infinite; }
.pill-completed { background: rgba(16, 185, 129, 0.1); color: var(--accent-green); }
.pill-failed { background: rgba(239, 68, 68, 0.12); color: var(--accent-red); }

@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: 0.5; }
  100% { opacity: 1; }
}

/* Terminal / Log Styles */
.terminal {
  background: #000;
  border-radius: 12px;
  padding: 16px;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.875rem;
  color: #10b981;
  max-height: 300px;
  overflow-y: auto;
}

/* Results Table */
.table-container {
  overflow-x: auto;
  margin-top: 24px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  padding: 16px;
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  border-bottom: 1px solid var(--glass-border);
}

td {
  padding: 16px;
  border-bottom: 1px solid var(--glass-border);
  font-size: 0.9375rem;
}

tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Responsive */
@media (max-width: 1024px) {
  .dashboard-root {
    grid-template-columns: 1fr;
  }
  aside.sidebar {
    display: none;
  }
}

/* Utility Classes for Clean HTML */
.sidebar-nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sidebar-nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  transition: color var(--speed);
}

.sidebar-nav-link.active { color: var(--brand); font-weight: 600; }
.sidebar-nav-link.inactive { color: var(--muted); }
.sidebar-nav-link.inactive:hover { color: var(--text); }

.sidebar-footer-box {
  margin-top: auto;
  padding-top: 24px;
  border-top: 1px solid var(--glass-border);
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

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

.panel-header-stack {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
}

.stack-small { display: flex; flex-direction: column; gap: 8px; }
.stack-medium { display: flex; flex-direction: column; gap: 16px; }
.stack-large { display: flex; flex-direction: column; gap: 24px; }
.flex-row-gap { display: flex; gap: 12px; flex-wrap: wrap; }

/* Final Polish Classes */
.panel-inset {
  padding: 16px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 12px;
}

.sidebar-status-box {
  padding: 16px;
  border-radius: 12px;
  font-size: 0.875rem;
}

.text-muted-sm {
  color: var(--muted);
  font-size: 0.875rem;
}

.mb-4 { margin-bottom: 4px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-32 { margin-top: 32px; }

.w-full { width: 100%; }
.flex-1 { flex: 1; }

.business-title { font-weight: 600; color: var(--text); }
.business-subtitle { font-size: 0.75rem; color: var(--muted); }
.business-address { font-size: 0.8125rem; }
.business-phone { font-size: 0.75rem; color: var(--brand); }
.star-icon { color: #fbbf24; font-size: 0.75rem; }

/* Spacing & Layout Utilities */
.p-16 { padding: 16px; }
.br-12 { border-radius: 12px; }
.w-full { width: 100%; }
.flex-1 { flex: 1; }
.flex-row-gap-8 { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.flex-center-gap-4 { display: flex; align-items: center; gap: 4px; }
.icon-w-12 { width: 12px; text-align: center; }

/* Typography Utilities */
.font-outfit { font-family: 'Outfit', sans-serif; }
.font-bold { font-weight: 600; }
.font-sm { font-size: 0.8125rem; }
.font-tiny { font-size: 0.7rem; }

/* Color & Special Utilities */
.bg-white-05 { background: rgba(255, 255, 255, 0.05); }
.active-border { border-left: 4px solid var(--brand); }

/* Final Element Utilities */
.dot-status { background: var(--accent-red); }
.dot-completed { background: var(--accent-green); }
.dot-running { background: var(--brand); }
.dot-pending { background: var(--muted); }
.dot-failed { background: var(--accent-red); }
.bg-accent-red { background: var(--accent-red); }
.bg-accent-green { background: var(--brand); }
.preset-btn { font-size: 0.75rem; padding: 6px 12px; }

/* Button Variations */
.btn-tiny { padding: 4px 8px; font-size: 0.7rem; }
.btn-icon-sm { padding: 6px 10px; font-size: 0.75rem; }

/* Dashboard Structural Layout */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 32px;
}

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

.results-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.results-summary-value {
  display: block;
  margin-top: 8px;
  font-size: 1.4rem;
  font-family: 'Outfit', sans-serif;
  color: var(--text);
}

.results-empty-box {
  padding: 40px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--glass-border);
  border-radius: 12px;
}

/* Polished Sync States */
.pill-syncing { 
  background: rgba(168, 85, 247, 0.1); 
  color: var(--accent-purple); 
  animation: pulse 1.5s infinite ease-in-out; 
}
.pill-error { 
  background: rgba(239, 68, 68, 0.1); 
  color: var(--accent-red); 
}

/* Button & Layout Refinement */
.btn-group { display: flex; gap: 4px; }
.mt-20 { margin-top: 20px; }
.tooltip-box {
  font-size: 0.75rem;
  background: var(--glass-strong);
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--glass-border);
}
/* Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 32px;
  height: 18px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--glass-strong);
  transition: .4s;
  border-radius: 34px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 12px;
  width: 12px;
  left: 3px;
  bottom: 3px;
  background-color: var(--text);
  transition: .4s;
  border-radius: 50%;
}
input:checked + .slider { background-color: var(--brand); }
input:checked + .slider:before { transform: translateX(14px); }

/* Coverage Map */
#germany-map-svg-container {
  width: 100%;
  height: 480px;
  position: relative;
  overflow: hidden;
}

.map-city-dot {
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.1));
}

.map-city-dot:hover {
  transform: scale(1.6);
  filter: drop-shadow(0 0 12px var(--brand));
  fill: var(--text) !important;
}

.map-city-dot.completed { 
  fill: var(--accent-green); 
  filter: drop-shadow(0 0 6px rgba(16, 185, 129, 0.4)); 
}

.map-city-dot.running { 
  fill: var(--brand); 
  animation: pulse-glow 2s infinite; 
}

.map-city-dot.pending { 
  fill: var(--muted); 
  opacity: 0.3; 
}

.map-city-dot.failed {
  fill: var(--accent-red);
  filter: drop-shadow(0 0 6px rgba(239, 68, 68, 0.35));
}

.map-city-label {
  font-size: 9px;
  font-weight: 500;
  fill: var(--text);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.map-city-dot:hover + .map-city-label {
  opacity: 1;
}

@keyframes pulse-glow {
  0% { filter: drop-shadow(0 0 2px var(--brand)); opacity: 1; }
  50% { filter: drop-shadow(0 0 15px var(--brand)); opacity: 0.7; }
  100% { filter: drop-shadow(0 0 2px var(--brand)); opacity: 1; }
}

/* Utilities */
.p-24 { padding: 24px; }
.br-16 { border-radius: 16px; }
.mr-4 { margin-right: 4px; }
.ml-12 { margin-left: 12px; }
.mr-8 { margin-right: 8px; }
.ml-8 { margin-left: 8px; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.mode-toggle-wrap { display: flex; align-items: center; }

@media (max-width: 720px) {
  .results-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
