/**
 * Upload Components — Componentes globais de UI para upload de arquivos
 * Extraído do módulo de Galerias para uso compartilhado (DRY).
 * Usado por: Galerias, Mídia, MediaSelector
 */

/* ═══════ UPLOAD PROGRESS PANEL (flutuante, fixed bottom-right) ═══════ */
.cfs-upload-panel {
    position: fixed;
    bottom: 20px; right: 20px;
    width: 360px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,.25);
    z-index: 1050;
    overflow: hidden;
    transition: width .25s;
}
.cfs-upload-panel__header {
    border-bottom: 1px solid var(--border);
}
.cfs-upload-panel__info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    gap: 8px;
}
.cfs-upload-panel__stats {
    font-size: .7rem;
    color: var(--text-muted);
    line-height: 1.2;
}
.cfs-upload-panel__btn {
    background: none; border: none; cursor: pointer;
    color: var(--text-muted); padding: 4px;
    border-radius: 4px; display: flex;
    align-items: center; justify-content: center;
    transition: background .15s, color .15s;
    font-size: .85rem;
}
.cfs-upload-panel__btn:hover {
    background: rgba(128,128,128,.15);
    color: var(--text);
}
.cfs-upload-panel__progress {
    height: 3px;
    background: rgba(128,128,128,.15);
}
.cfs-upload-panel__progress-bar {
    height: 100%;
    width: 0%;
    background: var(--primary);
    transition: width .3s;
    border-radius: 0 3px 3px 0;
}
.cfs-upload-panel__body {
    max-height: 300px;
    overflow-y: auto;
    transition: max-height .3s ease;
}

/* Estados do painel */
.cfs-upload-panel.minimized .cfs-upload-panel__body {
    max-height: 0;
    overflow: hidden;
}
.cfs-upload-panel.minimized .cfs-upload-panel__header {
    border-bottom: none;
}
.cfs-upload-panel.completed .cfs-upload-panel__progress-bar {
    background: #10b981;
}

/* Item individual na lista de progresso */
.cfs-upload-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 14px;
    font-size: .8rem;
    color: var(--text);
}
.cfs-upload-item__name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cfs-upload-item__size {
    font-size: .7rem;
    color: var(--text-muted);
    margin-left: auto;
    margin-right: 8px;
    flex-shrink: 0;
}
.cfs-upload-item__status {
    margin-left: 8px;
    flex-shrink: 0;
}
.cfs-spinner-sm {
    width: 14px;
    height: 14px;
}
.cfs-item-note {
    font-size: 11px;
    line-height: 1.2;
    margin-top: 2px;
}
.cfs-item-note--error {
    word-break: break-word;
}

/* ═══════ DRAG OVERLAY (feedback visual ao arrastar sobre área) ═══════ */
.cfs-drag-overlay {
    position: absolute;
    inset: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--primary) 8%, var(--panel));
    border: 2px dashed var(--primary);
    border-radius: 8px;
    z-index: 20;
    color: var(--primary);
    pointer-events: none;
}
.cfs-drag-overlay i {
    font-size: 3rem;
    margin-bottom: .5rem;
    opacity: .6;
}
.cfs-drag-overlay p {
    font-size: 1rem;
    margin: 0;
    font-weight: 500;
}

/* ═══════ ANIMACOES (Skeleton/Placeholder, Erro, Fade-in) ═══════ */
@keyframes cfsPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}
@keyframes cfsShake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}
@keyframes cfsFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Placeholder pulsante (skeleton) */
.cfs-upload-placeholder {
    animation: cfsPulse 1.5s ease-in-out infinite;
}

/* Estado de erro (shake + opacidade) */
.cfs-upload-error {
    animation: cfsShake 0.5s ease;
    opacity: 0.5;
}

/* Fade-in generico */
.cfs-fade-in {
    animation: cfsFadeIn .2s ease;
}
