/* ==========================================
   动作替换页面样式
   ========================================== */

/* 占位容器在 main-wrapper 之外，需建立独立层叠上下文，避免被主内容区盖住 */
#motionReplaceContent {
    position: relative;
    z-index: 100;
}

.motion-replace-content {
    width: 100vw;
    height: calc(100vh - 60px);
    overflow-y: auto;
    background: transparent; /* 设置为透明 */
    padding: 0;
    margin-top: 60px;
    margin-left: 0;
}

.motion-replace-container {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    min-height: calc(100vh - 120px);
    position: fixed;
    left: calc(var(--sidebar-width) + var(--quick-create-width) + 10px);
    top: 90px;
    right: 20px;
    bottom: 30px;
    overflow-y: auto;
}

.motion-replace-container:hover {
    border-color: rgba(74, 222, 128, 0.3);
    box-shadow: 0 4px 20px rgba(74, 222, 128, 0.1);
}

/* 右侧作品区域 - 已移除，样式合并到 motion-replace-container */

/* 左侧上传区域 - 固定侧边栏 */
.motion-upload-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 30px 20px;
    width: var(--quick-create-width);
    height: calc(100vh - 60px);
    background: var(--sidebar-bg-light);
    border-right: 1px solid var(--border-color);
    position: fixed;
    left: var(--sidebar-width);
    top: 60px;
    z-index: 10;
    overflow-y: auto;
}

.upload-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.upload-card:hover {
    border-color: rgba(74, 222, 128, 0.3);
    box-shadow: 0 4px 20px rgba(74, 222, 128, 0.1);
}

.upload-title {
    font-size: 14px; /* 调整字体大小 */
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.upload-title i {
    color: var(--primary-color);
}

.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: rgba(74, 222, 128, 0.05);
}

.upload-icon {
    font-size: 48px;
    color: #6c757d;
    margin-bottom: 10px;
}

.upload-text {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
    margin: 0;
}

.upload-hint {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 0;
}

.motion-replace-content .video-preview {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
    border: 1px solid var(--border-color);
    height: 250px;
}

.motion-replace-content .video-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.motion-replace-content .video-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
    border-radius: 12px;
    margin: auto;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.motion-replace-content #motionSourceImage {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
    border-radius: 12px;
}

.remove-video-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    color: white;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.remove-video-btn:hover {
    background: var(--danger-color);
    transform: scale(1.1);
}

/* 替换选项 */
.motion-options {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.motion-options:hover {
    border-color: rgba(74, 222, 128, 0.3);
    box-shadow: 0 4px 20px rgba(74, 222, 128, 0.1);
}

.options-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.options-title i {
    color: var(--primary-color);
}

.option-item {
    margin-bottom: 16px;
}

.option-item:last-child {
    margin-bottom: 0;
}

.option-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    user-select: none;
}

.option-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.option-item label:not(.option-label) {
    display: block;
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-weight: 500;
}

.quality-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
}

.quality-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.1);
}

/* 提交按钮 */
.motion-submit-btn {
    width: 100%;
    padding: 16px;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 14px; /* 调整字体大小 */
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(74, 222, 128, 0.3);
}

.motion-submit-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 222, 128, 0.5);
}

.motion-submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title i {
    color: var(--primary-color);
}

/* 作品区标题 + 右上角分页 */
.motion-works-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px 20px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.motion-works-header .section-title {
    margin-bottom: 0;
    flex: 1;
    min-width: 0;
}

.motion-works-header .motion-pagination {
    margin-top: 0;
    padding-top: 0;
    flex-shrink: 0;
}

.motion-works-grid {
    --motion-work-card-min-width: 188px;
    display: grid;
    /* auto-fill 保留空列轨道，避免作品数量少时 auto-fit 折叠列导致单卡被拉满整行（视频背景/动作替换等页面一致） */
    grid-template-columns: repeat(auto-fill, minmax(var(--motion-work-card-min-width), 1fr));
    gap: 20px;
    justify-content: start;
    flex: 1;
    overflow-y: auto;
    max-height: calc(100vh - 200px);
    padding: 10px 10px 10px 0;
    margin: -10px 0;
}

.motion-works-grid::-webkit-scrollbar {
    width: 8px;
}

.motion-works-grid::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

.motion-works-grid::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

.motion-works-grid::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* 空状态 */
.empty-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.3;
    color: var(--text-secondary);
}

.empty-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-desc {
    font-size: 14px;
    color: var(--text-secondary);
    opacity: 0.7;
}

/* 作品卡片 */
.motion-work-card {
    background: var(--card-bg-hover);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    position: relative;
    height: 220px;
}

.motion-work-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(74, 222, 128, 0.2);
    border-color: rgba(74, 222, 128, 0.3);
}

/* 全屏视频容器 */
.work-video-full {
    width: 100%;
    height: 100%;
    background: #000;
    position: relative;
}

.work-video-full .video-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* 播放按钮覆盖层 */
.play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background-color: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 5;
    opacity: 0;
    transition: all 0.3s ease;
    border: 2px solid rgba(255, 255, 255, 0.8);
}

.motion-work-card:hover .play-overlay {
    opacity: 1;
}

.play-overlay:hover {
    background-color: rgba(0, 0, 0, 0.9);
    transform: translate(-50%, -50%) scale(1.1);
    border-color: #4ade80;
}

.play-icon {
    font-size: 24px;
    color: white;
    margin-left: 3px;
}

/* 视频时间显示 */
.motion-work-card .video-time {
    position: absolute !important;
    top: 8px !important;
    left: 8px !important;
    background: none !important;
    color: white !important;
    font-size: 11px !important;
    z-index: 3 !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8), 0 0 5px rgba(0, 0, 0, 0.5) !important;
    font-weight: 500 !important;
    padding: 0 !important;
    border-radius: 0 !important;
    backdrop-filter: none !important;
}

/* 处理中和失败状态的覆盖层 */
.processing-overlay,
.failed-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.8);
    gap: 12px;
}

.processing-icon {
    font-size: 48px;
    color: var(--primary-color);
}

.processing-text {
    font-size: 16px;
    color: var(--text-primary);
}

.failed-icon {
    font-size: 48px;
    color: var(--danger-color);
}

.failed-text {
    font-size: 16px;
    color: var(--danger-color);
    font-weight: 600;
}

.failed-reason {
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
    padding: 0 20px;
}

/* 旧样式保留用于兼容 */
.work-video {
    width: 100%;
    height: 180px;
    background: #000;
}

.work-video video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.work-info {
    padding: 12px;
}

.work-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 12px;
    color: var(--text-secondary);
}

.work-quality {
    display: flex;
    align-items: center;
    gap: 6px;
}

.work-actions {
    display: flex;
    gap: 8px;
}

.work-action-btn {
    flex: 1;
    padding: 8px;
    border: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-secondary);
    font-size: 14px;
}

.work-action-btn:hover {
    background: rgba(74, 222, 128, 0.1);
    border-color: var(--primary-color);
}

.download-btn:hover {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.delete-btn:hover {
    color: var(--danger-color);
    border-color: var(--danger-color);
    background: rgba(248, 81, 73, 0.1);
}

/* 分页 */
.motion-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 20px;
    padding-top: 20px;
}

.pagination-btn {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-primary);
    font-size: 14px;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 0 10px rgba(74, 222, 128, 0.3);
}

.pagination-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.pagination-info {
    font-size: 14px;
    color: var(--text-secondary);
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .motion-replace-container {
        grid-template-columns: 1fr;
    }
    
    .motion-works-grid {
        max-height: 500px;
    }
}

@media (max-width: 768px) {
    .motion-replace-content {
        padding: 15px;
    }
    
    .motion-works-grid {
        grid-template-columns: 1fr;
    }
    
    .upload-card,
    .motion-options {
        padding: 16px;
    }
}

