/**
 * TERRASCOPE AI - Modern Design System & Stylesheet v3.0
 * Features: Glassmorphism, CSS Grid, Responsive, Accessible, Print-Optimized
 * New: Toast notifications, Skeletons, Mobile hamburger menu, Stats counter,
 *      Smooth scroll animations, Enhanced cards, Floating labels
 */

/* ============================================================
   CSS Custom Properties (Design Tokens)
   ============================================================ */
:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Color Palette */
  --bg-dark:        #0a0e17;
  --bg-surface:     #111827;
  --bg-card:        rgba(17, 24, 39, 0.85);
  --bg-card-hover:  rgba(31, 41, 55, 0.95);
  --bg-input:       #1e293b;

  --border:         rgba(255, 255, 255, 0.08);
  --border-hover:   rgba(255, 255, 255, 0.15);
  --border-focus:   #38bdf8;

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

  --primary:        #3b82f6;
  --primary-hover:  #2563eb;
  --primary-glow:   rgba(59, 130, 246, 0.25);

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

  --radius-xs:   4px;
  --radius-sm:   6px;
  --radius-md:   12px;
  --radius-lg:   18px;
  --radius-xl:   24px;
  --radius-full: 9999px;

  --shadow-sm:   0 2px 4px rgba(0, 0, 0, 0.2);
  --shadow-md:   0 4px 14px rgba(0, 0, 0, 0.35);
  --shadow-lg:   0 10px 30px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 25px rgba(59, 130, 246, 0.3);
  --shadow-glow-emerald: 0 0 20px rgba(16, 185, 129, 0.25);

  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================
   Base Reset & Defaults
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-dark);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-image:
    radial-gradient(at 0% 0%,   rgba(59, 130, 246, 0.12) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.08) 0px, transparent 50%),
    radial-gradient(at 50% 50%,  rgba(99, 102, 241, 0.04) 0px, transparent 60%);
  background-attachment: fixed;
}

a {
  color: var(--accent-cyan);
  text-decoration: none;
  transition: var(--transition);
}

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

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

img { max-width: 100%; height: auto; }

/* ============================================================
   Navigation Bar
   ============================================================ */
.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 2rem;
  background: rgba(10, 14, 23, 0.88);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.brand-logo {
  height: 40px;
  width: auto;
  transition: var(--transition);
}

.brand-logo:hover { transform: scale(1.04); }

.nav-links {
  display: flex;
  align-items: center;
  list-style: none;
  gap: 0.25rem;
}

.nav-link {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  white-space: nowrap;
}

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

.nav-link.active {
  color: #60a5fa;
}

.nav-auth {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

/* Hamburger Menu (Mobile) */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 6px;
  transition: var(--transition);
}

.nav-toggle:hover { background: rgba(255, 255, 255, 0.07); }

.nav-toggle span {
  display: block;
  height: 2px;
  background: var(--text-muted);
  border-radius: 2px;
  transition: var(--transition);
}

.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.65rem 1.35rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.5);
  transform: translateY(-1px);
  color: white;
}

.btn-outline {
  background: transparent;
  color: var(--text-main);
  border-color: var(--border);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-hover);
  color: var(--text-main);
}

.btn-success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  box-shadow: var(--shadow-glow-emerald);
}

.btn-success:hover {
  background: linear-gradient(135deg, #059669, #047857);
  transform: translateY(-1px);
  color: white;
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
}

.btn-sm {
  padding: 0.4rem 0.85rem;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 0.85rem 2rem;
  font-size: 1.05rem;
  border-radius: var(--radius-lg);
}

/* ============================================================
   Hero Section & Search Bar
   ============================================================ */
.hero {
  padding: 4rem 1.5rem 2.5rem;
  text-align: center;
  max-width: 920px;
  margin: 0 auto;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 1.1rem;
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: var(--radius-full);
  color: #60a5fa;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  animation: fadeInDown 0.6s ease;
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

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

@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

.hero-title {
  font-size: clamp(2.1rem, 5vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 1.1rem;
  animation: fadeInUp 0.7s ease 0.1s both;
}

.gradient-text {
  background: linear-gradient(135deg, #60a5fa 0%, #38bdf8 50%, #34d399 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-desc {
  color: var(--text-muted);
  font-size: 1.15rem;
  max-width: 680px;
  margin: 0 auto 2.5rem;
  animation: fadeInUp 0.7s ease 0.2s both;
}

/* ============================================================
   Search Bar Component
   ============================================================ */
.search-container {
  position: relative;
  max-width: 660px;
  margin: 0 auto;
}

.search-box {
  display: flex;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-lg);
  padding: 0.5rem 0.6rem 0.5rem 1.25rem;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  transition: var(--transition);
  gap: 0.5rem;
}

.search-box:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2), var(--shadow-lg);
}

.search-icon {
  color: var(--text-dim);
  font-size: 1.2rem;
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 1.05rem;
  font-family: inherit;
  outline: none;
  min-width: 0;
}

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

.search-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.btn-locate {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: var(--text-muted);
  padding: 0.55rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  font-size: 1rem;
}

.btn-locate:hover {
  background: rgba(255, 255, 255, 0.15);
  color: var(--accent-cyan);
}

/* Autocomplete Dropdown */
.autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  list-style: none;
  overflow: hidden;
  z-index: 200;
  display: none;
  max-height: 320px;
  overflow-y: auto;
}

.autocomplete-dropdown.show { display: block; }

.autocomplete-item {
  padding: 0.8rem 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition: var(--transition);
}

.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover,
.autocomplete-item.active {
  background: rgba(59, 130, 246, 0.12);
  color: #93c5fd;
}

.autocomplete-sub {
  color: var(--text-dim);
  font-size: 0.8rem;
}

/* Quick Chips */
.quick-chips {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.quick-chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 0.3rem 0.9rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.quick-chip:hover {
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
  border-color: rgba(59, 130, 246, 0.4);
  transform: translateY(-1px);
}

/* ============================================================
   Stats Counter Row
   ============================================================ */
.stats-row {
  display: flex;
  justify-content: center;
  gap: 3rem;
  padding: 2.5rem 1.5rem;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.stat-item {
  text-align: center;
}

.stat-number {
  font-size: 2.25rem;
  font-weight: 800;
  line-height: 1;
  background: linear-gradient(135deg, #60a5fa, #34d399);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
  font-weight: 500;
}

/* ============================================================
   Container
   ============================================================ */
.container {
  width: 100%;
  max-width: 1260px;
  margin: 0 auto;
  padding: 1.5rem;
  flex: 1;
}

/* ============================================================
   Skeleton Loaders
   ============================================================ */
.skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.09) 37%, rgba(255,255,255,0.04) 63%);
  background-size: 400px 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: var(--radius-sm);
}

.skeleton-line {
  height: 14px;
  margin-bottom: 0.6rem;
  border-radius: var(--radius-full);
}

.skeleton-line:last-child { width: 70%; }

.skeleton-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  overflow: hidden;
}

.skeleton-score {
  width: 80px;
  height: 80px;
  border-radius: 50%;
}

/* ============================================================
   Executive Header
   ============================================================ */
.executive-header {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-bottom: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.5rem;
  box-shadow: var(--shadow-md);
}

.location-meta h1 {
  font-size: 2rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.location-meta p {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin-top: 0.3rem;
}

.score-display {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

/* Circular Score Gauge */
.gauge-container {
  position: relative;
  width: 90px;
  height: 90px;
}

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

.gauge-circle-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 8;
}

.gauge-circle-fill {
  fill: none;
  stroke: var(--accent-emerald);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 226;
  stroke-dashoffset: 226;
  transition: stroke-dashoffset 1.2s ease-in-out, stroke 0.5s ease;
}

.gauge-value {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text-main);
}

.gauge-grade { display: flex; flex-direction: column; }

.grade-pill {
  font-size: 1.85rem;
  font-weight: 900;
  line-height: 1;
  color: var(--accent-emerald);
}

.grade-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.action-buttons {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ============================================================
   AI Executive Briefing Card
   ============================================================ */
.ai-briefing-card {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.85), rgba(15, 23, 42, 0.95));
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.75rem;
  position: relative;
  box-shadow: var(--shadow-md);
}

.ai-briefing-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(59,130,246,0.04), transparent 60%);
  pointer-events: none;
}

.ai-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.ai-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.3rem 0.8rem;
  border-radius: var(--radius-full);
  border: 1px solid rgba(56, 189, 248, 0.2);
}

.ai-verdict {
  font-size: 1.05rem;
  line-height: 1.6;
  color: #e2e8f0;
  margin-bottom: 1.25rem;
}

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

.ai-column {
  background: rgba(0, 0, 0, 0.2);
  padding: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.ai-column h3,
.ai-column h4 {
  font-size: 0.88rem;
  font-weight: 700;
  margin-bottom: 0.7rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.ai-column.strengths h3,
.ai-column.strengths h4     { color: #34d399; }
.ai-column.considerations h3,
.ai-column.considerations h4 { color: #fbbf24; }
.ai-column.travel h3,
.ai-column.travel h4        { color: #38bdf8; }

.ai-list { list-style: none; }

.ai-list li {
  font-size: 0.86rem;
  color: var(--text-muted);
  margin-bottom: 0.45rem;
  position: relative;
  padding-left: 1.2rem;
  line-height: 1.5;
}

.ai-list li::before {
  content: "▸";
  position: absolute;
  left: 0;
  color: var(--text-dim);
  font-size: 0.7rem;
  top: 0.15rem;
}

/* ============================================================
   Persona Suitability
   ============================================================ */
.persona-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.75rem;
}

.section-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

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

.persona-card {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  padding: 1rem;
  text-align: center;
  transition: var(--transition);
  cursor: default;
}

.persona-card:hover {
  transform: translateY(-3px);
  background: rgba(59, 130, 246, 0.07);
  border-color: rgba(59, 130, 246, 0.2);
}

.persona-icon { font-size: 1.85rem; margin-bottom: 0.4rem; }

.persona-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.persona-score {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text-main);
}

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

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #10b981);
  border-radius: var(--radius-full);
  transition: width 1.1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================
   Interactive Map
   ============================================================ */
.map-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  margin-bottom: 1.75rem;
  overflow: hidden;
}

.map-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.7rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

#map {
  width: 100%;
  height: 400px;
  border-radius: var(--radius-md);
  z-index: 10;
}

/* ============================================================
   16 Core Metrics Grid
   ============================================================ */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 1.1rem;
  margin-bottom: 2rem;
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: var(--transition);
  cursor: default;
}

.metric-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.14);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.metric-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.metric-title-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.metric-icon { font-size: 1.2rem; }

.metric-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
}

/* Badges */
.badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.badge-success { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.badge-info    { background: rgba(56, 189, 248, 0.15); color: #38bdf8; }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.badge-danger  { background: rgba(239, 68, 68, 0.15);  color: #f87171; }

.metric-score-group {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  margin-bottom: 0.6rem;
}

.metric-score-num {
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1;
}

.metric-score-pct {
  font-size: 0.82rem;
  color: var(--text-dim);
}

.metric-details {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-top: 0.6rem;
}

/* ============================================================
   Real-Time Widgets Grid
   ============================================================ */
.widgets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.1rem;
  margin-bottom: 2.5rem;
}

.widget-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: var(--transition);
}

.widget-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
}

.widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

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

.weather-stats {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-top: 0.75rem;
  gap: 1rem;
}

.weather-temp {
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1;
}

.weather-sub {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-top: 0.3rem;
}

.air-quality-badge {
  font-size: 1.15rem;
  font-weight: 700;
  margin-top: 0.3rem;
}

/* ============================================================
   Toast Notification System
   ============================================================ */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none;
  max-width: 380px;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: #1e293b;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  pointer-events: all;
  animation: slideInRight 0.3s ease;
  position: relative;
  overflow: hidden;
}

.toast::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: var(--toast-color, #3b82f6);
  animation: toastProgress var(--toast-duration, 4s) linear forwards;
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(100%); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes slideOutRight {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(100%); }
}

@keyframes toastProgress {
  from { width: 100%; }
  to   { width: 0%; }
}

.toast.hiding { animation: slideOutRight 0.3s ease forwards; }

.toast-icon { font-size: 1.2rem; flex-shrink: 0; margin-top: 0.05rem; }

.toast-body { flex: 1; }
.toast-title { font-size: 0.88rem; font-weight: 700; color: var(--text-main); }
.toast-message { font-size: 0.82rem; color: var(--text-muted); margin-top: 0.15rem; line-height: 1.4; }

.toast-close {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 1rem;
  padding: 0.1rem;
  line-height: 1;
  flex-shrink: 0;
  transition: var(--transition);
}

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

.toast.toast-success { --toast-color: #10b981; }
.toast.toast-error   { --toast-color: #ef4444; }
.toast.toast-warning { --toast-color: #f59e0b; }
.toast.toast-info    { --toast-color: #3b82f6; }

/* ============================================================
   Comparison Mode Layout
   ============================================================ */
.compare-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 1rem;
  align-items: center;
  margin-bottom: 2rem;
}

.compare-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-top: 1.5rem;
}

.compare-table th,
.compare-table td {
  padding: 0.9rem 1.25rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.compare-table th {
  background: rgba(255, 255, 255, 0.04);
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.compare-table tr:last-child td { border-bottom: none; }
.compare-table tr:hover td { background: rgba(255, 255, 255, 0.02); }

.winner-pill {
  background: rgba(16, 185, 129, 0.18);
  color: #34d399;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.loser-score { color: var(--text-dim); }

/* ============================================================
   Forms & Authentication
   ============================================================ */
.auth-wrapper {
  max-width: 460px;
  margin: 3.5rem auto;
  padding: 2.25rem;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
}

.auth-header {
  text-align: center;
  margin-bottom: 1.75rem;
}

.auth-header h1,
.auth-header h2 {
  font-size: 1.75rem;
  font-weight: 800;
}

.auth-header p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 0.35rem;
}

.auth-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.form-group { margin-bottom: 1.25rem; }

.form-label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 0.45rem;
  color: #cbd5e1;
}

.form-input {
  width: 100%;
  padding: 0.78rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.95rem;
  transition: var(--transition);
}

.form-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.18);
}

.form-input.is-invalid {
  border-color: #f43f5e;
  box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.15);
}

.form-input.is-valid {
  border-color: #10b981;
}

.form-hint {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: 0.35rem;
}

.form-error {
  font-size: 0.78rem;
  color: #f87171;
  margin-top: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.password-strength {
  margin-top: 0.5rem;
}

.strength-bar-bg {
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 0.25rem;
}

.strength-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: var(--transition-slow);
}

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

.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.radio-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.88rem;
}

/* ============================================================
   Saved Places / History Cards
   ============================================================ */
.place-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  transition: var(--transition);
}

.place-card:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
  transform: translateX(3px);
}

.place-card-info { flex: 1; min-width: 0; }
.place-card-name {
  font-weight: 700;
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.place-card-meta {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.place-card-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* ============================================================
   Feature Cards (Landing Page)
   ============================================================ */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
}

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

.feature-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, #3b82f6, #10b981);
  opacity: 0;
  transition: var(--transition);
}

.feature-card:hover {
  transform: translateY(-4px);
  border-color: rgba(59, 130, 246, 0.3);
  box-shadow: var(--shadow-md), 0 0 15px rgba(59, 130, 246, 0.1);
}

.feature-card:hover::before { opacity: 1; }

.feature-icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
  display: block;
}

.feature-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text-main);
}

.feature-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.55;
}

/* ============================================================
   Footer
   ============================================================ */
footer {
  margin-top: auto;
  padding: 2rem;
  text-align: center;
  border-top: 1px solid var(--border);
  background: rgba(10, 14, 23, 0.95);
  color: var(--text-dim);
  font-size: 0.88rem;
}

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

.footer-links {
  display: flex;
  gap: 1.5rem;
}

.footer-links a {
  color: var(--text-dim);
  font-size: 0.85rem;
  transition: var(--transition);
}

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

/* ============================================================
   Alerts & Info Boxes
   ============================================================ */
.alert {
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.alert-info    { background: rgba(56, 189, 248, 0.08); border: 1px solid rgba(56, 189, 248, 0.2); color: #7dd3fc; }
.alert-success { background: rgba(16, 185, 129, 0.08); border: 1px solid rgba(16, 185, 129, 0.2); color: #6ee7b7; }
.alert-warning { background: rgba(245, 158, 11, 0.08); border: 1px solid rgba(245, 158, 11, 0.2); color: #fcd34d; }
.alert-danger  { background: rgba(239, 68, 68, 0.08);  border: 1px solid rgba(239, 68, 68, 0.2);  color: #fca5a5; }

/* ============================================================
   Empty State
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-dim);
}

.empty-state-icon {
  font-size: 3.5rem;
  margin-bottom: 1rem;
  opacity: 0.6;
}

.empty-state h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.empty-state p {
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

/* ============================================================
   Print Optimization
   ============================================================ */
@media print {
  body {
    background: #ffffff !important;
    color: #111827 !important;
  }
  .navbar, .search-container, .action-buttons, footer, #map,
  #toast-container, .nav-toggle, .quick-chips {
    display: none !important;
  }
  .executive-header, .ai-briefing-card, .metric-card, .widget-card {
    background: #ffffff !important;
    border: 1px solid #e5e7eb !important;
    color: #111827 !important;
    box-shadow: none !important;
    break-inside: avoid;
  }
  .gradient-text {
    -webkit-text-fill-color: #1d4ed8;
    color: #1d4ed8;
  }
  .metric-name, h1, h2, h3, h4 { color: #111827 !important; }
  .ai-verdict, .ai-list li, .metric-details, .text-muted { color: #374151 !important; }
}

/* ============================================================
   Responsive: Tablet (≤1024px)
   ============================================================ */
@media (max-width: 1024px) {
  .nav-links { gap: 0.5rem; }
}

/* ============================================================
   Responsive: Mobile (≤768px)
   ============================================================ */
@media (max-width: 768px) {
  .navbar {
    padding: 0.75rem 1rem;
    flex-wrap: wrap;
    position: relative;
  }

  .nav-toggle {
    display: flex;
    order: 2;
  }

  .nav-links,
  .nav-auth {
    display: none;
    width: 100%;
    order: 3;
  }

  .nav-links.open,
  .nav-auth.open {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 0.75rem 0;
    gap: 0.25rem;
  }

  .nav-auth.open {
    flex-direction: row;
    align-items: center;
    padding-top: 0;
    border-top: 1px solid var(--border);
    margin-top: 0.5rem;
  }

  .nav-link {
    padding: 0.6rem 0.5rem;
    width: 100%;
  }

  .hero { padding: 2.5rem 1rem 1.5rem; }
  .hero-title { font-size: clamp(1.75rem, 8vw, 2.5rem); }
  .hero-desc { font-size: 1rem; }

  .search-box { padding: 0.4rem 0.5rem 0.4rem 1rem; }

  .stats-row { gap: 1.5rem; }
  .stat-number { font-size: 1.75rem; }

  .executive-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .score-display {
    width: 100%;
    justify-content: flex-start;
  }

  .action-buttons { width: 100%; }

  .metrics-grid { grid-template-columns: 1fr; }

  .compare-inputs,
  .compare-cards { grid-template-columns: 1fr; }

  .ai-columns { grid-template-columns: 1fr; }

  .widgets-grid { grid-template-columns: 1fr; }

  .footer-content { flex-direction: column; text-align: center; }
  .footer-links { justify-content: center; }

  #map { height: 280px; }

  #toast-container {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    max-width: none;
  }
}

/* ============================================================
   Responsive: Small mobile (≤480px)
   ============================================================ */
@media (max-width: 480px) {
  .btn { padding: 0.55rem 1rem; font-size: 0.9rem; }
  .auth-wrapper { margin: 2rem 1rem; padding: 1.5rem; }
  .compare-table { font-size: 0.82rem; }
  .compare-table th, .compare-table td { padding: 0.65rem 0.75rem; }
}
