/* ============== 全局 ============== */
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.app-wrap {
    max-width: 920px;
    margin: 0 auto;
    padding: 32px 16px 48px;
}

/* ============== 头部 ============== */
.app-header {
    text-align: center;
    color: #fff;
    margin-bottom: 24px;
}
.app-title {
    font-size: 30px;
    font-weight: 600;
    margin: 0 0 8px;
    letter-spacing: 1px;
    text-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.app-title .layui-icon {
    margin-right: 8px;
    font-size: 28px;
}
.app-subtitle {
    margin: 0;
    font-size: 14px;
    opacity: .9;
    line-height: 1.7;
}
.app-subtitle strong {
    font-weight: 600;
    margin: 0 2px;
}
.subtitle-hint {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    opacity: .8;
}
@media (max-width: 640px) {
    .subtitle-hint { font-size: 11px; }
}

/* ============ 跨页面工具入口卡 ============ */
.cross-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    margin-bottom: 18px;
    background: linear-gradient(135deg, rgba(255,255,255,.12) 0%, rgba(255,255,255,.06) 100%);
    border: 1px solid rgba(255,255,255,.18);
    border-radius: 10px;
    color: #fff;
    text-decoration: none;
    transition: all .2s;
    backdrop-filter: blur(6px);
}
.cross-link:hover {
    background: linear-gradient(135deg, rgba(255,255,255,.22) 0%, rgba(255,255,255,.12) 100%);
    border-color: rgba(255,255,255,.35);
    transform: translateY(-1px);
    color: #fff;
    text-decoration: none;
}
.cross-link-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #16baaa;
    border-radius: 50%;
    font-size: 22px;
    color: #fff;
    flex-shrink: 0;
}
.cross-link-body { flex: 1; min-width: 0; }
.cross-link-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 3px;
}
.cross-link-desc {
    font-size: 12px;
    opacity: .8;
    line-height: 1.5;
}
.cross-link-arrow {
    font-size: 18px;
    opacity: .7;
    flex-shrink: 0;
}
@media (max-width: 640px) {
    .cross-link { padding: 10px 14px; gap: 10px; }
    .cross-link-icon { width: 36px; height: 36px; font-size: 18px; }
    .cross-link-title { font-size: 14px; }
    .cross-link-desc { font-size: 11px; }
}

/* ============== 卡片容器 ============== */
.layui-tab-content,
.input-card,
.result-container,
.error-box,
.loading-box {
    background: #fff;
    border-radius: 12px;
}
.app-tabs .layui-tab-title {
    background: rgba(255,255,255,.15);
    border-radius: 12px 12px 0 0;
    border: none;
}
.app-tabs .layui-tab-title li {
    color: #fff;
    padding: 0 28px;
    line-height: 44px;
    border-radius: 12px 12px 0 0;
}
.app-tabs .layui-tab-title li.layui-this {
    background: #fff;
    color: #5b6ee1;
    font-weight: 600;
}
.layui-tab-content {
    padding: 24px;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,.1);
}

/* ============== 输入区 ============== */
.input-card {
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,.05);
    border: 1px solid #f0f0f0;
}
.input-label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
    font-size: 14px;
}
.product-input {
    width: 100%;
    min-height: 110px;
    resize: vertical;
    border: 1px solid #e6e6e6;
    border-radius: 8px;
    padding: 12px 14px;
    font-size: 14px;
    line-height: 1.6;
    transition: border-color .2s;
}
.product-input:focus {
    outline: none;
    border-color: #5b6ee1;
    box-shadow: 0 0 0 3px rgba(91,110,225,.12);
}
.input-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 14px;
}
.char-count {
    font-size: 12px;
    color: #999;
}
.footer-right {
    display: flex;
    align-items: center;
    gap: 10px;
}
.count-label {
    font-size: 13px;
    color: #666;
}
.count-select {
    height: 32px;
    padding: 0 10px;
    border: 1px solid #e6e6e6;
    border-radius: 6px;
    background: #fff;
    font-size: 13px;
    color: #333;
    cursor: pointer;
    outline: none;
    transition: border-color .2s;
}
.count-select:hover,
.count-select:focus {
    border-color: #5b6ee1;
}

/* ============== 标题生成器 ============== */
.title-product-input {
    width: 100%;
    height: 38px;
    border: 1px solid #e6e6e6;
    border-radius: 8px;
    padding: 0 14px;
    font-size: 14px;
    transition: border-color .2s;
}
.title-product-input:focus {
    outline: none;
    border-color: #5b6ee1;
    box-shadow: 0 0 0 3px rgba(91,110,225,.12);
}
.points-input {
    width: 100%;
    min-height: 90px;
    resize: vertical;
    border: 1px solid #e6e6e6;
    border-radius: 8px;
    padding: 12px 14px;
    font-size: 14px;
    line-height: 1.6;
    transition: border-color .2s;
}
.points-input:focus {
    outline: none;
    border-color: #5b6ee1;
    box-shadow: 0 0 0 3px rgba(91,110,225,.12);
}
/* 标题卡片：稍紧凑 + 暖色调，与卖点卡片做视觉区分 */
.title-card {
    background: linear-gradient(135deg, #fff8f0 0%, #fff3e0 100%);
    border-color: #ffe0b2;
}
.title-card:hover {
    border-color: #ff9800;
    box-shadow: 0 6px 16px rgba(255,152,0,.18);
}
.title-card .point-index {
    background: #ff9800;
}

/* ============== Loading ============== */
.loading-box {
    margin-top: 20px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,.05);
}
.loading-spinner {
    display: inline-block;
    width: 50px;
    height: 50px;
    position: relative;
}
.loading-spinner div {
    position: absolute;
    top: 22px; left: 22px;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #5b6ee1;
    animation: loading-bounce 1.2s infinite ease-in-out;
}
.loading-spinner div:nth-child(1) { top: 4px;  left: 22px; animation-delay: -0.32s; }
.loading-spinner div:nth-child(2) { top: 12px; left: 36px; animation-delay: -0.16s; }
.loading-spinner div:nth-child(3) { top: 22px; left: 40px; animation-delay: 0s;      }
.loading-spinner div:nth-child(4) { top: 32px; left: 36px; animation-delay: 0.16s;  }
@keyframes loading-bounce {
    0%, 80%, 100% { transform: scale(0); }
    40%           { transform: scale(1); }
}
.loading-text {
    margin-top: 16px;
    color: #666;
    font-size: 14px;
}

/* ============== 错误提示 ============== */
.error-box {
    margin-top: 20px;
    padding: 14px 18px;
    background: #fef0f0;
    color: #e85a5a;
    border: 1px solid #fbc4c4;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}
.error-box .layui-icon {
    font-size: 18px;
}

/* ============== 结果卡片 ============== */
.result-container {
    margin-top: 20px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,.05);
}
.result-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin: 0 0 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
}
.result-title .layui-icon {
    color: #5b6ee1;
    margin-right: 6px;
}
.point-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}
@media (min-width: 640px) {
    .point-list { grid-template-columns: 1fr 1fr; }
}
.point-card {
    position: relative;
    padding: 16px 16px 16px 48px;
    background: linear-gradient(135deg, #f8f9ff 0%, #f0f3ff 100%);
    border: 1px solid #e8ecff;
    border-radius: 10px;
    transition: all .25s;
    animation: point-fade-in .4s ease both;
}
.point-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(91,110,225,.18);
    border-color: #5b6ee1;
}
.point-card .point-index {
    position: absolute;
    top: 14px;
    left: 14px;
    width: 26px;
    height: 26px;
    line-height: 26px;
    text-align: center;
    background: #5b6ee1;
    color: #fff;
    border-radius: 50%;
    font-size: 13px;
    font-weight: 600;
}
.point-card .point-text {
    color: #333;
    font-size: 14px;
    line-height: 1.6;
    padding-right: 60px;
    word-break: break-word;
}
.point-card .copy-btn {
    position: absolute;
    top: 14px;
    right: 14px;
    padding: 4px 12px;
    background: #fff;
    border: 1px solid #5b6ee1;
    color: #5b6ee1;
    border-radius: 14px;
    font-size: 12px;
    cursor: pointer;
    transition: all .2s;
}
.point-card .copy-btn:hover {
    background: #5b6ee1;
    color: #fff;
}
.point-card .copy-btn.copied {
    background: #67c23a;
    border-color: #67c23a;
    color: #fff;
}
@keyframes point-fade-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============== 页脚 ============== */
.app-footer {
    margin-top: 32px;
    text-align: center;
    color: rgba(255,255,255,.75);
    font-size: 12px;
}
.app-footer p { margin: 0; }
.app-footer p + p { margin-top: 6px; opacity: .8; }
.app-footer a {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px dotted rgba(255,255,255,.4);
}
.app-footer a:hover { border-bottom-style: solid; }

/* ICP 备案：合规要求带工信部图标，链接到 beian.miit.gov.cn */
.beian-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border-bottom: none !important;
    opacity: .9;
}
.beian-link:hover { opacity: 1; border-bottom: none !important; }
.beian-icon {
    width: 14px;
    height: 14px;
    fill: currentColor;
    flex-shrink: 0;
}

/* ============== 双列输入行 ============== */
.row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
@media (max-width: 640px) {
    .row-2 { grid-template-columns: 1fr; }
}

/* ============== 种草文案卡片 ============== */
.seed-card {
    padding: 22px 24px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 4px 14px rgba(0,0,0,.05);
    border: 1px solid #ffe7d6;
}
.seed-card + .seed-card { margin-top: 16px; }
.seed-card-title {
    font-size: 18px;
    font-weight: 700;
    color: #ff7a45;
    margin: 0 0 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.seed-card-content {
    font-size: 14.5px;
    line-height: 1.9;
    color: #333;
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
}
.seed-card-tags {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px dashed #ffd9bf;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.seed-tag {
    display: inline-block;
    padding: 4px 12px;
    background: #fff5ec;
    color: #fa541c;
    border-radius: 999px;
    font-size: 12.5px;
    border: 1px solid #ffd9bf;
    cursor: pointer;
    transition: all .15s;
}
.seed-tag:hover { background: #fa541c; color: #fff; }
.seed-card-actions {
    margin-top: 14px;
    display: flex;
    gap: 8px;
}

/* ============== 直播话术卡片 ============== */
.live-card {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 4px 14px rgba(0,0,0,.05);
    border: 1px solid #ffe0e6;
    overflow: hidden;
}
.live-card + .live-card { margin-top: 12px; }
.live-segment {
    display: flex;
    align-items: stretch;
    border-bottom: 1px solid #f5f0f3;
}
.live-segment:last-child { border-bottom: none; }
.live-segment-label {
    flex: 0 0 120px;
    background: linear-gradient(180deg, #fff0f4 0%, #fff5f7 100%);
    color: #f5222d;
    font-weight: 700;
    padding: 18px 14px;
    text-align: center;
    font-size: 14px;
    border-right: 1px solid #ffe0e6;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
}
.live-segment-label small {
    font-weight: 400;
    color: #999;
    font-size: 11.5px;
}
.live-segment-body {
    flex: 1;
    padding: 16px 18px;
    font-size: 14px;
    line-height: 1.85;
    color: #333;
    white-space: pre-wrap;
    word-break: break-word;
}
.live-card-actions {
    padding: 12px 16px;
    background: #fafafa;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    border-top: 1px solid #f0f0f0;
}

/* ============== 卡片通用操作按钮 ============== */
.card-action-btn {
    cursor: pointer;
    border: 1px solid #d9d9d9;
    background: #fff;
    color: #555;
    padding: 5px 14px;
    border-radius: 999px;
    font-size: 12.5px;
    transition: all .15s;
}
.card-action-btn:hover { border-color: #5b6ee1; color: #5b6ee1; }
.card-action-btn.copied { background: #67c23a; color: #fff; border-color: #67c23a; }

/* ============== 解析兜底提示（fallback_used） ============== */
.fallback-hint {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    margin: 4px 0 14px;
    background: #fffbe6;
    border: 1px solid #ffe58f;
    border-radius: 8px;
    color: #ad6800;
    font-size: 12.5px;
    line-height: 1.6;
}
.fallback-hint .layui-icon {
    color: #faad14;
    font-size: 14px;
}

/* ============== 结果条数小标 ============== */
.result-count {
    font-size: 12.5px;
    color: #999;
    font-weight: normal;
    margin-left: 6px;
}

/* ============== 空状态卡片（AI 没产出可用结果） ============== */
.empty-state {
    text-align: center;
    padding: 36px 20px;
    background: #fafbfc;
    border: 1px dashed #e0e3eb;
    border-radius: 8px;
    color: #888;
}
.empty-state .layui-icon {
    font-size: 38px;
    color: #d0d4dc;
    margin-bottom: 8px;
}
.empty-state p {
    margin: 4px 0;
    font-size: 13px;
    line-height: 1.7;
}

/* ============== 错误框内 AI 原始输出（折叠预览） ============== */
.error-raw {
    margin-top: 8px;
    font-size: 12px;
    color: #888;
}
.error-raw summary {
    cursor: pointer;
    user-select: none;
    color: #5b6ee1;
}
.error-raw summary:hover { text-decoration: underline; }
.error-raw pre {
    margin-top: 6px;
    padding: 10px;
    background: #f7f7f9;
    border: 1px solid #eee;
    border-radius: 6px;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 240px;
    overflow: auto;
    color: #555;
}

/* ============== 使用密码弹窗 & 底部提示条 ============== */
.bbd-pwd-mask {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100000;
    animation: bbdFadeIn .15s ease-out;
}
@keyframes bbdFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.bbd-pwd-box {
    width: 92%;
    max-width: 360px;
    background: #fff;
    border-radius: 12px;
    padding: 22px 22px 18px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
    animation: bbdPopIn .2s cubic-bezier(.2, .9, .35, 1.2);
}
@keyframes bbdPopIn {
    from { transform: scale(.85); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}
.bbd-pwd-head {
    font-size: 18px;
    font-weight: 700;
    color: #333;
    margin-bottom: 6px;
    text-align: center;
}
.bbd-pwd-sub {
    font-size: 13px;
    color: #888;
    margin-bottom: 14px;
    text-align: center;
}
.bbd-pwd-box input[type="password"] {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 14px;
    font-size: 16px;
    letter-spacing: 2px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    outline: none;
    transition: border-color .15s;
}
.bbd-pwd-box input[type="password"]:focus {
    border-color: #667eea;
}
.bbd-pwd-error {
    margin-top: 10px;
    padding: 10px 12px;
    background: #fff3f3;
    border: 1px solid #ffd0d0;
    border-radius: 6px;
    font-size: 13px;
    color: #c62828;
    text-align: center;
}
.bbd-pwd-error b {
    color: #d84315;
    font-weight: 700;
    user-select: all;
}
.bbd-pwx-tip {
    margin-top: 14px;
    padding: 10px 12px;
    background: linear-gradient(135deg, #fff8e1, #ffecb3);
    border-radius: 6px;
    font-size: 13px;
    color: #6d4c00;
    text-align: center;
}
.bbd-pwx-tip b {
    color: #d84315;
    font-weight: 700;
    user-select: all;
    cursor: pointer;
}
.bbd-pwd-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}
.bbd-pwd-actions button {
    flex: 1;
    padding: 11px;
    font-size: 15px;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    background: #f0f0f3;
    color: #555;
    transition: background .15s, transform .1s;
}
.bbd-pwd-actions button:hover { background: #e6e6ea; }
.bbd-pwd-actions button:active { transform: scale(.97); }
.bbd-pwd-actions .bbd-pwd-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
}
.bbd-pwd-actions .bbd-pwd-primary:hover { filter: brightness(1.1); }

/* ---- 底部"加微信获取密码"提示条 ---- */
.bbd-auth-tip {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 11px 16px;
    background: linear-gradient(135deg, #fff8e1, #ffecb3);
    color: #6d4c00;
    text-align: center;
    font-size: 14px;
    border-top: 2px solid #ffb300;
    box-shadow: 0 -4px 14px rgba(0, 0, 0, .12);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    transition: transform .25s ease, opacity .25s ease;
}
.bbd-auth-tip.hidden {
    transform: translateY(110%);
    opacity: 0;
    pointer-events: none;
}
.bbd-auth-tip .bbd-icon {
    font-size: 16px;
}
.bbd-auth-tip .bbd-wx {
    color: #d84315;
    font-weight: 700;
    cursor: pointer;
    user-select: all;
    padding: 2px 4px;
    border-radius: 3px;
    background: rgba(216, 67, 21, .1);
}
.bbd-auth-tip .bbd-wx:hover {
    background: rgba(216, 67, 21, .2);
}
.bbd-auth-tip-close {
    background: transparent;
    border: 0;
    color: #6d4c00;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 0 6px;
    opacity: .6;
    transition: opacity .15s;
}
.bbd-auth-tip-close:hover { opacity: 1; }

@media (max-width: 600px) {
    .bbd-auth-tip {
        font-size: 13px;
        padding: 9px 12px;
        flex-wrap: wrap;
    }
}

/* 避免底部提示条遮挡页脚：在 body 底部加 padding 让内容上移 */
body {
    padding-bottom: 56px;
}
@media (max-width: 600px) {
    body { padding-bottom: 64px; }
}