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

/* --- GEOGRAPHIC STYLE SYSTEM --- */
:root {
  --bg-deep: #030712;
  --bg-panel: rgba(17, 24, 39, 0.45);
  --bg-panel-solid: #111827;
  --bg-hover: rgba(31, 41, 55, 0.7);
  
  --border-light: rgba(255, 255, 255, 0.05);
  --border-hover: rgba(255, 255, 255, 0.12);
  
  --text-main: #f9fafb;
  --text-sub: #9ca3af;
  --text-muted: #4b5563;
  
  /* Status/Hazard Color System */
  --color-good: #10b981;
  --color-good-rgb: 16, 185, 129;
  
  --color-moderate: #f59e0b;
  --color-moderate-rgb: 245, 158, 11;
  
  --color-hazard: #ef4444;
  --color-hazard-rgb: 239, 68, 68;

  /* Theme Accents */
  --color-air: #22d3ee;
  --color-air-rgb: 34, 211, 238;
  
  --color-money: #fbbf24;
  --color-money-rgb: 251, 191, 36;
  
  --color-transit: #f87171;
  --color-transit-rgb: 248, 113, 113;
  
  --font-title: 'Outfit', sans-serif;
  --font-sans: 'Inter', sans-serif;
  
  --transition-smooth: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-fast: all 0.25s ease;
}

/* --- RESET & BASIC STYLES --- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: var(--font-sans);
}

html, body {
  background-color: var(--bg-deep);
  color: var(--text-main);
  scroll-behavior: smooth;
  overflow-x: hidden;
  line-height: 1.6;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-deep);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.18);
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* --- AMBIENT GLOW BUBBLES --- */
.bg-glow-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -10;
  overflow: hidden;
  pointer-events: none;
}

.glow-bubble {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.12;
  animation: float-around 28s infinite alternate ease-in-out;
}

.glow-bubble-air {
  top: 15%;
  left: 10%;
  width: 35vw;
  height: 35vw;
  background: radial-gradient(circle, rgba(var(--color-air-rgb), 0.8) 0%, rgba(0,0,0,0) 70%);
}

.glow-bubble-money {
  bottom: 10%;
  right: 15%;
  width: 40vw;
  height: 40vw;
  background: radial-gradient(circle, rgba(var(--color-money-rgb), 0.8) 0%, rgba(0,0,0,0) 70%);
  animation-delay: -7s;
  animation-duration: 32s;
}

.glow-bubble-transit {
  top: 45%;
  left: 55%;
  width: 30vw;
  height: 30vw;
  background: radial-gradient(circle, rgba(var(--color-transit-rgb), 0.8) 0%, rgba(0,0,0,0) 70%);
  animation-delay: -14s;
  animation-duration: 24s;
}

.grid-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    linear-gradient(rgba(255, 255, 255, 0.01) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.01) 1px, transparent 1px);
  background-size: 80px 80px;
}

@keyframes float-around {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(4%, 6%) scale(1.08); }
  100% { transform: translate(-4%, -4%) scale(0.96); }
}

/* --- GLASS CARD COMPONENTS --- */
.glass-card {
  background: var(--bg-panel);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-light);
  border-radius: 24px;
  transition: var(--transition-smooth);
}

.glass-card:hover {
  border-color: var(--border-hover);
  box-shadow: 0 12px 40px -12px rgba(0, 0, 0, 0.7);
}

/* --- HEADER & NAVIGATION --- */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
  border-bottom: 1px solid var(--border-light);
  background: rgba(3, 7, 18, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 70px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-title);
  font-size: 1.45rem;
  font-weight: 800;
  text-decoration: none;
  color: var(--text-main);
  letter-spacing: -0.5px;
}

.logo-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-air), var(--color-transit));
  box-shadow: 0 0 10px var(--color-air);
}

.logo span {
  background: linear-gradient(135deg, #fff 40%, var(--text-sub) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-accent {
  background: linear-gradient(135deg, var(--color-air) 0%, var(--color-transit) 100%) !important;
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.nav-links {
  display: flex;
  gap: 28px;
  list-style: none;
}

.nav-links a {
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  color: var(--text-sub);
  transition: var(--transition-fast);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text-main);
}

/* Local status pill in header */
.header-geo-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 600;
}

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

@keyframes pulse {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.4; }
  100% { transform: scale(1); opacity: 1; }
}

/* --- HERO SECTION --- */
.hero {
  padding: 80px 0 40px 0;
  text-align: center;
  position: relative;
}

.hero h1 {
  font-family: var(--font-title);
  font-size: 3.5rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -1.5px;
  max-width: 800px;
  margin: 0 auto 16px auto;
  background: linear-gradient(135deg, #ffffff 40%, #c7d2fe 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p {
  font-size: 1.15rem;
  color: var(--text-sub);
  max-width: 620px;
  margin: 0 auto 32px auto;
}

/* City Selection Controller */
.city-control-center {
  max-width: 580px;
  margin: 0 auto;
  position: relative;
  z-index: 50;
}

.search-container {
  display: flex;
  align-items: center;
  background: var(--bg-panel-solid);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 8px 16px;
  gap: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  transition: var(--transition-fast);
}

.search-container:hover {
  border-color: var(--border-hover);
}

.search-icon {
  font-size: 1.25rem;
  color: var(--text-sub);
}

.active-city-display {
  flex: 1;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.active-city-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.active-city-name {
  font-family: var(--font-title);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main);
}

.dropdown-trigger-icon {
  font-size: 0.8rem;
  color: var(--text-sub);
  transition: var(--transition-fast);
}

.search-container.open .dropdown-trigger-icon {
  transform: rotate(180deg);
}

/* Dropdown Menu */
.city-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  margin-top: 8px;
  background: #111827;
  border: 1px solid var(--border-light);
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
  padding: 8px;
  display: none;
  flex-direction: column;
  gap: 4px;
  z-index: 100;
}

.search-container.open + .city-dropdown-menu {
  display: flex;
}

.dropdown-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-radius: 12px;
  cursor: pointer;
  transition: var(--transition-fast);
  text-decoration: none;
  color: var(--text-sub);
}

.dropdown-item:hover,
.dropdown-item.active {
  background: var(--bg-hover);
  color: var(--text-main);
}

.item-city-details {
  display: flex;
  align-items: center;
  gap: 12px;
}

.item-flag {
  font-size: 1.25rem;
}

.item-name-block {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.item-city-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.item-city-country {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.item-triad-summary {
  display: flex;
  gap: 10px;
  font-size: 0.75rem;
  font-weight: 700;
}

.item-summary-pill {
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.03);
}

.pill-air { color: var(--color-air); }
.pill-money { color: var(--color-money); }
.pill-transit { color: var(--color-transit); }

/* --- THE LOCAL TRIAD DISPLAY GRID --- */
.triad-dashboard-section {
  padding: 40px 0 80px 0;
}

.triad-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
  margin-bottom: 40px;
}

.metric-widget-card {
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  overflow: hidden;
}

/* Metric specific indicator stripes */
.metric-widget-card::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 4px;
  transition: var(--transition-smooth);
}

.card-air::after { background: var(--color-air); }
.card-money::after { background: var(--color-money); }
.card-transit::after { background: var(--color-transit); }

/* Widget header details */
.widget-meta {
  margin-bottom: 20px;
}

.widget-meta h3 {
  font-family: var(--font-title);
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.widget-meta p {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

/* Circular ring structure */
.gauge-wrapper {
  position: relative;
  width: 130px;
  height: 130px;
  margin-bottom: 24px;
}

.gauge-svg {
  transform: rotate(-90deg);
  width: 130px;
  height: 130px;
}

.gauge-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.03);
  stroke-width: 10;
}

.gauge-fill {
  fill: none;
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 345.4; /* 2 * PI * r (r=55) */
  stroke-dashoffset: 345.4;
  transition: stroke-dashoffset 0.8s cubic-bezier(0.16, 1, 0.3, 1), stroke 0.4s ease;
}

/* Default Colors of the rings */
.card-air .gauge-fill { stroke: var(--color-air); filter: drop-shadow(0 0 8px rgba(var(--color-air-rgb), 0.4)); }
.card-money .gauge-fill { stroke: var(--color-money); filter: drop-shadow(0 0 8px rgba(var(--color-money-rgb), 0.4)); }
.card-transit .gauge-fill { stroke: var(--color-transit); filter: drop-shadow(0 0 8px rgba(var(--color-transit-rgb), 0.4)); }

/* Dynamic Status Glow classes overridden by JS */
.status-good { stroke: var(--color-good) !important; filter: drop-shadow(0 0 8px rgba(var(--color-good-rgb), 0.5)) !important; }
.status-moderate { stroke: var(--color-moderate) !important; filter: drop-shadow(0 0 8px rgba(var(--color-moderate-rgb), 0.5)) !important; }
.status-hazard { stroke: var(--color-hazard) !important; filter: drop-shadow(0 0 8px rgba(var(--color-hazard-rgb), 0.5)) !important; }

.gauge-center-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.gauge-center-val {
  font-family: var(--font-title);
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1;
}

.gauge-center-unit {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-sub);
  margin-top: 2px;
}

/* Advisory message box */
.widget-advice-box {
  width: 100%;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 14px;
  padding: 16px;
  min-height: 110px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.advice-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-sub);
  margin-bottom: 6px;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.advice-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.advice-text {
  font-size: 0.85rem;
  color: var(--text-main);
  line-height: 1.4;
}

/* --- THE COMPARISON ENGINE SECTION --- */
.comparison-section {
  padding: 80px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.comparison-layout {
  display: grid;
  grid-template-columns: 460px 1fr;
  gap: 48px;
  align-items: start;
}

.comparison-text h2 {
  font-family: var(--font-title);
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 16px;
}

.comparison-text p {
  color: var(--text-sub);
  font-size: 1.05rem;
  margin-bottom: 28px;
}

.benchmarks-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.benchmark-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-radius: 14px;
}

.benchmark-num-badge {
  font-family: var(--font-title);
  font-size: 1.1rem;
  font-weight: 700;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.num-badge-air { background: rgba(var(--color-air-rgb), 0.1); color: var(--color-air); }
.num-badge-money { background: rgba(var(--color-money-rgb), 0.1); color: var(--color-money); }
.num-badge-transit { background: rgba(var(--color-transit-rgb), 0.1); color: var(--color-transit); }

.benchmark-details h4 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.benchmark-details p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0;
}

/* Visualization Panel */
.comparison-visualization-panel {
  padding: 32px;
  min-height: 360px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

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

.chart-header h3 {
  font-family: var(--font-title);
  font-size: 1.25rem;
  font-weight: 700;
}

.chart-legend {
  display: flex;
  gap: 16px;
  font-size: 0.8rem;
  font-weight: 600;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-dot-active {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-air); /* updates via JS helper */
}

.legend-dot-global {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
}

/* SVG Chart Layout */
.chart-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

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

.chart-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-sub);
}

.chart-bar-label-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
}

.label-title-air { color: var(--color-air); }
.label-title-money { color: var(--color-money); }
.label-title-transit { color: var(--color-transit); }

.bar-track-wrapper {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bar-track {
  width: 100%;
  height: 14px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 7px;
  position: relative;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 7px;
  width: 0%; /* animates via JS */
  transition: width 1s cubic-bezier(0.16, 1, 0.3, 1), background 0.4s ease;
}

.bar-fill-air { background: linear-gradient(90deg, #0ea5e9, var(--color-air)); }
.bar-fill-money { background: linear-gradient(90deg, #eab308, var(--color-money)); }
.bar-fill-transit { background: linear-gradient(90deg, #f87171, var(--color-transit)); }

.bar-fill-global {
  background: rgba(255, 255, 255, 0.15);
}

/* --- LOCALIZED ALERTS SUBSCRIPTION --- */
.alerts-subscribe-section {
  padding: 80px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.alerts-box {
  padding: 50px;
  border-radius: 28px;
  background: radial-gradient(circle at top right, rgba(var(--color-air-rgb), 0.1), transparent 40%),
              radial-gradient(circle at bottom left, rgba(var(--color-transit-rgb), 0.1), transparent 40%),
              var(--bg-panel);
  border: 1px solid var(--border-light);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: center;
}

.alerts-intro h2 {
  font-family: var(--font-title);
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 12px;
}

.alerts-intro p {
  color: var(--text-sub);
  font-size: 1rem;
}

.alerts-form-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-inputs-row {
  display: flex;
  gap: 12px;
}

.form-inputs-row input[type="email"] {
  flex: 1;
  background: rgba(5, 8, 17, 0.5);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 14px 18px;
  color: var(--text-main);
  outline: none;
  font-size: 0.95rem;
}

.form-inputs-row input[type="email"]:focus {
  border-color: var(--color-air);
}

.form-inputs-row button {
  background: #fff;
  color: #000;
  border: none;
  border-radius: 12px;
  padding: 14px 24px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.form-inputs-row button:hover {
  background: #e5e7eb;
}

.alerts-options-selector {
  display: flex;
  gap: 16px;
}

.alert-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-sub);
  cursor: pointer;
}

.alert-checkbox-label input {
  accent-color: var(--color-air);
  width: 16px;
  height: 16px;
}

/* --- FOOTER --- */
footer {
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  padding: 30px 0;
  background: rgba(3, 7, 18, 0.9);
}

.footer-content-clean {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

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

.footer-links-row {
  display: flex;
  gap: 60px;
}

.footer-links-column h4 {
  font-family: var(--font-title);
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-main);
  margin-bottom: 16px;
  letter-spacing: 0.5px;
}

.footer-links-column ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer-links-column a {
  text-decoration: none;
  font-size: 0.9rem;
  color: var(--text-sub);
  transition: var(--transition-fast);
}

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

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.02);
  padding-top: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.footer-social-links {
  display: flex;
  gap: 20px;
}

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

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

/* --- RESPONSIVE ADAPTATIONS --- */
@media (max-width: 1024px) {
  .triad-dashboard-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .comparison-layout {
    grid-template-columns: 1fr;
    gap: 40px;
  }
  .alerts-box {
    grid-template-columns: 1fr;
    padding: 32px;
  }
}

@media (max-width: 768px) {
  .hero h1 {
    font-size: 2.5rem;
  }
  .navbar {
    flex-direction: column;
    height: auto;
    padding: 16px 0;
    gap: 12px;
  }
  .footer-content {
    flex-direction: column;
    gap: 32px;
  }
  .footer-links-row {
    width: 100%;
    justify-content: space-between;
  }
}
