/* ============================================
   CHARTS CSS
   Styles for budget visualization charts
   ============================================ */

/* Charts Modal */
.charts-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.charts-modal.active {
  opacity: 1;
  visibility: visible;
}

.charts-modal-content {
  background: white;
  border-radius: 12px;
  width: 95%;
  max-width: 1200px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.charts-modal.active .charts-modal-content {
  transform: scale(1);
}

/* Charts Modal Header */
.charts-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 32px;
  border-bottom: 1px solid #e0e0e0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 12px 12px 0 0;
}

.charts-modal-header h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
}

.charts-modal-close {
  background: none;
  border: none;
  font-size: 28px;
  color: white;
  cursor: pointer;
  padding: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease;
}

.charts-modal-close:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

/* Charts Container */
.charts-container {
  padding: 32px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
}

.chart-section {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 24px;
  border: 1px solid #e9ecef;
}

.chart-section h3 {
  margin: 0 0 20px 0;
  font-size: 18px;
  font-weight: 600;
  color: #2c3e50;
  text-align: center;
}

.chart-wrapper {
  position: relative;
  height: 300px;
  margin: 0 auto;
}

/* Empty States */
.empty-chart,
.charts-no-data,
.charts-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  color: #6c757d;
}

.empty-chart-icon,
.charts-no-data-icon,
.charts-error-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.7;
}

.charts-no-data h3,
.charts-error h3 {
  margin: 0 0 8px 0;
  font-size: 20px;
  color: #495057;
}

.charts-no-data p,
.charts-error p {
  margin: 0;
  font-size: 16px;
  color: #6c757d;
}

/* Chart Buttons */
.btn-chart {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-chart-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.btn-chart-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.btn-chart-secondary {
  background: #6c757d;
  color: white;
}

.btn-chart-secondary:hover {
  background: #5a6268;
  transform: translateY(-2px);
}

/* Charts Modal Footer */
.charts-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 16px;
  padding: 24px 32px;
  border-top: 1px solid #e0e0e0;
  background: #f8f9fa;
  border-radius: 0 0 12px 12px;
}

/* Responsive Design */
@media (min-width: 768px) {
  .charts-container {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto auto;
  }

  .chart-section:last-child {
    grid-column: 1 / -1;
  }
}

@media (min-width: 1024px) {
  .charts-container {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
  }

  .chart-section:last-child {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

/* Mobile Optimizations */
@media (max-width: 767px) {
  .charts-modal-content {
    width: 98%;
    margin: 1%;
    max-height: 95vh;
  }

  .charts-modal-header {
    padding: 16px 20px;
  }

  .charts-modal-header h2 {
    font-size: 20px;
  }

  .charts-container {
    padding: 20px;
    gap: 20px;
  }

  .chart-section {
    padding: 16px;
  }

  .chart-wrapper {
    height: 250px;
  }

  .charts-modal-footer {
    padding: 16px 20px;
    flex-direction: column;
  }

  .btn-chart {
    width: 100%;
    margin-bottom: 8px;
  }
}

/* Dark mode support (for future implementation) */
@media (prefers-color-scheme: dark) {
  .charts-modal-content {
    background: #2c3e50;
    color: white;
  }

  .chart-section {
    background: #34495e;
    border-color: #4a5568;
  }

  .charts-modal-footer {
    background: #34495e;
    border-color: #4a5568;
  }
}

/* Loading animation for charts */
@keyframes chartLoading {
  0% {
    opacity: 0.3;
  }
  50% {
    opacity: 0.7;
  }
  100% {
    opacity: 0.3;
  }
}

.chart-wrapper.loading {
  animation: chartLoading 1.5s ease-in-out infinite;
}

/* Chart hover effects */
.chart-wrapper:hover {
  transform: translateY(-2px);
  transition: transform 0.2s ease;
}

/* Success states */
.charts-success {
  color: #28a745;
  background: #d4edda;
  border: 1px solid #c3e6cb;
  border-radius: 8px;
  padding: 12px 16px;
  margin: 16px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.charts-success::before {
  content: '✅';
  font-size: 16px;
}
