/* ==========================================================================
   Variables
   ========================================================================== */

@keyframes ts-progress-active {
    from {
        opacity: 0.8;
        width: 0%;
    }
    to {
        opacity: 0;
        width: 100%;
    }
}

@keyframes ts-progress-animation {
    from {
        background-position: 0px;
    }
    to {
        background-position: 40px;
    }
}

@keyframes ts-progress-indeterminate {
    0% {
        inset-inline-start: -40%;
    }
    100% {
        inset-inline-start: 100%;
    }
}

.ts-progress {
    --accent-color: initial;
    --accent-foreground-color: initial;
}

.ts-progress .bar {
    --value: 0;
}

/* ==========================================================================
   Base
   ========================================================================== */

.ts-progress {
    position: relative;
    display: flex;
    border-radius: var(--ts-border-radius-element);
    background: var(--ts-gray-300);
    overflow: hidden;
    min-height: 1.2rem;
    line-height: 1;
}

.ts-progress .bar {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    background: var(--accent-color, var(--ts-gray-800));
    color: var(--accent-foreground-color, var(--ts-gray-50));
    padding: 0rem 0.5rem;
    font-size: var(--ts-font-size-12px);
    min-width: fit-content;
    text-align: right;
    transition: width 1s ease-out;
    width: calc(var(--value) * 1%);
    z-index: 1;
}

/* ==========================================================================
   Variations
   ========================================================================== */

/**
 * Active
 */

.ts-progress.is-active .bar::after {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    content: "";
    background: var(--ts-gray-300);
    animation: ts-progress-active 2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

/**
 * Empty
 */

.ts-progress.is-empty .bar {
    background: transparent;
    color: var(--ts-gray-800);
}

/**
 * Processing
 */

.ts-progress.is-processing {
    background-size: 40px 40px;
    background-image: linear-gradient(135deg, #9e9e9e 25%, #949494 25%, #949494 50%, #9e9e9e 50%, #9e9e9e 75%, #949494 75%, #949494 100%);
    animation: ts-progress-animation 2s linear 0s infinite;
}

/**
 * Indeterminate
 */

.ts-progress.is-indeterminate .bar {
    animation: ts-progress-indeterminate 1s ease infinite normal none running;
    width: 40% !important;
    min-width: 0;
}

.ts-progress.is-indeterminate .bar .text {
    visibility: hidden;
}

/**
 * Secondary
 */

.ts-progress .bar.is-secondary {
    position: absolute;
    top: 0;
    bottom: 0;
    z-index: 0;
    background: var(--ts-gray-400);
    color: var(--ts-gray-800);
}

/**
 * Sizes
 */

.ts-progress.is-small {
    min-height: 0.7rem;
}

.ts-progress.is-small .bar .text {
    font-size: var(--ts-font-size-12px);
}

.ts-progress.is-large {
    min-height: 1.6rem;
}

.ts-progress.is-large .bar .text {
    font-size: var(--ts-font-size-13px);
}
