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

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

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* 头部样式 */
header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

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

header p {
    color: #7f8c8d;
    font-size: 1.1em;
}

/* 主内容区域 */
.main-content {
    display: flex;
    gap: 30px;
    height: calc(100vh - 200px);
}

/* 控制面板样式 */
.control-panel {
    flex: 1;
    background-color: #fff;
    border-radius: 8px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow-y: auto;
}

.control-panel h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
}

.setting-group {
    margin-bottom: 25px;
}

.setting-group h3 {
    color: #34495e;
    margin-bottom: 15px;
    font-size: 1.2em;
}

/* 模板选择器 - 移除下边距相关样式 */
.template-selector {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.template-thumbnail {
    width: 120px;
    height: 80px;
    object-fit: cover;
    border: 2px solid transparent;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.template-selector input[type="radio"]:checked + .template-thumbnail {
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.upload-template {
    width: 120px;
    height: 80px;
    border: 2px dashed #ddd;
    border-radius: 5px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-template:hover {
    border-color: #3498db;
    background-color: #f8f9fa;
}

.upload-template input[type="file"] {
    display: none;
}

/* 年级和老师选择 */
.grade-teacher-selection {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

select {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1em;
    background-color: #fff;
    cursor: pointer;
}

.custom-teacher {
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.custom-teacher input[type="text"] {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

/* 学生姓名输入 */
.student-name-input textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    resize: vertical;
}

.name-display-options {
    margin-top: 10px;
}

/* 字体设置 */
.font-settings {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.font-style-options {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.font-style-options input[type="color"] {
    width: 50px;
    height: 35px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

/* 排版设置 */
.layout-settings {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.margin-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.margin-controls label,
.line-spacing label,
.first-line-indent label {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.margin-controls input[type="range"],
.line-spacing input[type="range"],
.first-line-indent input[type="range"] {
    flex: 1;
    min-width: 150px;
}

/* 自定义文本 */
.custom-text {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.custom-text textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    resize: vertical;
}

/* 操作按钮 */
.action-buttons {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    flex-wrap: wrap;
}

button {
    padding: 12px 24px;
    border: none;
    border-radius: 5px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

#generateBtn {
    background-color: #3498db;
    color: white;
}

#generateBtn:hover {
    background-color: #2980b9;
}

#lockBtn {
    background-color: #e74c3c;
    color: white;
}

#lockBtn:hover {
    background-color: #c0392b;
}

#lockBtn:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
}

/* 新增：图片调整按钮样式 */
#imageEditBtn {
    background-color: #f39c12;
    color: white;
}

#imageEditBtn:hover {
    background-color: #e67e22;
}

#imageEditBtn:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
}

/* 图片大小控制样式 */
.image-size-controls label {
    display: flex;
    align-items: center;
    gap: 10px;
}

.image-size-controls input[type="range"] {
    flex: 1;
    max-width: 200px;
}

.image-size-controls input[type="checkbox"] {
    margin: 0;
}

/* 预览面板样式 */
.preview-panel {
    flex: 1;
    background-color: #fff;
    border-radius: 8px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

/* 下载进度条样式 */
.download-progress {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    min-width: 300px;
}

.download-progress .progress-header {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 15px;
    text-align: center;
}

.download-progress .progress-bar {
    height: 20px;
    background-color: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}

.download-progress .progress-fill {
    height: 100%;
    background-color: #4CAF50;
    transition: width 0.3s ease;
}

.download-progress .progress-text {
    text-align: center;
    font-size: 14px;
    color: #666;
}

.preview-panel h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
}

.preview-container {
    flex: 1;
    border: 2px solid #ddd;
    border-radius: 5px;
    overflow: hidden;
    position: relative;
}

#letterPreview {
    width: 100%;
    height: 100%;
    padding: 20px;
    overflow-y: auto;
    background-color: white;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    min-height: 800px;
    line-height: 1.5;
    font-size: 16px;
    font-family: 'dingliexidafont', sans-serif;
    color: #000000;
}

#letterPreview p {
    margin-bottom: 1em;
    text-indent: 2em;
}

#letterPreview p:nth-child(1),
#letterPreview p:nth-last-child(2),
#letterPreview p:last-child {
    text-indent: 0;
}

#letterPreview p:nth-last-child(2),
#letterPreview p:last-child {
    text-align: right;
}

.status-info {
    margin-top: 15px;
    padding: 10px;
    border-radius: 5px;
    text-align: center;
    font-weight: bold;
}

.status-locked {
    background-color: #f1c40f;
    color: #8e44ad;
}

.status-unlocked {
    background-color: #2ecc71;
    color: white;
}

/* 新增：图片编辑模式状态样式 */
.status-image-edit {
    background-color: #f39c12;
    color: white;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .main-content {
        flex-direction: column;
        height: auto;
    }
    
    .control-panel,
    .preview-panel {
        min-height: 500px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .template-selector {
        justify-content: center;
    }
}

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

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}