/* Chart container styling */
#unified-chart-container {
    background: var(--card-bg) !important;
    backdrop-filter: blur(6px) saturate(100%) !important;
    -webkit-backdrop-filter: blur(6px) saturate(100%) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--border-radius) !important;
    padding: 15px !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1) !important;
}

/* Dark theme adjustments for chart */
[data-theme="dark"] #unified-chart-container {
    background: var(--card-bg) !important;
    border-color: var(--border) !important;
}

/* Ensure Highcharts chart matches the theme */
#unified-chart-container .highcharts-background {
    fill: var(--card-bg) !important;
}

/* Chart text styling that adapts to theme */
#unified-chart-container .highcharts-title {
    fill: var(--text) !important;
    font-weight: 600 !important;
}

#unified-chart-container .highcharts-axis-labels text {
    fill: var(--muted, #6b7280) !important;
}

#unified-chart-container .highcharts-axis-title {
    fill: var(--text) !important;
}

#unified-chart-container .highcharts-legend-item text {
    fill: var(--text) !important;
}

/* Active tab styling */
.nav-tabs .nav-link.active {
    background-color: var(--card-bg) !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
}

.nav-tabs .nav-link {
    color: var(--muted) !important;
}

/* Chart controls styling */
.chart-controls {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 1rem;
    margin-bottom: 1rem;
}

.chart-controls .btn {
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
}

/* Period selector styling */
#period-selector .btn {
    min-width: 60px;
}

/* Chart type selector styling */
#chart-type-selector .btn {
    min-width: 80px;
}

/* Loading state for charts */
.chart-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 400px;
    color: var(--muted);
}

.chart-loading i {
    font-size: 2rem;
    margin-right: 0.5rem;
}

/* Error state for charts */
.chart-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 400px;
    color: var(--muted);
}

.chart-error i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--danger, #dc3545);
}

.chart-error .error-message {
    text-align: center;
    max-width: 300px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #unified-chart-container {
        padding: 10px !important;
    }

    .chart-controls .btn {
        width: 100%;
        margin-right: 0;
        margin-bottom: 0.5rem;
    }

    #period-selector .btn,
    #chart-type-selector .btn {
        min-width: auto;
    }
}

/* Highcharts tooltip styling to match theme */
.highcharts-tooltip {
    background: rgba(255, 255, 255, 0.95) !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
}

.highcharts-tooltip text {
    fill: #1f2937 !important;
    font-family: 'Inter', sans-serif !important;
    font-size: 12px !important;
}

/* More specific Highcharts tooltip selectors */
.highcharts-tooltip-box {
    fill: rgba(255, 255, 255, 0.95) !important;
    stroke: rgba(0, 0, 0, 0.1) !important;
    stroke-width: 1 !important;
}

/* Dark theme tooltip adjustments */
[data-theme="dark"] .highcharts-tooltip {
    background: rgba(15, 23, 42, 0.95) !important;
    border-color: rgba(71, 85, 105, 0.5) !important;
}

[data-theme="dark"] .highcharts-tooltip-box {
    fill: rgba(15, 23, 42, 0.95) !important;
    stroke: rgba(71, 85, 105, 0.5) !important;
}

[data-theme="dark"] .highcharts-tooltip text {
    fill: #e2e8f0 !important;
}

/* Loading animation */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.chart-loading {
    animation: pulse 1.5s ease-in-out infinite;
    color: var(--muted);
    text-align: center;
    padding: 40px;
    font-size: 16px;
}

/* Hide Highcharts context menu/export menu */
.highcharts-contextmenu,
.highcharts-menu,
.highcharts-exporting-group {
    display: none !important;
}

/* Wind chart specific styling */
#wind-chart .highcharts-axis-labels text {
    fill: var(--muted) !important;
    font-size: 11px !important;
}

/* Dark theme specific nav-tabs styling */
[data-theme="dark"] .nav-tabs .nav-link.active {
    background-color: rgba(17, 25, 40, 0.8) !important;
    border-color: rgba(226, 232, 240, 0.12) !important;
    color: #e2e8f0 !important;
}

[data-theme="dark"] .nav-tabs .nav-link {
    color: rgba(226, 232, 240, 0.7) !important;
    border-color: rgba(226, 232, 240, 0.12) !important;
}

[data-theme="dark"] .nav-tabs .nav-link:hover {
    color: #e2e8f0 !important;
    border-color: rgba(226, 232, 240, 0.12) !important;
}

[data-theme="dark"] .highcharts-tooltip text {
    fill: #e2e8f0 !important;
}