/**
 * 图生视频页面样式
 * 统一的视觉风格，简洁大气的专业SaaS设计
 */

/* 主容器 */
.image-to-video-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: #f8f9fa;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
}

/* 主内容包装器 */
.main-content-wrapper {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* 历史记录侧边栏 */
.history-sidebar {
    width: 280px;
    background: #ffffff;
    border-right: 1px solid #e6e6e6;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.05);
}

.new-chat-section {
    padding: 16px;
    border-bottom: 1px solid #f0f0f0;
}

.new-chat-btn {
    width: 100%;
    padding: 12px 16px;
    background: linear-gradient(135deg, #1890FF, #40a9ff);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
}

.new-chat-btn:hover {
    background: linear-gradient(135deg, #40a9ff, #1890FF);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(24, 144, 255, 0.3);
}

.new-chat-btn:active {
    transform: translateY(0);
}

.history-list {
    flex: 1;
    padding: 8px 16px;
    overflow-y: auto;
}

.history-empty {
    text-align: center;
    color: #999;
    padding: 40px 20px;
}

.history-empty i {
    font-size: 32px;
    margin-bottom: 16px;
    color: #ddd;
}

.history-empty p {
    margin-bottom: 8px;
    color: #666;
    font-weight: 500;
}

.history-empty small {
    color: #999;
}

/* 内容区域 */
.content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #ffffff;
}

.messages-container {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* 底部输入区域 */
.input-area {
    background: #ffffff;
    border-top: 1px solid #e6e6e6;
    padding: 20px;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
}

.upload-input-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* 图片上传区域 */
.image-upload-container {
    position: relative;
}

.drag-upload-area {
    border: 2px dashed #d9d9d9;
    border-radius: 12px;
    padding: 40px 20px;
    background: #fafafa;
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 160px;
}

.drag-upload-area:hover {
    border-color: #1890FF;
    background: #f6fbff;
}

.drag-upload-area.drag-over {
    border-color: #1890FF;
    background: #e6f7ff;
    border-style: solid;
}

.upload-content {
    text-align: center;
}

.upload-icon {
    font-size: 48px;
    color: #1890FF;
    margin-bottom: 16px;
}

.upload-text h4 {
    margin: 0 0 16px 0;
    color: #333;
    font-weight: 500;
    font-size: 18px;
}

.upload-btn {
    background: #1890FF;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.upload-btn:hover {
    background: #40a9ff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(24, 144, 255, 0.3);
}

.upload-hint {
    margin-top: 12px;
    color: #999;
    font-size: 12px;
}

/* 已上传图片预览 */
.uploaded-images-preview {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #e6e6e6;
}

.images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.image-preview-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background: #ffffff;
    border: 2px solid #e6e6e6;
    transition: all 0.2s ease;
    aspect-ratio: 1;
}

.image-preview-item:hover {
    border-color: #1890FF;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(24, 144, 255, 0.15);
}

.image-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.remove-image-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    background: rgba(255, 77, 79, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s ease;
    font-size: 12px;
}

.image-preview-item:hover .remove-image-btn {
    opacity: 1;
}

.remove-image-btn:hover {
    background: #ff4d4f;
    transform: scale(1.1);
}

.upload-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.add-more-btn, .clear-all-btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

.add-more-btn {
    background: #f0f0f0;
    color: #666;
    border: 1px solid #d9d9d9;
}

.add-more-btn:hover {
    background: #e6e6e6;
    color: #333;
}

.clear-all-btn {
    background: #fff2f0;
    color: #ff4d4f;
    border: 1px solid #ffccc7;
}

.clear-all-btn:hover {
    background: #ff4d4f;
    color: white;
}

/* 提示词输入区域 */
.prompt-input-section {
    margin-bottom: 16px;
}

.prompt-wrapper {
    position: relative;
    display: flex;
    align-items: flex-end;
    gap: 12px;
    background: #ffffff;
    border: 1px solid #d9d9d9;
    border-radius: 8px;
    padding: 12px;
}

.prompt-wrapper:focus-within {
    border-color: #1890FF;
    box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
}

#promptInput {
    flex: 1;
    border: none;
    outline: none;
    resize: none;
    font-size: 14px;
    line-height: 1.4;
    color: #333;
    background: transparent;
    min-height: 20px;
    max-height: 80px;
}

#promptInput::placeholder {
    color: #999;
}

.generate-btn {
    background: linear-gradient(135deg, #52c41a, #73d13d);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    flex-shrink: 0;
}

.generate-btn:hover {
    background: linear-gradient(135deg, #73d13d, #52c41a);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(82, 196, 26, 0.3);
}

.generate-btn:disabled {
    background: #f5f5f5;
    color: #bbb;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 参数按钮组 */
.params-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.param-btn {
    background: #ffffff;
    border: 1px solid #d9d9d9;
    color: #666;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    min-width: 80px;
    justify-content: center;
}

.param-btn:hover {
    border-color: #1890FF;
    color: #1890FF;
    background: #f6fbff;
}

.param-btn.active {
    background: #1890FF;
    border-color: #1890FF;
    color: white;
}

.param-btn i {
    font-size: 12px;
}

/* 参数面板样式 */
.param-section {
    padding: 20px;
}

.param-section h6 {
    margin: 0 0 16px 0;
    color: #333;
    font-weight: 600;
    font-size: 16px;
}

/* 比例选项 */
.ratio-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.ratio-option {
    background: #ffffff;
    border: 2px solid #e6e6e6;
    border-radius: 8px;
    padding: 16px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.ratio-option:hover {
    border-color: #1890FF;
    background: #f6fbff;
}

.ratio-option.active {
    border-color: #1890FF;
    background: #e6f7ff;
    box-shadow: 0 2px 8px rgba(24, 144, 255, 0.2);
}

.ratio-preview {
    width: 48px;
    height: 32px;
    background: linear-gradient(135deg, #1890FF, #40a9ff);
    border-radius: 4px;
    position: relative;
}

.ratio-preview.portrait {
    width: 32px;
    height: 48px;
}

.ratio-preview.square {
    width: 40px;
    height: 40px;
}

.ratio-option span {
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.ratio-option small {
    color: #666;
    font-size: 12px;
}

/* 时长选项 */
.duration-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.duration-option {
    background: #ffffff;
    border: 1px solid #d9d9d9;
    color: #666;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    min-width: 60px;
    text-align: center;
}

.duration-option:hover {
    border-color: #1890FF;
    color: #1890FF;
}

.duration-option.active {
    background: #1890FF;
    border-color: #1890FF;
    color: white;
}

/* 质量选项 */
.quality-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.quality-option {
    background: #ffffff;
    border: 2px solid #e6e6e6;
    border-radius: 8px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.quality-option:hover {
    border-color: #1890FF;
    background: #f6fbff;
}

.quality-option.active {
    border-color: #1890FF;
    background: #e6f7ff;
    box-shadow: 0 2px 8px rgba(24, 144, 255, 0.2);
}

.quality-option i {
    font-size: 24px;
    color: #1890FF;
    margin-bottom: 4px;
}

.quality-option span {
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.quality-option small {
    color: #666;
    font-size: 12px;
    line-height: 1.3;
}

/* 动态模型选择器容器 */
.dynamic-model-selector-container {
    min-height: 200px;
}

.model-selector-loading {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 20px;
}

.loading-skeleton {
    height: 60px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 8px;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .main-content-wrapper {
        flex-direction: column;
    }
    
    .history-sidebar {
        width: 100%;
        height: 200px;
        border-right: none;
        border-bottom: 1px solid #e6e6e6;
    }
    
    .new-chat-section {
        padding: 12px 16px;
    }
    
    .history-list {
        padding: 4px 16px;
    }
    
    .input-area {
        padding: 16px;
    }
    
    .drag-upload-area {
        min-height: 120px;
        padding: 30px 15px;
    }
    
    .upload-icon {
        font-size: 36px;
    }
    
    .upload-text h4 {
        font-size: 16px;
    }
    
    .images-grid {
        grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
        gap: 12px;
    }
    
    .params-buttons {
        gap: 6px;
    }
    
    .param-btn {
        padding: 6px 12px;
        font-size: 13px;
        min-width: 70px;
    }
    
    .ratio-options,
    .quality-options {
        grid-template-columns: 1fr;
    }
    
    .duration-options {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .history-sidebar {
        height: 160px;
    }
    
    .new-chat-btn {
        padding: 10px 14px;
        font-size: 13px;
    }
    
    .input-area {
        padding: 12px;
    }
    
    .upload-input-form {
        gap: 12px;
    }
    
    .drag-upload-area {
        min-height: 100px;
        padding: 20px 10px;
    }
    
    .upload-icon {
        font-size: 28px;
        margin-bottom: 12px;
    }
    
    .upload-text h4 {
        font-size: 14px;
        margin-bottom: 12px;
    }
    
    .upload-btn {
        padding: 8px 16px;
        font-size: 13px;
    }
    
    .prompt-wrapper {
        padding: 10px;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .generate-btn {
        align-self: flex-end;
        padding: 8px 16px;
    }
    
    .params-buttons {
        gap: 4px;
    }
    
    .param-btn {
        padding: 6px 10px;
        font-size: 12px;
        min-width: 65px;
    }
    
    .param-btn span {
        display: none;
    }
    
    .param-btn i {
        font-size: 14px;
    }
    
    .images-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    .image-to-video-container {
        background: #1a1a1a;
        color: #ffffff;
    }
    
    .history-sidebar {
        background: #2a2a2a;
        border-color: #404040;
    }
    
    .content-area {
        background: #1a1a1a;
    }
    
    .input-area {
        background: #2a2a2a;
        border-color: #404040;
    }
    
    .drag-upload-area {
        background: #2a2a2a;
        border-color: #404040;
        color: #cccccc;
    }
    
    .drag-upload-area:hover {
        background: #333333;
    }
    
    .uploaded-images-preview {
        background: #2a2a2a;
        border-color: #404040;
    }
    
    .image-preview-item {
        border-color: #404040;
        background: #333333;
    }
    
    .prompt-wrapper {
        background: #333333;
        border-color: #404040;
    }
    
    #promptInput {
        color: #ffffff;
    }
    
    #promptInput::placeholder {
        color: #888888;
    }
    
    .param-btn {
        background: #333333;
        border-color: #404040;
        color: #cccccc;
    }
    
    .param-btn:hover {
        background: #404040;
        color: #1890FF;
    }
    
    .ratio-option,
    .quality-option {
        background: #333333;
        border-color: #404040;
    }
    
    .ratio-option:hover,
    .quality-option:hover {
        background: #404040;
    }
    
    .duration-option {
        background: #333333;
        border-color: #404040;
        color: #cccccc;
    }
    
    .duration-option:hover {
        color: #1890FF;
    }
}

/* 高对比度支持 */
@media (prefers-contrast: high) {
    .drag-upload-area {
        border-width: 3px;
    }
    
    .image-preview-item {
        border-width: 3px;
    }
    
    .param-btn,
    .ratio-option,
    .quality-option,
    .duration-option {
        border-width: 2px;
    }
    
    .param-btn.active,
    .ratio-option.active,
    .quality-option.active,
    .duration-option.active {
        border-width: 3px;
    }
}

/* 无障碍支持 */
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
    
    .loading-skeleton {
        background: #f0f0f0;
    }
}

/* 焦点指示器 */
.param-btn:focus,
.ratio-option:focus,
.quality-option:focus,
.duration-option:focus,
.upload-btn:focus,
.generate-btn:focus,
.new-chat-btn:focus {
    outline: 2px solid #1890FF;
    outline-offset: 2px;
}

/* 上传进度条样式 */
.upload-progress {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #d9d9d9;
    border-radius: 8px;
    padding: 16px 20px;
    min-width: 280px;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.progress-text {
    font-size: 14px;
    color: #595959;
    font-weight: 500;
}

.progress-count {
    font-size: 13px;
    color: #8c8c8c;
    font-weight: 600;
}

.progress-bar {
    height: 6px;
    background: #f5f5f5;
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #1890FF, #40a9ff);
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* 图片预览增强样式 */
.image-preview-item {
    position: relative;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.image-preview-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.image-wrapper {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
}

.image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.image-preview-item:hover .image-overlay {
    opacity: 1;
}

.preview-image-btn,
.remove-image-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s ease;
}

.preview-image-btn {
    background: rgba(24, 144, 255, 0.9);
    color: white;
}

.preview-image-btn:hover {
    background: #1890ff;
}

.remove-image-btn {
    background: rgba(255, 77, 79, 0.9);
    color: white;
}

.remove-image-btn:hover {
    background: #ff4d4f;
}

.image-dimensions {
    position: absolute;
    top: 4px;
    left: 4px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 500;
}

.image-info {
    padding: 8px 12px;
}

.image-name {
    font-size: 13px;
    font-weight: 500;
    color: #262626;
    margin-bottom: 4px;
}

.image-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: #8c8c8c;
}

.image-ratio {
    background: #f0f0f0;
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: 500;
}

/* 图片预览模态框 */
.image-preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    cursor: pointer;
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 12px;
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
}

.modal-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #262626;
}

.close-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: #f5f5f5;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #8c8c8c;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background: #e6f7ff;
    color: #1890ff;
}

.modal-body {
    padding: 20px;
    text-align: center;
    max-height: 60vh;
    overflow: auto;
}

.modal-body img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
}

.modal-footer {
    padding: 12px 20px;
    border-top: 1px solid #f0f0f0;
    background: #fafafa;
}

.image-details {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: #595959;
}

.image-details span {
    background: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 500;
}

/* 欢迎消息增强样式 */
.welcome-message .getting-started {
    margin-top: 20px;
    padding: 16px;
    background: #f6ffed;
    border: 1px solid #b7eb8f;
    border-radius: 8px;
}

.welcome-message .getting-started h4 {
    color: #389e0d;
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 600;
}

.welcome-message .getting-started ol {
    margin: 0;
    padding-left: 18px;
    color: #52c41a;
}

.welcome-message .getting-started li {
    margin-bottom: 6px;
    font-size: 13px;
    line-height: 1.4;
}

/* 积分显示样式 */
.credit-cost {
    font-size: 11px;
    color: #52c41a;
    font-weight: 500;
    background: rgba(82, 196, 26, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
}

.generate-btn.insufficient-credits {
    background: linear-gradient(135deg, #ff4d4f, #ff7875) !important;
    cursor: not-allowed;
}

.generate-btn.insufficient-credits .credit-cost {
    color: #fff;
    background: rgba(255, 255, 255, 0.2);
}

/* 积分预估面板 */
.credit-estimate-panel {
    background: #f8f9fa;
    border: 1px solid #e6e8eb;
    border-radius: 8px;
    padding: 12px 16px;
    margin-top: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.credit-estimate-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.credit-estimate-icon {
    color: #1890ff;
    font-size: 14px;
}

.credit-estimate-text {
    font-size: 13px;
    color: #595959;
}

.credit-estimate-value {
    font-weight: 600;
    color: #262626;
}

.balance-insufficient {
    color: #ff4d4f !important;
}

.balance-warning {
    color: #fa8c16 !important;
}

.balance-sufficient {
    color: #52c41a !important;
}

/* 余额不足提示 */
.insufficient-credits-warning {
    background: #fff2f0;
    border: 1px solid #ffccc7;
    border-radius: 6px;
    padding: 8px 12px;
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.insufficient-credits-warning .warning-icon {
    color: #ff4d4f;
    font-size: 14px;
}

.insufficient-credits-warning .warning-text {
    color: #cf1322;
    font-size: 12px;
}

.recharge-link {
    color: #1890ff;
    text-decoration: none;
    font-weight: 500;
}

.recharge-link:hover {
    text-decoration: underline;
}

/* 打印样式 */
@media print {
    .history-sidebar,
    .input-area {
        display: none;
    }
    
    .content-area {
        flex: 1;
    }
}