/* superchart-smooth-transitions.css */
/* Smooth animations and transitions for chart data updates and series alignment */

/* Chart panels get a smooth opacity transition when they're being updated */
.chart-panel {
    transition: opacity 0.2s ease-in-out, transform 0.15s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* When data is being loaded and realigned, apply a subtle transition */
.chart-panel.data-updating {
    opacity: 0.92;
    transform: scale(0.9995);
}

/* Chart containers get smooth height transitions during resize */
.chart-container-wrapper {
    transition: height 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Lightweight Charts container smooth transitions */
.tv-chart-container {
    transition: background-color 0.2s ease-in-out;
}

/* Series data updates smooth transition */
.series-update {
    animation: series-smooth-update 0.4s ease-in-out;
}

/* Subtle pulse animation when new data arrives */
@keyframes series-smooth-update {
    0% {
        opacity: 0.95;
    }
    50% {
        opacity: 1;
    }
    100% {
        opacity: 1;
    }
}

/* When time range is frozen (data loading), charts show subtle visual feedback */
.time-range-frozen .timeScale {
    opacity: 0.7;
    pointer-events: none;
}

/* Loading state for individual chart panels */
.chart-panel.loading {
    position: relative;
}

.chart-panel.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.05),
        transparent
    );
    animation: shimmer 2s infinite;
    pointer-events: none;
    border-radius: 4px;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Crosshair sync animation - smooth follow */
.cross-hair-sync {
    transition: all 0.1s linear;
}

/* Chart resize handle hover state with smooth transition */
.resize-handle {
    transition: background-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.resize-handle:hover {
    background-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 0 8px rgba(255, 157, 77, 0.3);
}

/* Smooth color transitions when values change */
.value-change {
    transition: color 0.3s ease-in-out;
}

/* Pan animation: smooth leftward scroll when older data loads */
@keyframes pan-smooth {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(0);
    }
}

/* Apply smooth transition to charts when visible range changes via user pan */
.chart-panning {
    animation: pan-smooth 0.2s ease-out;
}

/* Indicator panel smooth toggle animation */
.indicator-panel-toggle {
    animation: panel-slide-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes panel-slide-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Smooth fade when removing a chart panel */
.chart-panel-removing {
    animation: panel-fade-out 0.3s ease-in-out forwards;
}

@keyframes panel-fade-out {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.95);
    }
}

/* Data sync indicator - subtle glow when syncing */
.data-sync-active {
    box-shadow: inset 0 0 8px rgba(0, 255, 127, 0.2), 0 0 12px rgba(0, 255, 127, 0.15);
    transition: box-shadow 0.3s ease-in-out;
}

/* Prevent jank: use will-change for frequently updated elements */
.chart-panel {
    will-change: opacity, transform;
}

/* Smooth scroll on time range indicator */
.time-range-indicator {
    transition: width 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), left 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Ensure GPU acceleration for smoother animations */
.chart-container,
.chart-panel,
.tv-chart-container {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}
