/*
 * Hydrogen Build Metrics Browser - Loading & Error States CSS
 * Loading overlays, error messages, and state transitions
 */

/* Loading State */
.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.95);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  color: var(--text-color);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--text-secondary);
  border-top-color: var(--accent-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 15px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  font-size: 1.1rem;
  margin-top: 10px;
}

/* Error State */
.error-message {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--panel-bg);
  border: 1px solid var(--error-color);
  border-radius: 8px;
  padding: 20px;
  max-width: 80%;
  text-align: center;
  color: var(--text-color);
  z-index: 2000;
}

.error-title {
  color: var(--error-color);
  font-size: 1.2rem;
  margin-bottom: 10px;
}

.error-details {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 15px;
}

.retry-btn {
  background: var(--error-color);
  color: white;
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--font-family);
}

/* Tooltip Styling */
.d3-tooltip {
  position: absolute;
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 8px 9px;
  color: var(--text-color);
  font-size: 0.85rem;
  pointer-events: none;
  z-index: 10000;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
  opacity: 0;

}

.d3-tooltip.visible {
  opacity: 1 !important;
}

.tooltip-date {
  font-weight: 600;
  margin-bottom: 3px;
  color: var(--accent-color);
}

.tooltip-value {
  display: flex;
  justify-content: space-between;
  margin: 2px 0;
}

.tooltip-metric {
  color: var(--text-secondary);
}

.tooltip-number {
  font-weight: 500;
}

/* Responsive Design */
@media (max-width: 1200px) {
  .control-panel {
    width: 330px;
    right: 10px;
  }

  .chart-title {
    font-size: 1.1rem;
  }
}

@media (max-width: 768px) {
  .control-panel {
    position: fixed;
    bottom: 10px;
    left: 10px;
    right: 10px;
    width: auto;
    max-width: 95%;
  }

  .chart-legend {
    position: fixed;
    bottom: 70px;
    left: 10px;
    right: auto;
  }

  .chart-title {
    font-size: 1rem;
    padding: 3px 10px;
  }
}

@media (max-width: 480px) {
  .panel-header h3 {
    font-size: 1rem;
  }

  .btn {
    font-size: 0.85rem;
    padding: 6px 10px;
  }

  .metric-label {
    font-size: 0.8rem;
  }

  .metric-path {
    font-size: 0.7rem;
  }
}

/* Print/SVG Export Styles */
@media print {
  .control-panel {
    display: none !important;
  }

  body {
    background: white !important;
    color: black !important;
  }

  #chart-container {
    background: white !important;
  }
}