﻿/* file-upload.css - .file-attach: drop zone, file list, progress bar, paperclip animation */

/* File Attachment Styles */
.file-attach {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-top: 0.3rem;
    width: 100%;
}

.file-attach__controls {
    width: 100%;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 0.7rem;
    align-items: stretch;
}

.file-attach__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 0.35rem;
    width: 100%;
    padding: 0.5rem;
    background: transparent;
    border: none;
    border-radius: 0.8rem;
    color: #5a3d2a;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.3;
    text-align: center;
}

.file-attach__btn:not(.file-attach__btn--camera) .file-attach__title,
.file-attach__btn:not(.file-attach__btn--camera) .file-attach__icon,
.file-attach__btn:not(.file-attach__btn--camera) .file-attach__icon-svg,
.file-attach__btn:not(.file-attach__btn--camera):hover .file-attach__title,
.file-attach__btn:not(.file-attach__btn--camera):hover .file-attach__icon,
.file-attach__btn:not(.file-attach__btn--camera):hover .file-attach__icon-svg,
.file-attach__btn:not(.file-attach__btn--camera):focus-visible .file-attach__title,
.file-attach__btn:not(.file-attach__btn--camera):focus-visible .file-attach__icon,
.file-attach__btn:not(.file-attach__btn--camera):focus-visible .file-attach__icon-svg {
    color: #5a3d2a !important;
    stroke: #5a3d2a !important;
}

.file-attach__btn:not(.file-attach__btn--camera):hover,
.file-attach__btn:not(.file-attach__btn--camera):focus-visible {
    background: rgba(90, 61, 42, 0.05) !important;
    color: #5a3d2a !important;
}

.file-attach__btn--camera {
    border: none;
    background: transparent;
    color: #5a3d2a;
    width: 5.25rem;
    min-width: 5.25rem;
    height: 5.25rem;
    min-height: 5.25rem;
    padding: 0.5rem;
    gap: 0.2rem;
    flex-direction: column;
}

.file-attach__btn--camera .file-attach__title {
    font-size: 0;
    letter-spacing: 0;
    text-transform: none;
    gap: 0;
    margin: 0;
    line-height: 1;
}

.file-attach__btn--camera .file-attach__icon {
    font-size: 2rem;
}

.file-attach__btn--camera .file-attach__icon-svg,
.file-attach__icon-svg--camera {
    width: 1.85em !important;
    height: 1.85em !important;
    animation: none !important;
}

.file-attach__btn--camera .file-attach__icon-svg,
.file-attach__btn--camera .file-attach__icon-svg--camera {
    color: #5a3d2a !important;
    stroke: #5a3d2a !important;
}

.file-attach__btn--camera:hover .file-attach__icon-svg,
.file-attach__btn--camera:hover .file-attach__icon-svg--camera,
.file-attach__btn--camera:focus-visible .file-attach__icon-svg,
.file-attach__btn--camera:focus-visible .file-attach__icon-svg--camera {
    color: #5a3d2a !important;
    stroke: #5a3d2a !important;
}

.file-attach__btn--camera:hover,
.file-attach__btn--camera:focus-visible {
    background: rgba(90, 61, 42, 0.05) !important;
    border-color: transparent !important;
    color: #5a3d2a !important;
}

.file-attach__btn:hover,
.file-attach__btn:focus-visible {
    background: rgba(90, 61, 42, 0.05);
    border-color: transparent;
    color: #5a3d2a;
    box-shadow: none;
}



.file-attach__drop-zone-file--drag-over {
    background: #ffffff !important;
    border-color: #5a3d2a !important;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.55), 0 6px 20px rgba(255, 255, 255, 0.22) !important;
}

.file-attach.file-attach--drag-over .file-attach__drop-zone-file {
    background: #ffffff !important;
    border-color: #5a3d2a !important;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.55), 0 6px 20px rgba(255, 255, 255, 0.22) !important;
}

.file-attach__drop-zone-file--drag-over .file-attach__btn {
    background: rgba(90, 61, 42, 0.05) !important;
    border-color: transparent !important;
    color: #5a3d2a !important;
    box-shadow: none !important;
}

.file-attach.file-attach--drag-over .file-attach__drop-zone-file .file-attach__btn {
    background: rgba(90, 61, 42, 0.05) !important;
    border-color: transparent !important;
    color: #5a3d2a !important;
    box-shadow: none !important;
}

.file-attach__drop-zone-file--drag-over .file-attach__title,
.file-attach__drop-zone-file--drag-over .file-attach__icon,
.file-attach__drop-zone-file--drag-over .file-attach__icon-svg,
.file-attach__drop-zone-file--drag-over p {
    color: #5a3d2a !important;
    stroke: #5a3d2a !important;
}

.file-attach.file-attach--drag-over .file-attach__drop-zone-file .file-attach__title,
.file-attach.file-attach--drag-over .file-attach__drop-zone-file .file-attach__icon,
.file-attach.file-attach--drag-over .file-attach__drop-zone-file .file-attach__icon-svg,
.file-attach.file-attach--drag-over .file-attach__drop-zone-file p {
    color: #5a3d2a !important;
    stroke: #5a3d2a !important;
}

.file-attach__title {
    font-size: 1.02rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: none;
    line-height: 1.15;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

/* Paperclip Attention Animation */
@keyframes paperclipAttention {

    0%,
    90%,
    100% {
        transform: rotate(0deg) scale(1);
    }

    92% {
        transform: rotate(5deg) scale(1.05);
    }

    94% {
        transform: rotate(-5deg) scale(1.05);
    }

    96% {
        transform: rotate(5deg) scale(1.05);
    }

    98% {
        transform: rotate(-2deg) scale(1.02);
    }
}

.file-attach__icon-svg {
    display: inline-block;
    transform-origin: center center;
    animation: paperclipAttention 8s infinite ease-in-out;
    width: 1.1em !important;
    height: 1.1em !important;
}

.file-attach__icon-svg--paperclip {
    width: 1.42em !important;
    height: 1.42em !important;
    animation: none !important;
}

.file-attach__icon {
    font-size: 1rem;
    line-height: 1;
    display: flex;
}

.file-attach__terms {
    margin-top: 0.1rem;
    margin-bottom: 0.3rem;
}

.file-attach__list {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.file-attach__list:empty {
    display: none;
}

.file-attach__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.7rem;
    padding: 0.6rem 0.9rem 0.88rem;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 0.5rem;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.9);
    position: relative;
    overflow: hidden;
    text-align: left;
}

.file-attach__summary {
    display: grid;
    grid-template-columns: 0.92rem minmax(0, 1fr);
    align-items: center;
    align-content: center;
    justify-content: start;
    justify-items: start;
    column-gap: 0.52rem;
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
    padding-right: 0.7rem;
    text-align: left;
}

.file-attach__name {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: none;
    justify-self: start;
    align-self: center;
    margin: 0;
    text-align: left;
    line-height: 1.25;
}

.file-attach__check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 0.92rem;
    height: 0.92rem;
    flex: 0 0 0.92rem;
    position: relative;
    align-self: center;
    justify-self: start;
    color: #a8ef72;
    opacity: 0;
    transform: scale(0.84);
    filter: drop-shadow(0 0 0 rgba(168, 239, 114, 0));
    transition: opacity 0.24s ease, transform 0.24s ease, filter 0.26s ease;
}

.file-attach__check::before {
    content: "";
    display: block;
    width: 0.34rem;
    height: 0.64rem;
    border-right: 0.11rem solid currentColor;
    border-bottom: 0.11rem solid currentColor;
    transform: rotate(45deg) translate(-4%, -6%);
    transform-origin: center;
    box-sizing: border-box;
}

.file-attach__item[data-upload-visual-complete="true"] .file-attach__check,
.file-attach__item[data-temp-synced="true"] .file-attach__check {
    opacity: 1;
    transform: scale(1);
    filter: drop-shadow(0 0 0.45rem rgba(168, 239, 114, 0.38));
}

.file-attach__item[data-upload-sync-state="failed"] .file-attach__check {
    color: #ff7070;
    opacity: 1;
    transform: scale(1);
    filter: drop-shadow(0 0 0.38rem rgba(255, 112, 112, 0.4));
    cursor: help;
}

.file-attach__item[data-upload-sync-state="failed"] .file-attach__check::before {
    width: 0.74rem;
    height: 0.74rem;
    border: 0.09rem solid currentColor;
    border-radius: 50%;
    transform: none;
    background: linear-gradient(-45deg,
            transparent calc(50% - 0.045rem),
            currentColor calc(50% - 0.045rem),
            currentColor calc(50% + 0.045rem),
            transparent calc(50% + 0.045rem));
}

.file-attach__item[data-upload-visual-bounce="true"] {
    animation: fileAttachItemHop 0.72s cubic-bezier(0.22, 1, 0.36, 1);
}

.file-attach__item[data-upload-visual-bounce="true"] .file-attach__check {
    animation: fileAttachCheckPop 0.58s cubic-bezier(0.2, 0.9, 0.2, 1);
}

@keyframes fileAttachItemHop {
    0% {
        transform: translateY(0);
    }

    28% {
        transform: translateY(-0.28rem);
    }

    58% {
        transform: translateY(0.06rem);
    }

    100% {
        transform: translateY(0);
    }
}

@keyframes fileAttachCheckPop {
    0% {
        opacity: 0;
        transform: translateY(0.16rem) scale(0.56);
        filter: drop-shadow(0 0 0 rgba(168, 239, 114, 0));
    }

    56% {
        opacity: 1;
        transform: translateY(-0.12rem) scale(1.22);
        filter: drop-shadow(0 0 0.72rem rgba(168, 239, 114, 0.5));
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: drop-shadow(0 0 0.45rem rgba(168, 239, 114, 0.38));
    }
}

.file-attach__remove {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0 0.3rem;
    transition: color 0.3s;
}

.file-attach__remove:hover {
    color: #ff6b6b;
}

.file-attach__progress {
    --file-progress-scale: 0;
    --file-progress-opacity: 0;
    --file-progress-transition-ms: 320ms;
    --file-progress-sheen-duration-ms: 1350ms;
    --file-progress-sheen-delay-ms: 0ms;
    --file-progress-complete-duration-ms: 320ms;
    --file-progress-complete-from: 0.84;
    position: absolute;
    left: 0.9rem;
    right: 0.9rem;
    bottom: 0.34rem;
    height: 0.22rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    overflow: hidden;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.24s ease, background-color 0.28s ease;
}

.file-attach__progress[data-progress-state="loading"],
.file-attach__progress[data-progress-state="complete"] {
    opacity: 1;
}

.file-attach__progress::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(90deg,
            rgba(255, 255, 255, 0.36) 0%,
            rgba(255, 255, 255, 0.9) 24%,
            rgba(255, 255, 255, 1) 52%,
            rgba(255, 255, 255, 0.92) 74%,
            rgba(255, 255, 255, 0.44) 100%);
    background-size: 200% 100%;
    background-position: 0% 50%;
    box-shadow: 0 0 0.55rem rgba(255, 255, 255, 0.24);
    opacity: var(--file-progress-opacity);
    transform: scaleX(var(--file-progress-scale));
    transform-origin: left center;
    transition:
        transform var(--file-progress-transition-ms) cubic-bezier(0.22, 1, 0.36, 1),
        opacity 0.26s ease;
    will-change: transform, opacity, background-position;
}

.file-attach__progress[data-progress-state="loading"]::before {
    animation-name: fileAttachProgressSheen;
    animation-duration: var(--file-progress-sheen-duration-ms);
    animation-timing-function: linear;
    animation-iteration-count: infinite;
    animation-delay: var(--file-progress-sheen-delay-ms);
}

.file-attach__progress[data-progress-state="complete"] {
    background: rgba(132, 104, 82, 0.18);
}

.file-attach__progress[data-progress-state="complete"]::before {
    background-position: 100% 50%;
    animation-name: fileAttachProgressComplete;
    animation-duration: var(--file-progress-complete-duration-ms);
    animation-timing-function: cubic-bezier(0.2, 0.9, 0.2, 1);
    animation-fill-mode: forwards;
}

@keyframes fileAttachProgressSheen {
    from {
        background-position: 0% 50%;
    }

    to {
        background-position: 200% 50%;
    }
}

@keyframes fileAttachProgressComplete {
    0% {
        opacity: 0.9;
        transform: scaleX(var(--file-progress-complete-from));
        filter: brightness(1);
    }

    68% {
        opacity: 1;
        transform: scaleX(1);
        filter: brightness(1.08);
    }

    100% {
        opacity: 0;
        transform: scaleX(1);
        filter: brightness(1.14);
    }
}

@media (prefers-reduced-motion: reduce) {
    .file-attach__item[data-upload-visual-bounce="true"],
    .file-attach__item[data-upload-visual-bounce="true"] .file-attach__check {
        animation: none;
    }

    .file-attach__progress[data-progress-state="loading"]::before {
        animation: none;
    }

    .file-attach__progress[data-progress-state="complete"]::before {
        animation-duration: 0.24s;
    }
}

