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

:root {
    /* 微信颜色风格 */
    --wechat-green: #07C160;
    --wechat-green-dark: #06AD56;
    --wechat-green-light: #E7F8F0;
    --text-primary: #191919;
    --text-secondary: #666666;
    --text-tertiary: #999999;
    --bg-page: #EDEDED;
    --bg-card: #FFFFFF;
    --border-color: #E5E5E5;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 4px 20px rgba(0, 0, 0, 0.12);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto",
        "Helvetica Neue", "PingFang SC", "Hiragino Sans GB",
        "Microsoft YaHei", sans-serif;
    background: var(--bg-page);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 头部样式 */
.header {
    text-align: center;
    padding: 30px 20px;
    background: linear-gradient(135deg, var(--wechat-green), var(--wechat-green-dark));
    border-radius: 16px;
    margin-bottom: 20px;
    color: white;
    box-shadow: var(--shadow);
}

.header h1 {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 8px;
}

.subtitle {
    font-size: 14px;
    opacity: 0.9;
}

/* 主要内容区 */
.main-content {
    flex: 1;
}

/* 卡片样式 */
.card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.card h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

/* 输入模式切换 */
.input-mode-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.tab-btn {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.tab-btn:hover {
    border-color: var(--wechat-green);
    color: var(--wechat-green);
}

.tab-btn.active {
    background: var(--wechat-green-light);
    border-color: var(--wechat-green);
    color: var(--wechat-green);
    font-weight: 500;
}

/* 输入区域 */
.input-mode {
    margin-top: 16px;
}

.input-mode.hidden {
    display: none;
}

.chat-textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    line-height: 1.6;
    resize: vertical;
    font-family: inherit;
    transition: border-color 0.2s ease;
}

.chat-textarea:focus {
    outline: none;
    border-color: var(--wechat-green);
}

/* 上传区域 */
.upload-area {
    position: relative;
}

.file-input {
    display: none;
}

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

.upload-content {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    transition: all 0.2s ease;
}

.upload-content:hover {
    border-color: var(--wechat-green);
    background: var(--wechat-green-light);
}

.upload-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 12px;
}

.upload-content p {
    color: var(--text-secondary);
    margin: 4px 0;
}

.upload-hint {
    font-size: 12px;
    color: var(--text-tertiary);
}

/* 图片预览 */
#image-preview-container {
    margin-top: 16px;
    text-align: center;
}

#image-preview {
    max-width: 100%;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 12px;
}

.btn-remove {
    padding: 8px 16px;
    background: #FA5151;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: opacity 0.2s ease;
}

.btn-remove:hover {
    opacity: 0.9;
}

/* OCR 结果 */
.ocr-result {
    margin-top: 16px;
    padding: 12px;
    background: var(--wechat-green-light);
    border-radius: 8px;
    border-left: 3px solid var(--wechat-green);
}

.ocr-result h3 {
    font-size: 14px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

#ocr-text {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-secondary);
    white-space: pre-wrap;
}

/* 风格选择 */
.style-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.style-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 12px;
    border: 2px solid var(--border-color);
    background: white;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.style-btn:hover {
    border-color: var(--wechat-green);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.style-btn.selected {
    border-color: var(--wechat-green);
    background: var(--wechat-green-light);
}

.style-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.style-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.style-desc {
    font-size: 12px;
    color: var(--text-tertiary);
}

/* 生成按钮 */
.generate-btn {
    width: 100%;
    padding: 16px;
    background: var(--wechat-green);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}

.generate-btn:hover:not(:disabled) {
    background: var(--wechat-green-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.generate-btn:disabled {
    background: var(--border-color);
    cursor: not-allowed;
    opacity: 0.6;
}

/* 结果展示 */
.result-section {
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-content {
    min-height: 100px;
}

.loading {
    text-align: center;
    padding: 40px 20px;
}

.spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 16px;
    border: 3px solid var(--border-color);
    border-top-color: var(--wechat-green);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading p {
    color: var(--text-secondary);
    font-size: 14px;
}

.result-text {
    padding: 16px;
    background: var(--wechat-green-light);
    border-radius: 8px;
    font-size: 15px;
    line-height: 1.8;
    color: var(--text-primary);
    white-space: pre-wrap;
}

.copy-btn {
    width: 100%;
    padding: 12px;
    margin-top: 12px;
    background: white;
    border: 1px solid var(--wechat-green);
    color: var(--wechat-green);
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.copy-btn:hover {
    background: var(--wechat-green-light);
}

/* 页脚 */
.footer {
    text-align: center;
    padding: 20px;
    color: var(--text-tertiary);
    font-size: 12px;
}

/* 工具类 */
.hidden {
    display: none !important;
}

/* 移动端适配 */
@media (max-width: 600px) {
    .container {
        padding: 12px;
    }

    .header {
        padding: 20px 16px;
        border-radius: 12px;
    }

    .header h1 {
        font-size: 24px;
    }

    .card {
        padding: 16px;
        border-radius: 10px;
    }

    .style-buttons {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .style-btn {
        flex-direction: row;
        justify-content: flex-start;
        padding: 12px 16px;
    }

    .style-icon {
        font-size: 28px;
        margin-bottom: 0;
        margin-right: 12px;
    }

    .style-name,
    .style-desc {
        text-align: left;
    }
}