/* --- ZENITH EQUITY PLOTLY CHART OVERRIDES --- */

/* 1. Global Font & Text Rendering */
.js-plotly-plot .plotly text {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 2. Axis Labels (Ticks) */
.js-plotly-plot .xtick text,
.js-plotly-plot .ytick text {
    fill: var(--ze-color-on-surface-variant) !important;
    font-size: 11px !important;
    font-weight: 500 !important;
}

/* 3. Axis Titles */
.js-plotly-plot .g-xtitle text,
.js-plotly-plot .g-ytitle text {
    fill: var(--ze-color-on-surface) !important;
    font-family: 'Geist', sans-serif !important;
    font-weight: 600 !important;
    font-size: 12px !important;
}

/* 4. Grid Lines - Subtle Zenith Style */
.js-plotly-plot .gridlayer path {
    stroke: var(--ze-color-outline-variant) !important;
    stroke-opacity: 0.2 !important;
    stroke-width: 1px !important;
}

/* 5. Zero Line */
.js-plotly-plot .zerolinelayer path {
    stroke: var(--ze-color-outline-variant) !important;
    stroke-opacity: 0.5 !important;
    stroke-width: 1px !important;
}

/* 6. Hover Labels (Fintech Tooltip) */
.js-plotly-plot .hoverlayer path {
    fill: var(--ze-color-surface-container-lowest) !important;
    stroke: var(--ze-color-outline-variant) !important;
    stroke-width: 1px !important;
    fill-opacity: 1 !important;
}

.js-plotly-plot .hoverlayer text {
    fill: var(--ze-color-on-surface) !important;
    font-family: 'Inter', sans-serif !important;
    font-weight: 500 !important;
    text-shadow: none !important;
}

/* Spike Line */
.js-plotly-plot .spikeline {
    stroke: var(--ze-color-primary) !important;
    stroke-dasharray: 2px !important;
    stroke-width: 1px !important;
}

/* 7. Bar Hover Effect */
.js-plotly-plot .barlayer path {
    transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.js-plotly-plot .barlayer path:hover {
    opacity: 0.85 !important;
}

@keyframes zeFadeInChart {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Chart skeleton / loading state ───────────────────────────────────── */

.ze-chart-container.ze-chart-loading {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    overflow: hidden;
    border-radius: var(--ze-radius-md);
    background: var(--ze-color-surface-container-low);
    width: 100%;
}

.ze-chart-skeleton {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: inherit;
    display: flex;
    align-items: flex-end;
    padding: var(--ze-space-lg);
    box-sizing: border-box;
}

.ze-skeleton-bar {
    position: absolute;
    bottom: var(--ze-space-xl);
    border-radius: var(--ze-radius-sm) var(--ze-radius-sm) 0 0;
    background: linear-gradient(90deg,
    var(--ze-color-surface-container) 25%,
    var(--ze-color-surface-container-high) 50%,
    var(--ze-color-surface-container) 75%);
    background-size: 200% 100%;
    animation: zeSkeletonShimmer 1.5s ease-in-out infinite;
}

.ze-skeleton-bar:nth-child(2) { animation-delay: 0.1s; }
.ze-skeleton-bar:nth-child(3) { animation-delay: 0.2s; }
.ze-skeleton-bar:nth-child(4) { animation-delay: 0.3s; }
.ze-skeleton-bar:nth-child(5) { animation-delay: 0.4s; }
.ze-skeleton-bar:nth-child(6) { animation-delay: 0.5s; }

@keyframes zeSkeletonShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.js-plotly-plot {
    animation: zeFadeInChart 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.ze-chart-error {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-height: 80px;
    color: var(--ze-color-on-surface-variant);
    font-size: 14px;
    font-family: 'Inter', sans-serif;
}

/* ── Horizontal bar skeleton ───────────────────────────── */
.ze-chart-skeleton--hbar {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: inherit;
    padding: var(--ze-space-md) var(--ze-space-md) var(--ze-space-lg) 60px;
    box-sizing: border-box;
}

.ze-skeleton-hbar {
    position: absolute;
    left: 60px;
    height: 8%;
    border-radius: 0 var(--ze-radius-sm) var(--ze-radius-sm) 0;
    background: linear-gradient(90deg,
            var(--ze-color-surface-container) 25%,
            var(--ze-color-surface-container-high) 50%,
            var(--ze-color-surface-container) 75%
    );
    background-size: 200% 100%;
    animation: zeSkeletonShimmer 1.5s ease-in-out infinite;
}

.ze-skeleton-hbar:nth-child(2) { animation-delay: 0.1s; }
.ze-skeleton-hbar:nth-child(3) { animation-delay: 0.2s; }
.ze-skeleton-hbar:nth-child(4) { animation-delay: 0.3s; }
.ze-skeleton-hbar:nth-child(5) { animation-delay: 0.4s; }
.ze-skeleton-hbar:nth-child(6) { animation-delay: 0.5s; }

/* ── Scatter / line skeleton ───────────────────── */
.ze-chart-skeleton--scatter {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: inherit;
    padding: var(--ze-space-md) var(--ze-space-md) var(--ze-space-lg);
    box-sizing: border-box;
    overflow: hidden;
}

.ze-skeleton-line {
    position: absolute;
    bottom: var(--ze-space-lg);
    left: var(--ze-space-md);
    right: var(--ze-space-md);
    height: 1px;
    background: var(--ze-color-outline-variant);
    opacity: 0.3;
}

.ze-skeleton-dot {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    transform: translate(-50%, 50%);
    background: var(--ze-color-surface-container-high);
    animation: zeSkeletonPulse 1.5s ease-in-out infinite;
}

@keyframes zeSkeletonPulse {
    0% { transform: translate(-50%, 50%) scale(0.9); opacity: 0.5; }
    50% { transform: translate(-50%, 50%) scale(1.1); opacity: 1; }
    100% { transform: translate(-50%, 50%) scale(0.9); opacity: 0.5; }
}

.ze-skeleton-dot:nth-child(2) { animation-delay: 0.1s; }
.ze-skeleton-dot:nth-child(3) { animation-delay: 0.2s; }
.ze-skeleton-dot:nth-child(4) { animation-delay: 0.3s; }
.ze-skeleton-dot:nth-child(5) { animation-delay: 0.4s; }
.ze-skeleton-dot:nth-child(6) { animation-delay: 0.5s; }
