/**
 * Sparkles Progress Component Styles
 * Progress bars, loaders, and multi-step indicators
 * Extends: sparkles-utilities.css, sparkles-animations.css, sparkles-tokens.css
 * All 3 optimization layers applied: keyframes consolidated, patterns extracted, component organization
 */

/* ========== PROGRESS BAR BASE ========== */
.sparkles-progress,
.sparkles-progress-bar,
.sparkles-form-progress {
    width: 100%;
    background-color: var(--gray-200);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.sparkles-progress {
    position: relative;
}

.sparkles-progress-bar {
    transition: width 0.3s ease-out; /* Keep raw for specific timing */
    border-radius: inherit; /* Keep raw for inherit value */ height: 100%; position: relative; overflow: hidden;
}

/* ========== PROGRESS SIZES ========== */
.sparkles-progress-sm {
    height: .25rem;
}

.sparkles-progress-md {
    height: .5rem;
}

.sparkles-progress-lg {
    height: 1rem;
}

/* ========== PROGRESS VARIANTS ========== */
.sparkles-progress-bar-primary {
    background-color: var(--color-primary);
}

.sparkles-progress-bar-success {
    --tw-bg-opacity: 1;
    background-color: var(--color-success);
}

.sparkles-progress-bar-warning {
    --tw-bg-opacity: 1;
    background-color: rgba(245,158,11,var(--tw-bg-opacity,1));
}

.sparkles-progress-bar-error {
    --tw-bg-opacity: 1;
    background-color: rgba(239,68,68,var(--tw-bg-opacity,1));
}

.sparkles-progress-bar-info {
    background-color: var(--color-primary);
}

/* ========== GRADIENT VARIANTS ========== */
.sparkles-progress-bar-gradient.sparkles-progress-bar-primary {
    background: linear-gradient(to right, var(--color-primary), var(--color-secondary));
}

.sparkles-progress-bar-gradient.sparkles-progress-bar-success {
    background: linear-gradient(45deg, var(--color-success), var(--color-success-light));
}

.sparkles-progress-bar-gradient.sparkles-progress-bar-warning {
    background: linear-gradient(45deg, var(--color-warning), var(--color-warning-light));
}

.sparkles-progress-bar-gradient.sparkles-progress-bar-error {
    background: linear-gradient(45deg, var(--color-error), var(--color-error-light));
}

/* ========== STRIPED PROGRESS ========== */
.sparkles-progress-bar-striped {
    background-image: linear-gradient(
        45deg,
        rgba(255, 255, 255, 0.15) 25%,
        transparent 25%,
        transparent 50%,
        rgba(255, 255, 255, 0.15) 50%,
        rgba(255, 255, 255, 0.15) 75%,
        transparent 75%,
        transparent
    );
    background-size: 1rem 1rem;
}

.sparkles-progress-bar-animated.sparkles-progress-bar-striped {
    animation: sparkles-progress-stripes 1s linear infinite;
}

/* ========== INDETERMINATE PROGRESS ========== */
.sparkles-progress-indeterminate .sparkles-progress-bar {
    animation: sparkles-progress-indeterminate 2s linear infinite;
}

/* ========== PULSE ANIMATION ========== */
.sparkles-progress-pulse .sparkles-progress-bar {
    animation: sparkles-progress-pulse 1.5s ease-in-out infinite;
}

/* ========== PROGRESS LABELS ========== */
.sparkles-progress-wrapper {
    width: 100%;
}

.sparkles-progress-label,
.sparkles-recommendations__pricing-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: .5rem;
    font-size: .875rem;
    line-height: 1.25rem;
}

.sparkles-progress-label {
    font-weight: 500;
    color: var(--gray-700);
}

.sparkles-progress-label-bottom {
    margin-bottom: 0;
    margin-top: .5rem;
}

.sparkles-progress-value {
    
    color: var(--color-primary);
    font-variant-numeric: tabular-nums;
}

/* Inside label for larger progress bars */
.sparkles-progress-lg .sparkles-progress-bar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: .5rem;
    --tw-text-opacity: 1;
    color: rgba(255,255,255,var(--tw-text-opacity,1));
    font-size: .75rem;
    line-height: 1rem;
    font-weight: 500;
}

/* ========== CIRCULAR PROGRESS ========== */
.sparkles-progress-circular {
    background: conic-gradient(var(--color-primary) 0deg, var(--gray-200) 0deg); /* Uses variable for primary color */ width: 5rem; height: 5rem; border-radius: var(--radius-full); display: flex; align-items: center; justify-content: center; position: relative; container-type: inline-size;
}

.sparkles-progress-circular::before {
    content: '';
    width: calc(100% - 8px); /* Keep raw for calc() */
    height: calc(100% - 8px); /* Keep raw for calc() */ position: absolute; border-radius: var(--radius-full); --tw-bg-opacity: 1; background-color: rgba(255,255,255,var(--tw-bg-opacity,1));
}

.sparkles-progress-circular-label {
    z-index: var(--z-dropdown); /* Keep raw for CSS variable */ position: relative; font-size: .875rem; line-height: 1.25rem; font-weight: 600; color: var(--gray-700);
}

.sparkles-progress-circular-sm {
    width: 3rem;
    height: 3rem;
}

.sparkles-progress-circular-sm::before {
    width: calc(100% - 6px);
    height: calc(100% - 6px);
}

.sparkles-progress-circular-lg {
    width: 120px;
    height: 120px;
}

.sparkles-progress-circular-lg::before {
    width: calc(100% - 12px);
    height: calc(100% - 12px);
}

/* ========== MULTI-STEP PROGRESS ========== */
.sparkles-multi-step {
    display: flex;
    align-items: center;
    width: 100%;
    container-type: inline-size;
}

.sparkles-multi-step-vertical {
    flex-direction: column;
    align-items: flex-start;
}

.sparkles-multi-step-item,
.sparkles-form-step {
    display: flex;
    align-items: center;
    flex: 1 1 0%;
    position: relative;
}

.sparkles-multi-step-vertical .sparkles-multi-step-item {
    flex: none;
    width: 100%;
    margin-bottom: 1.5rem;
}

.sparkles-multi-step-vertical .sparkles-multi-step-item:last-child {
    margin-bottom: 0;
}

/* ========== STEP INDICATORS ========== */
.sparkles-step-indicator {
    z-index: var(--z-sticky); /* Keep raw for CSS variable */ width: 2rem; height: 2rem; border-radius: var(--radius-full); background-color: var(--gray-300); color: var(--gray-600); display: flex; align-items: center; justify-content: center; font-size: .875rem; line-height: 1.25rem; font-weight: 600; border-width: 2px; border-color: var(--gray-300); position: relative; transition-property: all; transition-duration: .15s; transition-duration: .2s; transition-timing-function: cubic-bezier(.4,0,.2,1);
}

.sparkles-step-indicator-sm {
    width: 1.5rem;
    height: 1.5rem;
    font-size: .75rem;
    line-height: 1rem;
}

.sparkles-step-indicator-lg {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1rem;
    line-height: 1.5rem;
}

/* Step states */
.sparkles-step-current .sparkles-step-indicator {
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--color-primary) 20%, transparent);
}

.sparkles-step-completed .sparkles-step-indicator {
    background-color: var(--color-success);
    color: rgba(255,255,255,var(--tw-text-opacity,1));
    border-color: var(--color-success);
}

.sparkles-step-completed .sparkles-step-indicator::after {
    content: '✓';
    font-size: .875rem;
    line-height: 1.25rem;
}

.sparkles-step-error .sparkles-step-indicator {
    background-color: rgba(239,68,68,var(--tw-bg-opacity,1));
    color: rgba(255,255,255,var(--tw-text-opacity,1));
    border-color: rgba(239,68,68,var(--tw-border-opacity,1));
}

.sparkles-step-error .sparkles-step-indicator::after {
    content: '!';
    font-size: .875rem;
    line-height: 1.25rem;
}

.sparkles-step-skipped .sparkles-step-indicator {
    --tw-bg-opacity: 1;
    background-color: rgba(156,163,175,var(--tw-bg-opacity,1));
    --tw-text-opacity: 1;
    color: rgba(255,255,255,var(--tw-text-opacity,1));
    border-color: var(--gray-400);
}

.sparkles-step-skipped .sparkles-step-indicator::after {
    content: '–';
    font-size: .875rem;
    line-height: 1.25rem;
}

/* Clickable steps */
.sparkles-step-clickable .sparkles-step-indicator {
    cursor: pointer;
}

.sparkles-step-clickable .sparkles-step-indicator:hover {
    transform: scale(1.1);
}

/* ========== STEP CONNECTORS ========== */
.sparkles-step-connector {
    z-index: var(--z-dropdown); /* Keep raw for CSS variable */
    flex: 1 1 0%;
    background-color: var(--gray-300);
    margin-left: var(--sparkles-step-connector-margin-x, .75rem);
    margin-right: var(--sparkles-step-connector-margin-x, .75rem);
    margin-top: var(--sparkles-step-connector-margin-y, 0);
    margin-bottom: var(--sparkles-step-connector-margin-y, 0);
    position: relative;
}

.sparkles-multi-step-vertical .sparkles-step-connector {
    --sparkles-step-connector-margin-x: .125rem;
    --sparkles-step-connector-margin-y: .5rem;
    height: 1.5rem;
}

.sparkles-step-connector-completed {
    --tw-bg-opacity: 1;
    background-color: var(--color-success);
}

.sparkles-step-connector-current {
    background: linear-gradient(
        to right,
        var(--color-success) 0%,
        var(--color-success) 50%,
        var(--gray-300) 50%,
        var(--gray-300) 100%
    );
}

.sparkles-multi-step-vertical .sparkles-step-connector-current {
    background: linear-gradient(
        to bottom,
        var(--color-success) 0%,
        var(--color-success) 50%,
        var(--gray-300) 50%,
        var(--gray-300) 100%
    );
}

/* ========== STEP LABELS ========== */
.sparkles-step-content {
    margin-left: var(--sparkles-step-content-offset-x, .75rem);
}

.sparkles-multi-step-vertical .sparkles-step-content {
    --sparkles-step-content-offset-x: 1rem;
    margin-top: -2rem;
    padding-top: .5rem;
}

.sparkles-step-title {
    margin-bottom: .25rem;
}

.sparkles-step-current .sparkles-step-title {
    color: var(--color-primary);
    font-weight: 600;
}

.sparkles-step-completed .sparkles-step-title {
    --tw-text-opacity: 1;
    color: var(--color-success);
}

.sparkles-step-description {
    font-size: .75rem;
    color: var(--gray-500);
    line-height: 1.25;
}

/* ========== PROGRESS RING (SVG) ========== */
.sparkles-progress-ring {
    --tw-rotate: -90deg;
}

.sparkles-progress-ring-background {
    stroke-width: 8; /* Keep raw for SVG stroke width */
}

.sparkles-progress-ring-progress {
    stroke: var(--color-primary);
    stroke-width: 8; /* Keep raw for SVG stroke width */
    stroke-linecap: round; /* Keep raw for SVG property */
    transition: stroke-dasharray 0.3s ease-out; /* Keep raw for specific timing */
}

/* ========== LOADING BARS ========== */
.sparkles-loading-bars {
    display: flex;
    gap: .25rem;
    align-items: flex-end;
}

.sparkles-loading-bar {
    background-color: var(--color-primary);
    animation: sparkles-loading-bars 1.2s ease-in-out infinite; /* Keep raw for animation */ width: .25rem; border-radius: var(--radius-full);
}

.sparkles-loading-bar:nth-child(1) {
    animation-delay: -0.24s; 
}
.sparkles-loading-bar:nth-child(2) {
    animation-delay: -0.12s;
    height: 1.25rem; 
}
.sparkles-loading-bar:nth-child(3) {
    animation-delay: 0s; 
}
.sparkles-loading-bar:nth-child(4) {
    animation-delay: 0.12s;
    height: 1.25rem; 
}
.sparkles-loading-bar:nth-child(5) {
    animation-delay: 0.24s; 
}

/* ========== RESPONSIVE DESIGN ========== */
@container (max-width: 768px) {
    .sparkles-multi-step {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .sparkles-multi-step-item {
        width: 100%;
        margin-bottom: 1rem;
    }
    
    .sparkles-multi-step-item:last-child {
        margin-bottom: 0;
    }
    
    .sparkles-step-connector {
        height: 1rem;
        margin-top: .5rem;
        margin-bottom: .5rem;
        margin-left: .125rem;
        margin-right: .125rem;
}
    
    .sparkles-step-content {
        margin-left: 1rem;
        margin-top: -2rem;
        padding-top: .5rem;
    }
}

@container (max-width: 768px) {
    .sparkles-progress-circular {
        width: 60px;
        height: 60px;
    }

    .sparkles-progress-circular-lg {
        width: 5rem;
        height: 5rem;
    }
}

/* ========== ACCESSIBILITY ========== */
@media (prefers-reduced-motion: reduce) {
    .sparkles-progress-bar,
    .sparkles-step-indicator,
    .sparkles-progress-ring-progress {
        transition-property: none;
    }
    
    .sparkles-progress-bar-animated,
    .sparkles-progress-pulse,
    .sparkles-progress-indeterminate,
    .sparkles-loading-bars {
        animation: none;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .sparkles-progress {
        border-width: 1px;
        border-style: solid;
    }
    
    .sparkles-step-indicator {
        border-width: 3px;
    }
}

/* ========== PRINT STYLES ========== */
@media print {
    .sparkles-progress-bar-animated,
    .sparkles-progress-pulse,
    .sparkles-loading-bars {
        animation: none;
    }
    
}
