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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* 头部样式 */
.header-div {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin: 0 auto 20px auto;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    max-width: 1200px;
}

.header-title {
    margin: 0 0 10px 0;
    font-size: 2rem;
    font-weight: 700;
}

.header-link {
    margin-top: 10px;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

.link-a {
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    transition: background-color 0.3s ease;
}

.link-a:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

.text-white {
    color: white;
}

/* 主容器 */
.main-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 上传区域 */
.upload-section {
    background: white;
    border-radius: 10px;
    padding: 30px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.upload-area {
    border: 2px dashed #dee2e6;
    border-radius: 10px;
    padding: 40px 20px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.upload-area:hover {
    border-color: #007bff;
    background-color: #f8f9fa;
}

.upload-area.dragover {
    border-color: #007bff;
    background-color: rgba(0, 123, 255, 0.1);
}

.file-label {
    display: block;
    cursor: pointer;
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.upload-text {
    font-size: 1.2rem;
    font-weight: 500;
    color: #333;
    margin-bottom: 10px;
}

.upload-hint {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 5px;
}

#fileInput {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* 设置区域 */
.settings-section {
    background: white;
    border-radius: 10px;
    padding: 30px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.settings-container h3 {
    margin-bottom: 20px;
    color: #333;
    font-size: 1.5rem;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.setting-group {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.setting-label {
    display: block;
    margin-bottom: 15px;
    font-weight: 600;
    color: #333;
    font-size: 1.1rem;
}

/* 文字输入 */
.text-input-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.text-input {
    width: 100%;
    padding: 15px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.3s ease;
}

.text-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.text-preview {
    padding: 15px;
    background: #333;
    color: white;
    border-radius: 8px;
    font-size: 18px;
    text-align: center;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 字体控制 */
.font-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.font-family-group,
.font-size-group,
.font-weight-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.font-select {
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    background: white;
}

.font-size-group {
    position: relative;
}

#fontSize {
    width: 100%;
    margin: 5px 0;
}

#fontSizeValue {
    position: absolute;
    right: 0;
    top: 0;
    background: #007bff;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
}

/* 颜色控制 */
.color-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.color-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.color-input-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

input[type="color"] {
    width: 50px;
    height: 40px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.color-hex {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    font-family: monospace;
}

/* 位置控制 */
.position-controls {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.position-preset-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.position-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
}

.position-btn {
    padding: 8px 12px;
    border: 1px solid #ced4da;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 12px;
}

.position-btn:hover {
    background: #f8f9fa;
}

.position-btn.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.position-custom-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.position-inputs {
    display: flex;
    gap: 15px;
}

.position-input-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.position-input-item input {
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
}

/* 效果控制 */
.effect-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
}

.effect-option {
    margin-bottom: 5px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.checkbox-label:hover {
    background: rgba(0, 123, 255, 0.1);
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid #ced4da;
    border-radius: 4px;
    position: relative;
    transition: all 0.3s ease;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark {
    background: #007bff;
    border-color: #007bff;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.effect-settings {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 15px;
    background: #e9ecef;
    border-radius: 4px;
}

.stroke-width-group,
.shadow-blur-group,
.background-opacity-group {
    position: relative;
}

.stroke-width-group input[type="range"],
.shadow-blur-group input[type="range"],
.background-opacity-group input[type="range"] {
    width: 100%;
    margin: 5px 0;
}

.stroke-width-group span,
.shadow-blur-group span,
.background-opacity-group span {
    position: absolute;
    right: 0;
    top: 0;
    background: #28a745;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
}

/* 输出控制 */
.output-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.format-select {
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    background: white;
}

.quality-group {
    position: relative;
}

.quality-group input[type="range"] {
    width: 100%;
    margin: 5px 0;
}

.quality-group span {
    position: absolute;
    right: 0;
    top: 0;
    background: #17a2b8;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
}

/* 按钮样式 */
.action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: #007bff;
    color: white;
}

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

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #545b62;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3);
}

.btn-outline {
    background: transparent;
    color: #007bff;
    border: 2px solid #007bff;
}

.btn-outline:hover {
    background: #007bff;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

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

.btn-success:hover {
    background: #1e7e34;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.btn-info {
    background: #17a2b8;
    color: white;
}

.btn-info:hover {
    background: #117a8b;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(23, 162, 184, 0.3);
}

.btn-warning {
    background: #ffc107;
    color: #212529;
}

.btn-warning:hover {
    background: #e0a800;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.3);
}

/* 预览区域 */
.preview-section {
    background: white;
    border-radius: 10px;
    padding: 30px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.preview-container h3 {
    margin-bottom: 20px;
    color: #333;
    font-size: 1.5rem;
}

.preview-canvas-container {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px dashed #dee2e6;
    overflow: auto;
}

#previewCanvas {
    max-width: 100%;
    height: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.preview-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

/* 使用说明 */
.instructions-section {
    background: white;
    border-radius: 10px;
    padding: 30px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.instructions-container h3 {
    margin-bottom: 20px;
    color: #333;
    font-size: 1.5rem;
}

.instructions-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.instruction-item {
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #007bff;
}

.instruction-item h4 {
    margin-bottom: 10px;
    color: #333;
    font-size: 1.1rem;
}

.instruction-item p {
    color: #666;
    line-height: 1.5;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .main-container {
        padding: 0 10px;
    }
    
    .upload-section,
    .settings-section,
    .preview-section,
    .instructions-section {
        padding: 20px;
    }
    
    .settings-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .action-buttons,
    .preview-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .btn {
        width: 100%;
        max-width: 300px;
    }
    
    .header-link {
        flex-direction: column;
        gap: 10px;
    }
    
    .link-a {
        width: 100%;
        text-align: center;
    }
    
    .position-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .position-inputs {
        flex-direction: column;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .header-title {
        font-size: 1.5rem;
    }
    
    .settings-container h3,
    .preview-container h3,
    .instructions-container h3 {
        font-size: 1.3rem;
    }
    
    .upload-icon {
        font-size: 2rem;
    }
    
    .upload-text {
        font-size: 1rem;
    }
    
    .position-buttons {
        grid-template-columns: 1fr;
    }
    
    .font-controls,
    .color-controls,
    .position-controls {
        gap: 10px;
    }
}
