/* share-dock.css
 *
 * 移动端底部固定分享条（"Mobile Share Dock"）。
 * 用法：在工具/模板/场景详情页通过 commonSections :: mobileShareDock 注入。
 * 设计原则：
 *   - 仅在窄屏（≤ 768px）显示，PC 端隐藏（PC 端用现有的 .tool-share-bar 行内组件）
 *   - 底部固定，给底部 tabbar 让 50px 空间（结合 mobile-tabbar.css 总高度 ≈ 116px）
 *   - 半透明毛玻璃 + 圆角顶边，避免与页面内容割裂
 *   - 4 按钮等宽：💬 分享 / 📷 长图 / 🔗 二维码 / 📋 复制
 *   - 隐藏在 admin 后台、首页等不需要分享的页面（由 JS 判断后加 body[data-share-dock="off"]）
 */

.m-share-dock {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 56px;
    z-index: 1040;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-top: 1px solid rgba(226, 232, 240, 0.92);
    box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.06);
    padding: 6px 4px 8px;
    transition: transform 0.25s ease;
    transform: translateY(0);
}

.m-share-dock.is-hidden {
    transform: translateY(150%);
}

.m-share-dock-row {
    display: flex;
    align-items: stretch;
    justify-content: space-around;
    gap: 4px;
}

.m-share-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 0;
    color: #334155;
    padding: 6px 4px;
    border-radius: 10px;
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
    min-height: 50px;
    transition: background 0.15s, transform 0.1s;
}

.m-share-btn:active {
    background: rgba(99, 102, 241, 0.08);
    transform: scale(0.96);
}

.m-share-btn .m-share-icon {
    font-size: 22px;
    line-height: 1;
    margin-bottom: 3px;
}

.m-share-btn .m-share-label {
    font-size: 11px;
    color: #64748b;
    line-height: 1.2;
    font-weight: 600;
}

.m-share-btn.is-primary {
    color: #1d4ed8;
}

.m-share-btn.is-primary .m-share-label {
    color: #1d4ed8;
}

.m-share-toast {
    position: fixed;
    left: 50%;
    bottom: 178px;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.88);
    color: #fff;
    font-size: 13px;
    padding: 8px 14px;
    border-radius: 999px;
    z-index: 1050;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s, transform 0.2s;
}

.m-share-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(-4px);
}

/* 暗色模式 */
body.dark-mode .m-share-dock {
    background: rgba(15, 23, 42, 0.94);
    border-top-color: rgba(51, 65, 85, 0.88);
}

body.dark-mode .m-share-btn {
    color: #cbd5e1;
}

body.dark-mode .m-share-btn .m-share-label {
    color: #94a3b8;
}

body.dark-mode .m-share-btn.is-primary {
    color: #60a5fa;
}

body.dark-mode .m-share-btn.is-primary .m-share-label {
    color: #60a5fa;
}

/* 只在 ≤768px 移动端显示；同时 body 必须没有 data-share-dock="off" */
@media (max-width: 768px) {
    body[data-share-dock="on"] .m-share-dock {
        display: block;
    }
    /* 出现分享条时，给页面底部留够空间避免 tab bar + 分享条遮挡 footer 内容 */
    body[data-share-dock="on"] .footer,
    body[data-share-dock="on"] .footer-inner {
        padding-bottom: 90px;
    }
}

/* 二维码弹层（点击 🔗 二维码按钮触发） */
.m-share-qr-mask {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.66);
    z-index: 99998;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.m-share-qr-box {
    background: #fff;
    border-radius: 16px;
    padding: 22px 24px;
    max-width: 320px;
    width: 100%;
    text-align: center;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.25);
}

body.dark-mode .m-share-qr-box {
    background: #1e293b;
    color: #f1f5f9;
}

.m-share-qr-box h4 {
    margin: 0 0 6px;
    font-size: 16px;
    color: inherit;
}

.m-share-qr-box .m-share-qr-hint {
    color: #64748b;
    font-size: 12px;
    margin-bottom: 12px;
}

body.dark-mode .m-share-qr-box .m-share-qr-hint {
    color: #94a3b8;
}

.m-share-qr-box .m-share-qr-canvas {
    display: inline-block;
    padding: 8px;
    background: #fff;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

.m-share-qr-box .m-share-qr-url {
    margin-top: 12px;
    font-size: 12px;
    color: #64748b;
    word-break: break-all;
    line-height: 1.5;
}

.m-share-qr-box .m-share-qr-actions {
    margin-top: 14px;
    display: flex;
    gap: 8px;
    justify-content: center;
}

/* P6：当 ToolResult.publish 触发时，给"长图/分享"按钮加引导脉冲 —— 提示用户
 * 此刻分享会带个性化结果卡片 + _r 快照参数，扩散效果最好。 */
.m-share-btn.is-pulse {
    position: relative;
}

.m-share-btn.is-pulse::before {
    content: "";
    position: absolute;
    inset: 4px;
    border-radius: 12px;
    box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.55);
    animation: m-share-pulse 1.4s ease-out infinite;
    pointer-events: none;
}

@keyframes m-share-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.55); }
    70%  { box-shadow: 0 0 0 14px rgba(99, 102, 241, 0); }
    100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
}

body.dark-mode .m-share-btn.is-pulse::before {
    animation: m-share-pulse-dark 1.4s ease-out infinite;
}

@keyframes m-share-pulse-dark {
    0%   { box-shadow: 0 0 0 0 rgba(165, 180, 252, 0.6); }
    70%  { box-shadow: 0 0 0 14px rgba(165, 180, 252, 0); }
    100% { box-shadow: 0 0 0 0 rgba(165, 180, 252, 0); }
}
