/* Ex Center Chart Styles */

.ex-chart-container {
  background: white;
  border-radius: 15px;
  padding: 25px;
  margin-bottom: 30px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  position: relative;
}

.ex-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  padding-bottom: 15px;
  border-bottom: 2px solid #f0f0f0;
}

.ex-chart-title {
  color: #00bf63;
  font-size: 1.5rem;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.ex-chart-controls {
  display: flex;
  align-items: center;
  gap: 15px;
}

.ex-chart-period-selector {
  display: flex;
  background: #f8f9fa;
  border-radius: 25px;
  padding: 3px;
  border: 1px solid #e0e0e0;
}

.ex-period-btn {
  background: transparent;
  border: none;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  color: #666;
  font-weight: 500;
}

.ex-period-btn.active {
  background: #00bf63;
  color: white;
  box-shadow: 0 2px 8px rgba(0, 191, 99, 0.3);
}

.ex-period-btn:hover:not(.active) {
  background: rgba(0, 191, 99, 0.1);
  color: #00bf63;
}

.ex-chart-wrapper {
  position: relative;
  width: 100%;
  height: 400px;
  background: #fafafa;
  border-radius: 10px;
  border: 1px solid #e0e0e0;
  overflow: hidden;
}

/* Make chart fully responsive */
.ex-chart-wrapper #historical-chart {
  width: 100% !important;
  height: 100% !important;
}

.ex-chart-wrapper canvas {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  display: block;
}

.ex-chart-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.ex-chart-loading {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.9);
  z-index: 10;
}

.ex-chart-loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #00bf63;
  border-radius: 50%;
  animation: ex-chart-spin 1s linear infinite;
  margin-bottom: 15px;
}

@keyframes ex-chart-spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.ex-chart-loading-text {
  color: #00bf63;
  font-weight: 600;
  font-size: 14px;
}

/* Chart Tooltip */
.ex-chart-tooltip {
  position: absolute;
  background: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  z-index: 1000;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  max-width: 250px;
  backdrop-filter: blur(10px);
}

.ex-tooltip-header {
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.ex-tooltip-header strong {
  color: #00bf63;
  font-size: 14px;
}

.ex-tooltip-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ex-tooltip-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.ex-tooltip-label {
  color: #ccc;
  font-size: 12px;
}

.ex-tooltip-value {
  color: white;
  font-weight: 600;
  text-align: right;
}

/* Chart Statistics */
.ex-chart-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 15px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #f0f0f0;
}

.ex-chart-stat {
  text-align: center;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 10px;
  border: 1px solid #e0e0e0;
  transition: all 0.3s ease;
}

.ex-chart-stat:hover {
  background: #f0fff0;
  border-color: #00bf63;
  transform: translateY(-2px);
}

.ex-chart-stat-label {
  font-size: 12px;
  color: #666;
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ex-chart-stat-value {
  font-size: 1.2rem;
  font-weight: bold;
  color: #00bf63;
  margin-bottom: 3px;
}

.ex-chart-stat-change {
  font-size: 11px;
  color: #888;
}

.ex-chart-stat-change.positive {
  color: #28a745;
}

.ex-chart-stat-change.negative {
  color: #dc3545;
}

/* Chart Error State */
.ex-chart-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 300px;
  color: #dc3545;
  text-align: center;
}

.ex-chart-error-icon {
  font-size: 3rem;
  margin-bottom: 15px;
  opacity: 0.7;
}

.ex-chart-error-message {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 10px;
}

.ex-chart-error-details {
  font-size: 14px;
  color: #666;
  margin-bottom: 20px;
}

.ex-chart-retry-btn {
  background: #00bf63;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.3s ease;
}

.ex-chart-retry-btn:hover {
  background: #00a855;
  transform: translateY(-1px);
}

/* Responsive Design */
@media (max-width: 768px) {
  .ex-chart-container {
    padding: 20px 15px;
    margin-left: -25px;
    margin-right: -25px;
  }

  .ex-chart-header {
    flex-direction: column;
    gap: 15px;
    align-items: stretch;
  }

  .ex-chart-controls {
    justify-content: center;
  }

  .ex-chart-wrapper {
    height: 300px;
  }

  .ex-chart-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .ex-chart-stat {
    padding: 10px;
  }

  .ex-chart-stat-value {
    font-size: 1rem;
  }

  .ex-period-btn {
    padding: 6px 12px;
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  .ex-chart-container {
    padding: 15px 10px;
    margin-left: -25px;
    margin-right: -25px;
  }

  .ex-chart-title {
    font-size: 1.3rem;
  }

  .ex-chart-wrapper {
    height: 250px;
  }

  .ex-chart-stats {
    grid-template-columns: 1fr;
  }

  .ex-chart-period-selector {
    flex-wrap: wrap;
    gap: 5px;
  }

  .ex-period-btn {
    flex: 1;
    min-width: 60px;
  }

  .ex-chart-tooltip {
    font-size: 12px;
    padding: 10px 12px;
    max-width: 200px;
  }
}

/* Animation for chart appearance */
.ex-chart-container {
  animation: ex-chart-fade-in 0.5s ease-out;
}

@keyframes ex-chart-fade-in {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Chart container when loading */
.ex-chart-container.loading .ex-chart-wrapper {
  opacity: 0.6;
}

.ex-chart-container.loading .ex-chart-controls {
  pointer-events: none;
  opacity: 0.5;
}

/* Custom scrollbar for tooltip if needed */
.ex-chart-tooltip::-webkit-scrollbar {
  width: 4px;
}

.ex-chart-tooltip::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}

.ex-chart-tooltip::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
}

.ex-chart-tooltip::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}

/* Print styles */
@media print {
  .ex-chart-container {
    box-shadow: none;
    border: 1px solid #ddd;
  }

  .ex-chart-controls {
    display: none;
  }

  .ex-chart-tooltip {
    display: none !important;
  }
}

/* Ensure chart fills container properly */
.ex-chart-wrapper {
  position: relative;
  width: 100%;
  height: 400px;
  background: #fafafa;
  border-radius: 10px;
  border: 1px solid #e0e0e0;
  overflow: hidden;
}

.ex-chart-wrapper > div {
  width: 100% !important;
  height: 100% !important;
}

.ex-chart-wrapper canvas {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  display: block;
}

/* Force responsive behavior */
#historical-chart {
  width: 100% !important;
  height: 100% !important;
  position: relative;
}

#historical-chart canvas {
  width: 100% !important;
  height: 100% !important;
  position: absolute;
  top: 0;
  left: 0;
}
