/**
 * 极栈源录 · 子比全能美化 AI 增强插件
 * 前台静态结构样式（可配置部分由 PHP 动态输出，见 inc/dynamic-css.php）
 */

/* ---------------- 滚动进度条 ---------------- */
.jzsa-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--jzsa-progress-h, 3px);
    z-index: 9997;
    pointer-events: none;
    background: rgba(127, 147, 180, .12);
}

.jzsa-progress > i {
    display: block;
    height: 100%;
    width: 0;
    background: var(--jzsa-progress, linear-gradient(90deg, #4f7cff, #8b5cf6));
    border-radius: 0 3px 3px 0;
    transition: width .1s linear;
}

.jzsa-progress-num {
    position: fixed;
    right: 18px;
    bottom: 150px;
    z-index: 9997;
    min-width: 46px;
    text-align: center;
    padding: 6px 8px;
    border-radius: 10px;
    font-size: 12px;
    color: #fff;
    background: rgba(15, 22, 38, .72);
    backdrop-filter: blur(8px);
    pointer-events: none;
    opacity: 0;
    transition: opacity .3s ease;
}

.jzsa-progress-num.jzsa-show {
    opacity: 1;
}

/* ---------------- 公告 ---------------- */
.jzsa-notice-popup-body {
    font-size: 14.5px;
    line-height: 1.85;
    color: #2b3a55;
    max-height: 46vh;
    overflow: auto;
}

.jzsa-notice-popup-foot {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 16px;
}

.jzsa-notice-popup-foot button,
.jzsa-notice-popup-foot a {
    padding: 9px 18px;
    border-radius: 10px;
    border: 0;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    background: #4f7cff;
    color: #fff;
}

.jzsa-notice-popup-foot .jzsa-notice-popup-close {
    background: #eef2f8;
    color: #4a5b76;
}

/* ---------------- 图片占位 ---------------- */
.jzsa-img-wrap {
    position: relative;
    display: block;
}

.jzsa-img-wrap > .jzsa-img-spinner {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #9aa8bf;
}

/* ---------------- 灯箱 ---------------- */
body.jzsa-lb-open {
    overflow: hidden;
}

.jzsa-lb img {
    user-select: none;
    -webkit-user-drag: none;
}

.jzsa-lb.jzsa-dragging img {
    cursor: grabbing;
    transition: none;
}

/* ---------------- 翻译按钮 ---------------- */
.jzsa-translate-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 22px 0 8px;
    padding-top: 16px;
    border-top: 1px dashed rgba(127, 147, 180, .3);
}

.jzsa-translate-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 0;
    cursor: pointer;
    font-size: 16px;
    color: #fff;
    background: linear-gradient(135deg, #4f7cff, #8b5cf6);
    box-shadow: 0 8px 20px rgba(79, 124, 255, .3);
}

.jzsa-translate-tip {
    font-size: 13px;
    color: #8b9ab4;
}

/* ---------------- AI 结果浮层 ---------------- */
.jzsa-ai-float {
    position: fixed;
    z-index: 9998;
    right: 20px;
    bottom: 170px;
    width: min(420px, 92vw);
    max-height: 60vh;
    overflow: auto;
    padding: 18px 20px;
    border-radius: 16px;
    background: #fff;
    color: #26324a;
    font-size: 14.5px;
    line-height: 1.85;
    white-space: pre-wrap;
    box-shadow: 0 24px 70px rgba(12, 18, 32, .26);
    display: none;
}

.jzsa-ai-float.jzsa-show {
    display: block;
}

.jzsa-ai-float .jzsa-ai-float-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-weight: 600;
    color: #1f2c46;
}

.jzsa-ai-float .jzsa-ai-float-head button {
    border: 0;
    background: none;
    cursor: pointer;
    font-size: 18px;
    color: #8b9ab4;
    line-height: 1;
}

/* ---------------- 推荐弹窗 ---------------- */
.jzsa-rec-mask {
    position: fixed;
    inset: 0;
    z-index: 99996;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(12, 18, 32, .55);
    backdrop-filter: blur(4px);
}

.jzsa-rec-mask.jzsa-show {
    display: flex;
}

.jzsa-rec {
    width: min(520px, 94vw);
    max-height: 84vh;
    overflow: auto;
    background: #fff;
    border-radius: 20px;
    padding: 24px 22px 18px;
    box-shadow: 0 30px 80px rgba(12, 18, 32, .34);
}

.jzsa-rec h3 {
    margin: 0 0 16px;
    font-size: 18px;
    color: #1f2c46;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.jzsa-rec h3 button {
    border: 0;
    background: none;
    cursor: pointer;
    font-size: 20px;
    color: #98a6bd;
}

.jzsa-rec-item {
    display: flex;
    gap: 12px;
    padding: 10px 8px;
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    transition: background .25s ease;
}

.jzsa-rec-item:hover {
    background: #f4f7fd;
}

.jzsa-rec-item img {
    width: 78px;
    height: 56px;
    object-fit: cover;
    border-radius: 10px;
    flex: 0 0 auto;
    background: #eef2f7;
}

.jzsa-rec-item .jzsa-rec-body {
    flex: 1 1 auto;
    min-width: 0;
}

.jzsa-rec-item strong {
    display: block;
    font-size: 14.5px;
    color: #22304a;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.jzsa-rec-item span {
    font-size: 12.5px;
    color: #8b9ab4;
}

.jzsa-rec-foot {
    text-align: center;
    margin-top: 14px;
}

.jzsa-rec-foot button {
    border: 0;
    background: none;
    cursor: pointer;
    color: #8b9ab4;
    font-size: 13px;
}

/* ---------------- 通用小组件 ---------------- */
.jzsa-sr-only {
    position: absolute !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.jzsa-preloader-hidden {
    display: none !important;
}

@media (prefers-reduced-motion: reduce) {
    .jzsa-progress > i,
    .jzsa-fab,
    .jzsa-chat {
        transition: none !important;
        animation: none !important;
    }
}

/* ==========================================================================
   前台 AI 提示词库（短代码 [jzsa_prompts]）
   全部变量带兜底值，未加载动态 CSS 时依然可读。
   ========================================================================== */
.jzsa-prompt-app {
    --jzsa-p-brand: var(--jzsa-main, #4b6bfb);
    --jzsa-p-brand2: var(--jzsa-main-2, #7a5cff);
    --jzsa-p-line: var(--jzsa-line, rgba(0, 0, 0, .1));
    --jzsa-p-text: var(--jzsa-text, inherit);
    --jzsa-p-muted: var(--jzsa-muted, #7b8798);
    --jzsa-p-card: var(--jzsa-card-bg, rgba(255, 255, 255, .82));
    margin: 0 0 26px;
    color: var(--jzsa-p-text);
}

.jzsa-prompt-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.jzsa-prompt-search input {
    width: min(420px, 76vw);
    height: 40px;
    border-radius: 12px;
    border: 1px solid var(--jzsa-p-line);
    background: var(--jzsa-p-card);
    color: inherit;
    padding: 0 14px;
    font-size: 14px;
    outline: none;
}

.jzsa-prompt-search input:focus {
    border-color: var(--jzsa-p-brand);
}

.jzsa-prompt-meta {
    font-size: 13px;
    color: var(--jzsa-p-muted);
}

.jzsa-prompt-meta b {
    color: var(--jzsa-p-brand);
}

.jzsa-prompt-cats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
    max-height: 140px;
    overflow-y: auto;
}

.jzsa-prompt-cats button {
    padding: 7px 14px;
    border-radius: 999px;
    border: 1px solid var(--jzsa-p-line);
    background: var(--jzsa-p-card);
    color: inherit;
    cursor: pointer;
    font-size: 12.5px;
    line-height: 1;
    transition: color .2s ease, background .2s ease, border-color .2s ease;
    white-space: nowrap;
}

.jzsa-prompt-cats button i {
    font-style: normal;
    opacity: .55;
    margin-left: 5px;
}

.jzsa-prompt-cats button.is-on {
    background: linear-gradient(135deg, var(--jzsa-p-brand), var(--jzsa-p-brand2));
    color: #fff;
    border-color: transparent;
}

.jzsa-prompt-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 12px;
    min-height: 120px;
}

.jzsa-prompt-item {
    background: var(--jzsa-p-card);
    border: 1px solid var(--jzsa-p-line);
    border-radius: 14px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: transform .2s ease, box-shadow .2s ease;
}

.jzsa-prompt-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(24, 44, 96, .12);
}

.jzsa-prompt-item strong {
    font-size: 14px;
    line-height: 1.5;
    color: inherit;
}

.jzsa-prompt-item p {
    margin: 0;
    font-size: 12.5px;
    line-height: 1.7;
    color: var(--jzsa-p-muted);
    max-height: 100px;
    overflow: hidden;
    white-space: pre-wrap;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
}

.jzsa-prompt-tag {
    font-size: 11.5px;
    color: var(--jzsa-p-brand);
    background: rgba(75, 107, 251, .12);
    border-radius: 999px;
    padding: 2px 9px;
    align-self: flex-start;
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@supports (background: color-mix(in srgb, red 10%, transparent)) {
    .jzsa-prompt-tag {
        background: color-mix(in srgb, var(--jzsa-p-brand) 12%, transparent);
    }
}

.jzsa-prompt-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
    flex-wrap: wrap;
}

.jzsa-prompt-actions button {
    flex: 1 1 auto;
    padding: 7px 10px;
    border-radius: 9px;
    border: 1px solid var(--jzsa-p-line);
    background: transparent;
    color: inherit;
    cursor: pointer;
    font-size: 12.5px;
    transition: color .2s ease, border-color .2s ease;
}

.jzsa-prompt-actions button:hover {
    border-color: var(--jzsa-p-brand);
    color: var(--jzsa-p-brand);
}

.jzsa-prompt-foot {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-top: 18px;
    font-size: 13px;
    color: var(--jzsa-p-muted);
}

.jzsa-prompt-foot button {
    padding: 7px 16px;
    border-radius: 9px;
    border: 1px solid var(--jzsa-p-line);
    background: var(--jzsa-p-card);
    color: inherit;
    cursor: pointer;
}

.jzsa-prompt-foot button:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.jzsa-prompt-custom {
    margin-top: 26px;
    padding-top: 20px;
    border-top: 1px dashed var(--jzsa-p-line);
}

.jzsa-prompt-custom input,
.jzsa-prompt-custom textarea {
    width: 100%;
    max-width: 720px;
    border-radius: 10px;
    border: 1px solid var(--jzsa-p-line);
    background: var(--jzsa-p-card);
    color: inherit;
    padding: 10px 12px;
    margin-bottom: 10px;
    font-size: 13.5px;
}

.jzsa-prompt-app .jzsa-desc {
    margin: 6px 0;
    font-size: 13px;
    line-height: 1.7;
    color: var(--jzsa-p-muted);
}

@media screen and (max-width: 640px) {
    .jzsa-prompt-grid {
        grid-template-columns: 1fr;
    }

    .jzsa-prompt-search input {
        width: 100%;
    }
}
