/* ============================================
   Shared Chart Widget Styles
   ============================================ */

/* Base chart widget container */
.chart-widget {
    height: 100%;
    width: 100%;
    display: flex;
    flex-direction: column;
}

.chart-widget > div {
    flex: 1;
    min-height: 0;
}

/* Empty state for charts */
.chart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 0.5rem;
    color: var(--text-tertiary);
}

.chart-empty i {
    font-size: 2rem;
    opacity: 0.5;
}

.chart-empty span {
    font-size: 0.875rem;
}

/* ============================================
   ApexCharts Theme Overrides
   ============================================ */

/* Canvas background */
.apexcharts-canvas {
    background: transparent !important;
}

/* Tooltip styling */
.apexcharts-tooltip {
    background: var(--bg-surface) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 0.5rem !important;
    box-shadow: var(--shadow-lg) !important;
}

.apexcharts-tooltip-title {
    background: var(--bg-surface-hover) !important;
    border-bottom: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    padding: 0.5rem 0.75rem !important;
    font-size: 0.8125rem !important;
    font-weight: 600 !important;
}

.apexcharts-tooltip-text {
    color: var(--text-primary) !important;
}

.apexcharts-tooltip-series-group {
    padding: 0.375rem 0.75rem !important;
}

.apexcharts-tooltip-y-group {
    padding: 0.25rem 0 !important;
}

.apexcharts-tooltip-text-y-value {
    font-weight: 600 !important;
}

/* Legend styling */
.apexcharts-legend {
    padding: 0.5rem 0 !important;
}

.apexcharts-legend-text {
    color: var(--text-primary) !important;
    font-size: 0.75rem !important;
}

.apexcharts-legend-series {
    margin: 0.125rem 0.5rem !important;
}

/* Menu styling */
.apexcharts-menu {
    background: var(--bg-surface) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 0.5rem !important;
    box-shadow: var(--shadow-lg) !important;
}

.apexcharts-menu-item {
    color: var(--text-primary) !important;
}

.apexcharts-menu-item:hover {
    background: var(--bg-surface-hover) !important;
}

/* Grid lines */
.apexcharts-gridline {
    stroke: var(--border-color) !important;
}

.apexcharts-grid-borders line {
    stroke: var(--border-color) !important;
}

/* Axis labels */
.apexcharts-xaxis-label,
.apexcharts-yaxis-label {
    fill: var(--text-secondary) !important;
}

.apexcharts-xaxis-title,
.apexcharts-yaxis-title {
    fill: var(--text-secondary) !important;
}

/* Data labels */
.apexcharts-data-labels text,
.apexcharts-datalabel,
.apexcharts-datalabel-label,
.apexcharts-datalabel-value {
    fill: var(--text-primary) !important;
}

/* Pie/Donut specific */
.apexcharts-pie-label {
    fill: #fff !important;
    font-weight: 500 !important;
}

.apexcharts-datalabels-group text {
    fill: var(--text-primary) !important;
}

/* Radial bar / Gauge specific */
.apexcharts-radialbar-track .apexcharts-radialbar-area {
    stroke: var(--bg-surface-hover) !important;
}

/* Bar chart hover */
.apexcharts-bar-area:hover {
    filter: brightness(1.1);
}

/* Line chart markers */
.apexcharts-marker {
    stroke: var(--bg-surface) !important;
}

/* Selection styling */
.apexcharts-selection-rect {
    fill: var(--primary-color) !important;
    fill-opacity: 0.1 !important;
}

/* Toolbar icons */
.apexcharts-toolbar {
    opacity: 0;
    transition: opacity 0.2s;
}

.chart-widget:hover .apexcharts-toolbar {
    opacity: 1;
}

.apexcharts-toolbar > div {
    color: var(--text-secondary) !important;
}

.apexcharts-toolbar > div:hover {
    color: var(--text-primary) !important;
}

/* Zoom selection */
.apexcharts-zoom-icon.apexcharts-selected svg,
.apexcharts-pan-icon.apexcharts-selected svg {
    stroke: var(--primary-color) !important;
}

/* Reset zoom button */
.apexcharts-reset-icon {
    margin-left: 0.25rem;
}

/* Annotation labels */
.apexcharts-annotation-label {
    color: var(--text-primary) !important;
    background: var(--bg-surface) !important;
    border-color: var(--border-color) !important;
}

/* Crosshairs */
.apexcharts-xcrosshairs,
.apexcharts-ycrosshairs {
    stroke: var(--primary-color) !important;
    stroke-opacity: 0.3 !important;
}

/* ============================================
   Responsive Adjustments
   ============================================ */

@media (max-width: 768px) {
    .apexcharts-legend {
        font-size: 0.6875rem !important;
    }

    .apexcharts-tooltip {
        font-size: 0.75rem !important;
    }

    .chart-empty i {
        font-size: 1.5rem;
    }

    .chart-empty span {
        font-size: 0.75rem;
    }
}
