:root {
  --bg: #f4f6f9;
  --card: #fff;
  --ink: #1f2937;
  --muted: #6b7280;
  --brand: #1976d2;
  --chart-height: 350px;
  --safe-area-top: 0px;
  --safe-area-bottom: 0px;
}
@supports (padding-top: env(safe-area-inset-top)) {
  :root {
    --safe-area-top: env(safe-area-inset-top);
    --safe-area-bottom: env(safe-area-inset-bottom);
  }
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial;
  background: var(--bg);
  color: var(--ink);
}
.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: calc(20px + var(--safe-area-top)) 16px 20px 16px;
}
.toolbar {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  position: sticky;
  top: var(--safe-area-top);
  z-index: 10;
  background: var(--bg);
  padding-bottom: 12px;
  padding-top: 5px;
}

.alert-severity-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-right: 6px;
  vertical-align: middle;
  background: #6b7280;
  color: #fff;
}

/* Map NWS severity string to colors */
.alert-severity-Extreme  { background: #b91c1c; } /* deep red */
.alert-severity-Severe   { background: #dc2626; } /* red */
.alert-severity-Moderate { background: #f97316; } /* orange */
.alert-severity-Minor    { background: #3b82f6; } /* blue */
.alert-severity-Unknown  { background: #6b7280; } /* gray */

input[type=text] {
  padding: 12px 14px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  font-size: 16px;
  outline: none;
}

button {
  padding: 12px 16px;
  border: 0;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  font-size: 15px;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease;
}
button:hover:not(:disabled) {
    /* This is a slightly darker shade of your --brand color */
    background-color: #1565c0; 
}
button:active:not(:disabled) {
    /* This gives a "press" effect */
    transform: scale(0.98);
}

button:disabled {
  background: #90caf9;
  cursor: not-allowed;
}

.error-text {
    color: #c53030; /* A strong red */
    font-weight: 600;
  }

.card {
    background: var(--card);
    border-radius: 14px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .06);
    padding: 18px;
    margin-top: 14px;
  }

/* Add this CSS for the new snow table */
#snowOutlookTable {
    width: 100%;
    border-collapse: collapse;
}
#snowOutlookTable th, #snowOutlookTable td {
    text-align: left;
    padding: 8px 6px;
    border-bottom: 1px solid #eee;
}
#snowOutlookTable th {
    font-size: 0.9em;
    color: var(--muted);
}
#snowOutlookTable tr:last-child td {
    border-bottom: none;
}
#snowOutlookTable td:nth-child(2), 
#snowOutlookTable td:nth-child(3) {
    text-align: center;
    font-weight: 500;
}

#radarMap {
  height: 400px; /* You can adjust this height */
  width: 100%;
  border-radius: 8px;
  background-color: #eee;
  z-index: 1; /* Ensures map is clickable */
}
/* ===== Radar block ===== */
#radarBlock {
  margin-top: 1rem;
  background: #fff;
  border-radius: 16px;
  padding: .6rem .6rem .85rem;
  box-shadow: 0 4px 12px rgba(0,0,0,.03);
}

#radarBlock .radar-head {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: .35rem;
}

#radarBlock h2 {
  font-size: .9rem;
  margin: 0;
}

#radarTimestamp {
  font-size: .7rem;
  color: #6b7280;
}

.radar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}

.radar-toggle {
  display: flex;
  gap: 6px;
}

.radar-toggle button {
  border: 1px solid rgba(25,118,210,.18);
  background: #fff;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  cursor: pointer;
  color: #1f2937;
}

.radar-toggle button.active {
  background: #1976d2;
  color: #fff;
  border-color: #1976d2;
}



/* radar container + map */
#radarMapContainer {
  height: 210px;
  border-radius: 14px;
  overflow: hidden;
  background: #dbeafe;
}

#radarMap {
  height: 100%;
}

@media (min-width: 768px) {
  #radarMapContainer {
    height: 250px;
  }
}



/* Optional: Styles for the timestamp/attribution */
.radar-meta {
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
  margin-top: 8px;
}


  #alertBox, #currentConditionsCard {
    min-height: 50px;
  }

  #summaryBox {
    /* Give it enough space to hold a typical summary */
    min-height: 120px;
  }

.location {
  color: var(--muted);
  margin: 8px 2px 6px;
}
h2 {
  margin: 0 0 10px;
  font-size: 18px;
  text-align: center;
}
.alert-card {
  background: #fffbe6;
  border: 1px solid #fde047;
  color: #713f12;
  padding: 14px 18px;
  font-weight: 500;
  cursor: pointer;
}
.alert-card:hover {
  background: #fefce8;
}
.alert-card > a {
  color: var(--brand);
  text-decoration: none;
}
.alert-card > a:hover {
  text-decoration: underline;
}
.alert-card.safe {
  background: #f0fdf4;
  border: 1px solid #a7f3d0;
  color: #14532d;
  cursor: default;
}
#summaryBox a {
  color: var(--brand);
  text-decoration: none;
  font-weight: 500;
  margin-left: 8px;
}
#summaryBox a:hover {
  text-decoration: underline;
}
#debugBox {
  display: none;
  margin-top: 6px;
  color: #475569;
  font-size: 12px;
}
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-content {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  text-align: left;
}
.modal-close {
  position: absolute;
  top: 8px;
  right: 12px;
  font-size: 24px;
  font-weight: bold;
  color: #888;
  cursor: pointer;
}
.modal-content h3 {
  margin: 0 0 4px;
}
.modal-content p {
  white-space: pre-wrap;
  line-height: 1.6;
}
.modal-context {
  font-size: 0.8rem;
  color: var(--muted);
  border-bottom: 1px solid #eee;
  padding-bottom: 10px;
  margin-bottom: 10px;
}
.modal-close-btn {
  display: block;
  margin: 20px auto 0;
  padding: 10px 24px;
  background-color: var(--muted);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  cursor: pointer;
}
.modal-close-btn:hover {
  background-color: #555;
}
.spinner {
  border: 4px solid rgba(0, 0, 0, .1);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border-left-color: var(--brand);
  animation: spin 1s ease infinite;
  margin: 20px auto;
}

.btn-spinner {
    display: inline-block;
    width: 1.1em;
    height: 1.1em;
    vertical-align: text-bottom;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  0% { transform: rotate(0); }
  100% { transform: rotate(360deg); }
}
.chart-container {
  position: relative;
  width: 100%;
  height: var(--chart-height);
  margin-bottom: 12px;
}
.chart-container canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}
.chart-hidden {
  display: none;
}
#precipOverlay, #snowOverlay, #cloudOverlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  color: #0f172a;
  font-weight: 600;
  text-align: center;
  padding: 1rem;
  background-color: rgba(255, 255, 255, 0.7); /* Optional: Slight bg */
  display: none; /* Keep hidden by default */
}
#chartCard {
  padding-bottom: 0;
}
.chart-nav {
  display: flex;
  justify-content: center; /* centered icons */
  gap: 16px;
  margin: 18px -18px 0;
  padding: 10px 18px;
  border-top: 1px solid #eee;
  background: #ffffff;
  border-bottom-left-radius: 14px;
  border-bottom-right-radius: 14px;
}
.chart-nav button {
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  border-radius: 50%;
  transition: background-color .2s;
}
.chart-nav button:hover {
  background: #e9e9e9;
}
.chart-nav svg {
  width: 28px;
  height: 28px;
  fill: var(--muted); /* fills for icons that are shapes */
  transition: fill .2s;
}

.chart-nav button.active {
    background: #e3f2fd; /* A light blue background */
  }
  .chart-nav button.active svg { 
    fill: var(--brand); 
  }
/* default (inactive) wind icon */
.wind-icon path {
  fill: none;
  stroke: var(--muted); /* gray wind lines */
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke .2s;
}
/* active wind icon when its button has .active */
.chart-nav button.active .wind-icon path {
  stroke: var(--brand); /* blue wind lines on active */
}
.wind-note {
  text-align: center;
  font-size: 12px;
  color: #6b7280;
  margin-top: 6px;
}
.site-footer {
  padding: 20px 16px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px; /* space between icons and text */
  background: var(--bg);
}
.site-footer .footer-text p {
  margin: 0;
  line-height: 1.4;
}
/* reuse your chart-nav look but make sure it's centered and not super wide */
.site-footer .footer-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 32px; /* space between icons */
  margin: 0;
  padding: 0;
  border-top: none; /* kill the card border if it carried over */
  background: none;
  border-radius: 0;
}
/* buttons inside footer still clickable / highlightable */
.site-footer .footer-nav button {
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  border-radius: 50%;
  transition: background-color .2s;
}
.site-footer .footer-nav button:hover {
  background: #e9e9e9;
}
.site-footer .footer-nav svg {
  width: 28px;
  height: 28px;
  fill: var(--muted);
  stroke: none;
  transition: fill .2s, stroke .2s;
}
/* active state color */
.site-footer .footer-nav button.active svg {
  fill: var(--brand);
  stroke: var(--brand);
}
/* wind icon is stroke-only, so keep your wind-icon rules */
.site-footer .footer-nav button.active .wind-icon path {
  stroke: var(--brand);
}
#chat-fab {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(0, 0, 0, .2);
  margin-bottom: var(--safe-area-bottom);
}
#chat-box{position:fixed;right:18px;bottom:86px;width:340px;max-width:92vw;height:440px;background:#fff;border-radius:14px;box-shadow:0 14px 30px rgba(0,0,0,.28);overflow:hidden; margin-bottom: var(--safe-area-bottom); 
    /* --- CHANGES HERE --- */
    opacity: 0;
    visibility: hidden;
    transform: translateY(15px);
    transition: opacity .2s ease-out, transform .2s ease-out, visibility .2s ease-out;
  }
  /* --- ADD THIS NEW RULE --- */
#chat-box.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }
#chat-head {
  background: var(--brand);
  color: #fff;
  padding: 12px 14px;
  font-weight: 600;
}
#chat-log {
  height: calc(100% - 110px);
  padding: 10px 12px;
  overflow: auto;
}
#chat-form {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid #eee;
}
#chat-form input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 10px;
}
#locationList button {
  display: block;
  width: 100%;
  padding: 12px;
  margin-bottom: 8px;
  border: 1px solid #ddd;
  background: #f9f9f9;
  border-radius: 8px;
  text-align: left;
  cursor: pointer;
  color: var(--ink);
}
#locationList button:hover {
  background: #f0f0f0;
}

/* --- Styles for Graphical Summary --- */

#graphicalSummary {
  display: flex;          /* Arrange day blocks horizontally */
  justify-content: space-around; /* Distribute space between days */
  flex-wrap: wrap;       /* Allow wrapping on very small screens if needed */
  padding: 10px 5px;     /* Adjust padding inside the card */
  margin-top: 15px;      /* Space above this element */
  background-color: var(--card); /* Use card background */
  border-radius: 14px;      /* Match other cards */
  box-shadow: 0 6px 18px rgba(0,0,0,.06); /* Match other cards */
}

.summary-day {
  display: flex;
  flex-direction: column; /* Stack items vertically within a day block */
  align-items: center;    /* Center items horizontally */
  text-align: center;
  padding: 8px 5px;      /* Padding around each day's content */
  min-width: 55px;       /* Minimum width for each day block */
  flex: 1;               /* Allow blocks to grow equally */
}

.summary-day .day-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}

.summary-day .weather-icon {
  width: 36px;           /* Adjust icon size as needed */
  height: 36px;
  margin-bottom: 6px;
}

/* Make sure SVG icons scale */
.summary-day .weather-icon svg {
    width: 100%;
    height: 100%;
}

.summary-day .temps {
  font-size: 0.95rem;
  font-weight: 500;
  margin-bottom: 4px;
}

.summary-day .temps .high-temp {
  color: var(--ink); /* Or a specific color for high temps */
}

.summary-day .temps .low-temp {
  color: var(--muted); /* Or a specific color for low temps */
}

.summary-day .precip-info {
  font-size: 0.75rem;
  color: #06b6d4; /* Example: Teal color for precip */
  font-weight: 600;
  min-height: 1.2em; /* Reserve space even if empty */
}

.summary-day .wind-info {
  font-size: 0.75rem;
  color: var(--muted); /* Use muted color for wind */
  font-weight: 500;
  min-height: 1.2em; /* Reserve space */
  margin-top: 2px; /* Small space above */
}

/* --- End Styles for Graphical Summary --- */


/* --- Styles for Hourly Detail View --- */

#hourlyDetailView {
  display: none; /* Hidden by default */
  margin-top: -10px; /* Pull it up slightly below the summary */
  margin-bottom: 15px;
  padding: 15px;
  background-color: #f9fafb; /* Slightly different background */
  border: 1px solid #eee;
  border-radius: 0 0 12px 12px; /* Rounded bottom corners */
  box-shadow: 0 4px 6px rgba(0,0,0,0.05) inset; /* Inner shadow */
}

.hourly-detail-title {
  font-size: 0.9rem;
  font-weight: bold;
  text-align: center;
  margin-bottom: 10px;
  color: var(--ink);
}

.hourly-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(60px, 1fr)); /* Responsive columns */
  gap: 10px 5px;
  font-size: 0.8rem;
  text-align: center;
}

.hourly-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hourly-item .hour-label {
  font-weight: 500;
  color: var(--muted);
}

.hourly-item .hour-icon {
  width: 28px; /* Smaller icon */
  height: 28px;
  margin: 4px 0;
}
.hourly-item .hour-icon svg {
    width: 100%;
    height: 100%;
}

.hourly-item .hour-temp {
  font-weight: 600;
  color: var(--ink);
}

.hourly-item .hour-wind {
  font-size: 0.75rem;
  color: var(--muted); /* Use muted color */
  min-height: 1em; /* Reserve space */
  margin-top: 2px;
}

.hourly-item .hour-precip {
  font-size: 0.7rem;
  color: #06b6d4; /* Teal for precip */
  min-height: 1em;
}

/* Style to highlight the selected day in the main summary */
#graphicalSummary .summary-day.selected {
    background-color: #e0e7ff; /* Example highlight color */
    border-radius: 8px;
}


@media (max-width:640px) {
  :root {
    --chart-height: 330px;
  }
  input[type=text] {
    font-size: 15px;
  }
  .toolbar {
    grid-template-columns: 1fr 1fr;
  }
  .toolbar input[type=text] {
    grid-column: 1 / -1;
  }
  /* Ensure share button spans full width on mobile too if needed */
  #btnShare {
    grid-column: 1 / -1;
  }
}
