/* ============================================================
 * 全站通用上传面板样式（配合 main_page/js/upload-manager.js）
 *
 * 节点由 UploadManager 动态创建：右下角一块面板，每个文件一行，
 * 行内有进度条、百分比、取消按钮，整批结束后切成「完成」动画再自动收起。
 *
 * 位置：右下角，抬高到凡凡悬浮球（bottom:24px + 60px）之上，避免互相遮挡。
 * 配色全部走主题变量，浅色/深色模式自动适配（theme.css 提供变量覆盖）。
 * ============================================================ */
.up-panel {
    position: fixed;
    right: 20px;
    bottom: 96px;
    z-index: 12000;
    width: 340px;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 140px);
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg, 16px);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: upPanelIn 0.25s ease;
    transition: opacity 0.3s ease, transform 0.3s ease;
}
@keyframes upPanelIn {
    from { opacity: 0; transform: translateY(14px) scale(0.97); }
    to   { opacity: 1; transform: none; }
}
/* 收起态：下滑淡出，随后由 JS 移除节点 */
.up-panel.up-hide {
    opacity: 0;
    transform: translateY(14px) scale(0.97);
    pointer-events: none;
}

/* 头部 */
.up-head {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
}
.up-title {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}
.up-ok-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.up-cancel-all {
    flex-shrink: 0;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.78rem;
    padding: 3px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s;
}
.up-cancel-all:hover { color: var(--danger); background: rgba(231, 76, 60, 0.1); }

/* 提示条：有「已中断」任务时说明怎么续传（刷新 / 切页后恢复的面板会出现） */
.up-note {
    flex-shrink: 0;
    padding: 7px 12px;
    border-bottom: 1px solid var(--border);
    background: rgba(243, 156, 18, 0.10);
    color: var(--text-secondary);
    font-size: 0.7rem;
    line-height: 1.5;
}

/* 列表 */
.up-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 11px;
}
.up-item { display: flex; flex-direction: column; gap: 5px; }
.up-item-top { display: flex; align-items: center; gap: 8px; }
.up-name {
    flex: 1;
    min-width: 0;
    font-size: 0.8rem;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.up-size { flex-shrink: 0; font-size: 0.72rem; color: var(--text-secondary); }
.up-item-cancel {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.68rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s;
}
.up-item-cancel:hover { background: rgba(231, 76, 60, 0.12); color: var(--danger); }
/* 「继续」按钮：仅「已中断」的任务显示（刷新/切页后从断点续传） */
.up-item-resume {
    flex-shrink: 0;
    display: none;
    padding: 2px 8px;
    border: 1px solid var(--primary);
    border-radius: 999px;
    background: transparent;
    color: var(--primary);
    font-family: inherit;
    font-size: 0.7rem;
    line-height: 1.4;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s;
}
.up-item-resume:hover { background: var(--primary); color: #fff; }
.up-item-check {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: none;
    align-items: center;
    justify-content: center;
    color: var(--success);
    font-size: 0.72rem;
}
.up-bar {
    height: 4px;
    border-radius: 2px;
    background: var(--border);
    overflow: hidden;
}
.up-bar-fill {
    height: 100%;
    width: 0;
    border-radius: 2px;
    background: var(--primary);
    transition: width 0.15s linear;
}
.up-item-status {
    font-size: 0.72rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 单项状态 */
.up-state-uploading .up-item-status { color: var(--primary); }
.up-state-success .up-item-cancel { display: none; }
.up-state-success .up-item-check {
    display: flex;
    animation: upPop 0.35s cubic-bezier(0.2, 1.5, 0.45, 1);
}
.up-state-success .up-bar-fill { background: var(--success); }
.up-state-success .up-item-status { color: var(--success); }
.up-state-error .up-item-cancel { display: none; }
.up-state-error .up-bar-fill { background: var(--danger); }
.up-state-error .up-item-status { color: var(--danger); }
.up-state-error .up-name { color: var(--danger); }
.up-state-canceled .up-item-cancel { display: none; }
.up-state-canceled .up-name { opacity: 0.5; text-decoration: line-through; }
/* 已中断（刷新 / 切页打断）：琥珀色提示，带「继续」按钮（由 JS 控制显示） */
.up-state-interrupted .up-bar-fill { background: #F39C12; }
.up-state-interrupted .up-item-status { color: #F39C12; }

/* 整批完成：勾选图标弹出 + 面板描边高亮，停留几秒后 JS 收起 */
.up-ok-ico {
    flex-shrink: 0;
    width: 17px;
    height: 17px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--success);
    color: #fff;
    font-size: 0.58rem;
    animation: upPop 0.45s cubic-bezier(0.2, 1.5, 0.45, 1);
}
.up-ok-ico.warn { background: var(--warning); }
@keyframes upPop {
    0%   { transform: scale(0.2); opacity: 0; }
    60%  { transform: scale(1.18); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}
.up-panel.up-done-ok {
    border-color: var(--success);
    box-shadow: 0 8px 32px rgba(39, 174, 96, 0.28);
}
.up-panel.up-done-warn {
    border-color: var(--warning);
    box-shadow: 0 8px 32px rgba(243, 156, 18, 0.28);
}

/* 移动端：贴左右边、抬高避开凡凡悬浮球 */
@media (max-width: 768px) {
    .up-panel {
        right: 10px;
        left: 10px;
        width: auto;
        bottom: 80px;
    }
    .up-list { max-height: 40vh; }
}

/* 系统「减少动画效果」时不做进出场动画 */
@media (prefers-reduced-motion: reduce) {
    .up-panel,
    .up-ok-ico,
    .up-item-check { animation: none !important; }
    .up-bar-fill { transition: none; }
}
