/* ============ 公众号爆文生成器 - 页面专用样式 ============ */

/* 全局变体：表单区背景沿用首页渐变 */
body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

/* ============ 表单容器 ============ */
.wechat-form {
    background: rgba(255, 255, 255, .06);
    padding: 22px 24px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, .08);
}
.w-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px 16px;
    margin-bottom: 14px;
}
.w-field { display: flex; flex-direction: column; }
.w-label {
    font-size: 13px;
    color: rgba(255, 255, 255, .85);
    margin-bottom: 6px;
    font-weight: 500;
}
.w-required { color: #ff5722; margin-left: 2px; }
.wechat-form .layui-input,
.wechat-form .layui-textarea {
    background: rgba(255, 255, 255, .95);
    border: 1px solid rgba(255, 255, 255, .4);
    color: #333;
}
.w-textarea { min-height: 110px; resize: vertical; }

/* 操作按钮 */
.w-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px dashed rgba(255, 255, 255, .12);
}

/* ============ 结果区 ============ */
.wechat-result {
    margin-top: 4px;
}
.w-card {
    background: rgba(255, 255, 255, .96);
    color: #2c3e50;
    border-radius: 12px;
    padding: 20px 22px;
    margin-bottom: 16px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .08);
}
.w-h3 {
    font-size: 17px;
    font-weight: 600;
    margin: 0 0 14px;
    color: #07c160;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ============ 候选标题 ============ */
.title-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.title-option {
    padding: 12px 16px;
    border: 2px solid #e8e8e8;
    border-radius: 10px;
    cursor: pointer;
    transition: all .15s;
    background: #fff;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 15px;
    line-height: 1.5;
}
.title-option:hover {
    border-color: #07c160;
    background: #f6fef9;
}
.title-option.active {
    border-color: #07c160;
    background: #f0faf4;
    box-shadow: 0 2px 8px rgba(7, 193, 96, .15);
}
.title-option .title-idx {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: #07c160;
    color: #fff;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}
.title-option .title-text { flex: 1; }

/* ============ Tab 切换 ============ */
.result-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 14px;
    border-bottom: 2px solid #e8e8e8;
}
.result-tab {
    padding: 10px 20px;
    background: transparent;
    border: none;
    color: #888;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all .15s;
}
.result-tab:hover { color: #07c160; }
.result-tab.active {
    color: #07c160;
    border-bottom-color: #07c160;
}

.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ============ 手机框预览 ============ */
.phone-frame {
    width: 375px;
    max-width: 100%;
    margin: 0 auto;
    background: #1a1a1a;
    border-radius: 36px;
    padding: 14px 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .2);
}
.phone-notch {
    width: 100px;
    height: 22px;
    background: #1a1a1a;
    border-radius: 0 0 14px 14px;
    margin: 0 auto -8px;
    position: relative;
    z-index: 2;
}
.phone-screen {
    background: #fff;
    border-radius: 6px;
    min-height: 480px;
    max-height: 640px;
    overflow-y: auto;
    padding: 24px 18px 30px;
    /* 模拟微信阅读的字体 */
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
                 "Microsoft YaHei", "Helvetica Neue", sans-serif;
    color: #333;
    line-height: 1.85;
    font-size: 16px;
}

/* ============ 公众号文章风格（HTML 预览内部） ============ */
#preview .wx-title {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.4;
    margin: 0 0 18px;
    color: #1a1a1a;
    text-align: center;
}
#preview .wx-meta {
    text-align: center;
    color: #999;
    font-size: 12px;
    margin: 0 0 22px;
    padding-bottom: 14px;
    border-bottom: 1px dashed #eee;
}
#preview p {
    margin: 0 0 14px;
    text-indent: 2em;
    line-height: 1.85;
    color: #333;
}
#preview h2 {
    font-size: 18px;
    font-weight: 700;
    color: #07c160;
    margin: 26px 0 14px;
    padding-left: 10px;
    border-left: 4px solid #07c160;
    line-height: 1.5;
}
#preview strong { color: #07c160; font-weight: 700; }
#preview em { font-style: italic; color: #555; }
#preview blockquote {
    margin: 16px 0;
    padding: 12px 16px;
    background: #f6fef9;
    border-left: 4px solid #07c160;
    color: #555;
    border-radius: 0 6px 6px 0;
    text-indent: 0;
}
#preview blockquote p { text-indent: 0; margin: 0; }
#preview ul {
    margin: 14px 0;
    padding-left: 28px;
}
#preview ul li {
    margin-bottom: 6px;
    line-height: 1.75;
}
#preview br { line-height: 1.85; }

/* ============ HTML 源码 textarea ============ */
.source-pane {
    width: 100%;
    min-height: 360px;
    max-height: 540px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px 14px;
    font-family: 'SF Mono', Consolas, Menlo, monospace;
    font-size: 12.5px;
    line-height: 1.6;
    color: #2c3e50;
    background: #fafbfc;
    resize: vertical;
    white-space: pre-wrap;
    word-break: break-all;
}

/* ============ 底部按钮 ============ */
.w-result-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px dashed #e8e8e8;
}
.w-result-actions .layui-btn { flex: 1; min-width: 120px; }

/* ============ 错误/Loading ============ */
.error-box {
    background: #fff5f5;
    border: 1px solid #ffccc7;
    color: #cf1322;
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}
.loading-box {
    text-align: center;
    padding: 30px 0;
    color: rgba(255, 255, 255, .85);
}
.loading-spinner {
    display: inline-block;
    position: relative;
    width: 40px;
    height: 40px;
    margin-bottom: 12px;
}
.loading-spinner > div {
    position: absolute;
    top: 16px; left: 16px;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #07c160;
    animation: loading-bounce 1.2s infinite ease-in-out;
}
.loading-spinner > div:nth-child(1) { top: 4px;  left: 16px; animation-delay: -0.32s; }
.loading-spinner > div:nth-child(2) { top: 16px; left: 28px; animation-delay: -0.16s; }
.loading-spinner > div:nth-child(3) { top: 28px; left: 16px; animation-delay: 0s; }
.loading-spinner > div:nth-child(4) { top: 16px; left: 4px;  animation-delay: -0.48s; }
@keyframes loading-bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* ============ Tip 浮层（layui 替代） ============ */
.w-tip {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, .78);
    color: #fff;
    padding: 12px 22px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 99999;
    animation: tipFade .2s ease-out;
    pointer-events: none;
}
@keyframes tipFade {
    from { opacity: 0; transform: translate(-50%, -45%); }
    to   { opacity: 1; transform: translate(-50%, -50%); }
}

/* ============ Fallback 提示条 ============ */
.w-fallback {
    background: #fff3e0;
    color: #e65100;
    font-size: 13px;
    text-align: center;
}

/* ============ 小屏适配 ============ */
@media (max-width: 640px) {
    .wechat-form { padding: 16px; }
    .w-row { grid-template-columns: 1fr 1fr; gap: 10px; }
    .phone-frame {
        width: 100%;
        border-radius: 24px;
        padding: 10px 6px;
    }
    .phone-screen {
        padding: 18px 14px;
        font-size: 15px;
        max-height: 500px;
    }
    #preview .wx-title { font-size: 19px; }
    #preview h2 { font-size: 16px; }
    .result-tab { padding: 8px 14px; font-size: 13px; }
    .w-result-actions .layui-btn { font-size: 13px; padding: 0 12px; }
}