/* Ensure the page_content fills full height after navbar */
html, body { height:100%; }
#page-content { height: calc(100vh - 90px); }




/* === STATUS LIGHTS === */

.status-indicator {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  margin: 4px;
  position: relative;
  vertical-align: middle;
  animation: glow-pulse 1.5s ease-in-out infinite;
  box-shadow:
    inset 0 1px 2px rgba(255, 255, 255, 0.3),
    inset 0 -1px 2px rgba(0, 0, 0, 0.4),
    0 0 8px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(0, 0, 0, 0.5);
  outline: 1px solid rgba(255, 255, 255, 0.15);
}

.status-green {
  background: radial-gradient(circle at 30% 30%, #66ff66, #009900);
  box-shadow: 0 0 6px rgba(0, 255, 0, 0.6), 0 0 2px rgba(0, 100, 0, 0.5) inset;
}

.status-yellow {
  background: radial-gradient(circle at 30% 30%, #ffff99, #cccc00);
  box-shadow: 0 0 6px rgba(255, 255, 0, 0.6), 0 0 2px rgba(100, 100, 0, 0.5) inset;
}

.status-orange {
  background: radial-gradient(circle at 30% 30%, #ffcc66, #cc6600);
  box-shadow: 0 0 6px rgba(255, 165, 0, 0.6), 0 0 2px rgba(120, 60, 0, 0.5) inset;
}

.status-red {
  background: radial-gradient(circle at 30% 30%, #ff6666, #990000);
  box-shadow: 0 0 6px rgba(255, 0, 0, 0.6), 0 0 2px rgba(100, 0, 0, 0.5) inset;
}

/* === FLASHING ANIMATION === */
@keyframes glow-pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.4;
    transform: scale(1.1);
  }
}

/* === STATUS BOX BACKGROUNDS === */
.status-box-green {
  background-color: #e6f4ea;
  border: 1px solid #b3e2c2;
}

.status-box-yellow {
  background-color: #fffbe6;
  border: 1px solid #f5e79e;
}

.status-box-orange {
  background-color: #fff1e6;
  border: 1px solid #f5cba7;
}

.status-box-red {
  background-color: #fdecea;
  border: 1px solid #f5a6a6;
}


/* Custom toggle styling */
/* Base switch styling */
.custom-toggle-switch .form-check-input {
  background-color: #4CAF50 !important;
  border-color: #4CAF50 !important;

  /* White thumb SVG for BOTH states */
  --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23ffffff'/%3e%3c/svg%3e") !important;
}

/* Checked state — keep SAME appearance */
.custom-toggle-switch .form-check-input:checked {
  background-color: #4CAF50 !important;
  border-color: #4CAF50 !important;
}

/* Remove focus / active glow */
.custom-toggle-switch .form-check-input:focus,
.custom-toggle-switch .form-check-input:active {
  box-shadow: none !important;
}

/* Optional: remove hover dimming */
.custom-toggle-switch .form-check-input:hover {
  filter: none;
}

/* Disabled state (optional – still visible) */
.custom-toggle-switch .form-check-input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}



body.flood-mode {
  background-color: #eaf5ff; /* light blue */
}

body.drought-mode {
  background-color: #f2efe9; /* light yellow */
}


.station-pill {
  background: rgba(255, 255, 255, 0.25);  /* Frosted glass background */
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: all 0.3s ease;
  color: #000;
  font-weight: 500;
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #727272a4;
  cursor: pointer;
}

.station-pill:hover {
  background: rgba(255, 255, 255, 0.4);
  transform: scale(1.02);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.15);
}

.custom-scroll {
  scrollbar-width: thin;              /* Firefox */
  scrollbar-color: rgba(0,0,0,0.2) transparent; /* Firefox */
}

/* Webkit Browsers (Chrome, Safari, Edge) */
.custom-scroll::-webkit-scrollbar {
  width: 6px;
}

.custom-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.custom-scroll::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 10px;
  border: 1px solid transparent;
  background-clip: content-box;
  transition: background-color 0.2s ease;
}

.custom-scroll::-webkit-scrollbar-thumb:hover {
  background-color: rgba(0, 0, 0, 0.3);
}



/* Root grid: V1 (70%) and V2 (30%) */
.dash-grid{
  height: calc(100vh - 90px); /* keep your current assumption for now */
  display: grid;
  grid-template-columns: 70% 30%;
  gap: 12px;
  min-height: 0;
}

/* Each column is its own 2-row grid */
.v1, .v2{
  display: grid;
  grid-template-rows: 70% 30%;
  min-height: 0;
  min-width: 0;
  gap: 12px;
}

/* body.flood-mode .v1{
  grid-template-rows: 1fr minmax(50px, 360px);
} */
body.flood-mode .v1{
  grid-template-rows: 1fr clamp(160px, 45vh, 320px);
}
body.flood-mode .v1x2{
  display: grid;
  grid-template-rows: minmax(40px, 120px) 1fr;
  min-height: 0;
  height: 100%;
  gap: 12px;
}

body.flood-mode .status-region{
  overflow: auto;
  height: 100%;
  min-height: 0;
}

body.drought-mode .v1 {
  grid-template-rows: 1fr minmax(50px, 140px);
}

/* These prevent grid overflow issues */
.v1x1, .v1x2, .v2x1, .v2x2{
  min-height: 0;
  min-width: 0;
}

/* Make the map actually fill V1X1 */
#map-container{
  height: 100%;
  min-height: 0;
}
#map{
  height: 100% !important;
  min-height: 0;
}

.v1x2 {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 0;
  overflow: auto;
  height: 100%;
  align-items: start;
}

body.drought-mode .v1x2 .all-stations-section{
  height: 100%;
  min-height: 0;
}

body.drought-mode .all-stations-wrap{
  max-height: none;     /* remove the 80px cap */
  height: 100%;         /* fill remaining space */
  min-height: 0;
  overflow-y: auto;     /* keep scrolling inside */
}


.status-region {
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

body.drought-mode .status-region{
  display: none !important;
}

.status-region,
.all-stations-section {
  min-height: 0;
}

.v2x2{
  display: grid;
  min-height: 0;
  overflow: hidden;
}

.v2x2 > .flood-risk,
.v2x2 > .drought-risk{
  height: 100%;
  min-height: 0;
}
/* Make the risk wrappers fill their grid cell (this is the key) */
.v1x2 .status-region > .flood-risk,
.v1x2 .status-region > .drought-risk{
  height: 100%;
  width: 100%;
  min-height: 0;
  overflow: auto;
}

/* Ensure the live feed card fills the cell */
.v2x2 .live-feed-card{
  width: 100%;
  height: 100%;
}



.status-blocks-grid{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;

  align-items: stretch;   /* ← REQUIRED */
  height: 100%;
  min-height: 0;
}
.status-box{
  display: grid;
  grid-template-rows: auto minmax(90px, 1fr);
  min-height: 200px;
  overflow: auto;
}
.status-box-list{
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.status-blocks-wrap {
  height: 100%;
  min-height: 0;
  overflow: auto;
}


/* === ALL ACTIVE STATIONS === */
.all-stations-section{
  display: grid;
  grid-template-rows: auto 1fr; /* title + scroll area */
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background-color: #ffffff;
  border: 1px solid #c9c9c9;
  border-radius: 8px;
}

.all-stations-wrap{
  min-height: 0;
  overflow-y: auto;
  max-height: 80px;

  text-align: center;   /* centers inline elements */
  line-height: 1;
  
}

.all-stations-wrap .station-pill{
  display: inline-block;
  white-space: nowrap;
  width: fit-content;

  margin: 4px 6px;      /* spacing between pills */
  vertical-align: top;
  border: 1px solid #727272a4;
}

/* .all-stations-section{
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
} */


.drought-header {
  font-weight: 800;
  font-size: 1.5rem;
  text-align: center;
  margin-bottom: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(12, 12, 12, 0.08);
}

/* Container */
.drought-metrics {
  display: flex;
  flex-direction: column;
  justify-content: flex-start; /* was space-evenly */
  height: auto;               /* was 100% */
  gap: 14px;
  min-height: 90px; 
}

/* Row */
.metric-row {
  position: relative;
  overflow: visible;

  width: 100%;
  max-width: 800px;         /* keeps it tidy on wide screens */
  margin: 0 auto;

  padding: 14px 16px;
  border-radius: 14px;

  border: 1px solid rgba(0,0,0,0.10);
  background: linear-gradient(180deg, #ffffff 0%, #f7f8fa 100%);
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);

  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
  flex-wrap: wrap; /* allow wrapping if needed */
}

/* Description section inside metric cards */
.metric-desc {
  flex-basis: 100%;
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px solid rgba(0,0,0,0.08);
  font-size: 0.92rem;
  color: #333;
}

.metric-desc-title {
  font-weight: 800;
  font-size: 0.95rem;
  margin-bottom: 6px;
  color: rgba(0,0,0,0.75);
}

.metric-desc-text {
  line-height: 1.25rem;
  color: rgba(0,0,0,0.70);
}

/* Two-metric description layout */
.metric-desc-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
}

.metric-desc-label {
  font-weight: 800;
  margin-bottom: 2px;
}

.metric-desc {
  scroll-margin-bottom: 12px;
}

/* Ensure the drought card can shrink without pushing content out */
.drought-risk .border.rounded.shadow-sm {
  min-height: 0; /* critical in flex column layouts */
}

/* Make metrics area scrollable when space is tight */
.drought-metrics-scroll {
  overflow: auto;
  min-height: 0; /* critical so overflow works in flex containers */
  padding-right: 6px; /* avoids scrollbar covering text */
}

.metric-desc img,
.drought-legend-img,
.drought-table-img {
  display: block;
  max-width: 80%;
  height: auto;

  /* Keep images visually contained */
  max-height: 220px;          /* desktop cap */
  object-fit: contain;

  margin: 8px auto 10px auto; /* center + spacing */
}

.metric-pair{
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center; /* keep centered */
  gap: 14px;
  flex-wrap: wrap;         /* ✅ allow wrap at high zoom */
}

.metric-pair .metric-label{
  flex: 0 1 auto;
  text-align: left;
}

.metric-pair .level-pill{
  flex: 0 1 auto;
  max-width: 100%;
}



@media (max-width: 640px){
  .metric-pair{
    flex-direction: column;
    align-items: center;
  }

  .metric-pair .metric-label{
    text-align: center;
  }

  .metric-pair .level-pill{
    width: 100%;
  }
}


/* Labels */
.metric-label {
  font-weight: 700;
  font-size: 1.15rem;
  color: #000; /* solid black */
}

/* Value pill */
.level-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;

  padding: 16px 22px;   /* ⬆ more padding */
  border-radius: 14px;

  font-weight: 900;
  font-size: 1.6rem;    /* ⬆ much bigger text */
  min-width: 0;
  max-width: 100%;

  text-align: center;
  border: 1px solid rgba(0,0,0,0.08);
}

/* Percentile subtext */
.metric-sub {
  font-weight: 600;
  font-size: 1rem;
  opacity: 0.9;
}

/* Level colors */
.level-0 { background: #dff3d8; color: #1b5e20; }
.level-1 { background: #fff6a8; color: #6b5b00; }
.level-2 { background: #ffe0a3; color: #7a3e00; }
.level-3 { background: #ffc16b; color: #6a2f00; }
.level-4 { background: #ff4d4d; color: #ffffff; }
.level-5 { background: #7a0000; color: #ffffff; }
.level-na { background: #e9ecef; color: #495057; }




/* ECCC ALERTS */
.eccc-alerts {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.eccc-alert-card {
  border: 1px solid rgba(0,0,0,0.10);
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}

.eccc-alert-header {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(0,0,0,0.10);
  text-align: center;
}

.eccc-alert-headline {
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.25;
  color: #000000;
}

/* Header colors */
.eccc-yellow { background: #fff3b0; color: #5a4b00; }
.eccc-orange { background: #ffd2a6; color: #6b2f00; }
.eccc-red    { background: #ffb3b3; color: #6b0000; }
.eccc-grey   { background: #e9ecef; color: #374151; }

.eccc-alert-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 14px;
  padding: 10px 12px;
  font-size: 0.92rem;
}

.meta-label {
  font-weight: 700;
  color: #555;
  margin-right: 6px;
}

.meta-value {
  font-weight: 600;
  color: #222;
}

.meta-link a {
  text-decoration: none;
}

.meta-link a:hover {
  text-decoration: underline;
}

.eccc-alert-details {
  border-top: 1px solid rgba(0,0,0,0.08);
  padding: 6px 12px 10px 12px;
}

.eccc-alert-details summary {
  cursor: pointer;
  font-weight: 700;
  color: #333;
  list-style: none;
}

.eccc-alert-details summary::-webkit-details-marker {
  display: none;
}

.eccc-alert-description {
  margin-top: 8px;
  font-size: 0.92rem;
  color: #222;
  background: #f8f9fa;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 12px;
  padding: 10px;
  white-space: normal;
}

/* --- FPW Legend base styling --- */
#map .map-legend {
  background: rgba(255, 255, 255, 0.9);
  padding: 8px 10px;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  font-size: 0.85rem;
  line-height: 1.25;
  color: #222;
  max-width: 280px;
}

#map .map-legend .legend-title {
  font-weight: 700;
}

#map .map-legend .legend-subtitle {
  font-size: 0.8rem;
  opacity: 0.85;
}

#map .map-legend .legend-source {
  margin-top: 4px;
  font-size: 0.75rem;
  opacity: 0.7;
}

#map .map-legend .legend-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

#map .map-legend .legend-line {
  width: 28px;
  height: 4px;
  margin-top: 6px;
  background-color: #3388ff;
  border-radius: 2px;
  flex-shrink: 0;
}

#map .map-legend .legend-text {
  display: flex;
  flex-direction: column;
}

/* --- Hide legend while popup is open --- */
#map.popup-open .map-legend {
  display: none;
}

/* Leaflet callout dot + label */
.callout-dot{
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.25);
}

/* Color variants */
.callout-dot-red{ background: #d40000; }
.callout-dot-orange{ background: #f39c12; }
.callout-dot-yellow{ background: #f1c40f; }
.callout-dot-green{ background: #2ecc71; }
.callout-dot-grey{ background: #999; }

.callout-label{
  background: rgba(255,255,255,0.4);
  border: 1px solid rgba(0,0,0,0.15);
  border-radius: 6px;
  padding: 2px 6px;
}

.callout-title{
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  color: #222;
  opacity: 0.9;
}

.callout-subtext{
  font-size: 9px;
  font-weight: 400;
  color: #666;
  line-height: 1.2;
  opacity: 0.8;
}