/* === Base layout === */
html, body {
  height: 100%;
  margin: 0;
  display: flex;
  flex-direction: column;
  font-family: "Roboto", Arial, sans-serif;
}

/* Main area */
main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Map fills main */
#mapid {
  flex: 1;
  width: 100%;
  min-height: 0;
  height: 100%;
  padding-bottom: 90px; /* ✅ ensures bottom controls clear the footer */
}

/* === Floating header === */
.floating-header {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  color: #333;
  padding: 10px 18px;
  border-radius: 14px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  z-index: 2000;
  text-align: center;
}
.floating-header img {
  height: 38px;
  width: auto;
}
.floating-header .tagline {
  font-size: 13px;
  font-weight: 500;
  color: #333;
  white-space: nowrap;
}

/* === Sticky Footer === */
footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: #00072d;
  color: white;
  text-align: center;
  padding: 0.35rem 0.5rem;
  line-height: 0.75;
  font-family: "Roboto", Arial, sans-serif;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.4);
  z-index: 2500;
}
footer .container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0.25rem 0.6rem;
  padding-top: 0.3rem;
}
footer .built-by {
  font-size: 0.75rem;
  font-weight: 500;
  display: block;
  margin-bottom: 0.15rem;
}
footer .info-text {
  font-size: 0.63rem;
  opacity: 0.9;
  line-height: 0.75;
  margin-top: 0.1rem;
}
footer .modal-link {
  font-size: 0.6rem;
  color: #a2d2ff;
  text-decoration: underline;
  cursor: pointer;
  margin: 0 4px;
  transition: color 0.2s ease;
}
footer .modal-link:hover {
  color: #e0e0e0;
}

/* === Mobile footer tweaks === */
@media (max-width: 600px) {
  footer {
    padding: 0.3rem 0.4rem;
  }
  footer .built-by {
    font-size: 0.7rem;
  }
  footer .info-text {
    font-size: 0.56rem;
  }
  footer .modal-link {
    font-size: 0.55rem;
  }
  #mapid {
    padding-bottom: 100px; /* slightly more clearance on mobile */
  }
}

/* === Prediction Toggle (smaller bucket, now ABOVE spectrum) === */
.prediction-toggle {
  background: #fff;
  border: 1px solid #333;
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  padding: 8px 10px;
  text-align: center;
  width: fit-content;
  max-width: 220px;
  margin: 0 auto 4px auto; /* tighter spacing before spectrum */
  font-family: "Roboto", Arial, sans-serif;
}
.prediction-toggle h4 {
  margin: 0 0 6px;
  font-size: 12.5px;
  font-weight: 600;
}
.mode-top {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.mode-label {
  font-size: 16px;
  color: #999;
  transition: color 0.3s ease;
}
.mode-label.active#realtimeLabel {
  color: #2e7d32;
}
.mode-label.active#aiLabel {
  color: #6a1b9a;
}
.mode-description {
  font-size: 10.5px;
  margin-top: 4px;
  font-weight: 500;
  color: #444;
}

/* Toggle switch */
.bb-toggle {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 22px;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  touch-action: manipulation;
}
.bb-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}
.bb-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #ccc;
  transition: 0.4s;
  border-radius: 34px;
}
.bb-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: #fff;
  transition: 0.4s;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.bb-toggle input:checked + .bb-slider {
  background-color: #4caf50;
}
.bb-toggle input:checked + .bb-slider:before {
  transform: translateX(20px);
}

/* === Risk Spectrum (larger bucket, now BELOW) === */
.spectrum-legend {
  background: #fff;
  border: 1px solid #333;
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  padding: 10px 16px;
  text-align: center;
  width: fit-content;
  max-width: 360px;
  margin: 0 auto 10px auto;
  font-family: "Roboto", Arial, sans-serif;
}
.spectrum-legend h4 {
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 6px;
}
.spectrum-bar {
  height: 20px;
  background: linear-gradient(to right, #00c800, #ffff00, #c80000);
  border: 1px solid #333;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px;
  font-size: 11px;
  font-weight: 600;
  width: 230px;
  margin: 0 auto;
}

/* === Responsive tweaks for prediction + spectrum === */
@media (max-width: 600px) {
  .prediction-toggle {
    max-width: 200px;
    padding: 6px 8px;
  }
  .spectrum-legend {
    max-width: 280px;
    padding: 8px;
  }
  .spectrum-bar {
    width: 200px;
    font-size: 10px;
  }
  .prediction-toggle h4,
  .spectrum-legend h4 {
    font-size: 12px;
  }
}

/* === Hamburger Menu === */
.hamburger-menu {
  position: absolute;
  top: 16px;
  right: 16px;
  background: #fff;
  border: 1px solid #333;
  border-radius: 6px;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  z-index: 2200;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  transition: all 0.2s ease;
}
.hamburger-menu:hover {
  background: #f1f1f1;
  box-shadow: 0 3px 8px rgba(0,0,0,0.4);
}
.hamburger-panel {
  position: absolute;
  top: 60px;
  right: 16px;
  background: #fff;
  border: 1px solid #333;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  padding: 10px 14px;
  z-index: 2200;
  min-width: 180px;
  font-size: 15px;
  display: none;
}
.hamburger-panel .layer-option {
  cursor: pointer;
  margin: 4px 0;
  transition: opacity 0.2s ease, transform 0.1s ease;
}
.hamburger-panel .layer-option:hover {
  transform: translateX(3px);
  opacity: 0.8;
}

/* === Custom Modals === */
.custom-modal {
  display: none;
  position: fixed;
  z-index: 3000;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.6);
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow-y: auto;
}
.custom-modal .modal-content {
  background: #fff;
  border-radius: 12px;
  max-width: 600px;
  width: 90%;
  padding: 1.5rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  color: #333;
  line-height: 1.5;
  animation: fadeInModal 0.3s ease;
}
.custom-modal h4 {
  margin-top: 0;
  font-size: 1.3rem;
  color: #1a237e;
}
.custom-modal p {
  font-size: 0.95rem;
}
.custom-modal strong {
  color: #000;
}
.custom-modal em {
  color: #333;
  font-style: italic;
}
.custom-modal::-webkit-scrollbar {
  width: 8px;
}
.custom-modal::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 4px;
}
.custom-modal::-webkit-scrollbar-thumb:hover {
  background: #555;
}
@keyframes fadeInModal {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}
