/*noinspection CssUnusedSymbol*/

/* ==========================================================================
   Download Progress Component
   A fixed-position progress indicator for file downloads.
   Scoped selectors override bare progress[value] rules from file-input.css.
   ========================================================================== */

/* ---- Entrance animation ---- */

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes indeterminateProgress {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* ---- Container ---- */

/*noinspection CssUnusedSymbol*/
.download-progress-container {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    z-index: 1100;
    min-width: 16rem;
    padding: 0.75rem 1rem;
    background: var(--darkest0);
    border: 1px solid var(--primary10);
    border-radius: 0.25em;
    box-shadow: 3px 3px 15px 0 rgba(0, 0, 0, 0.4);
    animation: slideInRight 0.3s ease-out;
}

/* ---- Content layout ---- */

/*noinspection CssUnusedSymbol*/
.download-progress-content {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

/*noinspection CssUnusedSymbol*/
.download-progress-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
}

/*noinspection CssUnusedSymbol*/
.download-progress-message {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--greyscale100);
}

/*noinspection CssUnusedSymbol*/
.download-progress-percentage {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--tertiary10);
    min-width: 2.75rem;
    text-align: right;
}

/* ---- Progress bar (scoped to override file-input.css bare selectors) ---- */

.download-progress-container progress {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border: none;
    width: 100%;
    height: 0.5rem;
    border-radius: 0.25rem;
    overflow: hidden;
    display: block;
}

.download-progress-container progress[value] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border: none;
    width: 100%;
    height: 0.5rem;
    border-radius: 0.25rem;
}

.download-progress-container progress[value]::-webkit-progress-bar {
    background-color: var(--primary10);
    border-radius: 0.25rem;
    box-shadow: none;
}

.download-progress-container progress[value]::-webkit-progress-value {
    background-color: var(--tertiary10);
    background-image: none;
    border-radius: 0.25rem;
    background-size: auto;
    transition: width 0.2s ease-in-out;
    -webkit-animation: none;
    animation: none;
}

.download-progress-container progress[value]::-moz-progress-bar {
    background-color: var(--tertiary10);
    background-image: none;
    border-radius: 0.25rem;
    background-size: auto;
}

/* ---- Indeterminate state ---- */

/*noinspection CssUnusedSymbol*/
.download-progress-container progress:indeterminate {
    background-color: var(--primary10);
    background-image: linear-gradient(
        90deg,
        var(--primary10) 0%,
        var(--primary50) 50%,
        var(--primary10) 100%
    );
    background-size: 200% 100%;
    animation: indeterminateProgress 1.5s ease-in-out infinite;
}

.download-progress-container progress:indeterminate::-webkit-progress-bar {
    background-color: transparent;
    box-shadow: none;
}

.download-progress-container progress:indeterminate::-webkit-progress-value {
    background-color: transparent;
    background-image: none;
    -webkit-animation: none;
    animation: none;
}

.download-progress-container progress:indeterminate::-moz-progress-bar {
    background-color: transparent;
    background-image: none;
}

/* ---- Success / complete state ---- */

/*noinspection CssUnusedSymbol*/
.download-progress-complete progress[value]::-webkit-progress-value {
    background-color: var(--tertiary10);
    background-image: none;
}

/*noinspection CssUnusedSymbol*/
.download-progress-complete progress[value]::-moz-progress-bar {
    background-color: var(--tertiary10);
    background-image: none;
}

/* ---- Accessibility: reduced motion ---- */

@media (prefers-reduced-motion: reduce) {
    .download-progress-container {
        animation: none;
    }

    .download-progress-container progress:indeterminate {
        animation: none;
    }

    .download-progress-container progress[value]::-webkit-progress-value {
        transition: none;
        -webkit-animation: none;
        animation: none;
    }
}

/* ---- Accessibility: high contrast ---- */

@media (prefers-contrast: high) {
    .download-progress-container {
        border-width: 2px;
        border-color: var(--greyscale10);
    }

    .download-progress-container progress,
    .download-progress-container progress[value] {
        border: 1px solid var(--greyscale10);
    }
}
