/* Style for the custom download button */
.custom-download-button {
  background: transparent;
  /* Make background transparent */
  border: none;
  /* Remove borders */
  padding: 0;
  /* Remove padding */
  cursor: pointer;
  /* Change cursor to pointer on hover */
}

/* Increase text size in the hover panel (tooltip) */
.leaflet-tooltip {
  font-size: 14px !important;
  line-height: 1.2 !important;
}

/* Collapsible Map Control Styling */
.map-layer-control {
  background-color: white;
  border-radius: 4px;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
  padding: 5px;
  width: 36px;
  height: 36px;
  overflow: hidden;
  transition: width 0.3s ease, height 0.3s ease;
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

.map-layer-control.expanded {
  width: 200px;
  height: auto;
  padding: 10px;
}

.control-icon {
  width: 26px;
  height: 26px;
  text-align: center;
  margin-bottom: 5px;
  font-size: 18px;
  color: #333;
  flex-shrink: 0;
}

.control-content {
  opacity: 0;
  transition: opacity 0.3s ease;
  margin-top: 5px;
  white-space: nowrap;
  /* Prevent wrapping during transition */
}

.map-layer-control.expanded .control-content {
  opacity: 1;
  white-space: normal;
}

.map-layer-control.expanded .control-icon {
  display: none !important;
}

.map-layer-control .control-content label {
  font-size: 85%;
  /* Reduce text size by 15% */
}

/* Frozen overlay - blocks all interactions during data loading */
.frozen-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.3);
  z-index: 9999;
  display: none;
  cursor: wait;
}

.frozen-overlay.active {
  display: flex !important;
  align-items: flex-start !important;
  justify-content: flex-end !important;
  padding: 80px 30px 30px 30px !important;
}

.frozen-overlay-content {
  position: relative;
  background: white;
  width: 400px;
  min-height: 200px;
  padding: 30px;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.frozen-overlay-content .spinner-border {
  width: 3rem;
  height: 3rem;
  margin-bottom: 15px;
}

.frozen-overlay-content p {
  margin: 0;
  font-size: 1.1rem;
  color: #333;
}

.frozen-overlay-station {
  font-size: 1.3rem;
  font-weight: bold;
  color: #007bff;
  margin-bottom: 10px;
}

.frozen-overlay-close {
  position: absolute;
  top: 10px;
  right: 15px;
  border: none;
  background: none;
  font-size: 1.5rem;
  color: #666;
  cursor: pointer;
  line-height: 1;
}

.frozen-overlay-close:hover {
  color: #000;
}

/* Disable pointer events on sidebar when frozen */
body.ui-frozen .bslib-sidebar-layout>.sidebar {
  pointer-events: none;
  opacity: 0.6;
}

body.ui-frozen .navbar {
  pointer-events: none;
  opacity: 0.6;
}

/* Keep the floating panel active for close button */
body.ui-frozen #station_detail_panel {
  pointer-events: auto;
  opacity: 1;
}

div.outer {
  position: relative;
  height: calc(100vh - 100px);
}

#zoom_home_obs_panel {
  z-index: 10 !important;
}

.btn-home {
  background: white;
  border: 2px solid rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  color: #444;
  width: 34px;
  height: 34px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-home:hover {
  background: #f4f4f4;
  color: #000;
}

/* Move plotly modebar to bottom */
.plotly .modebar-container {
  top: auto !important;
  bottom: 10px !important;
}

.plotly .modebar {
  background: rgba(255, 255, 255, 0.9) !important;
  border-radius: 4px;
  padding: 2px 5px;
}


@media (max-width: 768px) {
  .container,
  .container-fluid,
  .container-sm,
  .container-md {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  .tab-content {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  .tab-content > .tab-pane > .card,
  .tab-content > .active > .card {
    border-left: none !important;
    border-right: none !important;
    border-radius: 0 !important;
  }

  .tab-content > .tab-pane > .card > .card-body,
  .tab-content > .active > .card > .card-body,
  .tab-content > .tab-pane > .card-body,
  .tab-content > .active > .card-body {
    padding: 4px !important;
  }

  .bslib-page-fill,
  .bslib-gap-spacing,
  .bslib-sidebar-layout > .main {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  .maplibregl-ctrl-top-left .maplibregl-ctrl-group,
  .mapboxgl-ctrl-top-left .mapboxgl-ctrl-group {
    display: none !important;
  }

  .map-layer-control {
    display: none !important;
  }

  .plotly .modebar-container {
    display: none !important;
  }

  .js-plotly-plot .annotation {
    display: none !important;
  }

  .frozen-overlay.active {
    padding: 60px 10px 10px 10px !important;
    justify-content: center !important;
  }

  .frozen-overlay-content {
    width: 90% !important;
    max-width: 350px;
    min-height: 150px;
    padding: 20px;
  }

  div.outer {
    height: calc(100vh - 56px);
    height: calc(100dvh - 56px);
  }

  #zoom_home_panel {
    top: 60px !important;
  }

  #fullscreen_toggle {
    display: none !important;
  }

  .row.g-3 {
    --bs-gutter-x: 0.25rem;
    --bs-gutter-y: 0.5rem;
    padding: 2px !important;
  }

  .col-12.col-lg-6 {
    padding-left: 2px !important;
    padding-right: 2px !important;
  }

  .col-12.col-lg-6 .plotly {
    min-height: 280px;
    height: 45vw !important;
    max-height: 360px;
  }

  .navbar-nav .nav-link {
    font-size: 0.8rem !important;
    padding: 0.4rem 0.5rem !important;
  }

  .datepicker {
    width: 100% !important;
    max-width: 300px;
  }

  .dataTables_wrapper {
    font-size: 0.8rem !important;
  }

  .dataTables_wrapper th {
    font-size: 0.75rem !important;
  }

  .btn-home {
    width: 44px;
    height: 44px;
  }

  .station-header-body {
    padding: 12px;
  }

  .station-header-row {
    row-gap: 10px;
  }

  .station-header-actions {
    justify-content: stretch;
  }

  .station-header-actions .btn {
    width: 100%;
  }

  .maplibregl-popup,
  .mapboxgl-popup {
    max-width: calc(100vw - 12px) !important;
  }

  .maplibregl-popup-content,
  .mapboxgl-popup-content {
    width: calc(100vw - 24px);
    max-width: calc(100vw - 24px);
    max-height: calc(100dvh - 90px);
    padding: 12px;
    overflow-y: auto;
  }

  .station-map-popup {
    max-width: 100%;
    font-size: 16px !important;
    line-height: 1.25;
  }
}

/* Data Info Box Styling */
.data-info-box {
  background-color: #f8f9fa;
  border-left: 4px solid #007bff;
  padding: 12px;
  border-radius: 0 6px 6px 0;
  margin: 15px 0;
  font-size: 0.9rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.data-info-title {
  font-weight: 700;
  color: #495057;
  margin-bottom: 6px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.data-info-item {
  color: #6c757d;
  margin-bottom: 2px;
}

.fw-bold {
  color: #343a40;
}

/* --- Summary Cards (Glassmorphism) --- */
.summary-cards-container {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 10px;
  margin-bottom: 5px;
}

.summary-cards-header {
  width: 100%;
  font-size: 0.75rem;
  font-weight: bold;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding-left: 0.25rem;
  margin-bottom: -0.5rem;
}

.glass-card {
  flex: 1 1 calc(20% - 1rem); /* 5 cols by default */
  min-width: 180px;
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 1rem;
  padding: 1rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.glass-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.glass-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  font-size: 1.1rem;
}

.glass-card-content {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.glass-card-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: #475569;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.glass-card-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f172a;
  margin-top: 0.1rem;
}

.glass-card-subtext {
  font-size: 0.75rem;
  color: #64748b;
  margin-top: 0.25rem;
  line-height: 1.2;
}

/* Color variations for glass cards */
.glass-card.card-red { background: rgba(254, 242, 242, 0.5); border-color: rgba(254, 226, 226, 0.5); }
.glass-card.card-red .glass-card-icon { color: #ef4444; background: rgba(254, 226, 226, 0.5); }

.glass-card.card-blue { background: rgba(239, 246, 255, 0.5); border-color: rgba(219, 234, 254, 0.5); }
.glass-card.card-blue .glass-card-icon { color: #3b82f6; background: rgba(219, 234, 254, 0.5); }

.glass-card.card-emerald { background: rgba(236, 253, 245, 0.5); border-color: rgba(209, 250, 229, 0.5); }
.glass-card.card-emerald .glass-card-icon { color: #10b981; background: rgba(209, 250, 229, 0.5); }

.glass-card.card-cyan { background: rgba(236, 254, 255, 0.5); border-color: rgba(207, 250, 254, 0.5); }
.glass-card.card-cyan .glass-card-icon { color: #06b6d4; background: rgba(207, 250, 254, 0.5); }

.glass-card.card-purple { background: rgba(250, 245, 255, 0.5); border-color: rgba(243, 232, 255, 0.5); }
.glass-card.card-purple .glass-card-icon { color: #a855f7; background: rgba(243, 232, 255, 0.5); }

.glass-card.card-sky { background: rgba(240, 249, 255, 0.5); border-color: rgba(224, 242, 254, 0.5); }
.glass-card.card-sky .glass-card-icon { color: #38bdf8; background: rgba(224, 242, 254, 0.5); }

.glass-card.card-amber { background: rgba(255, 251, 235, 0.5); border-color: rgba(254, 243, 199, 0.5); }
.glass-card.card-amber .glass-card-icon { color: #f59e0b; background: rgba(254, 243, 199, 0.5); }

.glass-card.card-pink { background: rgba(253, 242, 248, 0.5); border-color: rgba(252, 231, 243, 0.5); }
.glass-card.card-pink .glass-card-icon { color: #ec4899; background: rgba(252, 231, 243, 0.5); }

.glass-card.card-slate { background: rgba(248, 250, 252, 0.5); border-color: rgba(241, 245, 249, 0.5); }
.glass-card.card-slate .glass-card-icon { color: #64748b; background: rgba(241, 245, 249, 0.5); }

@media (max-width: 991px) {
  .glass-card {
    flex: 1 1 calc(33.333% - 1rem);
  }
}
@media (max-width: 767px) {
  .glass-card {
    flex: 1 1 calc(50% - 1rem);
  }
}
@media (max-width: 480px) {
  .glass-card {
    flex: 1 1 100%;
  }
}