/* Satellite Map Styles */
.leaflet-container {
  font-family: inherit;
}

.info-card {
  background: white;
  border-radius: 8px;
  padding: 15px;
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 8px 0;
  border-bottom: 1px solid #f0f0f0;
  min-height: 24px;
}

.info-row:last-child {
  border-bottom: none;
}

.info-label {
  font-weight: 600;
  color: #495057;
  font-size: 0.9em;
}

.info-value {
  color: #212529;
  font-size: 0.9em;
  text-align: right;
  flex: 1;
  margin-left: 10px;
  word-wrap: break-word;
  line-height: 1.4;
}

.irrigation-badge {
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.8em;
  font-weight: 600;
}

.irrigation-yes {
  background-color: #d4edda;
  color: #155724;
}

.irrigation-no {
  background-color: #f8d7da;
  color: #721c24;
}

#info-panel {
  max-height: calc(90vh - 100px);
  overflow-y: auto;
}

.field-highlight {
  stroke: #ff0000 !important;
  stroke-width: 3 !important;
  stroke-opacity: 1 !important;
}

.crop-description-row .info-value {
  font-style: italic;
}

.legend {
  background: white;
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 15px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  border-left: 4px solid #28a745;
}

.legend-title {
  font-weight: 600;
  color: #495057;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
  transition: color 0.2s ease;
}

.legend-title:hover {
  color: #28a745;
}

.legend-chevron {
  font-size: 0.8em;
  transition: transform 0.3s ease;
}

.legend-collapsible {
  max-height: max-content;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.legend-collapsible.collapsed {
  max-height: 0;
  margin-bottom: 0;
}

.legend.collapsed .legend-chevron {
  transform: rotate(-90deg);
}

#legend-content {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
  padding-top: 10px;
}

/* Info Panel Collapsible Styles */
.info-panel {
  background: white;
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 15px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  border-left: 4px solid #007bff;
}

.info-panel-title {
  font-weight: 600;
  color: #495057;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
  transition: color 0.2s ease;
}

.info-panel-title:hover {
  color: #007bff;
}

.info-panel-chevron {
  font-size: 0.8em;
  transition: transform 0.3s ease;
}

.info-panel-collapsible {
  max-height: max-content;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.info-panel-collapsible.collapsed {
  max-height: 0;
  margin-bottom: 0;
}

.info-panel.collapsed .info-panel-chevron {
  transform: rotate(-90deg);
}

.legend-item {
  display: flex;
  align-items: center;
  font-size: 0.75em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: help;
}

.legend-color {
  width: 14px;
  height: 14px;
  border-radius: 2px;
  margin-right: 6px;
  border: 1px solid #999;
  flex-shrink: 0;
}

.legend-text {
  color: #495057;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Vegetation Panel Styles */
.vegetation-panel {
  background: white;
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 15px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  border-left: 4px solid #28a745;
}

.vegetation-panel-title {
  font-weight: 600;
  color: #495057;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
  transition: color 0.2s ease;
}

.vegetation-panel-title:hover {
  color: #28a745;
}

.vegetation-panel-chevron {
  font-size: 0.8em;
  transition: transform 0.3s ease;
}

.vegetation-panel-collapsible {
  max-height: max-content;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.vegetation-panel-collapsible.collapsed {
  max-height: 0;
  margin-bottom: 0;
}

.vegetation-panel.collapsed .vegetation-panel-chevron {
  transform: rotate(-90deg);
}

/* Vegetation chart styles */
.vegetation-chart-container {
  position: relative;
  height: 300px;
  width: 100%;
  margin-top: 10px;
}

.vegetation-chart-canvas {
  max-height: 300px;
}

.chart-controls {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.chart-toggle {
  padding: 4px 8px;
  border: 1px solid #dee2e6;
  background: #f8f9fa;
  border-radius: 4px;
  font-size: 0.8em;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chart-toggle.active {
  background: #007bff;
  color: white;
  border-color: #007bff;
}

.chart-toggle:hover {
  background: #e9ecef;
}

.chart-toggle.active:hover {
  background: #0056b3;
}

.vegetation-stats {
  background-color: #f8f9fa;
  border-radius: 6px;
  padding: 10px;
  margin-bottom: 10px;
}

.vegetation-stats h6 {
  margin: 0 0 8px 0;
  color: #495057;
  font-size: 0.9em;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
  font-size: 0.8em;
}

.stat-label {
  color: #6c757d;
}

.stat-value {
  font-weight: 600;
  color: #495057;
}

.ndvi-value {
  color: #28a745;
}

.ndwi-value {
  color: #007bff;
}

.savi-value {
  color: #fd7e14;
}

.evi-value {
  color: #dc3545;
}

.lai-value {
  color: #fd7e14;
}

.rvi-value {
  color: #8e44ad;
}

/* MODIS Panel specific styling */
#modis-panel-wrapper {
  border-left: 4px solid #dc3545;
}

#modis-panel-wrapper .vegetation-panel-title:hover {
  color: #dc3545;
}

/* ET Panel specific styling */
#et-panel-wrapper {
  border-left: 4px solid #17a2b8;
}

#et-panel-wrapper .vegetation-panel-title:hover {
  color: #17a2b8;
}

/* Sentinel-1 Panel specific styling */
#sentinel1-panel-wrapper {
  border-left: 4px solid #8e44ad;
}

#sentinel1-panel-wrapper .vegetation-panel-title:hover {
  color: #8e44ad;
}

.et-stats {
  background-color: #e8f4f8;
  border-radius: 6px;
  padding: 10px;
  margin-bottom: 10px;
  border-left: 3px solid #17a2b8;
}

.et-stats h6 {
  margin: 0 0 8px 0;
  color: #495057;
  font-size: 0.9em;
}

.et-chart-container {
  position: relative;
  height: 300px;
  width: 100%;
  margin-top: 10px;
}

.sentinel1-chart-container {
  position: relative;
  height: 300px;
  width: 100%;
  margin-top: 10px;
}

.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #28a745;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-right: 10px;
}

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

.error-message {
  color: #dc3545;
  background-color: #f8d7da;
  border: 1px solid #f5c6cb;
  border-radius: 6px;
  padding: 10px;
  margin-top: 10px;
  font-size: 0.85em;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  #legend-content {
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 6px;
  }

  .legend-item {
    font-size: 0.7em;
  }

  .info-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .info-value {
    text-align: left;
    margin-left: 0;
    margin-top: 5px;
  }

  .vegetation-chart-container {
    height: 250px;
  }

  .chart-controls {
    gap: 5px;
  }

  .chart-toggle {
    font-size: 0.75em;
    padding: 3px 6px;
  }
}

@media (min-width: 769px) and (max-width: 1200px) {
  #legend-content {
    grid-template-columns: repeat(auto-fill, minmax(75px, 1fr));
  }
}

@media (min-width: 1201px) {
  #legend-content {
    grid-template-columns: repeat(auto-fill, minmax(85px, 1fr));
  }
}
