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

body {
    font-family: Arial, sans-serif;
    background: linear-gradient(to right, #e3f2fd, #bbdefb); /* 从左到右的蓝色渐变 */
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 20px;
    background-color: #fff;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
}

/* 左侧功能区 */
.left-section {
    flex: 1;
    min-width: 300px;
    margin-right: 20px;
    display: flex;
    flex-direction: column;
}
/* 新增：按钮容器区域 */
.buttons-container {
    display: flex;
    gap: 20px;
    margin-top: 30px;
}

/* 调整按钮样式 */
.buttons-container .btn {
    flex: 1;
    padding: 10px 20px;
    font-size: 14px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 移除多余的操作按钮区域样式 */
.action-section {
    display: none;
}
/* 右侧预览区 */
.right-section {
    flex: 2;
    min-width: 500px;
    display: flex;
    flex-direction: column;
}

/* 预览容器高度调整 */
.edit-section {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.preview-container {
    flex: 1;
    min-height: 1000px;
}

/* 响应式布局调整 */
@media (max-width: 992px) {
    .container {
        flex-direction: column;
    }
    
    .left-section {
        flex: 1;
        min-width: 300px;
        margin-right: 20px;
        display: flex;
        flex-direction: column;
    }
    
    .right-section {
        width: 100%;
    }
}

/* 标题样式 */
.header-section {
    width: 100%;
    text-align: center;
    margin-bottom: 30px;
}

h1 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 28px;
}

.subtitle {
    color: #7f8c8d;
    font-size: 16px;
    margin-bottom: 20px;
}

h2 {
    color: #34495e;
    margin: 20px 0 15px;
    font-size: 20px;
    border-bottom: 2px solid #3498db;
    padding-bottom: 5px;
}

/* 上传区域样式 */
.upload-section {
    margin-bottom: 30px;
}

.upload-container {
    text-align: center;
    padding: 40px;
    border: 2px dashed #ddd;
    border-radius: 8px;
    background-color: #fafafa;
    transition: all 0.3s ease;
}

.upload-container:hover {
    border-color: #3498db;
    background-color: #f0f8ff;
}

.upload-btn {
    display: inline-block;
    padding: 12px 30px;
    background-color: #3498db;
    color: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s ease;
}

.upload-btn:hover {
    background-color: #2980b9;
}

.upload-hint {
    margin-top: 10px;
    color: #666;
    font-size: 14px;
}

/* 预览区域样式 */
.edit-section {
    margin-bottom: 30px;
}

.preview-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 1200px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background-color: #f9f9f9;
    padding: 20px;
}

/* 响应式布局调整 */
@media (max-width: 992px) {
    .preview-container {
        min-height: 400px;
    }
}

.image-wrapper {
    position: relative;
    max-width: 100%;
    max-height: 100%;
}

#previewImage {
    max-width: 100%;
    max-height: 1200px;
    object-fit: contain;
    border-radius: 4px;
}

.caption-layer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: transparent;
}

.caption-line {
    width: 100%;
    margin-top: 1px;
    transition: all 0.3s ease;
}

.caption-line:hover {
    opacity: 0.9;
}

/* 字幕编辑区域样式 */
.caption-section {
    margin-bottom: 30px;
}

.caption-editor {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#captionText {
    width: 100%;
    height: 120px;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    resize: vertical;
    font-family: inherit;
}

.caption-controls {
    display: flex;
    justify-content: space-between;
}

.caption-controls .btn {
    flex: 1;
    margin: 0;
    margin-top: 10px;
}

/* 样式调整区域样式 */
.style-section {
    margin-bottom: 30px;
}

.style-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.control-group label {
    font-weight: bold;
    color: #555;
    font-size: 14px;
}

.control-group select,
.control-group input[type="range"] {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.control-group input[type="color"] {
    width: 100%;
    height: 40px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

#fontSizeValue {
    font-size: 14px;
    color: #666;
    margin-top: 5px;
}

/* 按钮样式 */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.3s ease;
    background-color: #27ae60; /* 生成字幕按钮绿色背景 */
    color: #fff;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.btn-primary {
    background-color: #95a5a6; /* 下载图片按钮灰色背景 */
    color: #fff;
}

.btn-primary:hover {
    background-color: #7f8c8d;
}

.btn-secondary {
    background-color: #95a5a6;
    color: #fff;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

/* 操作按钮区域样式 */
.action-section {
    display: flex;
    justify-content: center;
    width: 100%;
    margin-top: 0;
    padding-top: 0;
}

.action-section .btn {
    flex: 1;
    margin: 0;
    margin-top: 10px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        margin: 10px;
        padding: 15px;
    }
    
    h1 {
        font-size: 24px;
    }
    
    .preview-container {
        min-height: 300px;
        padding: 10px;
    }
    
    #previewImage {
        max-height: 300px;
    }
    
    .style-controls {
        grid-template-columns: 1fr;
    }
    
    .caption-controls {
        flex-direction: column;
    }
    
    .action-section {
        flex-direction: column;
        align-items: center;
    }
    
    .btn {
        width: 100%;
        max-width: 300px;
    }
}

@media (max-width: 480px) {
    .upload-container {
        padding: 30px 20px;
    }
    
    .preview-container {
        min-height: 250px;
    }
    
    #previewImage {
        max-height: 250px;
    }
}