/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* 容器样式 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: #fff;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}

/* 顶部标题栏 */
.header {
    background: linear-gradient(135deg, #667eea 0%, #ffffff 100%);
    color: #333;
    padding: 2rem;
    text-align: center;
}

.title {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* 主内容区域 */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: row;
    gap: 2rem;
    padding: 2rem;
}

/* 右侧控制面板 */
.control-panel {
    width: 40%;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.panel-section {
    background-color: #fafafa;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.section-title {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: #444;
    border-bottom: 2px solid #667eea;
    padding-bottom: 0.5rem;
}

/* 图片上传区域 */
.image-uploader {
    margin-bottom: 1rem;
}

.upload-btn {
    display: block;
    width: 100%;
    padding: 1.5rem;
    background-color: #667eea;
    color: white;
    text-align: center;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s ease;
    border: 2px dashed #5a6fd8;
}

.upload-btn:hover {
    background-color: #5a6fd8;
}

.info-text {
    font-size: 0.9rem;
    color: #666;
    margin-top: 0.5rem;
}

/* 字体样式设置区域 */
.style-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.style-item {
    flex: 1;
    min-width: 150px;
}

.style-item.full-width {
    flex: 1 1 100%;
}

.style-item label {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    color: #555;
    font-weight: 500;
}

.style-item input[type="number"],
.style-item input[type="color"] {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.style-item input[type="color"] {
    height: 40px;
    padding: 2px;
    cursor: pointer;
}

.style-item input[type="range"] {
    width: 100%;
    height: 6px;
    background: #ddd;
    border-radius: 3px;
    outline: none;
    margin-top: 0.5rem;
}

.style-item input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    background: #667eea;
    border-radius: 50%;
    cursor: pointer;
}

.style-item input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: #667eea;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

/* 字幕内容输入区域 */
#subtitle-content {
    width: 100%;
    padding: 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    min-height: 120px;
    transition: border-color 0.3s ease;
}

#subtitle-content:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

/* 左侧预览区域 */
.preview-panel {
    width: 60%;
    display: flex;
    flex-direction: column;
}

.preview-container {
    flex: 1;
    background-color: #fafafa;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 500px;
    position: relative;
}

.preview-canvas {
    max-width: 100%;
    max-height: 100%;
    border: 1px solid #ddd;
    background-color: white;
    display: none;
}

.preview-placeholder {
    text-align: center;
    color: #999;
}

.placeholder-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* 底部操作按钮区域 */
.footer {
    background-color: #fafafa;
    padding: 1.5rem 2rem;
    display: flex;
    gap: 1rem;
    justify-content: center;
    border-top: 1px solid #eee;
}

.action-btn {
    padding: 0.8rem 2rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 150px;
}

.generate-btn {
    background-color: #28a745;
    color: white;
}

.generate-btn:hover {
    background-color: #218838;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(40, 167, 69, 0.3);
}

.save-btn {
    background-color: #6c757d;
    color: white;
    cursor: not-allowed;
}

.save-btn.enabled {
    background-color: #007bff;
    cursor: pointer;
}

.save-btn.enabled:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
        padding: 1rem;
    }

    .control-panel,
    .preview-panel {
        width: 100%;
    }

    .style-group {
        flex-direction: column;
    }

    .style-item {
        min-width: auto;
    }

    .footer {
        flex-direction: column;
        align-items: center;
    }

    .action-btn {
        width: 100%;
        max-width: 300px;
    }
}

@media (max-width: 480px) {
    .title {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .panel-section {
        padding: 1rem;
    }

    .preview-container {
        padding: 1rem;
        min-height: 400px;
    }
}

/* 拖拽效果 */
.image-uploader.dragover .upload-btn {
    background-color: #4a5fd0;
    border-color: #3a4fbb;
    transform: scale(1.02);
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

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