html, body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    font-family: 'Poppins', Arial, sans-serif;
    background: #F4F7F9;
    min-height: 100vh;
  }
  #appFlexContainer {
    display: flex;
    width: 100vw;
    height: 100vh;
    position: relative;
    transition: background 0.2s;
  }
  #sidebar {
    width: 340px;
    min-width: 260px;
    max-width: 400px;
    height: 100%;
    background: #f7fafd;
    box-shadow: 2px 0 12px rgba(0,0,0,0.12);
    z-index: 300;
    transform: translateX(-100%);
    transition: transform 0.35s cubic-bezier(.4,0,.2,1);
    display: flex;
    flex-direction: column;
    padding: 0;
    position: relative;
  }
  #sidebar.open {
    transform: translateX(0);
  }
  #cesiumMapWrapper {
    flex: 1 1 0%;
    height: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
    transition: width 0.35s cubic-bezier(.4,0,.2,1);
    min-width: 0;
  }
  #appFlexContainer.maximized #sidebar {
    display: none !important;
  }
  #appFlexContainer.maximized #cesiumMapWrapper {
    width: 100vw !important;
    flex: 1 1 100%;
  }
  #cesiumContainer {
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    flex: 1 1 0%;
    position: relative;
    z-index: 1;
  }
  #maximizeMapBtn {
    position: absolute;
    bottom: 24px;
    right: 24px;
    z-index: 500;
    background: #fff;
    color: #1976d2;
    border: 2px solid #1976d2;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2em;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    transition: background 0.2s, color 0.2s;
  }
  #maximizeMapBtn:hover {
    background: #1976d2;
    color: #fff;
  }
  #infoPanel {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 18px;
    border-radius: 5px;
    max-width: 1400px;
    display: none;
    overflow: visible;
    z-index: 99999;
  }
  .modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
  }
  #infoPanel img {
    max-width: 100%;
    height: auto;
    margin-top: 10px;
  }
  #logoPanel {
    position: absolute;
    left: 180px;
    bottom: 60px;
    display: flex;
    align-items: center;
    z-index: 10;
  }
  .logo-img {
    height: 48px;
    margin-right: 16px;
  }
  .logo-img:last-child {
    margin-right: 0;
  }
  .close-btn {
    position: absolute;
    top: 4px;
    right: 12px;
    background: #fff;
    border: 2px solid #e53935;
    color: #e53935;
    font-size: 22px;
    font-weight: bold;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    z-index: 2;
    transition: background 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .close-btn:hover {
    background: #e53935;
    color: #fff;
  }
  #weatherPanel {
    position: absolute;
    top: 80px;
    right: 20px;
    background: rgba(230, 226, 226, 0.277);
    padding: 12px 18px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    z-index: 1;
    min-width: 180px;
    font-family: sans-serif;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    pointer-events: none;
  }
  #weatherPanel * {
    pointer-events: none !important;
  }
  .cesium-baseLayerPicker-dropDown,
  .cesium-baseLayerPicker-dropDown-visible {
    z-index: 9999 !important;
  }
  #weatherPanel img {
    width: 48px;
    height: 48px;
  }
  #trafficBtn {
    position: absolute;
    top: 24px;
    left: 24px;
    z-index: 200;
    background: #fff;
    color: #333;
    border: 2px solid #1976d2;
    border-radius: 6px;
    padding: 8px 18px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: background 0.2s, color 0.2s;
  }
  #trafficBtn.active {
    background: #1976d2;
    color: #fff;
  }
  #toggle3dBtn {
    position: absolute;
    top: 70px;
    left: 24px;
    z-index: 200;
    background: #fff;
    color: #333;
    border: 2px solid #388e3c;
    border-radius: 6px;
    padding: 8px 18px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: background 0.2s, color 0.2s;
    margin-top: 8px;
  }
  #toggle3dBtn.active {
    background: #388e3c;
    color: #fff;
  }
  /* Sidebar (drawer) styles */
  #sidebarHeader, .sidebar-header {
    background: #2196f3;
    color: #fff;
    font-size: 1.4em;
    font-weight: bold;
    padding: 22px 24px 18px 24px;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .sidebar-header button:first-of-type {
    margin-left: auto; /* Pushes buttons to the right */
    margin-right: 8px;
  }
  .static-data-header {
    padding-top: 11px;
    padding-bottom: 9px;
  }
  .live-observation-header {
    padding-top: 11px;
    padding-bottom: 9px;
  }

  #sidebarCloseBtn {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.6em;
    cursor: pointer;
    margin-left: 10px;
    transition: color 0.2s;
  }
  #sidebarCloseBtn:hover {
    color: #ff5252;
  }
  #sidebar-scroll-container {
    flex: 1;
    overflow-y: auto;
    min-height: 0; /* Important for flexbox scrolling */
    display: flex;
    flex-direction: column;
  }
  .sidebar-content {
    padding: 18px 24px;
    overflow-y: auto;
    max-height: 50%;
    min-height: 150px; /* Prevent it from becoming too small */
  }
  .sidebar-section {
    margin-bottom: 14px;
    margin-bottom: 7px;
  }
  .sidebar-section h3 {
    margin: 0 0 10px 0;
    font-size: 1.1em;
    color: #1976d2;
    font-weight: 600;
    letter-spacing: 0.5px;
  }
  .sidebar-btn {
    display: block;
    width: 100%;
    background: #fff;
    color: #1976d2;
    border: 2px solid #1976d2;
    border-radius: 6px;
    padding: 10px 0;
    font-size: 1em;
    font-weight: bold;
    margin-bottom: 12px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
  }
  .sidebar-btn.active, .sidebar-btn:hover {
    background: #1976d2;
    color: #fff;
  }

  /* Bounding Box Filter Dialog */
  .bb-filter-dialog {
    position: absolute;
    bottom: 100%;
    left: 0;
    width: 100%;
    background: #444;
    border: 1px solid #666;
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    box-shadow: 0 -4px 15px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    transition: all 0.3s ease;
  }
  .bb-filter-dialog.hidden {
    display: none;
  }
  .bb-filter-dialog.minimized .bb-filter-content {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
  }
  .bb-filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: #555;
    border-bottom: 1px solid #666;
  }
  .bb-filter-header h4 {
    margin: 0;
    font-size: 1em;
    color: #fff;
    font-weight: 600;
  }
  .bb-filter-toggle-btn {
    background: #666;
    border: 1px solid #888;
    color: #fff;
    border-radius: 4px;
    width: 20px;
    height: 20px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
  }
  .bb-filter-content {
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    max-height: 50vh;
    transition: max-height 0.4s ease-in-out, padding 0.4s ease-in-out;
  }
  .bb-filter-item {
    background: #3a3a3a;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #555;
    position: relative;
    display: flex;
    gap: 12px;
    user-select: none;
    transition: background-color 0.2s ease;
  }
  /* Add pointer cursor only when the item is interactive (not locked) */
  .bb-filter-item:not(.locked) {
    cursor: pointer;
  }
  .bb-filter-item:not(.locked):hover {
    background-color: #424242; /* Subtle hover effect */
  }
  .bb-filter-item.locked {
    opacity: 0.8;
    background: #333;
  }
  .bb-filter-item .bb-filter-control {
    /* Align checkbox to the top to match the header */
    align-self: flex-start;
  }
  .bb-filter-item.inactive-while-locked {
    opacity: 0.4;
    background: #2a2a2a;
    border-color: #444;
  }
  .bb-filter-item.inactive-while-locked .bb-filter-item-header {
    color: #888;
    font-weight: normal;
  }
  .bb-filter-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .bb-filter-item-header label {
    font-weight: bold;
    color: #ddd; /* Default color for unselected title */
    transition: color 0.3s ease;
  }
  .bb-filter-item.selected .bb-filter-item-header label {
    color: #00aaff; /* Blue color when selected */
  }
  .bb-filter-info-btn {
    background: #555;
    color: #fff;
    border: 1px solid #777;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-family: 'Times New Roman', serif;
    font-style: italic;
    font-weight: bold;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: background-color 0.2s;
  }
  .bb-filter-item-desc {
    font-size: 0.8em;
    color: #ccc;    
    margin: 4px 0 0 0;
  }
  .bb-filter-item-text-content {
    flex-grow: 1;
  }
  .bb-filter-control .filter-checkbox {
    accent-color: #00aaff;
    cursor: pointer;
    transform: scale(1.1);
  }
  .bb-filter-control {
    flex-shrink: 0;
  }
  .filter-display-result {
    font-size: 0.9em;
    font-weight: bold;
    margin-top: 8px;
    color: #4caf50;
  }
  .filter-display-result.map-display {
    color: #2196f3;
  }
  .hidden {
  display: none !important;
}

/* --- Reusable Progress Bar --- */
.progress-bar-container {
  width: 100%;
  background-color: #2a2a2a;
  border: 1px solid #555;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.progress-bar-fill {
  background-color: #00aaff;
  height: 100%;
  width: 0%;
  border-radius: 10px 0 0 10px;
  transition: width 0.2s ease-out;
  position: absolute;
  top: 0;
  left: 0;
}
.progress-bar-label {
  position: relative;
  z-index: 1;
  color: #fff;
  font-size: 12px;
  font-weight: bold;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

/* --- Heatmap Legend Styles --- */
/* This allows the filter result container to hold complex HTML like the legend */
.map-display {
  display: block !important;
  text-align: left !important;
  padding: 8px;
  background-color: #4a4a4a;
  border-radius: 4px;
  border: 1px solid #666;
  color: #eee;
}

.map-display-message {
  font-weight: 500;
  margin-bottom: 8px;
  color: #4caf50;
}

/* --- Traffic Legend --- */
.legend-container {
  background: #e9edf1;
  color: #333;
  padding: 0 15px;
  border-radius: 8px;
  border: 1px solid #d1d9e2;
  width: 100%;
  box-sizing: border-box;
  margin-top: 0;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.4s ease-out, opacity 0.4s ease-out, padding 0.4s ease-out, margin-top 0.4s ease-out;
}
.legend-container:not(.hidden) {
  max-height: 300px; /* A value larger than the legend's content */
  opacity: 1;
  padding: 12px 15px;
  margin-top: 15px;
  overflow-y: auto; /* Add scroll if content exceeds max-height */
}
.legend-container h5 {
  margin: 0 0 10px 0;
  font-size: 1em;
  font-weight: 600;
  text-align: center;
}
.traffic-legend-gradient {
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(to right, #4caf50, #ffeb3b, #f44336, #b71c1c);
  border: 1px solid #777;
}
.traffic-legend-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #555;
  margin-top: 4px;
}

.heatmap-legend {
  width: 100%;
  margin-top: 4px;
}

.legend-gradient {
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(to right, #0000ff, #00ffff, #00ff00, #ffff00, #ff0000);
  border: 1px solid #777;
}

.legend-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #ccc;
  margin-top: 4px;
  padding: 0 2px;
}

.dynamic-legend .legend-labels span {
  flex: 1 1 0;
  text-align: center;
}

/* --- Dynamic Heatmap Legend Styles --- */
.dynamic-legend {
  width: 100%;
}
.legend-top-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: bold;
  color: #fff;
  margin-bottom: 4px;
  padding: 0 2px;
}
.legend-avg-label {
  text-align: center;
}
.legend-max-label {
  text-align: right;
}
.legend-gradient-container {
  position: relative;
  height: 12px; /* Match gradient height */
  margin-bottom: 4px;
}
.legend-range-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.25);
  border-left: 1px solid rgba(255, 255, 255, 0.7);
  border-right: 1px solid rgba(255, 255, 255, 0.7);
  box-sizing: border-box;
}
.legend-out-of-range-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  background-color: rgba(80, 80, 80, 0.6);
  box-sizing: border-box;
}
.legend-marker-bar {
  position: absolute;
  top: -2px; /* Extend slightly above */
  bottom: -2px; /* Extend slightly below */
  width: 2px;
  transform: translateX(-50%);
  background-color: #fff;
  box-shadow: 0 0 3px rgba(0,0,0,0.8);
}
.min-marker, .max-marker {
  background-color: #f0f0f0;
}
.legend-avg-line {
  width: 2px;
  height: 12px; /* Same as gradient height */
  background-color: #fff;
  box-shadow: 0 0 2px rgba(0,0,0,0.7);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #333;
}

.legend-item:not(:last-child) {
  margin-bottom: 6px;
}

.legend-color-box {
  width: 14px;
  height: 14px;
  border: 1px solid rgba(0,0,0,0.2);
  border-radius: 3px;
}

/* --- Weather Alert Display Styles --- */
.weather-alert-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 200px; /* Or whatever fits your UI */
  overflow-y: auto;
}
.weather-alert-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px;
  background-color: #3f3f3f;
  border-radius: 4px;
}
.weather-alert-dot {
  flex-shrink: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-top: 4px;
  border: 1px solid rgba(0,0,0,0.5);
}
.weather-alert-event {
  font-weight: bold;
  color: #eee;
}
.weather-alert-headline {
  font-size: 0.85em;
  color: #ccc;
  margin: 2px 0 0 0;
  line-height: 1.3;
}

/* --- Aviation Text Summary --- */
.aviation-text-summary {
  font-size: 13px;
  color: #ddd;
  margin: 0 0 10px 0;
  padding-bottom: 8px;
  border-bottom: 1px solid #666;
  line-height: 1.4;
}

/* --- Aviation Data Display Styles --- */
.aviation-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.aviation-metric {
  background-color: #333;
  border-radius: 4px;
  padding: 8px;
  text-align: center;
  border-width: 2px;
  border-style: solid;
  border-color: #555; /* Default border color */
}
.aviation-metric.flight-category {
  grid-column: 1 / -1; /* Span both columns */
}
.aviation-label {
  display: block;
  font-size: 11px;
  color: #bbb;
  margin-bottom: 4px;
  font-weight: 500;
}
.aviation-label i {
  margin-right: 4px;
  color: #888;
}
.aviation-value {
  display: block;
  font-size: 16px;
  font-weight: bold;
  color: #fff;
}

  /* Hamburger menu */
  #hamburgerBtn {
    position: absolute;
    top: 24px;
    left: 24px;    
    z-index: 400;
    width: 44px;
    height: 44px;
    background: #fff;
    border: 2px solid #1976d2;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: background 0.2s, border 0.2s;
  }
  #hamburgerBtn:hover {
    background: #1976d2;
    border-color: #1976d2;
  }
  #hamburgerBtn .hamburger-bar {
    display: block;
    width: 24px;
    height: 3px;
    background: #1976d2;
    border-radius: 2px;
    margin: 4px 0;
    transition: background 0.2s;
  }
  #hamburgerBtn:hover .hamburger-bar {
    background: #fff;
  }
  /* Floating restore icon */
  #sidebarRestoreBtn {
    position: absolute;
    left: 24px;
    top: 32px;
    z-index: 400;
    width: 48px;
    height: 48px;
    background: #1976d2;
    color: #fff;
    border: none;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 2em;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    transition: background 0.2s;
  }
  #sidebarRestoreBtn:hover {
    background: #1565c0;
  }
  #aqiList {
    list-style: none;
    padding: 0;
    margin: 12px 0 0 0;
    max-height: 400px;
    overflow-y: auto;
  }
  .aqi-station {
    margin-bottom: 12px;
    padding: 12px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid #e0e0e0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  }
  .aqi-station-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
  }
  .aqi-station-name {
    font-weight: bold;
    color: #1976d2;
    font-size: 1.1em;
  }
  .aqi-station-state {
    color: #666;
    font-size: 0.9em;
  }
  .aqi-station-details {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px;
    font-size: 0.95em;
  }
  .aqi-station-label {
    color: #666;
  }
  .aqi-station-value {
    font-weight: 500;
  }
  .aqi-category {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.9em;
    font-weight: 500;
  }
  .aqi-category-good { background: #e8f5e9; color: #388e3c; }
  .aqi-category-moderate { background: #fff8e1; color: #fbc02d; }
  .aqi-category-unhealthy-sg { background: #fff3e0; color: #ff9800; }
  .aqi-category-unhealthy { background: #ffebee; color: #e53935; }
  .aqi-category-very-unhealthy { background: #f3e5f5; color: #8e24aa; }
  .aqi-category-hazardous { background: #efebe9; color: #6d4c41; }
  .auth-container {
    max-width: 350px;

    margin: 100px auto;
    padding: 32px 24px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 16px rgba(0,0,0,0.08);
    text-align: center;
  }
  .auth-container h2 {
    margin-bottom: 18px;
    color: #1976d2;
  }
  .auth-container input {
    width: 100%;
    padding: 10px;
    margin-bottom: 14px;
    border: 1px solid #bdbdbd;
    border-radius: 6px;
    font-size: 1em;
  }
  .auth-container button {
    width: 100%;
    padding: 10px;
    background: #1976d2;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    margin-bottom: 10px;
  }
  .auth-container button:hover {
    background: #1565c0;
  }
  .auth-error {
    color: #e53935;
    margin-bottom: 10px;
    min-height: 18px;
  }
  .landing-container {
    display: flex;
    min-height: 100vh;
    background: #F4F7F9;
  }
  #slideshow-section {
    width: 80vw;
    min-width: 60vw;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-right: 1px solid #e0e4ea;
    padding-right: 48px;
    position: relative;
    margin-left: 5px;
  }
  .slideshow-wrapper {
    width: 100%;
    max-width: 1000px;
    margin-bottom: 100px;
    height: 520px;
    position: relative;
    border-radius: 18px;
    box-shadow: 0 4px 32px rgba(0,0,0,0.10);
    overflow: hidden;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .slide-images {
    width: 100%;
    height: 100%;
    margin-left: 10px;;
    position: relative;
  }
  .slide-img {
    width: 100%;
    height: 520px;
    position: absolute;
    top: 0; left: 0;
    opacity: 0;
    transform: scale(1.05);
    transition: opacity 1s cubic-bezier(.4,0,.2,1), transform 1s cubic-bezier(.4,0,.2,1);
    z-index: 1;
    border-radius: 18px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
  }
  .slide-img.active {
    opacity: 1;
    z-index: 2;
    transform: scale(1);
  }
  .slide-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 18px;
    display: block;
  }
  .slide-caption {
    position: absolute;
    left: 0;
    bottom: 0;
    background: linear-gradient(90deg, rgba(0,39,76,0.85) 80%, rgba(0,39,76,0.0) 100%);
    color: #fff;
    padding: 24px 36px 18px 24px;
    border-bottom-left-radius: 18px;
    border-bottom-right-radius: 18px;
    max-width: 70%;
    z-index: 3;
  }
  .slide-caption h3 {
    font-size: 1.25em;
    font-weight: 600;
    margin: 0 0 4px 0;
    color: #fff;
  }
  .slide-caption p {
    font-size: 1em;
    font-weight: 400;
    margin: 0;
    color: #e0e4ea;
  }
  #slide-indicators {
    position: absolute;
    left: 50%;
    bottom: 18px;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 10;
  }
  .slide-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #e0e4ea;
    border: none;
    outline: none;
    cursor: pointer;
    transition: background 0.2s;
  }
  .slide-dot.active {
    background: #0055A5;
  }
  .slide-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,85,165,0.85);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    font-size: 1.6em;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
  }
  .slide-prev { left: 24px; }
  .slide-next { right: 24px; left: auto; }
  .slide-arrow:hover { background: #003F7F; }

  #auth-section {
    width: 40vw;
    min-width: 340px;
    max-width: 480px;
    background: #F4F7F9;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 64px 0;
    min-height: 100vh;
  }
  .landing-auth-card {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 32px rgba(0,0,0,0.10);
    padding: 40px 32px 32px 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: slideInRight 0.8s cubic-bezier(.4,0,.2,1);
    opacity: 1;
  }
  @keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
  }
  .landing-auth-card h1 {
    font-size: 24px;
    font-weight: 600;
    color: #00274C;
    margin: 0 0 6px 0;
    letter-spacing: 1.5px;
    text-align: center;
  }
  .tagline {
    font-size: 14px;
    color: #555;
    margin-bottom: 24px;
    text-align: center;
    font-weight: 400;
  }
  .welcome-heading {
    text-align: center;
    font-size: 1.15em;
    font-weight: 600;
    color: #00274C;
    margin-bottom: 24px;
    margin-top: 0;
    letter-spacing: 1px;
  }
  #authOptions {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 18px;
    align-items: center;
    justify-content: center;
    margin-bottom: 18px;
    transition: opacity 0.5s;
  }
  .btn-primary {
    background: #0055A5;
    color: #fff;
    font-weight: 700;
    text-transform: uppercase;
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    font-size: 1em;
    margin-bottom: 8px;
    cursor: pointer;
    transition: background 0.2s;
    font-family: 'Poppins', Arial, sans-serif;
  }
  .btn-primary:hover {
    background: #003F7F;
  }
  .btn-link {
    background: none;
    color: #0055A5;
    font-weight: 600;
    border: none;
    font-size: 1em;
    text-decoration: underline;
    cursor: pointer;
    margin-bottom: 8px;
    padding: 0;
    font-family: 'Poppins', Arial, sans-serif;
  }
  .btn-link:hover {
    color: #003F7F;
    text-decoration: underline;
  }
  .input-icon-group {
    position: relative;
    width: 100%;
    margin-bottom: 10px;
  }
  .input-icon-group i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #bbb;
    font-size: 1.1em;
    pointer-events: none;
    z-index: 2;
  }
  .input-icon-group input {
    width: 100%;
    padding: 12px 12px 12px 38px;
    border: 1.5px solid #ccc;
    border-radius: 4px;
    font-size: 1em;
    font-family: 'Poppins', Arial, sans-serif;
    transition: border 0.2s, box-shadow 0.2s;
    background: #fafbfc;
    outline: none;
  }
  .input-icon-group input:focus {
    border-color: #0055A5;
    box-shadow: 0 0 0 2px rgba(0,85,165,0.2);
  }
  .input-icon-group input.invalid {
    border-color: #D32F2F;
    box-shadow: 0 0 0 2px rgba(211,47,47,0.15);
  }
  .error {
    color: #D32F2F;
    font-size: 12px;
    margin-top: 4px;
    min-height: 16px;
    font-family: 'Poppins', Arial, sans-serif;
  }
  .auth-text {
    font-size: 14px;
    color: #333;
    margin-top: 12px;
    text-align: center;
    font-family: 'Poppins', Arial, sans-serif;
  }
  .success-message {
    color: #0055A5;
    font-size: 1.1em;
    margin-bottom: 18px;
    text-align: center;
    font-family: 'Poppins', Arial, sans-serif;
  }
  .udt-lab-heading {
    position: absolute;
    top: 32px;
    left: 48px;
    font-size: 2.6em;
    font-weight: 900;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: #00274C;
    z-index: 20;
    background: none;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    font-family: 'Poppins', Arial, sans-serif;
  }
  @media (max-width: 1200px) {
    .slideshow-wrapper {
      max-width: 98vw;
      height: 340px;
    }
    .slide-img, .slide-img img {
      height: 340px;
    }
    .udt-lab-heading {
      font-size: 1.5em;
      left: 18px;
      top: 18px;
    }
  }
  @media (max-width: 900px) {
    .slideshow-wrapper {
      height: 220px;
    }
    .slide-img, .slide-img img {
      height: 220px;
    }
    .udt-lab-heading {
      font-size: 1.1em;
      left: 10px;
      top: 10px;
    }
    #slideshow-section {
      margin-left: 12px;
    }
  }
  @media (max-width: 768px) {
    .landing-container {
      flex-direction: column;
    }
    #slideshow-section {
      display: none;
    }
    #auth-section {
      width: 100vw;
      min-width: 0;
      max-width: 100vw;
      margin: 0 auto;
      min-height: 100vh;
      box-shadow: none;
      border-radius: 0;
      padding: 32px 12px 28px 12px;
      background: #F4F7F9;
    }
    #header {
      top: 10px;
      right: 10px;
      gap: 8px;
    }
    .header-logo {
      height: 36px;
      padding: 2px 4px;
    }
  }

  /* Form fade/slide transitions */
  #authOptions, #registerForm, #loginForm, #forgotForm, #registerSuccess {
    opacity: 1;
    transition: opacity 0.5s, transform 0.5s;
  }
  #registerForm, #loginForm, #forgotForm, #registerSuccess {
    position: absolute;
    left: 0; right: 0;
    top: 0;
    width: 100%;
    background: transparent;
    z-index: 2;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
  }
  #registerForm.active, #loginForm.active, #forgotForm.active, #registerSuccess.active {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
    position: static;
  }
  #authOptions.inactive, #registerForm.inactive, #loginForm.inactive, #forgotForm.inactive, #registerSuccess.inactive {
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
  }

  #header {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 16px;
    z-index: 100;
  }
  .header-logo {
    height: 48px;
    width: auto;
    object-fit: contain;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    padding: 4px 8px;
  }

  .dropdown-header {
    font-size: 1.1em;
    font-weight: bold;
    color: #1976d2;
    cursor: pointer;
    padding: 8px 0;
    border-bottom: 1px solid #e0e0e0;
    outline: none;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .dropdown-header:after {
    content: '\25BC';
    font-size: 0.8em;
    margin-left: 8px;
    transition: transform 0.2s;
  }
  .dropdown.open .dropdown-header:after {
    transform: rotate(-180deg);
  }
  .dropdown-content {
    display: none;
    padding: 8px 0 0 0;
  }
  .dropdown.open .dropdown-content {
    display: block;
  }


  /* Bounding box UI */
  .bounding-box-ui {
    background-color: #333;
    color: #fff;
    padding: 15px;
    border-top: 2px solid #555;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: background-color 0.5s ease;
    position: relative; /* For popup positioning */
  }
  .bounding-box-ui.state-initial {
    background-color: #333;
  }
  .bounding-box-ui.state-creating {
    background-color: #646433;
  }
  .bounding-box-ui.state-inactive {
    background-color: #734d4d;
  }
  .bounding-box-ui.state-active {
    background-color: #336464;
  }

  .bounding-box-title {
    font-weight: bold;
    font-size: 1.1em;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .bounding-box-actions {
    display: flex;
    align-items: center;
  }
  .bounding-box-actions .bb-info-btn,
  .bounding-box-actions .bb-stats-btn {
    margin-left: 8px;
  }

  .bounding-box-description {
    font-size: 0.85em;
    color: #bbb;
    margin: -5px 0 5px 0;
  }
  .bounding-box-controls {
  display: flex;
  justify-content: space-around;
  gap: 8px;
}
.bounding-box-btn-group {
  position: relative;
  flex-grow: 1;
}
.bounding-box-btn {
  background-color: #007bff;
  color: #fff;
  border: none;
  padding: 8px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s;
  flex-grow: 1;
  text-align: center;
  width: 100%; /* Make button take full width of its container */
}
.bounding-box-options {
  position: absolute;
  bottom: 100%; /* Position above the button */
  left: 0;
  background-color: #444;
  width: max-content; /* Allow the container to be as wide as its content */
  border: 1px solid #666;
  border-radius: 4px;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.2);
  z-index: 10;
  display: flex;
  flex-direction: column;
  padding: 5px;
  white-space: nowrap;
  gap: 5px;
}
.bounding-box-option-btn {
  background-color: #555;
  color: #fff;
  border: 1px solid #777;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 8px;
}
.bounding-box-option-btn:hover:not(:disabled) {
  background-color: #666;
}
.bounding-box-btn#bbCreateBoxBtn, .bounding-box-btn#bbDrawShapeBtn {
  flex-grow: 0.5;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s;
  flex-grow: 1;
  text-align: center;
}
.bounding-box-btn:hover {
  background-color: #0056b3;
}
.bounding-box-btn:disabled {
  background-color: #f8f9fa;
  color: #6c757d;
  border: 1px solid #dee2e6;
  cursor: not-allowed;
  opacity: 0.7;
}
/* Ensure title attribute is shown on hover for disabled buttons */
.bounding-box-btn:disabled[title] {
  pointer-events: auto;
}
.bounding-box-btn:disabled:hover {
  background-color: #f8f9fa;
  color: #6c757d;
}

.bb-info-btn {
  background: #555;
  color: #fff;
  border: 1px solid #777;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  font-family: 'Times New Roman', serif;
  font-style: italic;
  font-weight: bold;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background-color 0.2s;
}
.bb-info-btn:hover {
  background: #777;
}

.bb-stats-btn {
  background: #555;
  color: #fff;
  border: 1px solid #777;
  border-radius: 50%;
  width: 22px;
  height: 22px;
}
.bb-info-popup {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  margin: 0 10px 5px 10px; /* Add some margin */
  background: #444;
  border: 1px solid #666;
  border-radius: 6px;
  padding: 15px;
  box-shadow: 0 -4px 15px rgba(0,0,0,0.3);
  z-index: 10;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
}
.bb-info-popup.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
/* Overrides for dynamically positioned popups (like filter metadata) */
#filterMetadataPopup {
  position: fixed; /* Use fixed to position relative to viewport */
  bottom: auto;
  right: auto;
  left: auto;
  margin: 0;
  z-index: 9999; /* Ensure it's on top of everything */
  max-width: 320px;
  box-shadow: 0 5px 20px rgba(0,0,0,0.4);
}
#filterMetadataPopup a {
  color: #00aaff;
  text-decoration: underline;
}
.bb-info-close-btn {
  position: absolute;
  top: 5px;
  right: 10px;
  background: none;
  border: none;
  color: #aaa;
  font-size: 24px;
  cursor: pointer;
}
.bb-info-section { margin-bottom: 15px; }
.bb-info-section:last-child { margin-bottom: 0; }
.bb-info-section h5 { 
  margin: 0 0 5px; 
  color: #00aaff; 
  display: flex;
  align-items: center;
}
.bb-info-section h5 i {
  margin-right: 8px;
  color: #7ac9ff;
  width: 1.2em;
  text-align: center;
}
.bb-info-section p { font-size: 0.9em; color: #ddd; margin: 0; }
.bb-info-section p strong {
  color: #fff;
  font-weight: 600;
}
.stat-copy-btn {
  background: none;
  border: none;
  color: #999;
  cursor: pointer;
  padding: 0 5px;
  margin-left: auto; /* Pushes the button to the right */
  font-size: 14px;
  transition: color 0.2s ease;
}
.stat-copy-btn:hover {
  color: #fff;
}
.stat-copy-btn i.fa-check {
  color: #4caf50; /* Green checkmark for success */
}
.bb-info-section h5 {
  display: flex;
  align-items: center;
}

/* --- Heatmap Opacity Controls --- */
.heatmap-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid #666;
}

.heatmap-control-btn {
  background: #555;
  color: #fff;
  border: 1px solid #777;
  border-radius: 4px;
  width: 30px;
  height: 30px;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
}
.heatmap-control-btn:hover {
  background-color: #666;
}

.heatmap-slider-container {
  flex-grow: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #ccc;
}

.heatmap-opacity-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: #333;
  outline: none;
  border-radius: 3px;
  border: 1px solid #777;
}
.heatmap-opacity-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  background: #00aaff;
  cursor: pointer;
  border-radius: 50%;
  border: 2px solid #fff;
}
.heatmap-opacity-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: #00aaff;
  cursor: pointer;
  border-radius: 50%;
  border: 2px solid #fff;
}

.heatmap-opacity-slider::-moz-range-thumb {
  border: 2px solid #fff;
}

/* --- Bounding Box Boundary Selection Dialog --- */
.bb-boundary-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  width: 90vw;
  max-width: 450px;
  height: 70vh;
  background: #f7fafd;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  z-index: 1001;
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
}

.bb-boundary-dialog:not(.hidden) {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

.bb-boundary-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid #e0e4ea;
  flex-shrink: 0;
}

.bb-boundary-header h4 {
  margin: 0;
  font-size: 1.2em;
  color: #1976d2;
  font-weight: 600;
}
.bb-boundary-close-btn {
  background: none;
  border: none;
  font-size: 1.8em;
  color: #999;
  cursor: pointer;
  transition: color 0.2s;
  line-height: 1;
}
.bb-boundary-close-btn:hover {
  color: #ff5252;
}

.bb-boundary-content {
  display: flex;
  flex-direction: column;
  padding: 16px 24px;
  overflow: hidden;
  flex-grow: 1;
}
.bb-boundary-search {
  width: 100%;
  padding: 12px 16px;
  font-size: 1em;
  border: 1px solid #ccc;
  border-radius: 6px;
  margin-bottom: 16px;
  box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.bb-boundary-search:focus {
  outline: none;
  border-color: #1976d2;
  box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.2);
}
.bb-boundary-list {
  overflow-y: auto;
  flex-grow: 1;
}
.bb-boundary-list::-webkit-scrollbar {
  width: 8px;
}
.bb-boundary-list::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}
.bb-boundary-list::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 4px;
}
.bb-boundary-list::-webkit-scrollbar-thumb:hover {
  background: #aaa;
}
.bb-boundary-category {
  font-size: 0.9em;
  font-weight: 600;
  color: #555;
  text-transform: uppercase;
  margin: 16px 0 8px 0;
  border-bottom: 1px solid #e0e4ea;
  padding-bottom: 4px;
}
.bb-boundary-item {
  display: block;
  width: 100%;
  padding: 10px 12px;
  background: transparent;
  border: none;
  border-radius: 4px;
  text-align: left;
  font-size: 1em;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}
.bb-boundary-item:hover,
.bb-boundary-item.keyboard-highlight {
  background-color: #e3f2fd;
  color: #1976d2;
}

/* --- Land Use Info Dialog --- */
/* Make the selector more specific to override .bb-boundary-dialog */
.bb-boundary-dialog.land-use-dialog {
  /* Override modal positioning to pin to the corner */
  position: absolute;
  bottom: 80px; /* Position above the bottom-right buttons */
  right: 20px;
  top: auto;
  left: auto;
  transform: translateY(0) scale(1); /* Reset transform */
  transition: opacity 0.3s, transform 0.3s;

  /* Style overrides */
  background: rgba(25, 35, 45, 0.9);
  backdrop-filter: blur(5px);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  width: 320px; /* Fixed width like other info boxes */
  max-width: 320px;
  height: auto; /* Auto height based on content */
  z-index: 1000; /* Ensure it's above map elements */
}
.bb-boundary-dialog.land-use-dialog .bb-boundary-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}
.bb-boundary-dialog.land-use-dialog .bb-boundary-header h4 {
  color: #7ac9ff;
}
.bb-boundary-dialog.land-use-dialog .bb-boundary-close-btn {
  color: #aaa;
}
.bb-boundary-dialog.land-use-dialog .bb-boundary-close-btn:hover {
  color: #fff;
}
.bb-boundary-dialog.land-use-dialog.hidden {
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
}
.land-use-content {
  padding: 16px 24px;
  overflow-y: auto;
}
.land-use-details {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  font-size: 1em;
  align-items: start; /* Align to top for multi-line values */
}
.land-use-label {
  font-weight: 600;
  color: #ccc;
  text-align: right;
  padding-top: 4px; /* Align with text in value box */
}
.land-use-value {
  font-weight: 400;
  color: #7ac9ff;
  background-color: rgba(0,0,0,0.2);
  padding: 4px 8px;
  border-radius: 4px;
  word-break: break-word; /* Better word breaking */
}
/* SVI Source Info */
#svi-source-info {
  font-size: 12px;
  color: #555;
  background-color: #eef2f7;
  padding: 10px;
  border-radius: 4px;
  border: 1px solid #d1d9e2;
}
#svi-source-info h6 {
  margin: 0 0 5px;
  font-weight: bold;
}

/* --- SVI Result Display Styles --- */
.svi-result {
  padding: 4px;
}
.svi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.svi-level {
  color: white;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: bold;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}
.svi-value {
  font-size: 14px;
  color: #eee;
}
.svi-explanation {
  font-size: 13px;
  margin: 0;
  line-height: 1.4;
  color: #ccc;
  font-weight: normal;
}

/* --- River Gauge Styles --- */
.gauge-result {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  padding: 8px;
}
.gauge-count {
  font-size: 24px;
  font-weight: bold;
  color: #00aaff;
}
.gauge-count-label {
  font-size: 16px;
  color: #eee;
}
.gauge-instructions {
  font-size: 12px;
  color: #bbb;
  text-align: center;
  margin-top: 4px;
}

/* --- Gauge InfoBox Container --- */
.gauge-info-box-container {
  position: absolute;
  bottom: 80px; /* Position above the bottom-right buttons */
  right: 20px;
  z-index: 1000;
  width: 320px;
  transition: opacity 0.3s, transform 0.3s;
}
.gauge-info-box-container.hidden {
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
}

.gauge-info-box {
  background: rgba(25, 35, 45, 0.9);
  backdrop-filter: blur(5px);
  color: #fff;
  border-radius: 8px;
  box-shadow: 0 5px 20px rgba(0,0,0,0.3);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 16px 20px;
}
.gauge-info-box h4 {
  margin: 0 0 12px 0;
  font-size: 1.1em;
  color: #7ac9ff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  padding-bottom: 8px;
}
.gauge-info-close {
  position: absolute;
  top: 8px;
  right: 12px;
  background: none;
  border: none;
  color: #aaa;
  font-size: 24px;
  cursor: pointer;
  transition: color 0.2s;
}
.gauge-info-close:hover {
  color: #fff;
}
.gauge-forecast-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.gauge-metric {
  text-align: center;
  background: rgba(0,0,0,0.2);
  padding: 8px;
  border-radius: 4px;
}
.gauge-label {
  display: block;
  font-size: 12px;
  color: #ccc;
  margin-bottom: 4px;
}
.gauge-value {
  font-size: 16px;
  font-weight: bold;
}
.gauge-timestamp {
  font-size: 11px;
  color: #999;
  text-align: center;
  margin-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  padding-top: 8px;
}
.gauge-status-legend {
  display: flex;
  justify-content: space-around;
  align-items: center;
  font-size: 11px;
  color: #bbb;
  margin-top: 12px;
  padding: 8px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}
.gauge-legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
}
.gauge-legend-item .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

/* --- Sensor InfoBox Overrides --- */
.sensor-info-box .gauge-timestamp {
  margin-top: 8px;
  padding-top: 8px;
}

/* --- Sensor Chart Styles --- */
.sensor-charts-container {
  display: flex;
  flex-direction: column;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
}
.sensor-chart-tabs {
  display: flex;
  border-bottom: 1px solid #555;
  margin-bottom: 12px;
}
.sensor-chart-tab {
  background: none;
  border: none;
  color: #aaa;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  position: relative;
  transition: color 0.2s ease;
}
.sensor-chart-tab:hover {
  color: #fff;
}
.sensor-chart-tab.active {
  color: #00aaff;
  font-weight: bold;
}
.sensor-chart-tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background-color: #00aaff;
}
.sensor-chart-wrapper {
  background: rgba(0,0,0,0.2);
  border-radius: 4px;
  padding: 12px 8px; /* Add more vertical padding */
  display: none; /* Hide charts by default */
}
.sensor-chart-wrapper.active {
  display: block; /* Show only the active chart */
}

/* Sensor History Controls */
.sensor-history-controls {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
  margin-bottom: 8px;
}
.history-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ccc;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
}
.history-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}
.history-btn.active {
  background: #00aaff;
  border-color: #00aaff;
  color: #fff;
}
.custom-date-inputs {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  padding: 4px;
  background: rgba(0,0,0,0.2);
  border-radius: 4px;
}
.history-date-input {
  background: #333;
  border: 1px solid #555;
  color: #fff;
  padding: 2px 4px;
  border-radius: 3px;
  font-size: 11px;
}
.history-date-input::-webkit-calendar-picker-indicator {
  filter: invert(1);
  cursor: pointer;
}
.history-go-btn {
  background: #4caf50;
  border: none;
  color: #fff;
  padding: 2px 8px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 11px;
  font-weight: bold;
}

/* --- CO2 Sensor Result Display --- */
.sensor-result {
  display: flex;
  justify-content: space-around;
  padding: 8px 4px;
  text-align: center;
}
.sensor-metric {
  display: flex;
  flex-direction: column;
}
.sensor-label {
  font-size: 12px;
  color: #bbb;
}
.sensor-value {
  font-size: 16px;
  font-weight: bold;
  color: #eee;
}
.sensor-metric.full-width {
  grid-column: 1 / -1; /* Span across all columns */
  margin-top: 4px;
}


/* --- Flood Level Analysis Result Display --- */
.flood-level-result {
  display: block;
  text-align: center;
  padding: 8px 4px;
}
.flood-cluster-label {
  font-size: 13px;
  color: #ccc;
  margin-bottom: 4px;
}
.flood-cluster-value {
  font-size: 22px;
  font-weight: bold;
  line-height: 1;
  padding: 4px 12px;
  border-radius: 16px;
  display: inline-block;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.4);
}
.flood-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
  text-align: center;
}
.flood-stat-item {
  line-height: 1;
  padding: 4px 12px;
  border-radius: 16px;
  display: inline-block;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.4);
}
.risk-low {
  background-color: #4caf50;
  color: white;
}
.risk-moderate {
  background-color: #ffeb3b;
  color: #333;
}
.risk-high {
  background-color: #f44336;
  color: white;
}


  /* Fullscreen Image Modal */
  .modal {
    display: none;
    position: fixed;
    z-index: 100000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: hidden; /* Changed from auto to hidden */
    background-color: rgba(0, 0, 0, 0.9);
  }

  #modalImageWrapper {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
  }

  .modal-content {
    margin: auto;
    display: block;
    max-width: 90%;
    max-height: 90%;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
    z-index: 100001;
  }

  .modal-close:hover,
  .modal-close:focus {
    color: #bbb;
    text-decoration: none;
    cursor: pointer;
  }

  /* --- Emergency Event Image Detection Button --- */
  .carousel-slide {
    position: relative; /* Needed for absolute positioning of the button */
  }

  .detect-btn {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background-color: rgba(0, 85, 165, 0.85); /* Opaque blue */
    color: #fff;
    border: none;
    border-radius: 20px; /* Pill shape */
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    overflow: hidden;
    transition: all 0.3s ease;
    width: 32px; /* Start as a circle */
    height: 32px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  }

  .detect-btn:hover {
    background-color: #003F7F; /* Darker blue on hover */
    width: 100px; /* Expand width on hover */
  }

  .detect-btn i {
    font-size: 16px;
    transition: margin 0.3s ease;
  }

  .detect-btn span {
    white-space: nowrap;
    font-weight: bold;
    font-size: 14px;
    max-width: 0;
    opacity: 0;
    transition: max-width 0.3s ease, opacity 0.3s ease, margin-left 0.3s ease;
    margin-left: 0;
  }

  .detect-btn:hover span {
    max-width: 60px; /* Allow space for the text */
    opacity: 1;
    margin-left: 8px; /* Space between icon and text */
  }

  .detect-btn.loading {
    width: 120px; /* Expanded width for "Detecting..." */
    cursor: wait;
    background-color: #555;
  }

  .detect-btn.loading span {
    max-width: 100px;
    opacity: 1;
    margin-left: 8px;
  }

/* --- Sensor Loading State --- */
.sensor-loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 160px; /* Match chart height approx */
  color: #ccc;
  gap: 10px;
  animation: fadeIn 0.3s ease-in-out;
}

.sensor-loader {
  width: 30px;
  height: 30px;
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: #00aaff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

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

.sensor-chart-content {
  min-height: 160px; /* Prevent collapse during loading */
  transition: opacity 0.3s ease;
}

/* --- Map Toolbox (Floating Action Buttons) --- */
#mapToolbox {
  position: absolute;
  top: 24px;
  left: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 400;
  pointer-events: none; /* Let clicks pass through container */
}

.toolbox-item {
  width: 48px;
  height: 48px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: auto; /* Enable clicks on buttons */
  transition: transform 0.2s, background-color 0.2s, color 0.2s;
  color: #333;
  font-size: 1.2em;
  border: 2px solid #1976d2;
  position: relative;
}

.toolbox-item:hover {
  background-color: #1976d2;
  color: white;
  transform: scale(1.05);
}

.toolbox-item.active {
  background-color: #1976d2;
  color: white;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

@keyframes toolboxIntro {
  0% { transform: scale(32.0); opacity: 0; background-color: #ffffff; }
  30% { opacity: 0.8; background-color: #64b5f6; }
  100% { transform: scale(1.0); opacity: 0; background-color: #1976d2; }
}

.toolbox-item.appearing::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  border-radius: 50%;
  background-color: #64b5f6;
  z-index: -1;
  animation: toolboxIntro 0.6s ease-in-out forwards;
}

/* Tool Panel (Interpolation UI) */
#toolPanel {
  position: absolute;
  top: 80px;
  left: 24px;
  width: 300px;
  background: rgba(25, 35, 45, 0.95); /* Dark theme matching other panels */
  backdrop-filter: blur(5px);
  padding: 16px;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  z-index: 401;
  display: none;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
}

#toolPanel h4 {
  margin: 0 0 12px 0;
  color: #7ac9ff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1.1em;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  padding-bottom: 8px;
}

.tool-panel-close {
  background: none;
  border: none;
  font-size: 1.4em;
  cursor: pointer;
  color: #aaa;
  transition: color 0.2s;
  line-height: 1;
}

.tool-panel-close:hover {
  color: #fff;
}

.tool-content {
  font-size: 0.95em;
  color: #ddd;
}

.tool-content p {
  margin-top: 0;
  line-height: 1.4;
  margin-bottom: 15px;
}

.tool-btn-action {
  width: 100%;
  padding: 10px;
  background: #00aaff;
  color: white;
  border: none;
  border-radius: 4px;
  font-weight: bold;
  cursor: pointer;
  margin-top: 15px;
  font-size: 1em;
  transition: background 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tool-btn-action:hover {
  background: #0088cc;
}

.tool-btn-action:disabled {
  background: #555;
  color: #888;
  cursor: not-allowed;
}

.tool-btn-secondary {
  width: 100%;
  padding: 8px;
  background: transparent;
  color: #aaa;
  border: 1px solid #555;
  border-radius: 4px;
  font-size: 0.85em;
  cursor: pointer;
  margin-top: 15px;
  transition: all 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tool-btn-secondary:hover {
  color: #ff5252;
  border-color: #ff5252;
  background: rgba(255, 82, 82, 0.1);
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.interpolation-stats {
  margin-top: 15px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 0.9em;
  color: #ccc;
}

.stat-box {
  background: rgba(255,255,255,0.05);
  padding: 8px 4px;
  border-radius: 4px;
  text-align: center;
}
.stat-box label {
  display: block;
  font-size: 0.7em;
  color: #aaa;
  margin-bottom: 3px;
  text-transform: uppercase;
}
.stat-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
}

.stat-row strong {
  color: #fff;
}
