﻿/* Theme */
:root {
  --bg-light: #f0f2f3;       /* grey background */
  --surface: #ffffff;        /* white panels */
  --text: #1f2937;           /* dark text */
  --muted: #6b7280;          /* muted text */
  --primary: #1b7836;        /* requested primary */
  --ring: #e5e7eb;           /* light ring color */
  --shadow: rgba(0,0,0,0.08);
}

body.theme-light { background: var(--bg-light); color: var(--text); font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif; margin:0; }

.header { display:flex; align-items:center; justify-content:center; gap:24px; padding:16px 24px; background: var(--surface); border-bottom: 1px solid var(--ring); position: sticky; top:0; z-index: 10; position: relative; }
.brand { display:flex; align-items:center; gap:14px; }
.brand-logo { height:52px; width:auto; display:block; }
.brand-text { display:flex; flex-direction:column; }
.brand-title { margin:0; font-size:1.4rem; color: var(--primary); }
.brand-subtitle { margin:2px 0 0; color: var(--muted); font-size:0.9rem; }
.brand-link { color: var(--primary); text-decoration: none; font-weight: 600; }
.brand-link:hover { text-decoration: underline; }

/* Footer */
.footer { background: var(--surface); border-top: 1px solid var(--ring); padding: 16px 24px; text-align: center; margin-top: 8px; }
.footer-links { display:flex; justify-content:center; gap:28px; flex-wrap:wrap; }
.footer-links a { color: var(--primary); text-decoration:none; font-weight:600; font-size:0.9rem; }
.footer-links a:hover { text-decoration:underline; }
.footer-copy { margin-top:6px; font-size:0.78rem; color: var(--muted); }

.container { max-width: 1100px; margin: 0 auto; padding: 24px; }
.panel { background: var(--surface); border-radius: 14px; padding: 16px 16px 22px; box-shadow: 0 8px 24px var(--shadow); margin-bottom: 16px; }
.panel-title { margin: 0 0 12px; color: var(--primary); font-size: 1.2rem; }


/* --- Responsive cards grid (similar to your original) --- */
.viz-grid {
  display: flex;
  flex-flow: row wrap;
  justify-content: center;
  align-content: center;
  align-items: center;
}

.viz-card {
  display: flex;
  flex-direction: column;
  padding-right: 30px;
  padding-left: 30px;
}
.viz-title {
  font-weight: 700;
  margin-bottom: 8px;
}


.viz-badge {
  display:inline-block; margin-top:8px; padding: 4px 10px; border-radius: 999px;
  font-weight: 700; font-size: 0.85rem; color: #fff;
}

.dial-details {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  font-size: 0.9rem;
  color: var(--text);
}
.dial-details .detail-item {
  font-weight: 600;
}


/* Circular gauge for PM2.5 */
.gauge {
  --size: 180px; --gauge-color: var(--primary); --gauge-deg: 0deg;
  width: var(--size); height: var(--size); border-radius: 50%; margin: 8px auto 10px;
  display: grid; place-items: center;
  background: conic-gradient(var(--gauge-color) var(--gauge-deg), #d1d5db var(--gauge-deg));
  box-shadow: inset 0 0 0 16px #f7f7f8; position: relative;
}
.gauge-center {
  position: absolute; width: 62%; height: 62%; background: #f7f7f8;
  border-radius: 50%; display: grid; place-items: center; text-align: center; padding: 8px; border: 1px solid var(--ring);
}
.gauge-label { font-size: 0.8rem; color: var(--muted); }
.gauge-value { font-size: 1.6rem; font-weight: 800; color: var(--text); }

/* Horizontal bars for O3 / NO2 / CO */
.bar { height: 16px; background: #e5e7eb; border-radius: 999px; overflow: hidden; border: 1px solid var(--ring); }
.bar > span { display:block; height: 100%; width: 0%; background: var(--primary); transition: width 400ms ease; }
.bar-info { display:flex; justify-content:space-between; align-items:center; margin-top: 6px; }
.bar-value { font-weight: 700; }


/* --- AirNow-style dial stack --- */

.aq-dial {
  width: 280px;
  height: 280px;
  position: relative;
  font-size: 14px;
  color: white;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

.aq-dial.status-bar {
  display: none;
}

.aq-dial.small {
  width: 230px;
  height: 230px;
  font-size: 8px;
}

.aq-dial.col-sm-5 {
  top: 27px;
}

.aq-dial.noData {
  display: none !important;
}

@media all and (max-width: 1199px) {
  .aq-dial {
    width:260px;
    height: 260px;
    margin-top: 35px;
  }
}

@media all and (max-width: 767px) {
  .aq-dial-container {
    margin-bottom:20px;
  }

  @media all and (max-width: 767px) {
    .aq-dial { width: 220px; height: 220px; font-size: 10px; margin: auto; margin-top: 45px; }
  }


  .aq-dial {
    width: 220px;
    height: 220px;
    font-size: 10px;
    margin: auto;
    margin-top: 45px;
  }

  .aq-dial.small {
    width: 175px;
    height: 175px;
    font-size: 6px;
  }

  .marquee-col.marquee-location-col.col-sm-5 {
    margin-top: -10px;
  }
}

@media all and (max-width: 320px) {
  .aq-dial {
    height:275px;
    width: 275px;
    margin-top: 35px;
  }

  .marquee-col.marquee-location-col.col-sm-5 {
    margin-top: -15px;
    height: 35px;
  }
}

.aq-dial .aq-dial-background,.aq-dial .aq-dial-background2,.aq-dial .aq-dial-meter,.aq-dial .aq-dial-arrow,.aq-dial .aq-dial-status {
  width: 100%;
  height: 100%;
  position: absolute;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
  -khtml-user-drag: none;
  -moz-user-drag: none;
  -o-user-drag: none;
  user-drag: none;
}

.aq-dial .aq-dial-background {
  opacity: 0.7;
}

.aq-dial .aq-dial-background2 {
  opacity: 0.5;
}

.aq-dial .aq-dial-arrow {
  -webkit-transition: all 1.25s ease-in-out;
  -moz-transition: all 1.25s ease-in-out;
  -o-transition: all 1.25s ease-in-out;
  transition: all 1.25s ease-in-out;
  -webkit-transform-origin: center;
  -moz-transform-origin: center;
  -o-transform-origin: center;
  transform-origin: center;
}


.aq-dial .top-half {
  position: absolute;
  top: 55%;               /* just below the midline */
  left: 1%;
  width: 100%;
  height: 16%;            /* a slim band for AQI text */+
display: grid;
  place-items: center;
  pointer-events: none;
}
.aqi-top {
  font-weight: 800;
  font-size: 1.4rem;      /* adjust for small dial variants via media queries if needed */
  color: #ffffff;         /* neutral; could be dynamic via JS */
  text-shadow: 0 1px 2px rgba(0,0,0,0.35);
}
.aq-dial .bottom-half {
  position: absolute;
  bottom: 8%;
  left: 0;
  width: 100%;
  height: 20%;
  display: grid;
  place-items: center;
  pointer-events: none;
}
.pollutant-bottom {
  font-weight: 700;
  font-size: 1.0rem;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.35);
}


.current-aq-data .aqi {
  font-size: 1.2rem;
}

.current-aq-data .pollutant {
  font-size: 0.9rem;
}

.aq-dial .bottom-half {
  position: absolute;
  box-sizing: border-box;
  height: 50%;
  width: 100%;
  bottom: 0;
}

.aq-dial .bottom-half .current-aq-container {
  position: relative;
  box-sizing: border-box;
  height: 42%;
  width: 100%;
  top: 0;
  padding: 2%;
  font-size: 1em;
}

.aq-dial .bottom-half .current-aq-container .header {
  position: relative;
  box-sizing: border-box;
  height: 50%;
  width: 100%;
  top: 0;
  padding: 1%;
  text-align: center;
}

.aq-dial .bottom-half .current-aq-container .current-aq-data {
  position: relative;
  box-sizing: border-box;
  height: 50%;
  width: 100%;
  bottom: 0;
}

.aq-dial .bottom-half .current-aq-container .current-aq-data .aqi {
  position: relative;
  box-sizing: border-box;
  height: 100%;
  width: 50%;
  float: left;
  text-align: right;
  padding: 1% 3% 1% 1%;
  border-right: 1px solid rgba(255,255,255,0.25);
}

.aq-dial .bottom-half .current-aq-container .current-aq-data .pollutant {
  position: relative;
  box-sizing: border-box;
  height: 100%;
  width: 50%;
  float: right;
  padding: 1% 1% 1% 3%;
}

.aq-dial .bottom-half .forecast-aq-container {
  position: relative;
  box-sizing: border-box;
  height: 58%;
  width: 100%;
  bottom: 0;
  padding: 2.5% 10% 6.5% 10%;
  text-align: center;
}

.aq-dial .bottom-half .forecast-aq-container .header,.aq-dial .bottom-half .forecast-aq-container .today-aq-data,.aq-dial .bottom-half .forecast-aq-container .tomorrow-aq-data,.aq-dial .bottom-half .forecast-aq-container .misc {
  position: relative;
  box-sizing: border-box;
  width: 25%;
  height: 100%;
  float: left;
  font-size: 0.75em;
  padding-right: 2%;
  padding-left: 2%;
  border-right: 1px solid rgba(255,255,255,0.25);
}

.aq-dial .bottom-half .forecast-aq-container .today-aq-data,.aq-dial .bottom-half .forecast-aq-container .tomorrow-aq-data {
  cursor: pointer;
}

.aq-dial .bottom-half .forecast-aq-container .today-aq-data .category.smallfont,.aq-dial .bottom-half .forecast-aq-container .tomorrow-aq-data .category.smallfont {
  font-size: 0.75em;
}

.aq-dial .bottom-half .forecast-aq-container .misc {
  text-align: left;
  border-right: none;
}

.aq-dial .bottom-half .forecast-aq-container .misc div,.aq-dial .bottom-half .forecast-aq-container .misc a {
  text-decoration: underline;
  color: white;
  cursor: pointer;
}

.aq-dial .bottom-half .forecast-aq-container .misc .print-only {
  display: none;
}

@media print {
  .aq-dial .bottom-half .forecast-aq-container .misc .browser-only {
    display: none;
  }

  .aq-dial .bottom-half .forecast-aq-container .misc .print-only {
    display: block;
  }
}


/* ADD: custom tooltip styling */
.aq-dial[data-tooltip] {
  position: relative;
}

.aq-dial[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%; /* above the card */
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.8);
  color: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.85rem;
  white-space: normal;
  width: 220px;
  text-align: center;
  z-index: 999;
}


.aq-dial .bottom-half .forecast-aq-container .circle {
  position: relative;
  width: 38%;
  height: 32%;
  border-radius: 50px;
  margin: 5% auto;
  border: 1px solid white;
  background-color: #5E5E5E;
}

.aq-dial .bottom-half .forecast-aq-container .circle.good {
  background-color: #00E400;
}

.aq-dial .bottom-half .forecast-aq-container .circle.moderate {
  background-color: #FFFF00;
}

.aq-dial .bottom-half .forecast-aq-container .circle.unhealthy-sensitive {
  background-color: #FF7E00;
}

.aq-dial .bottom-half .forecast-aq-container .circle.unhealthy {
  background-color: #FF0000;
}

.aq-dial .bottom-half .forecast-aq-container .circle.very-unhealthy {
  background-color: #8F3E96;
}

.aq-dial .bottom-half .forecast-aq-container .circle.hazardous {
  background-color: #7E0023;
}

.aq-dial .bottom-half .forecast-aq-container .circle.no-data-fcst {
  background-color: #5E5E5E;
}

.aq-dial .bottom-half .forecast-aq-container .circle .action-day {
  position: absolute;
  display: none;
  height: 65%;
  width: 65%;
  bottom: -1px;
  right: -35%;
}

.current-aq-data {
  display: inline-flex;
  gap: 8px;
  align-items: baseline;
  font-weight: 600;
}


.map {
  width: 100%;
  height: 420px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  border: 1px solid var(--ring);
}

/* Smaller map on very narrow screens */
@media (max-width: 480px) {
  .map { height: 300px; }
}


/* Optional: make viz cards breathe a bit more at larger dial size */

/* Back button in the header */
.back-btn {
  appearance: none;
  border: 0;
  background: #1b7836;
  color: #fff;
  border-radius: 6px;
  padding: 6px 10px;
  font-weight: 600;
  cursor: pointer;
}

.back-btn:hover { background: #16612b; }
.back-btn:focus { outline: 2px solid #0a8; }

/* Compass */
.compass { display:grid; place-items:center; }
.compass-rose {
  position: relative; width: 160px; height: 160px; border-radius: 50%;
  background: #f7f7f8; border: 1px solid var(--ring); box-shadow: inset 0 0 0 10px #fff;
}
.compass-mark { position: absolute; font-weight: 700; color: var(--muted); }
.compass-mark.n { top: 6px; left: 50%; transform: translateX(-50%); }
.compass-mark.s { bottom: 6px; left: 50%; transform: translateX(-50%); }
.compass-mark.e { right: 6px; top: 50%; transform: translateY(-50%); }
.compass-mark.w { left: 6px; top: 50%; transform: translateY(-50%); }

.compass-arrow {
  position: absolute; left: 47%; top: 18%;
  width: 0; height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 60px solid var(--primary); /* the arrow shaft & tip color */
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
  transform-origin: 50% calc(50% + 20px);
  -webkit-transition: all 1.25s ease-in-out;
  transition: all 1.25s ease-in-out;
}
.compass-info { margin-top: 8px; display:flex; justify-content:center; }

/* Utility */
.muted { color: var(--muted); }
.error { color: #7f1d1d; background:#fde2e2; padding:10px; border-radius:8px; margin-top:12px; border: 1px solid #fca5a5; }
.loader { height: 8px; border-radius: 4px; background: linear-gradient(90deg,#cfd8dc,#e0e0e0,#cfd8dc); background-size: 200% 100%; animation: load 1.2s infinite; }
@keyframes load { 0%{background-position:0%} 50%{background-position:100%} 100%{background-position:0%}}


body {
  background: #f0f2f3; /* grey background */
  font-family: system-ui, sans-serif;
  margin: 0;
  color: #1f2937;
}

.back-btn-wrap {
  position: absolute;
  left: 24px;
  top: 50%;
  transform: translateY(-50%);
}


.container {
  min-width: fit-content;
  margin: 0 auto;
  padding: 24px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  min-height: 160px;           /* consistent card height across the grid */
}

.card-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: auto;         /* push metrics to the bottom */
}

.card-aqi-badge {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.card-info {
  flex: 1;
  min-width: 0;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 2px;
  line-height: 1.3;
}

.card-subtitle {
  color: #6b7280;
  font-size: 0.85rem;
  margin-bottom: 0;
}

.metrics {
  font-size: 0.85rem;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #f0f0f0;
}

.metrics div {
  margin-bottom: 2px;
}


/* --- Split layout: two columns on desktop, one on mobile --- */
.split-grid {
  display: grid;
  grid-template-columns: 1fr 1fr; /* left (dials) | right (map+compass) */
  gap: 16px;
  align-items: start;
}

/* make the right column panels stack naturally */
.split-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
}


/* Responsive: stack into one column on narrow screens */
@media (max-width: 900px) {
  .split-grid {
    grid-template-columns: 1fr;
  }
}

/* Ensure dial cards and map look balanced inside panels */
.viz-card .viz-title {
  margin-bottom: 8px;
}


/* Map wrapper enables overlay positioning */
.map-wrap {
  position: relative;
}

/* Overlay container anchored to a corner */
.map-overlay {
  position: absolute;
  z-index: 400; /* above tiles/markers, below Leaflet zoom buttons (z=1000) */
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--ring);
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  padding: 8px 10px;
  padding-bottom: 35px;
  display: inline-flex;
  flex-direction: column;
  gap: 6px;
}


/* INSERT: bottom-corner info pills inside the overlay */
.map-overlay .overlay-info {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  display: flex;
  justify-content: space-between; /* left & right corners */
  pointer-events: none;           /* lets map interactions pass through */
}
.map-overlay .overlay-pill {
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.9rem;
  pointer-events: auto; /* clickable if you ever need */
}

/* Corner choice: top-right (default) */
.map-overlay.top-right {
  top: 10px;
  right: 10px;
}

/* Alternative corners (use these classes if you change placement) */
.map-overlay.top-left    { top: 10px; left: 10px; }
.map-overlay.bottom-left { bottom: 10px; left: 10px; }
.map-overlay.bottom-right{ bottom: 10px; right: 10px; }

/* Scale down overlay on very small screens */
@media (max-width: 480px) {
  .map-overlay { transform: scale(0.5); transform-origin: top right; }
}

/* Optional: avoid stealing map drag gestures */
.map-overlay {
  pointer-events: auto; /* Let users click inside overlay */
}
/* ── Resource Links ──────────────────────────────────────── */
.resource-links {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.resource-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.resource-card:hover {
  border-color: #3b82f6;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.12);
}

.resource-icon {
  font-size: 1.6rem;
  flex-shrink: 0;
  width: 40px;
  text-align: center;
  display: flex;
  justify-content: center;
  align-items: center;
}

.bench-emoji {
  height:32px;
  width: 29px;
  display:block;
}


.resource-text {
  flex: 1;
  min-width: 0;
}

.resource-title {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 2px;
  color: #111827;
}

.resource-desc {
  font-size: 0.85rem;
  color: #6b7280;
  line-height: 1.4;
}

.resource-arrow {
  font-size: 1.2rem;
  color: #9ca3af;
  flex-shrink: 0;
  transition: transform 0.15s ease, color 0.15s ease;
}

.resource-card:hover .resource-arrow {
  color: #3b82f6;
  transform: translateX(3px);
}