/* Portal Layout */
.portal-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.portal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background-color: #2c3e50;
  color: white;
  border-bottom: 1px solid #34495e;
}

.portal-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
}

.portal-controls {
  display: flex;
  gap: 1rem;
}

.refresh-status {
  background-color: #2c3e50;
  color: #ecf0f1;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  font-size: 0.85rem;
  font-family: Inconsolata, monospace;
  font-weight: 500;
  min-width: 150px;
  text-align: center;
}

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

/* Map Container */
.map-container {
  flex: 1;
  position: relative;
}

.weather-map {
  width: 100%;
  height: 100%;
}

/* Station Sidebar */
.station-sidebar {
  width: 300px;
  background-color: #47627d;
  border-left: 1px solid #bdc3c7;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.station-sidebar h3 {
  margin: 0;
  padding: 1rem;
  background-color: #34495e;
  color: white;
  font-size: 1.1rem;
  font-weight: 600;
}

.station-list-content {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
}

/* Station List Items */
.station-item {
  background-color: white;
  border: 1px solid #bdc3c7;
  border-radius: 6px;
  margin-bottom: 0.5rem;
  padding: 0.75rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.station-item:hover {
  background-color: #f8f9fa;
  border-color: #3498db;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.station-item.active {
  background-color: #3498db;
  color: white;
  border-color: #2980b9;
}

.station-name {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
}

.station-status {
  font-size: 0.8rem;
  color: #7f8c8d;
}

.station-item.active .station-status {
  color: #ecf0f1;
}

.station-temp {
  font-size: 1.1rem;
  font-weight: 600;
  color: #2c3e50;
  margin-top: 0.25rem;
}

  .station-item.active .station-temp {
    color: white;
  }
  
  /* Data Display Controls */
  .data-display-controls {
    margin-top: 1rem;
    padding: 1rem;
    background-color: #34495e;
    border-top: 1px solid #2c3e50;
  }
  
  .data-display-controls h4 {
    margin: 0 0 0.75rem 0;
    color: white;
    font-size: 1rem;
    font-weight: 600;
  }
  
  .data-display-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .data-display-button {
    background-color: #47627d;
    color: white;
    border: 1px solid #5a6d7a;
    border-radius: 4px;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
  }
  
  .data-display-button:hover {
    background-color: #3498db;
    border-color: #2980b9;
    transform: translateY(-1px);
  }
  
  .data-display-button.active {
    background-color: #2980b9;
    border-color: #1f5f8b;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  }
  
  .data-display-button:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.3);
  }
  
  /* Map Popup Styles */
.weather-popup {
  min-width: 280px;
  max-width: 320px;
}

.popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #bdc3c7;
}

.popup-station-name {
  font-family: Inconsolata, monospace;
  font-weight: 600;
  font-size: 1.1rem;
  color: #2c3e50;
}

.popup-timestamp {
  font-family: Inconsolata, monospace;
  font-size: 0.8rem;
  color: #7f8c8d;
}

.popup-content {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.popup-weather-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.popup-weather-item {
  text-align: center;
  padding: 0.5rem;
  background-color: #f8f9fa;
  border-radius: 4px;
}

.popup-weather-label {
  font-family: Inconsolata, monospace;
  font-size: 0.8rem;
  color: #7f8c8d;
  margin-bottom: 0.25rem;
}

.popup-weather-value {
  font-family: Inconsolata, monospace;
  font-size: 1.1rem;
  font-weight: 600;
  color: #2c3e50;
}

/* Website Link Styles */
.popup-website-link {
  margin-top: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid #bdc3c7;
  text-align: center;
}

.popup-website-link a {
  color: #3498db;
  text-decoration: none;
  font-size: 0.9rem;
  font-family: Inconsolata, monospace;
  font-weight: 500;
  transition: all 0.2s ease;
}

.popup-website-link a:hover {
  text-decoration: underline;
  color: #2980b9;
}

/* Windrose Design - Matching Original Template */
.popup-windrosecontainer {
  justify-content: center;
  align-items: center;
  margin-left: 0;
  margin-right: 0;
  padding-top: 0;
  font-family: Inconsolata, monospace;
  display: block;
  text-align: center;
  margin-bottom: 0.75rem;
}

.popup-windrose-box {
  width: 100%;
  height: auto;
}

.popup-div-block-3 {
  display: flex;
  justify-content: center;
  align-items: center;
}

.popup-wind-cardinal-dir {
  font-family: Inconsolata, monospace;
  font-size: 11px;
  font-weight: 600;
  color: #2c3e50;
  text-align: center;
  position: absolute;
  top: 60%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
}

.popup-wind-speed {
  text-align: center;
  font-family: Inconsolata, monospace;
  font-size: 18px;
  font-weight: 700;
  color: #2c3e50;
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
}

.popup-windrose-box-container {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  width: 70px;
  height: 70px;
}

.popup-windrose-circle {
  border: 3px solid #898989;
  border-radius: 50%;
  width: 70px;
  height: 70px;
  display: block;
  position: relative;
  background-color: white;
  z-index: 1;
}

.popup-windrose-arrow {
  border-top: 14px solid #669bbc;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  width: 0;
  height: 0;
  position: absolute;
  top: -7px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
}

/* Loading and Error States */
.loading-indicator {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: rgba(255, 255, 255, 0.95);
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  text-align: center;
  z-index: 1000;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #ecf0f1;
  border-top: 4px solid #3498db;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

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

.error-message {
  position: fixed;
  top: 20px;
  right: 20px;
  background-color: #e74c3c;
  color: white;
  padding: 1rem;
  border-radius: 4px;
  z-index: 1001;
  max-width: 300px;
}

/* Map Marker Icons */
.weather-station-marker {
  --marker-size: 40px;
  --marker-border: 2px;
  --marker-radius: calc(var(--marker-size) / 2);
  
  width: var(--marker-size);
  height: var(--marker-size);
  background-color: #3498db;
  border: var(--marker-border) solid white;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: Inconsolata, monospace;
  font-size: 0.7rem;
  font-weight: 600;
  color: white;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
  position: relative;
}

.weather-station-marker.offline {
  background-color: #95a5a6;
}

.weather-station-marker.warning {
  background-color: #f39c12;
}

.weather-station-marker.error {
  background-color: #e74c3c;
}

.weather-station-marker.no-data {
  background-color: #7f8c8d;
}

.wind-direction-indicator {
  --triangle-size: calc(var(--marker-size) * 0.2);
  --triangle-half: calc(var(--triangle-size) / 2);
  
  position: absolute;
  top: 50%;
  left: 50%;
  transform-origin: center center;
  width: 0;
  height: 0;
  border-left: var(--triangle-half) solid transparent;
  border-right: var(--triangle-half) solid transparent;
  border-bottom: var(--triangle-size) solid; /* Color will be set dynamically */
  margin-left: calc(var(--triangle-half) * -1);
  margin-top: calc(var(--triangle-size) * -0.5);
  z-index: 10;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.8)) drop-shadow(0 0 0 1px rgba(255,255,255,0.9));
}

/* Responsive Design */
@media (max-width: 768px) {
  .portal-content {
    flex-direction: column;
  }
  
  .station-sidebar {
    width: 100%;
    height: 200px;
    border-left: none;
    border-top: 1px solid #bdc3c7;
  }
  
  .station-list-content {
    display: flex;
    overflow-x: auto;
    padding: 0.5rem;
  }
  
  .station-item {
    min-width: 150px;
    margin-right: 0.5rem;
    margin-bottom: 0;
  }
  
  .portal-header {
    padding: 0.75rem 1rem;
  }
  
  .portal-title {
    font-size: 1.2rem;
  }
  
  .data-display-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.25rem;
  }
  
  .data-display-button {
    font-size: 0.75rem;
    padding: 0.4rem 0.5rem;
  }
}

@media (max-width: 480px) {
  .portal-header {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }
  
  .popup-weather-grid {
    grid-template-columns: 1fr;
  }
  
  .weather-popup {
    min-width: 250px;
  }
} 

/* Air Quality Modal */
.modal {
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0,0,0,0.4);
}

.modal-content {
  background-color: #fefefe;
  margin: 10% auto;
  padding: 0;
  border: 1px solid #888;
  border-radius: 8px;
  width: 80%;
  max-width: 600px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background-color: #2c3e50;
  color: white;
  border-radius: 8px 8px 0 0;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.25rem;
}

.modal-close {
  color: white;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  line-height: 20px;
  opacity: 0.8;
  transition: opacity 0.3s;
}

.modal-close:hover,
.modal-close:focus {
  opacity: 1;
}

.modal-body {
  padding: 1.5rem;
}

/* Air Quality Grid */
.air-quality-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1.5rem;
  margin-bottom: 1rem;
}

.air-quality-metric {
  text-align: center;
  padding: 1rem;
  background-color: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #dee2e6;
}

.air-quality-metric h4 {
  margin: 0 0 0.5rem 0;
  font-size: 0.9rem;
  color: #495057;
  font-weight: 600;
}

.metric-value {
  font-size: 1.5rem;
  font-weight: bold;
  color: #2c3e50;
  margin: 0.25rem 0;
}

.metric-unit {
  font-size: 0.8rem;
  color: #6c757d;
  margin-bottom: 0.5rem;
}

.metric-status {
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  display: inline-block;
}

/* Air Quality Status Colors */
.air-quality-good {
  background-color: #d4edda;
  color: #155724;
}

.air-quality-moderate {
  background-color: #fff3cd;
  color: #856404;
}

.air-quality-unhealthy-sensitive {
  background-color: #ffe5cc;
  color: #cc5500;
}

.air-quality-unhealthy {
  background-color: #f8d7da;
  color: #721c24;
}

.air-quality-very-unhealthy {
  background-color: #e7d4f1;
  color: #563d7c;
}

.air-quality-hazardous {
  background-color: #d1b2b2;
  color: #7e0023;
}

.air-quality-no-data {
  text-align: center;
  padding: 2rem;
  color: #6c757d;
}

.air-quality-no-data p {
  margin: 0;
  font-size: 1rem;
}

/* Mobile responsiveness for air quality modal */
@media (max-width: 768px) {
  .modal-content {
    width: 95%;
    margin: 5% auto;
  }
  
  .air-quality-grid {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
  }
  
  .air-quality-metric {
    padding: 0.75rem;
  }
  
  .metric-value {
    font-size: 1.25rem;
  }
}

/* Dark mode popup styles */
.leaflet-popup-content-wrapper {
  background-color: #1a2332 !important; /* Dark blue background */
  color: #e0e6ed !important;
  border-radius: 8px !important;
  box-shadow: 0 3px 14px rgba(0,0,0,0.4) !important;
}

.leaflet-popup-tip {
  background-color: #1a2332 !important; /* Match popup background */
}

.leaflet-popup-close-button {
  color: #e0e6ed !important;
  font-size: 20px !important;
}

.leaflet-popup-close-button:hover {
  color: #cb4b16 !important; /* Solarized orange on hover */
}

/* Dark mode weather popup content */
.weather-popup .popup-header {
  border-bottom-color: #2c3e50 !important;
}

.weather-popup .popup-station-name {
  color: #e0e6ed !important;
}

.weather-popup .popup-timestamp {
  color: #93a1a1 !important; /* Solarized base1 */
}

.weather-popup .popup-weather-item {
  background-color: #243447 !important; /* Slightly lighter than popup bg */
  border: 1px solid #2c3e50 !important;
}

.weather-popup .popup-weather-label {
  color: #93a1a1 !important; /* Solarized base1 */
}

.weather-popup .popup-weather-value {
  color: #e0e6ed !important;
}

.weather-popup .popup-website-link {
  border-top-color: #2c3e50 !important;
}

.weather-popup .popup-website-link a {
  color: #268bd2 !important; /* Solarized blue */
}

.weather-popup .popup-website-link a:hover {
  color: #cb4b16 !important; /* Solarized orange */
}

/* Dark mode windrose styles */
.weather-popup .popup-windrose-circle {
  background-color: #243447 !important;
  border-color: #2c3e50 !important;
}

.weather-popup .popup-wind-cardinal-dir,
.weather-popup .popup-wind-speed {
  color: #e0e6ed !important;
}

/* Dark mode AQI status text */
.weather-popup .popup-aqi-status {
  opacity: 0.9;
}
