/* ============================================== */
/*  video.css — 视频生成页面样式                     */
/*  与 image.css 布局风格一致                          */
/* ============================================== */

/* ===== Video Main Layout ===== */
.video-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
}

.video-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 1000px;
    margin: 0 auto;
    width: 100%;
    padding: 2rem 1.5rem;
}

/* ===== Welcome / Empty State ===== */
.video-welcome {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem 0;
    margin-bottom: 150px;
}

.video-welcome-icon {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    margin-bottom: 1.5rem;
}

.video-welcome-icon i {
    font-size: 1.8rem;
    color: var(--accent);
}

.video-welcome-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.video-welcome-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    max-width: 400px;
    line-height: 1.6;
}

.video-welcome-login-btn {
    display: inline-block;
    margin-top: 1.5rem;
    padding: 0.75rem 2.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: #ffffff;
    background: linear-gradient(135deg, #1a1a1a 0%, #000 100%);
    border-radius: 10px;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.video-welcome-login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.20);
    color: #ffffff;
}

/* ===== Input Area (fixed bottom) ===== */
.video-input-area {
    position: fixed;
    bottom: 0;
    left: var(--new-sidebar-width);
    right: 0;
    background: var(--bg-primary);
    z-index: 10;
    padding: 1rem 1.5rem;
    margin: 0px 10px;
}

.video-input-area-inner {
    max-width: 800px;
    margin: 0 auto;
}

.video-input-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.video-input-box:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.08);
}

.video-input-textarea {
    width: 100%;
    border: none;
    outline: none;
    resize: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.95rem;
    line-height: 1.6;
    font-family: inherit;
    min-height: 65px;
    max-height: 200px;
}

.video-input-textarea::placeholder {
    color: var(--text-muted);
}

/* ===== Params Bar (below textarea) ===== */
.video-params-bar {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-top: 0.5rem;
    padding-top: 0.6rem;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

.video-params-bar-2 {
    margin-top: 0.35rem;
    padding-top: 0.4rem;
    border-top: none;
}

.video-param-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}

.video-param-label {
    font-size: 0.72rem;
    color: var(--text-secondary);
    white-space: nowrap;
    font-weight: 500;
}

.video-param-select {
    padding: 0.4rem 1.6rem 0.4rem 0.6rem;
    background: var(--bg-card);
    border: 1.5px solid #cccccc;
    border-radius: 7px;
    color: var(--text-primary);
    font-size: 0.82rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.45rem center;
    background-size: 10px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.video-param-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.08);
}

.video-param-select:hover { border-color: var(--accent); }

.video-param-more-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1.5px solid #cccccc;
    border-radius: 7px;
    color: var(--text-secondary);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.video-param-more-btn:hover,
.video-param-more-btn.active {
    border-color: var(--accent);
    color: var(--accent);
}

/* Send button */
.video-send-btn {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    border: none;
    border-radius: 8px;
    color: #ffffff;
    font-size: 1.05rem;
    cursor: pointer;
    transition: opacity 0.15s ease, transform 0.15s ease;
    flex-shrink: 0;
    margin-left: auto;
}

.video-send-btn:hover { opacity: 0.9; transform: scale(1.05); }
.video-send-btn:active { transform: scale(0.95); }
.video-send-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ===== More Params Panel ===== */
.video-more-params {
    margin-top: 0.6rem;
    padding-top: 0.6rem;
    border-top: 1px solid var(--border);
    animation: videoParamsIn 0.2s ease;
}

@keyframes videoParamsIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.video-more-params-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.video-param-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.video-param-group .video-param-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Chip buttons */
.video-param-chips {
    display: flex;
    gap: 0.3rem;
    flex-wrap: wrap;
}

.video-chip {
    padding: 0.3rem 0.6rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.76rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
    white-space: nowrap;
}

.video-chip:hover {
    border-color: #999999;
    color: var(--text-primary);
}

.video-chip.active {
    border-color: #333333;
    background: #1a1a1a;
    color: #f5f5f5;
    font-weight: 600;
}

/* Upload button */
.video-param-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.35rem 0.7rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
}

.video-param-upload-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.video-param-hint {
    font-size: 0.72rem;
    color: var(--accent);
    margin-left: 0.35rem;
}

.video-param-note {
    font-size: 0.7rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Slider */
.video-param-slider {
    width: 100%;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--border);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
    margin-top: 0.25rem;
}

.video-param-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--accent);
    border: 2px solid #fff;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

/* Seed input */
.video-param-input {
    padding: 0.4rem 0.6rem;
    background: var(--bg-card);
    border: 1.5px solid #cccccc;
    border-radius: 7px;
    color: var(--text-primary);
    font-size: 0.82rem;
    font-family: inherit;
    outline: none;
    width: 120px;
    transition: border-color 0.15s ease;
}

.video-param-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.08);
}

/* Toggle switch */
.video-param-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.82rem;
    color: var(--text-primary);
}

.video-param-toggle input {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
}

/* ===== File Preview Container ===== */
.video-files-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.video-file-item {
    position: relative;
    display: inline-flex;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.video-file-thumb {
    width: 64px;
    height: 64px;
}

.video-file-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-file-badge {
    position: absolute;
    top: 3px;
    left: 3px;
    padding: 1px 5px;
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 600;
    border-radius: 4px;
    line-height: 1.4;
}

.video-file-badge-ref { background: var(--accent); }
.video-file-badge-first { background: #10b981; }
.video-file-badge-last { background: #f59e0b; }
.video-file-badge-audio { background: #555555; }
.video-file-badge-video { background: #777777; }

.video-file-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 0.7rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s;
}

.video-file-item:hover .video-file-remove { opacity: 1; }
.video-file-remove:hover { background: rgba(0, 0, 0, 0.85); }

/* Bottom hint */
.video-input-hint {
    text-align: center;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.video-retention-warn {
    color: #000;
    font-weight: 600;
    font-size: 0.72rem;
    margin-left: 0.5rem;
}

/* ===== Messages Area ===== */
.video-messages {
    flex: 1 0 auto;
    padding: 1rem 0 240px 0;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.video-msg-row {
    display: flex;
    flex-direction: column;
    margin-bottom: 1.25rem;
}

.video-msg-user { align-items: flex-end; }

.video-msg-user .video-msg-body { max-width: 85%; }

.video-msg-assistant {
    flex-direction: column;
    align-items: flex-start;
}

.video-msg-assistant .video-msg-body { padding-left: 40px; }

.video-msg-header {
    display: flex;
    align-items: center;
    margin-bottom: 6px;
}

.video-msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
    background: var(--bg-secondary);
    color: var(--accent);
    border: 1px solid var(--border);
    overflow: hidden;
    margin-right: 8px;
}

.video-msg-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.video-msg-meta {
    display: flex;
    align-items: center;
}

.video-model-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}

.video-msg-bubble {
    padding: 0.75rem 1rem;
    border-radius: 12px;
    line-height: 1.6;
    font-size: 0.95rem;
    word-wrap: break-word;
}

.video-msg-user .video-msg-bubble {
    background: #f0f0f0;
    color: #000;
}

.video-msg-assistant .video-msg-bubble {
    background: var(--bg-card);
    color: var(--text-primary);
}

/* ===== User message media (first/last frame, ref images, audio, video) ===== */
.video-msg-media {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
    align-items: flex-start;
}

.video-msg-media-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--bg-card);
}

/* Frame images (first/last) — slightly larger with badge */
.video-msg-media-frame {
    width: 72px;
    height: 72px;
}
.video-msg-media-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.video-msg-media-badge {
    position: absolute;
    top: 2px;
    left: 2px;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 0.65rem;
    font-weight: 600;
    color: #fff;
    line-height: 1.5;
    pointer-events: none;
}
.video-msg-media-first .video-msg-media-badge { background: #10b981; }
.video-msg-media-last .video-msg-media-badge { background: #f59e0b; }

/* Reference images */
.video-msg-media-ref {
    width: 60px;
    height: 60px;
}
.video-msg-media-ref img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Audio / video file indicator */
.video-msg-media-file {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 6px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    font-size: 0.78rem;
    color: var(--text-secondary);
}
.video-msg-media-file i {
    font-size: 0.9rem;
    flex-shrink: 0;
}
.video-msg-media-filename {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===== Message Actions ===== */
.video-msg-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-top: 4px;
}

.video-msg-user .video-msg-actions { justify-content: flex-end; }

.video-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.video-action-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.video-action-btn:active { transform: scale(0.95); }

/* ===== User Edit Area ===== */
.video-msg-body.is-editing {
    max-width: 100% !important;
    width: 100%;
}

.user-edit-area {
    margin-top: 8px;
}

.user-edit-textarea {
    width: 100%;
    min-height: 80px;
    min-width: 400px;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    line-height: 1.6;
    resize: vertical;
    outline: none;
}

.user-edit-textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.08);
}

.user-edit-toolbar {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 6px;
}

.user-edit-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.15s ease;
}

.user-edit-btn.cancel-btn {
    background: transparent;
    color: var(--text-secondary);
}

.user-edit-btn.cancel-btn:hover { background: var(--bg-secondary); }

.user-edit-btn.send-btn {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.user-edit-btn.send-btn:hover { opacity: 0.9; }

/* Status */
.video-msg-status {
    color: var(--text-muted);
    font-size: 0.88rem;
    padding: 0.25rem 0;
    display: flex;
    align-items: center;
    gap: 2px;
}

.video-msg-status .loading-dot {
    display: inline-block;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--accent);
    animation: videoStatusBounce 1.4s ease-in-out infinite;
}

.video-msg-status .loading-dot:nth-child(2) { animation-delay: 0.2s; }
.video-msg-status .loading-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes videoStatusBounce {
    0%, 80%, 100% { opacity: 0.2; transform: scale(0.8); }
    40% { opacity: 1; transform: scale(1.3); }
}

/* Video grid inside assistant messages */
.video-msg-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.video-msg-grid-item {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    aspect-ratio: 16 / 9;
    cursor: pointer;
}

.video-msg-grid-item video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    background: #000;
}

.video-msg-grid-item-toolbar {
    position: absolute;
    top: 6px;
    right: 6px;
    display: flex;
    gap: 4px;
    z-index: 2;
}

.vid-toolbar-btn {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    font-size: 0.85rem;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s ease;
}

.vid-toolbar-btn:hover { background: rgba(0, 0, 0, 0.7); }

/* ===== Floating Toolbox (top-right) ===== */
.video-toolbox {
    position: fixed;
    right: 16px;
    top: 16px;
    display: flex;
    gap: 6px;
    z-index: 99;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.video-toolbox.toolbox-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.toolbox-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.toolbox-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-light);
}

/* ===== Right Panel (History Sidebar) ===== */
.video-right-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 320px;
    background: var(--bg-card);
    border-left: 1px solid var(--border);
    z-index: 100;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.video-right-panel.open { transform: translateX(0); }

.right-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    flex-shrink: 0;
}

.right-panel-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.right-panel-close:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.right-panel-search {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0.75rem 1rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-secondary);
}

.right-panel-search i {
    color: var(--text-muted);
    font-size: 0.9rem;
    flex-shrink: 0;
}

.right-panel-search input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.88rem;
    font-family: inherit;
}

.right-panel-search input::placeholder { color: var(--text-muted); }

.right-panel-new-chat {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 0 1rem 0.75rem;
    padding: 0.55rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
    font-family: inherit;
}

.right-panel-new-chat:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-light);
}

.right-panel-history {
    flex: 1;
    overflow-y: auto;
    padding: 0 0.5rem;
}

.right-panel-loading,
.right-panel-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0.55rem 0.75rem;
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.15s ease;
    overflow: hidden;
}

.history-item:hover { background: var(--bg-secondary); }

.history-item.active {
    background: #f0f0f0;
    color: #000;
}

.history-item i {
    color: var(--text-muted);
    font-size: 0.9rem;
    flex-shrink: 0;
}

.history-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    flex-shrink: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
}

.history-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.history-item-content {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.history-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.history-time {
    font-size: 0.72rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* ===== Panel-Open State ===== */
.new-main-wrapper.panel-open { margin-right: 320px; }

.new-main-wrapper.panel-open .video-input-area { right: 320px; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .video-input-area {
        left: 0;
        padding: 0.75rem 1rem;
    }
    .video-container { padding: 1.5rem 1rem; }
    .video-more-params-grid { grid-template-columns: repeat(2, 1fr); }
    .video-toolbox { right: 8px; }
    .video-right-panel { width: 100vw; }
    .new-main-wrapper.panel-open { margin-right: 0; }
    .video-msg-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .video-more-params-grid { grid-template-columns: 1fr; }
}
