/* dashboard.css - Dashboard-specific styles */

#chartDiv {
  width: 100%;
  height: 100%;
}

.fuel-mix-container {
  min-height: 400px;
  height: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  animation: fade-in 0.6s ease forwards;
  animation-delay: 0.25s;
}

#fuelMixChartDiv {
  width: 100%;
  flex: 1;
  min-height: 350px;
  padding: 10px;
  position: relative;
}

.fuel-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 15px;
}

.fuel-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  padding: 6px 12px;
  border-radius: 20px;
  color: white;
  font-size: 13px;
  transition: all 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.fuel-legend-item:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
}

.fuel-legend-color {
  width: 12px;
  height: 12px;
  border-radius: 6px;
}

/* No data message */
.no-data-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: rgba(255, 255, 255, 0.7);
  text-align: center;
  padding: 20px;
}

.no-data-icon {
  margin-bottom: 15px;
  opacity: 0.7;
}

/* Summary styles for components that might be missing */
.summary-header {
  margin-bottom: 15px;
}

.component-stats {
  margin-top: 15px;
}

.component-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

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

.component-label {
  font-weight: 500;
}

.component-value {
  font-weight: 600;
}

/* Add fab button style */
.fab-button {
  position: fixed;
  right: 30px;
  bottom: 100px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--primary-color);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  transition: var(--transition-normal);
  z-index: 1000;
  border: none;
}

.fab-button:hover {
  transform: translateY(-5px) scale(1.05);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

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

.controls {
  animation-delay: 0.1s;
}

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

.data-summary {
  animation-delay: 0.3s;
}

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

.fab-button {
  animation: slide-in-right 0.5s ease forwards;
  animation-delay: 0.8s;
}


/* Mobile responsive adjustments */
@media (max-width: 768px) {
  .fuel-mix-container {
    min-height: 350px;
  }
  
  #fuelMixChartDiv {
    min-height: 300px;
  }
  
  .fab-button {
    right: 20px;
    bottom: 90px;
    width: 50px;
    height: 50px;
  }
}

/* Summary Grid Layout */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 35px;
  padding: 20px 0;
}

/* Summary Card Styles */
.summary-card {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 12px;
  padding: 15px;
  text-decoration: none;
  color: inherit;
  transition: all 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 180px;
  overflow: hidden; /* Ensure content doesn't overflow */
  position: relative; /* Added to position the badge relative to the card */
}

.summary-card:hover {
  transform: translateY(-3px);
  background: rgba(255, 255, 255, 0.15);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

/* Card header with icon and title side by side */
.summary-card .card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.summary-card .card-icon {
  width: 36px;
  height: 36px;
  min-width: 36px; /* Prevent icon from shrinking */
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0; /* Remove bottom margin as it's now in a flex container */
}

.summary-card .card-icon i {
  width: 18px;
  height: 18px;
  color: var(--primary-color);
}

.summary-card h3 {
  margin: 0;
  font-size: 1rem;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.summary-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%; /* Ensure it takes full width */
}

.summary-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%; /* Ensure it takes full width */
}

.stat-item {
  background: rgba(255, 255, 255, 0.05);
  padding: 8px;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow: hidden; /* Prevent content overflow */
  min-width: 0; /* Allow it to shrink below content size if needed */
}

.stat-label {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.7);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-value {
  font-size: 1rem;
  font-weight: 600;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Value coloring for imports/exports */
.positive-value {
  color: #4caf50; /* Green for imports */
}

.negative-value {
  color: #f44336; /* Red for exports */
}

/* Stability Grid */
.stability-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 10px;
  width: 100%;
  height: 100%;
}

.stability-grid-item {
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  align-items: center;
  padding: 12px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  gap: 12px;
  overflow: hidden;
  min-width: 0;
}

.stability-grid-item .grid-item-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.stability-grid-item .stat-label {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.7);
  margin-top: 2px;
  text-align: left;
  line-height: 1.1;
  min-height: 1.1em;
}

.stability-grid-item .stat-value {
  font-size: 1.25rem;
  font-weight: 600;
  color: white;
  line-height: 1.2;
}

.stability-grid-item:hover .icon-container {
  transform: scale(1.1);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
}

/*sparkline charts*/
.summary-chart {
  height: 80px;
  position: relative;
  margin-top: 12px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  padding: 5px;
}

/* Add chart description styles */
.chart-description {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.7);
  text-align: center;
  margin-top: 5px;
  padding-bottom: 5px;
  font-weight: 400;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
  .summary-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 30px;
  }

  .summary-card {
    min-height: 160px;
    padding: 12px;
  }

  .summary-stats, .stability-grid, .storage-grid {
    grid-template-columns: 1fr 1fr; /* Keep 2 columns on mobile for compactness */
  }
  
  .stat-item, .stability-grid-item, .storage-grid-item {
    padding: 6px;
  }
  
  .stat-label {
    font-size: 0.7rem;
  }
  
  .stat-value {
    font-size: 0.9rem;
  }
  
  .summary-chart {
    height: 60px;
  }
}

/* For very small screens */
@media (max-width: 480px) {
  .summary-grid {
    grid-template-columns: 1fr;
    gap: 30px;
  }
}

/* Loading State */
.loading {
  display: none;
  text-align: center;
  padding: 20px;
  color: rgba(255, 255, 255, 0.7);
}

/* Error Message */
.error-message {
  display: none;
  background: rgba(255, 59, 48, 0.1);
  border: 1px solid rgba(255, 59, 48, 0.2);
  color: #ff3b30;
  padding: 15px;
  border-radius: 8px;
  margin: 20px 0;
  text-align: center;
}

/* Toast Notification */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--dark-bg);
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  transform: translateX(150%);
  transition: transform 0.3s ease;
  z-index: 2000;
  border-left: 4px solid var(--primary-color);
}

.toast.show {
  transform: translateX(0);
}

/* Control Panel Styles */
.controls {
  margin-bottom: 20px;
}

.controls-flex-container {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
}

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

.compact-input {
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: white;
}

.compact-button {
  padding: 8px 20px;
  border-radius: 8px;
  border: none;
  background: var(--primary-color);
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
}

.compact-button:hover {
  background: var(--primary-color-dark);
  transform: translateY(-2px);
}

/* Animation Keyframes */
@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slide-in-right {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slide-in-left {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Plants grid layout for the 4 tiles in plants overview */
.plants-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 10px;
  height: 100%;
  width: 100%;
}

.plants-grid-item {
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  align-items: center;
  padding: 12px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  gap: 12px;
}

.plants-grid-item .grid-item-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.plants-grid-item .stat-label {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.7);
  margin-top: 2px;
  text-align: left;
}

.plants-grid-item .stat-value {
  font-size: 1.25rem;
  font-weight: 600;
  color: white;
  line-height: 1.2;
}

.icon-container {
  width: 32px;
  height: 32px;
  min-width: 32px;
  background: linear-gradient(135deg, rgba(30, 144, 255, 0.7), rgba(0, 191, 255, 0.7));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.grid-item-icon {
  width: 16px;
  height: 16px;
  color: white;
  opacity: 1;
  transition: all 0.3s ease;
}

.plants-grid-item:hover .icon-container {
  transform: scale(1.1);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
}

/* Storage Grid Styles */
.storage-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 10px;
  height: 100%;
  width: 100%;
}

.storage-grid-item {
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  align-items: center;
  padding: 12px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  gap: 12px;
}

.storage-grid-item .grid-item-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.storage-grid-item .stat-label {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.7);
  margin-top: 2px;
  text-align: left;
}

.storage-grid-item .stat-value {
  font-size: 1.25rem;
  font-weight: 600;
  color: white;
  line-height: 1.2;
}

.storage-grid-item:hover .icon-container {
  transform: scale(1.1);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
}

/* Make sure responsive adjustments include storage grid */
@media (max-width: 768px) {
  .summary-stats, .stability-grid, .plants-grid, .storage-grid {
    grid-template-columns: 1fr 1fr; /* Keep 2 columns on mobile for compactness */
  }
  
  .stat-item, .stability-grid-item, .plants-grid-item, .storage-grid-item {
    padding: 6px;
  }
}
