/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

/* 容器样式 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 头部样式 */
header {
    text-align: center;
    margin-bottom: 40px;
    padding: 20px 0;
}

header h1 {
    color: #2c3e50;
    font-size: 2.5em;
    margin-bottom: 10px;
}

header p {
    color: #7f8c8d;
    font-size: 1.2em;
}

/* 主要内容区域 */
main {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 30px;
    margin-bottom: 30px;
}

/* 上传区域样式 */
.upload-section {
    text-align: center;
    margin-bottom: 30px;
}

.upload-container {
    margin-bottom: 20px;
}

.upload-area {
    border: 2px dashed #3498db;
    border-radius: 10px;
    padding: 40px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: #f8fafc;
}

.upload-area:hover {
    border-color: #2980b9;
    background-color: #f1f5f9;
}

.upload-area i {
    font-size: 3em;
    color: #3498db;
    margin-bottom: 15px;
}

.upload-area p {
    font-size: 1.2em;
    color: #2c3e50;
    margin-bottom: 10px;
}

.upload-area span {
    color: #7f8c8d;
    font-size: 0.9em;
}

/* 预览区域样式 */
.preview-section {
    margin-top: 30px;
}

.preview-container {
    display: flex;
    gap: 30px;
    margin-bottom: 30px;
}

.preview-box {
    flex: 1;
    text-align: center;
}

.preview-box h3 {
    margin-bottom: 15px;
    color: #2c3e50;
}

.image-container {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f8fafc;
}

.image-container img {
    max-width: 100%;
    max-height: 400px;
    object-fit: contain;
}

/* 按钮样式 */
.actions {
    display: flex;
    gap: 20px;
    justify-content: center;
    align-items: center;
    margin-top: 20px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn i {
    font-size: 1.1em;
}

.primary-btn {
    background-color: #3498db;
    color: white;
}

.primary-btn:hover {
    background-color: #2980b9;
}

.primary-btn:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
}

.download-btn {
    background-color: #2ecc71;
    color: white;
}

.download-btn:hover {
    background-color: #27ae60;
}

.download-btn:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
}

/* 背景控制区域样式 */
.background-controls {
    display: flex;
    gap: 20px;
    align-items: center;
    padding: 15px;
    background-color: #f8fafc;
    border-radius: 8px;
    margin: 20px 0;
}

/* 背景颜色选择器样式 */
.bg-color-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.bg-color-container label {
    color: #2c3e50;
    font-weight: 500;
}

#bg-color {
    width: 50px;
    height: 30px;
    padding: 0;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

/* 背景图片控制样式 */
.bg-image-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.bg-image-container label {
    color: #2c3e50;
    font-weight: 500;
}

/* 次要按钮样式 */
.secondary-btn {
    background-color: #95a5a6;
    color: white;
    padding: 8px 16px;
}

.secondary-btn:hover {
    background-color: #7f8c8d;
}

#reset-bg-btn {
    background-color: #e74c3c;
}

#reset-bg-btn:hover {
    background-color: #c0392b;
}

/* 加载动画样式 */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: #3498db;
}

.loading i {
    font-size: 2em;
}

/* API Key 模态框样式 */
.api-key-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 10px;
    max-width: 500px;
    width: 90%;
    text-align: center;
}

.modal-content h2 {
    color: #2c3e50;
    margin-bottom: 15px;
}

.modal-content p {
    color: #7f8c8d;
    margin-bottom: 20px;
}

.modal-content a {
    color: #3498db;
    text-decoration: none;
}

.modal-content a:hover {
    text-decoration: underline;
}

#api-key-input {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1em;
}

#save-api-key {
    background-color: #3498db;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s ease;
}

#save-api-key:hover {
    background-color: #2980b9;
}

/* 页脚样式 */
footer {
    text-align: center;
    padding: 20px 0;
    color: #7f8c8d;
}

footer a {
    color: #3498db;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* 透明背景选项样式 */
.remove-bg-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.transparent-option {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.9em;
    color: #2c3e50;
}

.transparent-option input[type="checkbox"] {
    cursor: pointer;
}

/* 下载按钮容器样式 */
.download-container {
    display: flex;
    gap: 10px;
    justify-content: center;
    width: 100%;
    margin-top: 10px;
}

.download-container .download-btn {
    flex: 1;
    max-width: 200px;
    justify-content: center;
}

/* 棋盘格背景样式 - 用于显示透明效果 */
.transparent-bg {
    background-image: linear-gradient(45deg, #ccc 25%, transparent 25%),
                      linear-gradient(-45deg, #ccc 25%, transparent 25%),
                      linear-gradient(45deg, transparent 75%, #ccc 75%),
                      linear-gradient(-45deg, transparent 75%, #ccc 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .preview-container {
        flex-direction: column;
    }

    .actions {
        flex-direction: column;
        gap: 15px;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .bg-color-container {
        width: 100%;
        justify-content: center;
    }
}


/* API Key 设置按钮样式 */
.settings-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background-color: transparent;
    border: 2px solid #3498db;
    color: #3498db;
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.settings-btn:hover {
    background-color: #3498db;
    color: white;
}

header {
    position: relative;
}