﻿/* ========== 视频列表版块样式 ========== */
.video-grid-section {
    margin-top: 24px;
}

.video-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 32px;
    width: 100%;
}

.video-card {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    background: #f5f5f5;
    aspect-ratio: 240 / 427;
}

.video-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}

.video-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* 播放按钮 */
.video-card-play-btn {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 50px; height: 50px;
    border-radius: 50%;
    border: 3px solid #fff;
    background: rgba(0,0,0,0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 2;
    transition: opacity 0.2s;
}
.video-card.is-playing .video-card-play-btn {
    opacity: 0;
}
.video-card-play-btn::after {
    content: '';
    width: 0; height: 0;
    border-left: 15px solid #fff;
    border-top: 9px solid transparent;
    border-bottom: 9px solid transparent;
    margin-left: 3px;
}

.video-card-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s ease;
    z-index: 3;
}

.video-card:hover .video-card-overlay {
    opacity: 1;
}

.video-card-overlay .make-same-btn {
    padding: 10px 24px;
    background: #fff;
    color: #333;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    pointer-events: auto;
}

.video-card-overlay .make-same-btn:hover {
    background: #7c5cfc;
    color: #fff;
}

/* ========== 视频预览弹层 ========== */
.video-preview-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: vpFadeIn 0.25s ease;
}
@keyframes vpFadeIn { from { opacity: 0; } to { opacity: 1; } }

.video-preview-popup {
    background: #fff;
    border-radius: 16px;
    width: 90vw;
    max-width: 1100px;
    height: 620px;
    max-height: 90vh;
    display: flex;
    overflow: hidden;
    box-shadow: 0 24px 80px rgba(0,0,0,0.3);
    animation: vpSlideUp 0.3s ease;
}
@keyframes vpSlideUp { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.vp-close {
    position: absolute;
    top: 16px; right: 20px;
    width: 36px; height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.9);
    font-size: 22px;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    transition: all 0.2s;
}
.vp-close:hover { background: #fff; color: #333; }

.vp-left {
    aspect-ratio: 720 / 1080;
    max-width: 55%;
    height: 100%;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.vp-left video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.vp-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 28px 28px 24px;
    gap: 20px;
    min-width: 0;
}

.vp-input-preview {
    width: 100%;
    aspect-ratio: 720 / 1080;
    max-height: 280px;
    background: #f5f5f5;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.vp-input-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.vp-prompt-area {
    flex: 1;
    background: #fafafa;
    border: 1px solid #e8e8e8;
    border-radius: 10px;
    padding: 16px;
    font-size: 14px;
    line-height: 1.7;
    color: #555;
    overflow-y: auto;
    min-height: 80px;
    word-break: break-word;
}

.vp-make-btn {
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, #7c5cfc, #5b3cfc);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.02em;
    flex-shrink: 0;
}
.vp-make-btn:hover { background: linear-gradient(135deg, #6a4aee, #4a2aee); transform: translateY(-1px); box-shadow: 0 6px 20px rgba(124,92,252,0.35); }
.vp-make-btn:active { transform: scale(0.98); }

/* 视频网格底部加载提示 */
.video-loading-tip {
    grid-column: 1 / -1;
    text-align: center;
    padding: 30px 0;
    color: #999;
    font-size: 14px;
}

/* AI优化按钮 */
.ai-optimize-btn {
    padding: 10px 20px;
    background: #f0f0f0;
    color: #666;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}
.ai-optimize-btn:hover {
    background: #e5e5e5;
    color: #333;
}
.ai-optimize-btn.loading {
    pointer-events: none;
    opacity: 0.7;
}
.ai-optimize-loading {
    display: none;
    width: 14px;
    height: 14px;
    border: 2px solid #ccc;
    border-top-color: #666;
    border-radius: 50%;
    animation: aiSpin 0.7s linear infinite;
}
.ai-optimize-btn.loading .ai-optimize-loading {
    display: inline-block;
}
.ai-optimize-btn.loading .ai-optimize-text {
    display: none;
}
@keyframes aiSpin {
    to { transform: rotate(360deg); }
}

/* ========== 全屏生成Loading遮罩 ========== */
.gen-loading-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.55);
    z-index: 9998;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.gen-loading-box {
    background: #fff;
    border-radius: 16px;
    padding: 40px 48px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    min-width: 420px;
}
.gen-loading-text {
    font-size: 16px;
    color: #333;
    margin-bottom: 20px;
    font-weight: 500;
}
.gen-progress-bar {
    width: 100%;
    height: 8px;
    background: #e8e8e8;
    border-radius: 4px;
    overflow: hidden;
}
.gen-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #7c5cfc, #5b3cfc);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

/* ========== 视频生成结果弹层 ========== */
.gen-result-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: vpFadeIn 0.3s ease;
}
.gen-result-popup {
    background: #fff;
    border-radius: 16px;
    width: 90vw;
    max-width: 500px;
    overflow: hidden;
    box-shadow: 0 24px 80px rgba(0,0,0,0.3);
    animation: vpSlideUp 0.3s ease;
}
.gen-result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 12px;
}
.gen-result-title {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
}
.gen-result-close {
    width: 32px; height: 32px;
    border-radius: 50%;
    border: none;
    background: #f5f5f5;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
}
.gen-result-close:hover { background: #e8e8e8; color: #333; }
.gen-result-video {
    width: 100%;
    display: block;
    background: #000;
}
.gen-result-actions {
    padding: 16px 24px 24px;
    display: flex;
    justify-content: center;
}
.gen-download-btn {
    padding: 12px 32px;
    background: linear-gradient(135deg, #7c5cfc, #5b3cfc);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}
.gen-download-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(124,92,252,0.35); }

/* ========== 移动端适配 ========== */
@media (max-width: 639px) {
    .video-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    /* 视频预览弹层：上下布局 */
    .video-preview-popup {
        flex-direction: column;
        width: 95vw;
        height: auto;
        max-height: 95vh;
        overflow-y: auto;
    }

    .vp-close {
        top: 10px;
        right: 12px;
        width: 30px;
        height: 30px;
        font-size: 18px;
    }

    .vp-left {
        max-width: 100%;
        width: 100%;
        height: auto;
        aspect-ratio: 9 / 16;
        flex-shrink: 0;
    }

    .vp-left video {
        object-fit: contain;
    }

    .vp-right {
        padding: 16px 16px 20px;
        gap: 14px;
    }

    .vp-input-preview {
        aspect-ratio: 16 / 9;
        max-height: 180px;
    }

    .vp-prompt-area {
        flex: none;
        min-height: 60px;
        max-height: 120px;
    }

    .vp-make-btn {
        padding: 12px 20px;
        font-size: 15px;
    }
}