* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --secondary-color: #8b5cf6;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --background: #0f172a;
    --surface: #1e293b;
    --surface-light: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px 0;
}

header h1 {
    font-size: 3rem;
    background: linear-gradient(135deg, #6366f1, #8b5cf6, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* 导航标签 */
.nav-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    background: var(--surface);
    padding: 10px;
    border-radius: 15px;
    flex-wrap: wrap;
}

.tab-btn {
    flex: 1;
    min-width: 150px;
    padding: 15px 20px;
    background: transparent;
    border: 2px solid transparent;
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    background: var(--surface-light);
    color: var(--text-primary);
}

.tab-btn.active {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-color: var(--primary-color);
}

/* 内容面板 */
.tab-content {
    display: none;
    animation: fadeIn 0.5s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 输入区域 */
.input-section {
    background: var(--surface);
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}

.input-section h2 {
    margin-bottom: 25px;
    color: var(--primary-color);
    font-size: 1.8rem;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 600;
}

.form-group textarea,
.form-group input[type="text"],
.form-group input[type="password"],
.form-group select {
    width: 100%;
    padding: 12px 15px;
    background: var(--background);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-group textarea:focus,
.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

/* 上传区域 */
.upload-area {
    position: relative;
    border: 2px dashed var(--border-color);
    border-radius: 10px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--background);
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: var(--surface-light);
}

.upload-area.dragover {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.1);
}

.upload-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 10px;
}

.upload-placeholder p {
    color: var(--text-primary);
    font-size: 1.1rem;
    margin-bottom: 5px;
}

.upload-placeholder small {
    color: var(--text-secondary);
}

.preview-container {
    position: relative;
}

.preview-container img {
    max-width: 100%;
    max-height: 400px;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.btn-remove {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--danger-color);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-remove:hover {
    background: #dc2626;
    transform: scale(1.05);
}

/* 按钮样式 */
.btn-primary {
    width: 100%;
    padding: 15px 30px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(99, 102, 241, 0.4);
}

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

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary {
    margin-left: 10px;
    padding: 10px 20px;
    background: var(--surface-light);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

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

/* 加载动画 */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

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

/* 结果区域 */
.result-section {
    background: var(--surface);
    padding: 30px;
    border-radius: 15px;
    box-shadow: var(--shadow);
}

.result-section h3 {
    margin-bottom: 20px;
    color: var(--primary-color);
    font-size: 1.5rem;
}

/* 进度条样式 */
.progress-container {
    text-align: center;
    padding: 60px 20px;
}

.progress-message {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 30px;
    font-size: 1.2rem;
    color: var(--text-primary);
    font-weight: 600;
}

.progress-icon {
    font-size: 2rem;
    animation: rotate 2s linear infinite;
}

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

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--background);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 10px;
    width: 0%;
    transition: width 0.5s ease, background 0.3s ease;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
}

.progress-tips {
    margin-top: 20px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.progress-tips p {
    margin: 8px 0;
}

.image-grid,
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.result-item {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    background: var(--background);
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.result-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
}

.result-item img,
.result-item video {
    width: 100%;
    height: auto;
    display: block;
}

.result-actions {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.9), rgba(0,0,0,0.6), transparent);
    padding: 20px 15px 15px;
    display: flex;
    gap: 10px;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.result-item:hover .result-actions {
    opacity: 1;
    pointer-events: auto;
}

.result-item .download-btn {
    position: static;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    opacity: 1;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.result-item .download-btn:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-color));
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
}

/* 设置区域 */
.settings-section {
    margin-top: 40px;
    background: var(--surface);
    padding: 20px;
    border-radius: 15px;
    box-shadow: var(--shadow);
}

.settings-section details summary {
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: 600;
    padding: 10px;
    list-style: none;
    user-select: none;
}

.settings-section details summary::-webkit-details-marker {
    display: none;
}

.settings-section details[open] {
    padding-bottom: 10px;
}

.settings-section .form-group {
    margin-top: 20px;
}

/* 消息提示 */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--surface);
    color: var(--text-primary);
    padding: 15px 25px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    z-index: 1000;
    animation: slideIn 0.3s ease;
}

.toast.success {
    border-left: 4px solid var(--success-color);
}

.toast.error {
    border-left: 4px solid var(--danger-color);
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }

    .nav-tabs {
        flex-direction: column;
    }

    .tab-btn {
        width: 100%;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .image-grid,
    .video-grid {
        grid-template-columns: 1fr;
    }
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state.error {
    color: var(--danger-color);
}

.empty-state .icon {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 1.1rem;
    margin-bottom: 10px;
}

.empty-state small {
    font-size: 0.9rem;
    opacity: 0.7;
}

/* 历史记录样式 */
.history-grid {
    display: grid;
    gap: 20px;
}

.history-item {
    background: var(--surface);
    border-radius: 15px;
    padding: 20px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    border-left: 4px solid var(--primary-color);
}

.history-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.history-item.image {
    border-left-color: var(--primary-color);
}

.history-item.video {
    border-left-color: var(--secondary-color);
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.history-type {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    background: rgba(99, 102, 241, 0.2);
    color: var(--primary-color);
}

.history-type.video {
    background: rgba(139, 92, 246, 0.2);
    color: var(--secondary-color);
}

.history-time {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.history-content {
    margin-bottom: 15px;
}

.history-prompt {
    font-size: 0.95rem;
    color: var(--text-primary);
    margin-bottom: 10px;
    line-height: 1.5;
}

.history-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.history-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.history-preview {
    margin: 15px 0;
    border-radius: 10px;
    overflow: hidden;
}

.history-preview img,
.history-preview video {
    width: 100%;
    max-height: 300px;
    object-fit: cover;
    display: block;
}

.history-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.history-actions button {
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-copy {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

.btn-copy:hover {
    background: var(--primary-color);
    color: white;
}

.btn-download-history {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
    border: 1px solid var(--success-color);
}

.btn-download-history:hover {
    background: var(--success-color);
    color: white;
}

.btn-delete {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
    border: 1px solid var(--danger-color);
}

.btn-delete:hover {
    background: var(--danger-color);
    color: white;
}

.history-empty {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-secondary);
}

.history-empty .icon {
    font-size: 5rem;
    margin-bottom: 20px;
    opacity: 0.3;
}

.history-empty h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.history-empty p {
    font-size: 1rem;
    opacity: 0.7;
}
