/**
 * Unified Chart Container Styles
 * For Plotly charts across Comet, Asteroid, Planet, Meteor detail pages
 */

/* Chart panel wrapper */
.chart-panel {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Chart title */
.chart-panel-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #e5e7eb;
}

/* Chart content area */
.chart-panel-content {
    position: relative;
    min-height: 400px;
}

/* Plotly mount point */
.chart-plot {
    width: 100%;
    min-height: 400px;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    background: white;
}

/* Loading state */
.chart-loading-state {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    color: #6b7280;
}

.chart-loading-spinner {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    border: 3px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: chart-spin 0.8s linear infinite;
}

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

.chart-loading-text {
    margin-left: 0.75rem;
    font-size: 0.875rem;
}

.chart-loading-state.hidden,
.chart-error-state.hidden {
    display: none !important;
}

/* Error state */
.chart-error-state {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    color: #dc2626;
    background-color: #fef2f2;
    border-radius: 0.375rem;
    padding: 1rem;
}

.chart-error-icon {
    font-size: 1.5rem;
    margin-right: 0.5rem;
}

/* Plotly chart specific adjustments */
.chart-panel-content .plotly {
    width: 100% !important;
}

.chart-panel-content .js-plotly-plot {
    border-radius: 0.375rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .chart-panel {
        padding: 1rem;
    }

    .chart-panel-title {
        font-size: 1rem;
    }

    .chart-panel-content {
        min-height: 300px;
    }

    .chart-plot,
    .chart-loading-state,
    .chart-error-state {
        min-height: 300px;
    }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
    .chart-panel {
        background: #1f2937;
        box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3);
    }

    .chart-panel-title {
        color: #f9fafb;
        border-bottom-color: #374151;
    }

    .chart-loading-state {
        color: #9ca3af;
    }

    .chart-error-state {
        background-color: #7f1d1d;
        color: #fca5a5;
    }

    .chart-plot {
        background: #111827;
        border-color: #374151;
    }
}
