* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', sans-serif;
    background-color: #f5f5f5;
    color: #333;
    overflow: hidden;
    height: 100vh;
}

.page {
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px;
    overflow: hidden;
}

/* 上传页样式 */
.upload-container {
    text-align: center;
    margin-top: auto;
    margin-bottom: auto;
}

.upload-container h1 {
    font-size: 24px;
    margin-bottom: 30px;
    color: #2c3e50;
}

.upload-buttons {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
}

.upload-btn, #camera-btn {
    padding: 15px 30px;
    font-size: 16px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 200px;
}

.upload-btn:hover, #camera-btn:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
}

/* 海报生成页样式 */
.preview-section {
    width: 100%;
    max-width: 600px;
    margin: 10px 0;
    background-color: white;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: center;
    overflow: visible;
    flex: 1;
    max-height: calc(100vh - 160px);
}

#poster-preview {
    width: 100%;
    max-width: 500px;
    height: 100%;
    background-color: #fff;
    border: 1px solid #ddd;
    position: relative;
    overflow: hidden;
    object-fit: contain;
}

/* 确保模板内部元素完整显示 */
#poster-preview .poster {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    overflow: hidden !important;
}

/* 模板选择弹出层 */
.template-popup {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: white;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.15);
    transform: translateY(100%);
    transition: transform 0.3s ease;
    z-index: 1000;
    max-height: 40vh;
    display: flex;
    flex-direction: column;
    pointer-events: auto;
}

.template-popup.active {
    transform: translateY(0);
    pointer-events: auto;
}

/* 弹出层头部 */
.popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
}

.popup-header h3 {
    margin: 0;
    font-size: 18px;
    color: #2c3e50;
}

/* 关闭按钮 */
.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: #95a5a6;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background-color: #f5f5f5;
    color: #e74c3c;
}

/* 模板滚动栏 */
.template-scrollbar {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    padding: 15px;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
    flex: 1;
    align-items: center;
}

.template-scrollbar::-webkit-scrollbar {
    height: 6px;
}

.template-scrollbar::-webkit-scrollbar-thumb {
    background-color: #ddd;
    border-radius: 3px;
}

/* 模板项 */
.template-item {
    flex: 0 0 auto;
    width: 80px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.template-item:hover {
    transform: translateY(-5px);
}

/* 模板缩略图 */
.template-thumbnail {
    width: 80px;
    height: 120px;
    background-color: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    padding: 8px;
    margin-bottom: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

/* 模板名称 */
.template-name {
    text-align: center;
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

/* 模板预览样式由JavaScript自动生成，不需要手动添加 */
.template-thumbnail {
    display: flex;
    align-items: center;
    justify-content: center;
}

.template-thumbnail:hover {
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    border-color: #3498db;
}

.action-section {
    width: 100%;
    max-width: 600px;
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 15px 0;
    flex-wrap: nowrap;
}

#toggle-template, #regenerate-content, #download-poster {
    padding: 12px 15px;
    font-size: 14px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 100px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    flex: 1;
    max-width: 180px;
}

/* 选择模板按钮 */
#toggle-template {
    background-color: #3498db;
    color: white;
    position: relative;
    z-index: 999;
    margin: 0;
}

#toggle-template:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

/* 重新生成文案按钮 */
#regenerate-content {
    background-color: #95a5a6;
    color: white;
}

#regenerate-content:hover {
    background-color: #7f8c8d;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

/* 下载海报按钮 */
#download-poster {
    background-color: #2ecc71;
    color: white;
}

#download-poster:hover {
    background-color: #27ae60;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

/* 适配手机端 */
@media (max-width: 768px) {
    body {
        overflow: hidden;
    }
    
    .page {
        padding: 10px;
        height: 100vh;
    }
    
    .upload-container {
        margin-top: auto;
        margin-bottom: auto;
    }

    .upload-container h1 {
        font-size: 20px;
        margin-bottom: 20px;
    }

    .preview-section {
        padding: 10px;
        max-height: calc(100vh - 140px);
    }

    #poster-preview {
        max-width: 100%;
        height: 100%;
    }

    .action-section {
        gap: 8px;
    }

    #toggle-template, #regenerate-content, #download-poster {
        width: calc(33.333% - 8px);
        min-width: auto;
        padding: 10px 8px;
        font-size: 12px;
    }
}