/* ========================================
   云雾AI视频生成 - 明亮粉色主题
   ======================================== */

/* CSS变量定义 */
:root {
    --primary-color: #ec4899;
    --primary-dark: #db2777;
    --primary-light: #f472b6;
    --secondary-color: #8b5cf6;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --info-color: #3b82f6;
    
    --bg-primary: #fff0f5;
    --bg-secondary: #ffffff;
    --bg-tertiary: #fce7f3;
    --bg-card: rgba(255, 255, 255, 0.9);
    
    --text-primary: #1f2937;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    
    --border-color: rgba(236, 72, 153, 0.2);
    --border-radius-sm: 12px;
    --border-radius-md: 16px;
    --border-radius-lg: 20px;
    --border-radius-xl: 28px;
    
    --shadow-sm: 0 2px 8px rgba(236, 72, 153, 0.1);
    --shadow-md: 0 4px 16px rgba(236, 72, 153, 0.15);
    --shadow-lg: 0 8px 32px rgba(236, 72, 153, 0.2);
    --shadow-glow: 0 0 40px rgba(236, 72, 153, 0.3);
    
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* 基础重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #fff0f5 0%, #ffe4ec 25%, #fff5f8 50%, #fce7f3 75%, #fff0f5 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

/* 粉色光晕背景效果 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(ellipse at 20% 20%, rgba(236, 72, 153, 0.4) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(139, 92, 246, 0.3) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(244, 114, 182, 0.2) 0%, transparent 60%),
        radial-gradient(ellipse at 30% 70%, rgba(236, 72, 153, 0.25) 0%, transparent 45%),
        radial-gradient(ellipse at 70% 30%, rgba(139, 92, 246, 0.2) 0%, transparent 45%);
    pointer-events: none;
    z-index: -1;
    animation: glowPulse 8s ease-in-out infinite;
}

@keyframes glowPulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

/* 应用容器 */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ========================================
   导航栏
   ======================================== */
.navbar {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand .logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-brand .logo i {
    font-size: 1.75rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ========================================
   主内容区 - 手机适配从上到下布局
   ======================================== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
    max-width: 100%;
    margin: 0 auto;
    width: 100%;
}

/* 面板通用样式 */
.generation-panel,
.result-panel {
    background: var(--bg-card);
    border-radius: var(--border-radius-xl);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-md);
    height: fit-content;
}

.panel-header {
    margin-bottom: 1.25rem;
    text-align: center;
}

.panel-header h1,
.panel-header h2 {
    font-size: 1.4rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.panel-header h1 i,
.panel-header h2 i {
    color: var(--primary-color);
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ========================================
   表单样式
   ======================================== */
.form-container {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-label {
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.form-label i {
    color: var(--primary-color);
    font-size: 0.9rem;
}

.required {
    color: var(--error-color);
}

.tooltip {
    cursor: help;
    color: var(--text-muted);
}

/* 输入框样式 */
.input-wrapper {
    position: relative;
}

.form-input,
.form-textarea {
    width: 100%;
    padding: 1rem;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-md);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all var(--transition-fast);
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(236, 72, 153, 0.1);
}

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

.form-textarea {
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
}

.input-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.input-hint i {
    color: var(--warning-color);
}

/* 模型选择器 */
.model-selector {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.model-btn {
    padding: 1rem;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: left;
}

.model-btn:hover {
    border-color: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.model-btn.active {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border-color: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-md);
}

.model-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.model-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.model-duration {
    font-size: 0.85rem;
    opacity: 0.8;
    background: rgba(255, 255, 255, 0.2);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
}

.model-btn.active .model-duration {
    background: rgba(255, 255, 255, 0.3);
}

/* 宽高比选择器 */
.ratio-selector {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
}

.ratio-btn {
    padding: 0.75rem 0.25rem;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.ratio-btn:hover {
    border-color: var(--primary-light);
    transform: translateY(-2px);
}

.ratio-btn.active {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border-color: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-sm);
}

.ratio-icon {
    font-size: 0.75rem;
    font-weight: 700;
}

.ratio-label {
    font-size: 0.65rem;
    opacity: 0.9;
}

/* 尺寸选择器 */
.size-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.size-btn {
    padding: 1rem;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.size-btn:hover {
    border-color: var(--primary-light);
    transform: translateY(-2px);
}

.size-btn.active {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border-color: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-sm);
}

/* 图片上传区域 */
.image-upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 2rem 1rem;
    text-align: center;
    transition: all var(--transition-fast);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    background: var(--bg-secondary);
}

.image-upload-area:hover {
    border-color: var(--primary-color);
    background: rgba(236, 72, 153, 0.05);
}

.image-upload-area.dragover {
    border-color: var(--primary-color);
    background: rgba(236, 72, 153, 0.1);
}

.upload-placeholder i {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 0.75rem;
}

.upload-placeholder p {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.upload-link {
    color: var(--primary-color);
    text-decoration: underline;
    cursor: pointer;
    font-weight: 600;
}

.upload-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.image-preview-container {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 1rem;
    justify-content: center;
}

.image-preview {
    position: relative;
    width: 70px;
    height: 70px;
    border-radius: var(--border-radius-sm);
    overflow: hidden;
    border: 2px solid var(--border-color);
}

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

.image-preview .remove-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    background: var(--error-color);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 0.7rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

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

/* 生成按钮 */
.generate-btn {
    width: 100%;
    padding: 1.25rem 2rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: none;
    border-radius: var(--border-radius-lg);
    color: white;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
    margin-top: 0.5rem;
    box-shadow: var(--shadow-md);
}

.generate-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.generate-btn:hover::before {
    left: 100%;
}

.generate-btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-glow);
}

.generate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.generate-btn .btn-content,
.generate-btn .btn-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

/* ========================================
   结果面板
   ======================================== */
.result-panel {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* 任务状态卡片 */
.task-status-card {
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.1), rgba(139, 92, 246, 0.05));
    border: 2px solid rgba(236, 72, 153, 0.3);
    border-radius: var(--border-radius-lg);
    padding: 1.25rem;
}

.status-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.status-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--border-radius-md);
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.status-icon.pending {
    color: var(--warning-color);
    animation: pulse 2s infinite;
}

.status-icon.processing {
    color: var(--info-color);
    animation: spin 2s linear infinite;
}

.status-icon.completed {
    color: var(--success-color);
}

.status-icon.failed {
    color: var(--error-color);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.status-info h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.status-info p {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.progress-bar {
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 4px;
    transition: width var(--transition-slow);
    width: 0%;
}

.task-meta {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.task-meta code {
    background: var(--bg-tertiary);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-family: 'Monaco', 'Consolas', monospace;
    word-break: break-all;
}

.task-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--text-muted);
}

.empty-illustration {
    width: 100px;
    height: 100px;
    margin: 0 auto 1.25rem;
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.15), rgba(139, 92, 246, 0.1));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.empty-illustration i {
    font-size: 2.5rem;
    color: var(--primary-color);
    opacity: 0.6;
}

.empty-state h3 {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.empty-state p {
    font-size: 0.85rem;
}

/* 视频结果 */
.video-result {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.result-header {
    padding: 1rem;
    background: rgba(16, 185, 129, 0.1);
    border-bottom: 1px solid rgba(16, 185, 129, 0.2);
}

.result-header h3 {
    color: var(--success-color);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
}

.video-container {
    position: relative;
    background: #000;
}

.video-container video {
    width: 100%;
    display: block;
    max-height: 400px;
}

.video-info {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.info-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
}

.info-value {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    max-height: 100px;
    overflow-y: auto;
}

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

/* 按钮样式 */
.btn-primary,
.btn-secondary {
    padding: 0.875rem 1rem;
    border-radius: var(--border-radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-decoration: none;
    font-size: 0.9rem;
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 2px solid var(--border-color);
}

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

/* 历史记录 */
.history-section {
    margin-top: 0.5rem;
}

.history-section h3 {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 600;
}

.history-section h3 i {
    color: var(--primary-color);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: var(--border-radius-md);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.history-item:hover {
    border-color: var(--primary-color);
    background: var(--bg-tertiary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.history-thumb {
    width: 48px;
    height: 48px;
    border-radius: var(--border-radius-sm);
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

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

.history-thumb i {
    color: var(--text-muted);
    font-size: 1.25rem;
}

.history-info {
    flex: 1;
    min-width: 0;
}

.history-prompt {
    font-size: 0.85rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.history-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    gap: 1rem;
}

.history-status {
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
}

.history-status.completed {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success-color);
}

.history-status.pending {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning-color);
}

.history-status.failed {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error-color);
}

/* ========================================
   页脚
   ======================================== */
.footer {
    text-align: center;
    padding: 1.25rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    border-top: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.5);
}

/* ========================================
   Toast通知
   ======================================== */
.toast-container {
    position: fixed;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 90%;
    max-width: 400px;
}

.toast {
    padding: 1rem 1.25rem;
    border-radius: var(--border-radius-md);
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.toast.success {
    border-color: var(--success-color);
    background: rgba(16, 185, 129, 0.1);
}

.toast.error {
    border-color: var(--error-color);
    background: rgba(239, 68, 68, 0.1);
}

.toast.warning {
    border-color: var(--warning-color);
    background: rgba(245, 158, 11, 0.1);
}

.toast.info {
    border-color: var(--info-color);
    background: rgba(59, 130, 246, 0.1);
}

.toast-icon {
    font-size: 1.25rem;
}

.toast.success .toast-icon {
    color: var(--success-color);
}

.toast.error .toast-icon {
    color: var(--error-color);
}

.toast.warning .toast-icon {
    color: var(--warning-color);
}

.toast.info .toast-icon {
    color: var(--info-color);
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 700;
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
}

.toast-message {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    transition: color var(--transition-fast);
}

.toast-close:hover {
    color: var(--text-primary);
}

/* ========================================
   响应式设计 - 平板和桌面
   ======================================== */
@media (min-width: 768px) {
    .main-content {
        max-width: 600px;
        padding: 1.5rem;
        gap: 1.5rem;
    }
    
    .generation-panel,
    .result-panel {
        padding: 2rem;
    }
    
    .panel-header h1,
    .panel-header h2 {
        font-size: 1.6rem;
    }
    
    .ratio-selector {
        grid-template-columns: repeat(5, 1fr);
    }
    
    .task-actions {
        flex-direction: row;
    }
    
    .video-actions {
        flex-direction: row;
    }
}

@media (min-width: 1024px) {
    .main-content {
        max-width: 700px;
    }
}

/* ========================================
   滚动条样式
   ======================================== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* ========================================
   选中文字样式
   ======================================== */
::selection {
    background: var(--primary-color);
    color: white;
}
