/**
 * Progress Utilities CSS
 *
 * Unified animation system and utility classes for all progress bars.
 * Works alongside existing progress bar styles in styles.css.
 *
 * Usage:
 *   Add .progress-animated to any progress fill for stripe animation
 *   Add .progress-indeterminate for unknown-duration operations
 *   Add .progress-complete to stop animation when done
 */

/* ===========================================
   CSS Custom Properties
   =========================================== */

:root {
    /* Animation settings */
    --progress-stripe-size: 30px;
    --progress-animation-speed: 1s;
    --progress-transition-speed: 0.3s;

    /* Colors - can be overridden per-context */
    --progress-fill-color: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    --progress-stripe-color: rgba(255, 255, 255, 0.15);
    --progress-stripe-color-alt: transparent;

    /* Indeterminate mode colors */
    --progress-indeterminate-primary: #3b82f6;
    --progress-indeterminate-secondary: #60a5fa;
}

[data-theme="dark"] {
    --progress-stripe-color: rgba(255, 255, 255, 0.12);
}


/* ===========================================
   Unified Animation Keyframes
   =========================================== */

/* Standard stripe animation - diagonal stripes moving left */
@keyframes progressStripeAnimation {
    from {
        background-position: var(--progress-stripe-size) 0;
    }
    to {
        background-position: 0 0;
    }
}

/* Shimmer animation - subtle glow moving across (for long operations) */
@keyframes progressShimmerAnimation {
    0% {
        transform: translateX(-100%);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    50% {
        transform: translateX(100%);
        opacity: 1;
    }
    60% {
        opacity: 0;
    }
    100% {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Pulse animation - for indeterminate state emphasis */
@keyframes progressPulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}


/* ===========================================
   Animated Progress Fill
   =========================================== */

/* Apply to any progress fill element for stripe animation */
.progress-animated::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        -45deg,
        var(--progress-stripe-color) 25%,
        var(--progress-stripe-color-alt) 25%,
        var(--progress-stripe-color-alt) 50%,
        var(--progress-stripe-color) 50%,
        var(--progress-stripe-color) 75%,
        var(--progress-stripe-color-alt) 75%,
        var(--progress-stripe-color-alt)
    );
    background-size: var(--progress-stripe-size) var(--progress-stripe-size);
    animation: progressStripeAnimation var(--progress-animation-speed) linear infinite;
    pointer-events: none;
}

/* Stop animation when complete */
.progress-complete::after,
.progress-animated.progress-complete::after {
    animation: none;
    background: none;
}


/* ===========================================
   Indeterminate Progress
   =========================================== */

/* For operations with unknown duration */
.progress-indeterminate {
    width: 100% !important;
    background: linear-gradient(
        -45deg,
        var(--progress-indeterminate-primary) 25%,
        var(--progress-indeterminate-secondary) 25%,
        var(--progress-indeterminate-secondary) 50%,
        var(--progress-indeterminate-primary) 50%,
        var(--progress-indeterminate-primary) 75%,
        var(--progress-indeterminate-secondary) 75%,
        var(--progress-indeterminate-secondary)
    ) !important;
    background-size: 40px 40px !important;
    animation: progressStripeAnimation var(--progress-animation-speed) linear infinite !important;
}

/* Remove ::after overlay for indeterminate since animation is on element itself */
.progress-indeterminate::after {
    display: none;
}


/* ===========================================
   Shimmer Effect (for progress band)
   =========================================== */

/* Subtle shimmer overlay for long-running operations */
.progress-shimmer::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.25) 50%,
        transparent 100%
    );
    animation: progressShimmerAnimation 4s ease-in-out infinite;
    pointer-events: none;
}

.progress-shimmer.progress-complete::after {
    animation: none;
    opacity: 0;
}


/* ===========================================
   Color Variants
   =========================================== */

/* Main processing (purple gradient) */
.progress-fill--main {
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
}

/* Download (blue gradient) */
.progress-fill--download {
    background: linear-gradient(90deg, #3b82f6, #1d4ed8);
    --progress-indeterminate-primary: #3b82f6;
    --progress-indeterminate-secondary: #60a5fa;
}

/* AI/Batch (violet gradient) */
.progress-fill--ai {
    background: linear-gradient(90deg, #8b5cf6 0%, #6366f1 100%);
    --progress-indeterminate-primary: #8b5cf6;
    --progress-indeterminate-secondary: #a78bfa;
}

/* Success (green gradient) */
.progress-fill--success {
    background: linear-gradient(90deg, #10b981, #059669);
    --progress-indeterminate-primary: #10b981;
    --progress-indeterminate-secondary: #34d399;
}

/* Warning (amber gradient) */
.progress-fill--warning {
    background: linear-gradient(90deg, #f59e0b, #d97706);
    --progress-indeterminate-primary: #f59e0b;
    --progress-indeterminate-secondary: #fbbf24;
}


/* ===========================================
   Size Variants
   =========================================== */

/* Thin progress bar (6px) */
.progress-bar--thin {
    height: 6px;
    border-radius: 3px;
}

.progress-bar--thin .progress-fill,
.progress-fill--thin {
    border-radius: 3px;
}

/* Standard progress bar (12px) */
.progress-bar--standard {
    height: 12px;
    border-radius: 6px;
}

.progress-bar--standard .progress-fill,
.progress-fill--standard {
    border-radius: 6px;
}

/* Large progress bar (44px) - for main processing */
.progress-bar--large {
    height: 44px;
    border-radius: 22px;
}

.progress-bar--large .progress-fill,
.progress-fill--large {
    border-radius: 22px;
}


/* ===========================================
   Transition Utilities
   =========================================== */

/* Smooth width transitions */
.progress-transition {
    transition: width var(--progress-transition-speed) ease;
}

/* Fast transitions for responsive feel */
.progress-transition--fast {
    transition: width 0.15s ease;
}

/* No transition (for instant updates) */
.progress-transition--none {
    transition: none;
}
