/* Grid Storage specific styles */

.pie-container {
  height: 350px;
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  padding: 10px;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.02);
  margin-bottom: 15px;
  border: none;
}

/* Battery and pumped storage specific styling */
.battery-item {
  border-left: 4px solid var(--battery-color);
}

.pumped-item {
  border-left: 4px solid var(--pumped-color);
}

/* Storage info section */
.storage-info {
  margin-top: 20px;
  color: white;
  position: relative;
}

/* Override global glass-card to match the main.css */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--blur-intensity));
  -webkit-backdrop-filter: blur(var(--blur-intensity));
  border-radius: 15px;
  border: 1px solid var(--glass-border);
  box-shadow: 0 8px 32px 0 var(--glass-shadow);
  padding: 25px;
  margin: 25px 0;
  transition: var(--transition-normal);
  position: relative;
  overflow: hidden;
  width: 100%;
  box-sizing: border-box;
}

/* Make card headers consistent with main.css */
.card-header {
  display: flex;
  align-items: center;
  margin-bottom: 15px;
  gap: 10px;
  padding: 0;
  background: transparent;
  border-bottom: none;
}

.card-icon {
  background: rgba(255, 255, 255, 0.2);
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.card-header h3 {
  margin: 0;
  padding: 0;
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  font-size: 18px;
  color: #fff;
  margin-left: 0;
}

/* Remove the storage info specific header styling that was causing inconsistency */
.storage-info h3 {
  margin-top: 0;
  position: relative; /* Changed from sticky */
  z-index: 2;
  padding-bottom: 0; /* Remove padding that was causing inconsistency */
  background: transparent; /* Remove background that was causing the transparency issue */
  backdrop-filter: none; /* Remove filters */
  -webkit-backdrop-filter: none;
}

.storage-info h3::after {
  display: none; /* Remove the line under the header */
}

.chart-container {
  width: 100%;
  height: 250px;
  min-height: 200px;
  max-width: 100%;
  box-sizing: border-box;
  position: relative;
}

/* Inactive unit styling */
.inactive-unit {
  opacity: 0.6;
  background-color: rgba(0, 0, 0, 0.1);
}

.chart-title {
  text-align: center;
  font-size: 18px;
  font-weight: 600;
  margin: 10px 0;
  color: white;
}

/* Adjust summary stats to be more compact */
.summary-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  justify-content: space-between;
  padding: 0 10px 15px;
}

.stat-item {
  flex: 1;
  min-width: 120px;
  padding: 10px;
  text-align: center;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  margin-bottom: 5px;
}

.total-output-container {
  width: calc(100% - 20px);
  text-align: center;
  padding: 15px;
  margin: 0 10px 15px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  box-sizing: border-box;
}

.total-output-container .stat-value {
  font-size: 28px;
  font-weight: 700;
}

.stat-value {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 5px;
}

.stat-label {
  font-size: 14px;
  opacity: 0.8;
}

/* Utilization styling */
.high-utilization {
  color: #FF5252 !important; /* Red */
  font-weight: bold;
}

.medium-utilization {
  color: #FFC107 !important; /* Amber */
  font-weight: bold;
}

.low-utilization {
  color: #4CAF50 !important; /* Green */
}

/* Realtime indicator */
.realtime-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #4CAF50;
  margin-left: auto;
  padding: 4px 8px;
  background: rgba(76, 175, 80, 0.1);
  border-radius: 4px;
}

.realtime-indicator i {
  width: 14px;
  height: 14px;
  animation: pulse 2s infinite;
}

.realtime-indicator.hidden {
  display: none;
}

@keyframes pulse {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
  100% {
    opacity: 1;
  }
}

/* Section formatting */
.storage-section {
  margin-bottom: 30px;
}

.section-title {
  font-size: 18px;
  margin: 0;
  font-weight: 600;
  color: #ffffff;
  position: relative;
  padding-left: 12px;
}

.section-title::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 4px;
  background: var(--primary-color);
  border-radius: 2px;
}

/* Storage tables */
.storage-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
  font-size: 14px;
}

.storage-table th {
  padding: 12px 8px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.05);
}

.storage-table td {
  padding: 12px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.storage-table tr:hover td {
  background: rgba(255, 255, 255, 0.07);
}

/* Color variables for storage types */
:root {
  --battery-color: #4CAF50;
  --pumped-color: #2196F3;
}

/* Apply animations to main elements */
.controls, .chart-container, .pie-container, .storage-info {
  animation: fade-in 0.6s ease forwards;
}

.controls {
  animation-delay: 0.1s;
}

.chart-container {
  animation-delay: 0.2s;
}

.pie-container {
  animation-delay: 0.3s;
}

.storage-info {
  animation-delay: 0.4s;
}

/* Realtime button styling that matches plants page */
.realtime-active {
  font-weight: 500;
  color: #ffffff;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
  .glass-card {
    padding: 15px;
    margin: 15px 0;
  }
  
  .pie-container {
    height: 300px;
  }
  
  .chart-container {
    height: 200px;
    min-height: 150px;
  }
  
  .storage-table {
    font-size: 12px;
  }
  
  .storage-table th, 
  .storage-table td {
    padding: 8px 4px;
  }
  
  .section-title {
    font-size: 16px;
  }
  
  .stat-item {
    min-width: 100px;
    padding: 8px;
  }
  
  .stat-value {
    font-size: 18px;
  }
  
  .stat-label {
    font-size: 12px;
  }
  
  .total-output-container {
    margin: 0 5px 10px;
    padding: 10px;
  }
  
  .total-output-container .stat-value {
    font-size: 24px;
  }
  
  .legend {
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 10px 5px;
  }
  
  .legend-item {
    width: 80%;
  }
  
  .card-header {
    flex-wrap: wrap;
  }
  
  .realtime-indicator {
    margin: 5px 0 0 0;
  }
}

/* Section Header with Toggles */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  background: transparent;
  border-bottom: none;
}

.idle-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.8);
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.2);
  transition: .4s;
  border-radius: 34px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

input:checked + .toggle-slider {
  background-color: var(--primary-color);
}

input:checked + .toggle-slider:before {
  transform: translateX(18px);
}

.toggle-label {
  font-size: 13px;
  white-space: nowrap;
}

/* Mobile adjustments for toggles */
@media (max-width: 768px) {
  .section-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .idle-toggle {
    margin-top: 10px;
  }
  
  .toggle-switch {
    width: 36px;
    height: 20px;
  }
  
  .toggle-slider:before {
    height: 16px;
    width: 16px;
  }
  
  input:checked + .toggle-slider:before {
    transform: translateX(16px);
  }
}

/* Enhance legend for pie chart */
.legend {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 5px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  margin: 0 10px 15px;
  width: calc(100% - 20px);
  box-sizing: border-box;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  font-size: 13px;
}

.legend-color {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  display: block;
}

/* Additional Control Panel Styling to match plants page */
.controls-flex-container {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
  padding: 10px 15px;
}

.compact-controls {
  padding-bottom: 15px;
}

.compact-header {
  padding: 10px 15px;
  margin-bottom: 0;
}

.compact-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.compact-group label {
  margin-bottom: 0;
  min-width: 50px;
}

.period-control {
  flex: 1;
  min-width: 200px;
}

.compact-slider {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.compact-button {
  padding: 8px 15px;
  white-space: nowrap;
}

@media (max-width: 768px) {
  .controls-flex-container {
    flex-direction: column;
    align-items: stretch;
  }
  
  .compact-group {
    width: 100%;
  }
}
