* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
  width: 100%;
  height: 100%;
  font-family: 'Raleway', sans-serif;
  display: flex;
  flex-direction: column;
}

body {
    background-color: #333;
    color: #e0e0e0;
}

.site-select-container {
  text-align: center;
}

.site-select-container,
.site-select {
  width: 100%;
}

.content {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.select-container {
  position: relative;
  width: 100%;
}

.select-container::after {
  content: '▼';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #ecf0f1;
  pointer-events: none;
  font-size: 12px;
}

select {
  z-index: 2;
  position: relative;
}

.left-panel {
    width: 270px;
    background-color: #3c3c3c;
    padding: 0.5rem;
}
  
.site-title {
    font-size: 1.8rem;
    font-weight: 700;
    text-align: center;
    color: #2ecc71;
    margin-bottom: 10px;
}

.layer_title, .layer-intro, #left-panel-site-name {
    color: #f1f1f1;
}
 
.layer-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: #e67e22;
    text-align: center;
}
  
.image-container {
    text-align: center;
}
  
#left-panel-site-image {
    max-width: 100%;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.layer-intro {
  text-align: center;
  font-style: italic;
  color: #bdc3c7;
  margin-bottom: 15px;
}

.layer-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

h3 {
    margin-bottom: 0.5rem;
    text-align: center;
}

#left-panel-site-name {
    font-size: 40px;
    color: #f1f1f1;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-align: center;
}

#left-panel-site-id,
#left-panel-site-lat,
#left-panel-site-long,
#left-panel-site-date,
#left-panel-site-desc {
    font-size: 14px;
    color: #ddd;
    line-height: 1.5;
    margin-bottom: 0.75rem;
}

.map-container {
    position: relative;
    overflow: visible;
}

#layer-list {
    margin-top: 1rem;
    padding-left: 15px;
}
  
.layer-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background-color: #34495e;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}
  
.layer-item:hover {
    background-color: #2ecc71;
    color: #fff;
}
  
.layer-item input[type="checkbox"] {
    accent-color: #2ecc71;
}
.layer-item label {
    margin-left: 8px;
    font-size: 14px;
}
  
.map-legend {
    background: rgba(50, 56, 63, 0.8);
    border: 0.5px solid #456789;
    padding: 0.75rem;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 14px;
    position: absolute;
    left: 10px;
    bottom: 10px;
    max-height: 70vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #888 #32383f;
    width: 300px; /* Adjust this value as needed */
    max-width: 300px; /* Ensure it doesn't grow beyond this */
    box-sizing: border-box; /* Ensure padding is included in width */
}
  
.map-legend::-webkit-scrollbar {
    width: 8px;
}

.map-legend::-webkit-scrollbar-thumb {
    background-color: #888;
    border-radius: 4px;
}

.map-legend::-webkit-scrollbar-track {
    background: #32383f;
}

/* Add smooth scrolling */
.map-legend {
  scroll-behavior: smooth;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 4px 0;
    cursor: pointer;
    transition: background-color 0.3s;
}
.legend-item i {
    font-style: italic;
}
  
.legend-item:hover {
    background-color: #2ecc71;
    color: #fff;
    border-radius: 2px;
}
  
.legend-item input[type="checkbox"] {
    accent-color: #2ecc71;
}
.legend-item label {
    margin-left: 0.5rem;
    font-size: 14px;
}

/* .legend-graphic {
  width: 20px;
  height: 20px;
  margin-right: 5px;
  vertical-align: middle;
}
 */
 .map-legend .legend-color {
  display: inline-block;
  width: 20px;
  height: 16px;
  vertical-align: middle;
  margin-right: 5px;
  border: 1px solid #ccc;
}

.legend-color-circle {
  display: inline-block;
  border-radius: 50%;
  width: 12px;
  height: 12px; 
  border: 2px solid rgb(255, 255, 255);
}
/* Solid color style */
.map-legend .legend-color.legend-style-solid {
  /* Uses inline background-color directly */
}

/* Horizontal stripes */
.map-legend .legend-color.legend-style-stripes {
  background-image: linear-gradient(
    to bottom,
    transparent 50%,
    rgba(255, 255, 255, 0.8) 50%
  );
  background-size: 100% 8px;
}

/* Oblique (diagonal) stripes */
.map-legend .legend-color.legend-style-oblique-stripes {
  background-image: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 5px,
    rgb(255, 255, 255) 1px,
    rgb(255, 255, 255) 10px
  );
}

/* Colored stripes with multiple colors */
.map-legend .legend-color.legend-style-colored-stripes {
  background-image: linear-gradient(
    to bottom,
    transparent 33%,
    rgba(255, 255, 255, 0.8) 33%,
    rgba(255, 255, 255, 0.8) 66%,
    rgba(0, 0, 0, 0.5) 66%
  );
  background-size: 100% 12px;
}

/* Legend section container */
.legend-section {
  margin-bottom: 0.3rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  overflow: visible;
}
.legend-section:last-child {
  margin-bottom: 0;
}

/* Legend header styling */
.legend-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 12px;
  cursor: pointer;
  border-bottom: 1px solid rgba(69, 103, 137, 0.4);
  transition: background-color 0.2s ease;
}

.legend-header:hover {
  background: rgba(255, 255, 255, 0.05);
}

/* Legend header title */
.legend-header h4 {
  margin: 0;
  font-size: 14px;
  color: #ecf0f1;
  flex: 1;
}

/* Toggle button styling */
.legend-toggle {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ecf0f1;
  opacity: 0.7;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.legend-toggle:hover {
  opacity: 1;
}

/* SVG arrow icon */
.legend-toggle .toggle-icon {
  width: 12px;
  height: 12px;
  transition: transform 0.2s ease;
}

/* Rotate arrow when section is expanded */
.legend-section.expanded .legend-toggle .toggle-icon {
  transform: rotate(180deg);
}

/* Updated legend-content and subcategory-content styles */
.legend-content,
.subcategory-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  padding: 0 12px;
  display: none; /* hide initially */
}

/* When expanded, allow scrolling and set max-height */
.legend-section.expanded .legend-content {
  display: block;
  overflow: visible;
  max-height: none; /* Limit height to prevent overwhelming the legend */
  padding: 12px;
}

.legend-subcategory.expanded .subcategory-content {
  display: block;
  overflow: visible;
  max-height: none; /* Smaller max-height for subsections */
  padding: 8px 12px;
}

/* Webkit scrollbar styles for consistency */
.legend-content::-webkit-scrollbar,
.subcategory-content::-webkit-scrollbar {
  display: none;
}

.legend-content::-webkit-scrollbar-thumb,
.subcategory-content::-webkit-scrollbar-thumb {
  background-color: #888;
  border-radius: 4px;
}

.legend-content::-webkit-scrollbar-track,
.subcategory-content::-webkit-scrollbar-track {
  background: #32383f;
}


/* Loading indicators for legend items */
.legend-item.loading {
  opacity: 0.7;
}

.legend-item.error {
  opacity: 0.5;
}

.layer-loading-indicator {
  display: inline-block;
  margin-left: 4px;
  vertical-align: middle;
}

.layer-loading-indicator .spinner {
  width: 12px;
  height: 12px;
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-top-color: #007bff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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


#site-control-overlay {
    position: absolute;
    left: 10px;
    top: 10px;
    width: 225px;
    padding: 0.5rem;
    background: rgba(50, 56, 63, 0.8);
    border: 0.5px solid #456789;
    font-size: 14px;
    z-index: 1000;
    border-radius: 4px;
}

.center-panel {
  flex: 1;
  position: relative;
  background-color: #e0e0e0;
}
#map {
  width: 100%;
  height: 100%;
}

input[type="checkbox"] {
    margin-right: 5px;
}

.popup {
  position: absolute;
  z-index: 9999;
  background-color: #fff;
  border: 1px solid #ccc;
  border-radius: 3px;
  padding: 5px;
  font-size: 14px;
  color: #333;
  text-align: center;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  white-space: nowrap;
  pointer-events: none;
}

#cards-panel{
  width: 220px;
}
.right-panel {
  width: 220px;
  min-width: 220px;
  overflow: hidden;
  background: linear-gradient(135deg, #25292e, #383e47);
  border-left: 1px solid #444;
  box-sizing: border-box;
  color: #e0e0e0;
  transition: width 0.3s ease;
  display: flex;
  flex-direction: column;
}

.right-panel.expanded {
  width: 600px;
}
.right-panel[data-view="cards"] #sticky-tabs-header,
.right-panel[data-view="cards"] .sticky-content {
    display: none;
}

.right-panel[data-view="expanded"] #data-type-cards {
    display: none;
}

.panel-view {
  width: 100%;
  height: 100%;
}

.cards-view {
  width: 220px;
}

.expanded-view {
  width: 600px;
}

.sensor-name {
  font-size: 1.2rem;
  font-weight: 600;
  color: #f8f9fa;
}

.sensor-description-separator {
  color: #f8f9fa;
  font-size: 1.2rem;
  font-weight: 600;
}

.chart-container {
  width: 100%;
  height: 300px;
  margin-top: 20px;
  margin-bottom: 20px;
  background: 555;
  position: relative;  /* Added to contain the overlay */
  overflow: hidden; 
}

.plotly-container {
  position: relative;
  z-index: 1;
}
.plot-container {
  width: 100% !important;
}

.js-plotly-plot .plotly .main-svg {
  border-radius: 8px;
}

.plotly .plotly-notifier {
  display: none !important;
}
.plotly-notifier {
  background: rgba(255,255,255,0.9) !important;
  border: 1px solid #ecf0f1 !important;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1) !important;
  color: #2c3e50 !important;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
.chart-error {
  padding: 20px;
  color: #dc3545;
  background: #ffeef0;
  border-radius: 4px;
  text-align: center;
}

.warning-icon {
  font-size: 24px;
  margin-bottom: 10px;
  display: block;
}

.sensor-control-group {
  /* margin-bottom: 10px;
  position: relative; */
  flex-grow: 1;
}
#secondary-sensors-group,
#secondary-soil-group,
#secondary-biodiv-group {
    flex-grow: 1;
}

.sensor-meta-item {
  margin-bottom: 15px;
  padding: 10px;
  background: #34495e;
  border-radius: 5px;
}

.sensor-meta-title {
  color: #2ecc71;
  margin: 0 0 10px 0;
  font-size: 1.1em;
}

.meta-separator {
  border-color: #2c3e50;
  margin: 10px 0;
}

.menu-container {
  display: flex;
  gap: 4px;
  width: 100%;
  padding: 0.5rem;
}

.menu-container > div {
  flex: 1;
  min-width: 0;
}

#metadata-items-container {
  max-height: 300px;
  overflow-y: auto;
  padding-right: 10px;
}

.metadata-card {
  background: #34495e;
  border-radius: 8px;
  padding: 0.5rem;
  margin-bottom: 0.5rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.sensor-type {
  color: #bdc3c7;
  font-size: 0.9em;
}

.metadata-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 5px;
}

.metadata-item {
  justify-content: space-between;
  font-size: 13px;
  color: #bdc3c7;
}

.metadata-card h4 {
  margin: 0 0 10px 0;
  color: #2ecc71;
  font-size: 1.1em;
}

.metadata-card .sensor-type {
  color: #95a5a6;
  font-size: 0.9em;
}

.metadata-value {
  color: #ecf0f1;
  font-weight: 400;
  text-align: right;
}

.metadata {
  font-size: 0.9rem;
  line-height: 1.6;
}

.metadata p {
  margin: 5px 0;
}

.metadata-label {
  font-weight: 500;
  color: #a4b0be;
}
.metadata-title {
  margin: 0 0 10px 0;
  color: #f8f9fa;
}

.tabs {
  list-style: none;
  display: flex;
  border-bottom: 1px solid #444;
  padding: 0;
  margin: 0 0 10px;
}

.metadata-description {
  color: #bdc3c7;
  margin-top: 1rem;
  font-size: 0.9em;
  line-height: 1.4;
}

#data-type-cards {
  width: 220px;
  min-width: 220px;
  padding: 0.75rem;
  box-sizing: border-box;
  display: grid;
  gap: 0.75rem;
  grid-template-rows: repeat(3, 1fr);
  background: transparent;
  height: 100%;
}

.data-card {
  width: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 1rem;
  margin: 0;
  box-sizing: border-box;
  position: relative;
  border-radius: 6px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2); 
  overflow: hidden;
}

.data-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.data-card h3 {
  color: #2ecc71;
  margin: 0 0 0.5rem 0;
}

.data-card p {
  color: #bdc3c7;
  margin: 0;
}

.sticky-tabs {
  position: sticky;
  top: 0;
  background: linear-gradient(135deg, #25292e, #383e47);
  color: #e0e0e0;
  z-index: 1000;
  display: flex;
  width: 100%;
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
  padding: 0.15rem;
  align-items: center;
  border-bottom: 1px solid #444;
  font-size: 14px;
}

.tabs-container {
  display: flex;
  flex: 1;
  justify-content: space-around;
  gap: 4px;
}

.close-tabs-btn {
  background: none;
  border: none;
  color: #bdc3c7;
  font-size: 24px;
  cursor: pointer;
  padding: 0 8px;
  line-height: 1;
  border-radius: 4px;
  transition: all 0.2s ease;
  margin-left: 8px;
}

.close-tabs-btn:hover {
  color: #e74c3c;
  background: rgba(231, 76, 60, 0.1);
}

.close-tabs-btn:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(231, 76, 60, 0.2);
}

.tab-link {
  flex-grow: 1;
  text-align: center;
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  color: #bdc3c7;
  font-size: 1rem;
  outline: none;
  border-bottom: 2px solid transparent;
  transition: border-bottom-color 0.2s ease-in-out;
}

.tab-link.current {
  color: #D18F3A;
  font-weight: bold;
  border-bottom: 2px solid #D18F3A;
}

.tab-link:hover:not(.current) {
  color: #D18F3A;
  font-weight: bold;
  border-bottom: 2px solid #D18F3A;
}

.sticky-content {
  overflow-y: auto;
  height: calc(100vh - 120px);
  padding: 0.5rem;
}

.tab-content {
  display: none;
}

.tab-content.current {
  display: block;
}

#sticky-tabs-header {
  display: none;
  width: 100%;
}

.sticky-content {
  display: none;
  width: 100%;
}

.tab-content {
    display: none;
}

#site-metadata-container {
  display: none;
  border-top: 1px solid #456789;
}

.site-metadata {
  width: 100%;
  margin-top: 10px;
  overflow: hidden;
  max-height: 60vh;
  transition: max-height 0.3s ease;
}

/* Header: use flex and reserve space for the toggle */
.metadata-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center; /* centers all inline children */
  text-align: center;
  padding: 0 30px; /* reserve space on both sides so h2 doesn’t get too wide */
}

/* Site name styles */
.metadata-header h2 {
  margin: 0;
  flex: 1;
  text-align: center;
}

/* Toggle arrow: position within header.
   Hide on large screens. */
.metadata-toggle {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #ecf0f1;
  font-size: 18px;
  cursor: pointer;
  display: none; /* hidden by default */
}

/* Metadata details container */
.metadata-details {
  width: 100%;
  display: block;
}

/* Force site image to scale to container width */
.site-image {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 auto;
  margin-bottom: 10px;
  border-radius: 4px;
}

#site-metadata-name {
  font-size: 22px;
  font-weight: bold;
  margin-bottom: 10px;
}

#site-metadata-desc {
  font-size: 14px;
  margin: 5px 0;
}

.toggle-icon {
  transition: transform 0.3s ease;
}

/* When the metadata container has the expanded class, rotate the arrow */
#site-metadata-container.expanded .toggle-icon {
  transform: rotate(180deg);
}

#data-type-cards {
  display: grid;
  gap: 0.75rem;
  padding: 0.75rem;
  width: 100%;
  height: 100%;
  max-height: calc(100vh - 2rem);
  grid-template-rows: repeat(3, 1fr);
}

.data-card {
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.card-header .card-icon {
  width: 40px;
  height: 40px;
  margin: 0;
}

.icon-sensor { color: #2ecc71; }
.icon-soil { color: #e67e22; }
.icon-biodiv { color: #3498db; }

.card-content {
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.card-content h3 {
  color: #ecf0f1;
  font-size: 1.5rem;
  margin: 0 0 1rem 0;
  font-weight: 600;
}

.card-metrics {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.metric {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.metric-value {
  color: #ecf0f1;
  font-weight: 600;
  font-size: 0.9rem;
}

.metric-label {
  color: #bdc3c7;
  font-size: 0.8rem;
}

.card-description {
  color: #95a5a6;
  font-size: 0.85rem;
  line-height: 1.4;
  margin: 0;
  overflow-wrap: break-word;
}

.data-card[data-tab="sensor-tab"] {
  background: linear-gradient(135deg, #1a2c38, #2c4356);
}
.data-card[data-tab="sensor-tab"] .card-icon {
  color: #2ecc71;
}
.data-card[data-tab="sensor-tab"]:hover {
  background: linear-gradient(135deg, #1e3241, #324b61);
}

.data-card[data-tab="soil-tab"] {
  background: linear-gradient(135deg, #2d2520, #3d332c);
}
.data-card[data-tab="soil-tab"] .card-icon {
  color: #e67e22;
}
.data-card[data-tab="soil-tab"]:hover {
  background: linear-gradient(135deg, #332a24, #453a32);
}

.data-card[data-tab="biodiv-tab"] {
  background: linear-gradient(135deg, #272234, #373048);
}
.data-card[data-tab="biodiv-tab"] .card-icon {
  color: #3498db;
}
.data-card[data-tab="biodiv-tab"]:hover {
  background: linear-gradient(135deg, #2d273b, #3d3652);
}

.card-backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0) 70%);
  transition: all 0.3s ease;
  opacity: 0;
  z-index: 0;
}

.data-card:hover .card-backdrop {
  opacity: 1;
  transform: scale(1.2);
}

.data-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}

@media (max-height: 700px) {
  .data-card {
      padding: 1rem;
  }
  
  .card-icon {
      width: 30px;
      height: 30px;
      margin-bottom: 0.5rem;
  }
  
  .card-content h3 {
      font-size: 1.1rem;
      margin-bottom: 0.5rem;
  }
  
  .card-metrics {
      margin-bottom: 0.5rem;
  }
  
  .metric-value {
      font-size: 0.8rem;
  }
  
  .metric-label {
      font-size: 0.7rem;
  }
  
  .card-description {
      font-size: 0.8rem;
  }
  .metadata-toggle {
    display: inline-block;
  }
  /* Collapse the metadata container to show only the header */
  #site-metadata-container {
    overflow: hidden;
    max-height: 40px; /* Adjust so only the header is visible */
  }
  /* Hide the details when collapsed */
  #site-metadata-container .metadata-details {
    display: none;
  }
  /* When the panel is expanded, reveal details */
  #site-metadata-container.expanded {
    max-height: 60vh; /* or auto if you prefer */
  }
  #site-metadata-container.expanded .metadata-details {
    display: block;
  }
}

.logout-button {
  background: linear-gradient(135deg, #25292e, #383e47);
  color: #e0e0e0;
  border: 1px solid #456789;
  border-radius: 25px;
  padding: 0;
  margin: 0;
  display: block;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  transition: all 0.3s ease;
  align-items: center;
  cursor: pointer;
}

.logout-button:hover {
  background-color: #3d566e;
  color: #D18F3A;
  border-color: #D18F3A;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.logout-link {
  text-decoration: none;
  color: inherit;
  display: flex;
  align-items: center;
  font-size: 14px !important;
  gap: 8px;
  padding: 8px 16px;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  transition: color 0.3s ease;
}

.logout-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.logout-icon path,
.logout-icon polyline,
.logout-icon line {
  stroke: currentColor;
}

.reset-zoom {
  position: absolute;
  top: 60px;
  right: 10px;
}

.toggle-base-map {
  position: absolute;
  top: 110px;
  right: 10px;
}

.ol-zoom {
  position: absolute !important;
  top: 160px !important;
  right: 10px !important;
  background: transparent !important;
  box-shadow: none !important;
  border: none !important;
}

.reset-zoom,
.toggle-base-map {
    background: linear-gradient(135deg, #25292e, #383e47);
    color: #e0e0e0;
    border: 1px solid #456789;
    border-radius: 8px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.ol-zoom-in, .ol-zoom-out {
  border-radius: 8px !important;
  width: 40px !important;
  height: 40px !important;
  font-size: 20px !important;
  line-height: 28px !important;
  transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.1s ease;
  background: linear-gradient(135deg, #25292e, #383e47) !important;
  color: #e0e0e0 !important;
  border: 1px solid #456789 !important;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2) !important;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.reset-zoom:hover,
.toggle-base-map:hover,
.ol-zoom-in:hover,
.ol-zoom-out:hover {
    background: #3d566e !important;
    color: #D18F3A !important;
    border-color: #D18F3A !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4) !important;
}

.reset-zoom:active,
.toggle-base-map:active,
.ol-zoom-in:active,
.ol-zoom-out:active {
    background: #2a2e35 !important;
    transform: scale(0.95) !important;
}

.ol-attribution {
  background: rgba(44, 62, 80, 0.9) !important;
  color: #bdc3c7 !important;
  font-size: 12px !important;
  right: 0px !important;
  text-shadow: none !important;
}

.ol-attribution ul {
  list-style: none !important;
  padding: 0 !important;
  margin: 0 !important;
  color: #bdc3c7 !important;
  text-shadow: none !important;
}

.map-popup {
  position: fixed;
  background: rgba(50, 56, 63, 0.9);
  color: #ecf0f1;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 14px;
  pointer-events: none;
  z-index: 1000;
  transform: translate(-50%, -100%);
  white-space: nowrap;
  border: 1px solid #456789;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  margin-top: -5px;
}

.map-popup::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translateX(-50%);
  border-width: 4px;
  border-style: solid;
  border-color: rgba(50, 56, 63, 0.9) transparent transparent transparent;
}

/* Reset default browser styles */
select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  border-radius: 4px;
  border: 1px solid #456789;
  background-color: #32383f;
  background-image: linear-gradient(135deg, #25292e, #383e47);
  color: #ecf0f1;
  padding: 8px 12px;
  width: 100%;
  font-family: 'Raleway', sans-serif;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
}

/* Force background color on all states */
select,
select:hover,
select:focus,
select option,
select:checked,
select:-internal-list-box,
select:-internal-list-box option {
  background-color: #32383f !important;
}

/* Handle Firefox specific styling */
@-moz-document url-prefix() {
  select {
      background-color: #32383f !important;
      color: #ecf0f1 !important;
  }
  
  select option {
      background-color: #32383f !important;
      color: #ecf0f1 !important;
  }
}

/* Webkit (Chrome, Safari) specific styling */
select::-webkit-select-list-box,
select::-webkit-list-box {
  background-color: #32383f !important;
}

/* Dropdown arrow styling */
select {
  background-image: linear-gradient(135deg, #25292e, #383e47),
      url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23ecf0f1'%3E%3Cpath d='M6 9L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: auto, 12px;
  padding-right: 2.5rem;
}

/* Hover state */
select:hover {
  border-color: #D18F3A;
  background-image: linear-gradient(135deg, #2a2e35, #3d4a57),
      url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23D18F3A'%3E%3Cpath d='M6 9L0 0h12z'/%3E%3C/svg%3E");
  box-shadow: 0 0 5px rgba(209, 143, 58, 0.3);
}

/* Focus state */
select:focus {
  outline: none;
  border-color: #D18F3A;
  box-shadow: 0 0 8px rgba(209, 143, 58, 0.4);
}

/* Option styling */
select option {
  background-color: #32383f !important;
  color: #ecf0f1 !important;
  padding: 8px;
}

/* Specific styles for sensor selects */
.sensor-select {
  background-color: #32383f !important;
  color: #ecf0f1 !important;
  border: 1px solid #456789 !important;
}

.sensor-select:hover {
  border-color: #D18F3A !important;
}

/* Site select specific styles */
.site-select {
  width: 100%;
  height: 35px;
  background-color: #32383f !important;
  color: #ecf0f1 !important;
  border: 1px solid #456789 !important;
}

.site-select:hover {
  border-color: #D18F3A !important;
}

/* Disabled state */
select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background-image: linear-gradient(135deg, #1a1d21, #2a2e35),
      url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23999'%3E%3Cpath d='M6 9L0 0h12z'/%3E%3C/svg%3E");
}

/* Remove focus outline in Firefox */
select:-moz-focusring {
  color: transparent;
  text-shadow: 0 0 0 #ecf0f1;
}

/* Edge specific fixes */
@supports (-ms-ime-align: auto) {
  select {
      background-image: linear-gradient(135deg, #25292e, #383e47);
      padding-right: 2.5rem;
  }
}

/* Target Webkit browsers specifically */
@media screen and (-webkit-min-device-pixel-ratio:0) {
  select {
      background-color: #32383f !important;
  }
  
  select option {
      background-color: #32383f !important;
  }
}

.chart-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(42, 46, 53, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 999;
  border-radius: 8px;
}

.loading-container {
  margin: 1rem;
  width: calc(100% - 2rem);
  text-align: center;
  position: relative;
}

.loading-bar {
  width: 100%;
  height: 4px;
  background: #32383f;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.loading-progress {
  width: 0%;
  height: 100%;
  background: #A67C32;
  position: absolute;
  left: 0;
  transition: width 0.3s ease;
}

.loading-text {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: #b0b0b0;
}

.soil-display-container {
  display: flex;
  gap: 1rem;
  margin-top: 0.5rem;
}

.soil-chart-half {
  width: 50%;
  min-width: 300px;
}

#soil-core-image {
  width: 100%;
  max-height: 290;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
}

/* Soil image container styling */
.soil-image-container {
  position: relative;
  width: 40%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 8px;
  background-color: #32383f;
  max-height:300px;
  margin-top:20px;
}

#soil-core-image {
  width: 100%;
  max-height: 290px;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
}

/* Carousel button styling */
.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(50, 56, 63, 0.8);
  color: #ecf0f1;
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  z-index: 10;
  transition: all 0.3s ease;
}

.carousel-btn:hover {
  background: #D18F3A;
  color: #fff;
}

/* Position the buttons */
#prev-btn {
  left: 10px;
}

#next-btn {
  right: 10px;
}

/* Caption overlay on the image */
.soil-image-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.7);
  color: #ecf0f1;
  padding: 8px;
  text-align: center;
  font-size: 0.85rem;
  border-bottom-left-radius: 8px;
  border-bottom-right-radius: 8px;
  z-index: 5;
}

.tile-loading-indicator {
  position: absolute;
  top: 5%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(50, 56, 63, 0.8);
  padding: 15px 20px;
  border-radius: 8px;
  color: #e0e0e0;
  z-index: 1000;
  display: none;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  border: 1px solid #456789;
}

.tile-loading-content {
  display: flex;
  align-items: center;
  gap: 15px;
}

.tile-loading-spinner {
  width: 20px;
  height: 20px;
  border: 3px solid #456789;
  border-top: 3px solid #D18F3A;
  border-radius: 50%;
  animation: tile-spin 1s linear infinite;
}

.tile-loading-text {
  font-size: 14px;
}

@keyframes tile-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Standardized tooltips for map controls */
.tooltip-container {
  position: relative;
}

/* Base tooltip style - applies to all tooltips */
.map-tooltip {
  position: absolute;
  background: rgba(50, 56, 63, 0.9);
  color: #ecf0f1;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 13px;
  font-family: 'Raleway', sans-serif;
  font-weight: normal;
  white-space: nowrap;
  pointer-events: none;
  border: 1px solid #456789;
  bottom: calc(100% + 8px);
  right: 0; /* Position from right instead of left */
  left: auto; /* Reset any left positioning */
  transform: none; /* Remove transform that was causing issues */
  z-index: 1010;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Arrow below the tooltip */
.map-tooltip:after {
  content: '';
  position: absolute;
  right: 15px; /* Position the arrow on the right side */
  top: 100%;
  transform: none; /* Remove transform that was causing issues */
  border-width: 5px;
  border-style: solid;
  border-color: rgba(50, 56, 63, 0.9) transparent transparent transparent;
}

/* Show tooltip on hover */
.measurement-tools-btn:hover .map-tooltip,
.terrain-view-btn:hover .map-tooltip,
.terrain-view-threejs-btn:hover .map-tooltip,
.toggle-base-map:hover .map-tooltip,
.reset-zoom:hover .map-tooltip,
.global-comparison-btn:hover .map-tooltip,
.data-export-btn:hover .map-tooltip {
  opacity: 1;
  visibility: visible;
}

/* Specific adjustments for global-comparison-btn */
.global-comparison-btn .map-tooltip {
  bottom: calc(100% + 10px);
  width: max-content;
  right: 0;
}

/* Add additional positioning for buttons on the right side of the screen */
.measurement-tools-btn .map-tooltip,
.terrain-view-btn .map-tooltip,
.terrain-view-threejs-btn .map-tooltip,
.toggle-base-map .map-tooltip,
.reset-zoom .map-tooltip {
  right: 0; /* Ensure tooltip is aligned with the right side of the button */
}

/* Ensure button contents are properly centered */
.measurement-tools-btn,
.terrain-view-btn,
.terrain-view-threejs-btn,
.toggle-base-map,
.reset-zoom {
  display: flex;
  align-items: center;
  justify-content: center;
}

.legend-subcategory {
  margin: 5px 0;
  padding-left: 10px;
  overflow: visible;
}

.legend-subcategory.nested {
  padding-left: 15px;
}

.subcategory-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
  font-size: 13px;
}

.subcategory-toggle {
  background: none;
  border: none;
  color: #ecf0f1;
  font-size: 12px;
  padding: 0;
  cursor: pointer;
}

.toggle-icon-small {
  transition: transform 0.2s ease;
}

.legend-subcategory.expanded .toggle-icon-small {
  transform: rotate(180deg);
}

.feature-count {
  font-size: 0.8em;
  color: #888;
  margin-left: 5px;
}

.legend-item[data-layer-type="vector"] {
  border-left: 3px solid #2ecc71;
  padding-left: 8px;
}

.legend-item[data-layer-type="vector"]:hover {
  background-color: rgba(46, 204, 113, 0.1);
}

.layer-loading-indicator {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.8em;
}

.progress-bar-container {
  width: 40px;
  height: 4px;
  background: #ddd;
  border-radius: 2px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: #2ecc71;
  transition: width 0.3s ease;
}

/* Add this CSS to your style.css file */

/* Explorer Button - matches logout button styling */
.explorer-button {
  position: absolute;
  background: linear-gradient(135deg, #25292e, #383e47);
  color: #e0e0e0;
  border: 1px solid #456789;
  border-radius: 25px;
  padding: 0;
  margin: 0;
  display: block;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  transition: all 0.3s ease;
  align-items: center;
  cursor: pointer;
}

.explorer-button:hover {
  background-color: #3d566e;
  color: #D18F3A;
  border-color: #D18F3A;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.explorer-link {
  text-decoration: none;
  color: inherit;
  display: flex;
  align-items: center;
  font-size: 14px !important;
  gap: 8px;
  padding: 8px 16px;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  transition: color 0.3s ease;
}

.explorer-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.explorer-icon path {
  stroke: currentColor;
}

/* Optional: Add tooltip for explorer button */
.explorer-button .map-tooltip {
  position: absolute;
  background: rgba(50, 56, 63, 0.9);
  color: #ecf0f1;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 13px;
  font-family: 'Raleway', sans-serif;
  font-weight: normal;
  white-space: nowrap;
  pointer-events: none;
  border: 1px solid #456789;
  bottom: calc(100% + 8px);
  right: 0;
  left: auto;
  transform: none;
  z-index: 1010;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.explorer-button:hover .map-tooltip {
  opacity: 1;
  visibility: visible;
}

.explorer-button .map-tooltip:after {
  content: '';
  position: absolute;
  right: 15px;
  top: 100%;
  transform: none;
  border-width: 5px;
  border-style: solid;
  border-color: rgba(50, 56, 63, 0.9) transparent transparent transparent;
}