/**
 * Zibll 隐藏内容扣积分 - 前端样式
 * v2.2.0
 * - 胶囊（椭圆）按钮，贴合纸笔/Zibll 主题风格
 * - 自动渐变背景（浅 -> 主色 -> 深）
 * - 适配 Zibll 暗黑模式（.dark-theme / data-theme="dark"）
 * - 隐藏内容区域自动换行，长链接不再溢出
 */

/* ========== 外层容器 & 主题变量 ========== */
.zibll-yc-wrapper {
    /* 按钮变量：由 PHP 内联覆盖 */
    --yc-btn-bg: #0073aa;
    --yc-btn-bg-light: #2f9bd6;
    --yc-btn-bg-dark: #00507a;
    --yc-btn-text: #ffffff;

    /* 内容区域变量：亮色模式 */
    --yc-box-bg: #f7f8fa;
    --yc-box-border: rgba(15, 23, 42, 0.07);
    --yc-box-text: #2c2f36;
    --yc-box-muted: #8a909b;
    --yc-box-link: #2f6fed;
    --yc-box-shadow: 0 12px 32px -20px rgba(15, 23, 42, 0.45);
    --yc-box-code-bg: rgba(127, 127, 127, 0.12);

    margin: 22px 0;
    line-height: 1.7;
}

/* ========== 暗黑模式变量（兼容多种主题开关写法） ========== */
.dark-theme .zibll-yc-wrapper,
html.dark .zibll-yc-wrapper,
body.dark .zibll-yc-wrapper,
body.dark-theme .zibll-yc-wrapper,
body.dark-mode .zibll-yc-wrapper,
html[data-theme="dark"] .zibll-yc-wrapper,
body[data-theme="dark"] .zibll-yc-wrapper,
[data-color-scheme="dark"] .zibll-yc-wrapper {
    --yc-box-bg: #21242b;
    --yc-box-border: rgba(255, 255, 255, 0.09);
    --yc-box-text: #e6e8ec;
    --yc-box-muted: #9aa1ad;
    --yc-box-link: #7ab8ff;
    --yc-box-shadow: 0 14px 36px -20px rgba(0, 0, 0, 0.9);
    --yc-box-code-bg: rgba(255, 255, 255, 0.09);
}

/* ========== 胶囊渐变按钮 ========== */
.zibll-yc-wrapper .zibll-yc-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    margin: 0;
    padding: 10px 30px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    line-height: 1.5;
    letter-spacing: 0.4px;
    text-align: center;
    text-decoration: none !important;
    white-space: normal;
    cursor: pointer;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;

    color: var(--yc-btn-text) !important;
    -webkit-text-fill-color: var(--yc-btn-text) !important;
    text-shadow: none !important;
    background-color: var(--yc-btn-bg) !important;
    background-image: linear-gradient(135deg,
        var(--yc-btn-bg-light) 0%,
        var(--yc-btn-bg) 55%,
        var(--yc-btn-bg-dark) 100%) !important;
    background-size: 180% 180%;
    background-position: 0% 50%;
    background-repeat: no-repeat;
    background-origin: padding-box !important;
    background-clip: padding-box !important;
    -webkit-background-clip: padding-box !important;
    border: 0 !important;
    border-radius: 999px !important;
    box-shadow: 0 8px 20px -8px rgba(0, 0, 0, 0.38),
                inset 0 1px 0 rgba(255, 255, 255, 0.28);
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.22s ease,
                box-shadow 0.22s ease,
                background-position 0.45s ease,
                filter 0.22s ease,
                opacity 0.2s ease;
}

/* 渐变流光：悬停时背景流过 */
.zibll-yc-wrapper .zibll-yc-button:hover:not(:disabled) {
    background-position: 100% 50%;
    transform: translateY(-2px);
    filter: brightness(1.06);
    box-shadow: 0 12px 26px -10px rgba(0, 0, 0, 0.42),
                inset 0 1px 0 rgba(255, 255, 255, 0.32);
    opacity: 1;
}

.zibll-yc-wrapper .zibll-yc-button:active:not(:disabled) {
    transform: translateY(0) scale(0.985);
    box-shadow: 0 4px 12px -6px rgba(0, 0, 0, 0.35),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.zibll-yc-wrapper .zibll-yc-button:focus-visible {
    outline: 3px solid rgba(0, 115, 170, 0.4);
    outline-offset: 3px;
}

/* 已查看 / 处理中：保留渐变但明显弱化 */
.zibll-yc-wrapper .zibll-yc-button:disabled {
    cursor: default;
    transform: none;
    filter: saturate(0.6) brightness(0.96);
    opacity: 0.62;
    box-shadow: none;
}

/* 暗黑模式下按钮光影更柔和 */
.dark-theme .zibll-yc-wrapper .zibll-yc-button,
html[data-theme="dark"] .zibll-yc-wrapper .zibll-yc-button,
body[data-theme="dark"] .zibll-yc-wrapper .zibll-yc-button,
body.dark .zibll-yc-wrapper .zibll-yc-button {
    box-shadow: 0 10px 24px -10px rgba(0, 0, 0, 0.85),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* ========== 积分提示文字 ========== */
.zibll-yc-wrapper .zibll-yc-tip {
    margin-top: 10px;
    font-size: 12.5px;
    line-height: 1.6;
    color: var(--yc-box-muted) !important;
    opacity: 0.95;
}

/* ========== 隐藏内容区域 ========== */
.zibll-yc-wrapper .zibll-yc-content {
    margin-top: 14px;
    padding: 18px 20px;
    text-align: left;
    font-size: 15px;
    line-height: 1.85;

    color: var(--yc-box-text) !important;
    background: var(--yc-box-bg) !important;
    border: 1px solid var(--yc-box-border) !important;
    border-radius: 16px;
    box-shadow: var(--yc-box-shadow);

    overflow-wrap: anywhere;
    word-wrap: break-word;
    word-break: break-word;
    -webkit-text-size-adjust: 100%;
}

.zibll-yc-content.yc-reveal {
    animation: ycReveal 0.36s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

@keyframes ycReveal {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* 内容区文字统一使用变量，避免暗黑模式继承浅色文字导致不可读 */
.zibll-yc-wrapper .zibll-yc-content,
.zibll-yc-wrapper .zibll-yc-content p,
.zibll-yc-wrapper .zibll-yc-content div,
.zibll-yc-wrapper .zibll-yc-content span,
.zibll-yc-wrapper .zibll-yc-content li,
.zibll-yc-wrapper .zibll-yc-content strong,
.zibll-yc-wrapper .zibll-yc-content b,
.zibll-yc-wrapper .zibll-yc-content em,
.zibll-yc-wrapper .zibll-yc-content h1,
.zibll-yc-wrapper .zibll-yc-content h2,
.zibll-yc-wrapper .zibll-yc-content h3,
.zibll-yc-wrapper .zibll-yc-content h4,
.zibll-yc-wrapper .zibll-yc-content h5,
.zibll-yc-wrapper .zibll-yc-content h6 {
    color: var(--yc-box-text) !important;
}

.zibll-yc-wrapper .zibll-yc-content a {
    color: var(--yc-box-link) !important;
    text-decoration: underline;
    text-underline-offset: 2px;
    word-break: break-all;
}

.zibll-yc-wrapper .zibll-yc-content a:hover {
    opacity: 0.85;
}

/* 部分主题会在链接内再包一层 span，保持链接色一致 */
.zibll-yc-wrapper .zibll-yc-content a span,
.zibll-yc-wrapper .zibll-yc-content a * {
    color: inherit !important;
}

.zibll-yc-wrapper .zibll-yc-content p {
    margin: 0 0 12px;
}

.zibll-yc-wrapper .zibll-yc-content p:first-child {
    margin-top: 0;
}

.zibll-yc-wrapper .zibll-yc-content p:last-child {
    margin-bottom: 0;
}

.zibll-yc-wrapper .zibll-yc-content img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
}

.zibll-yc-wrapper .zibll-yc-content code {
    padding: 2px 6px;
    font-size: 0.92em;
    border-radius: 6px;
    background: var(--yc-box-code-bg) !important;
    color: var(--yc-box-text) !important;
}

.zibll-yc-wrapper .zibll-yc-content pre {
    padding: 14px 16px;
    overflow-x: auto;
    border-radius: 12px;
    background: var(--yc-box-code-bg) !important;
    color: var(--yc-box-text) !important;
}

.zibll-yc-wrapper .zibll-yc-content pre code {
    padding: 0;
    background: transparent !important;
}

.zibll-yc-wrapper .zibll-yc-content hr {
    margin: 16px 0;
    border: 0;
    border-top: 1px solid var(--yc-box-border);
}

.zibll-yc-wrapper .zibll-yc-content table {
    width: 100%;
    max-width: 100%;
    border-collapse: collapse;
    display: block;
    overflow-x: auto;
}

/* ========== 移动端 ========== */
@media (max-width: 480px) {
    .zibll-yc-wrapper .zibll-yc-button {
        min-height: 42px;
        padding: 9px 22px;
        font-size: 14px;
    }

    .zibll-yc-wrapper .zibll-yc-content {
        padding: 14px 15px;
        font-size: 14px;
        border-radius: 14px;
    }
}

/* 尊重“减少动画”偏好 */
@media (prefers-reduced-motion: reduce) {
    .zibll-yc-wrapper .zibll-yc-button,
    .zibll-yc-content.yc-reveal {
        transition: none;
        animation: none;
    }
}
