/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'MiSans', sans-serif;
}

:root {
    --primary-color: #4361ee;
    --secondary-color: #3f37c9;
    --text-color: #293241;
    --bg-color: #f8f9fa;
    --card-bg: #ffffff;
    --border-color: #e9ecef;
    --shadow-color: rgba(0, 0, 0, 0.1);
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

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

.main-title {
    text-align: center;
    margin-bottom: 30px;
    color: var(--primary-color);
    font-weight: 600;
}

/* 应用容器 */
.app-container {
    display: flex;
    flex-direction: row;
    gap: 30px;
    flex-wrap: wrap;
}

/* 输入区域样式 */
.input-section {
    flex: 1;
    min-width: 300px;
    background-color: var(--card-bg);
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 12px var(--shadow-color);
    max-height: 80vh;
    overflow-y: auto;
}

.input-section h2 {
    margin-bottom: 20px;
    font-weight: 500;
    color: var(--primary-color);
}

.input-group {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.input-group input[type="text"],
.input-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 16px;
    margin-bottom: 10px;
    resize: vertical;
}

.controls {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

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

.control-item label {
    font-size: 14px;
    margin-bottom: 3px;
}

.control-item input[type="number"] {
    width: 80px;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
}

.control-item input[type="color"] {
    width: 80px;
    height: 35px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    padding: 2px;
    cursor: pointer;
}

.file-upload {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

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

.file-upload button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.file-upload button:hover {
    background-color: var(--secondary-color);
}

.save-section {
    text-align: center;
    margin-top: 30px;
}

#save-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: background-color 0.3s, transform 0.2s;
}

#save-btn:hover {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
}

/* 预览区域样式 */
.preview-section {
    flex: 1;
    min-width: 300px;
    background-color: var(--card-bg);
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 12px var(--shadow-color);
    display: flex;
    flex-direction: column;
}

.preview-section h2 {
    margin-bottom: 20px;
    font-weight: 500;
    color: var(--primary-color);
    text-align: center;
}

.preview-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background-color: #f0f2f5;
    border-radius: 8px;
}

/* 封面预览样式 */
#cover-preview {
    position: relative;
    width: 300px;
    height: 400px;
    background: white;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* 封面背景层 */
.cover-background {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    z-index: 0;
}

/* 封面插图样式 */
.cover-image-container {
    flex: 0 0 auto;
    position: relative;
    width: 100%;
    height: 60%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: transparent;
    z-index: 1;
}

#cover-image {
    max-width: 80%;
    max-height: 80%;
    object-fit: contain;
    z-index: 2;
}

/* 标题样式 */
#preview-title {
    flex: 0 0 auto;
    position: relative;
    width: 100%;
    padding: 0 20px;
    margin-top: -3%;
    font-size: 20px;
    font-weight: 600;
    text-align: center;
    color: var(--text-color);
    z-index: 2;
    background: transparent;
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.3;
}

#preview-title[data-lines="2"] {
    line-height: 1.2;
    letter-spacing: -0.5px;
}

/* Logo和站点名样式 */
.site-info {
    flex: 1;
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    z-index: 2;
    padding-bottom: 0%;
    background: transparent;
}

.logo-container {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

#logo-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#preview-site-name {
    font-size: 12px;
    font-weight: 900;
    color: var(--text-color);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }
    
    .preview-section {
        margin-top: 20px;
    }
    
    #cover-preview {
        width: 240px;
        height: 320px;
    }
    
    #preview-title {
        font-size: 18px;
    }
    
    .logo-container {
        width: 15px;
        height: 15px;
    }
    
    #preview-site-name {
        font-size: 10px;
    }
}
