/**
 * 文章角标
 * - 自定义角标：彩色背景框 + 白字，显示在文章图片右上角
 * - 精选角标：红底黑字「精」，显示在文章图片左上角
 */

.post-module-thumb,
.post-style-3-top {
    position: relative;
}

.b2-post-badge {
    --b2-badge: #FF0000;
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 4;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 22px;
    padding: 0 9px;
    box-sizing: border-box;
    border-radius: 6px;
    font-size: 12px;
    line-height: 1;
    font-weight: 700;
    letter-spacing: .5px;
    color: #fff;
    white-space: nowrap;
    text-shadow: 0 1px 1px rgba(0, 0, 0, .18);
    background-color: var(--b2-badge);
    background-image:
        linear-gradient(135deg, rgba(255, 255, 255, .42) 0%, rgba(255, 255, 255, 0) 52%),
        linear-gradient(180deg, rgba(255, 255, 255, .16) 0%, rgba(0, 0, 0, .08) 100%);
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, .3),
        0 2px 8px -2px var(--b2-badge),
        0 1px 2px rgba(0, 0, 0, .12);
    -webkit-backdrop-filter: saturate(1.1);
    backdrop-filter: saturate(1.1);
    pointer-events: none;
    transition: transform .25s ease, box-shadow .25s ease;
}

/* 右上角一抹彩色光晕，增强“彩色效果” */
.b2-post-badge::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background-image: radial-gradient(120% 120% at 100% 0%, rgba(255, 255, 255, .55) 0%, rgba(255, 255, 255, 0) 55%);
    opacity: .8;
    pointer-events: none;
}

/* 精选角标：红底黑字「精」，左上角 */
.b2-post-badge.b2-post-badge-featured {
    left: 8px;
    right: auto;
    width: 22px;
    height: 22px;
    padding: 0;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0;
    color: #000;
    text-shadow: 0 1px 0 rgba(255, 255, 255, .35);
    background-color: #FF0000;
    background-image: linear-gradient(180deg, rgba(255, 255, 255, .22) 0%, rgba(0, 0, 0, .06) 100%);
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, .35),
        0 2px 8px -2px rgba(255, 0, 0, .75),
        0 1px 2px rgba(0, 0, 0, .12);
}

.b2-post-badge.b2-post-badge-featured::before {
    background-image: radial-gradient(120% 120% at 0% 0%, rgba(255, 255, 255, .5) 0%, rgba(255, 255, 255, 0) 60%);
}

/* 列表卡片悬停时轻微上浮 */
.post-list-item:hover .b2-post-badge {
    transform: translateY(-1px);
}

/* 单页大图 / 大卡片：等比放大 */
.post-style-3-top .b2-post-badge {
    top: 16px;
    right: 16px;
    height: 28px;
    padding: 0 13px;
    border-radius: 8px;
    font-size: 14px;
    letter-spacing: .8px;
}

.post-style-3-top .b2-post-badge.b2-post-badge-featured {
    left: 16px;
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: 8px;
    font-size: 16px;
}

/* 移动端：缩小一档，避免遮挡图片主体 */
@media screen and (max-width: 768px) {
    .b2-post-badge {
        top: 6px;
        right: 6px;
        height: 20px;
        padding: 0 8px;
        border-radius: 5px;
        font-size: 11px;
    }

    .b2-post-badge.b2-post-badge-featured {
        left: 6px;
        width: 20px;
        height: 20px;
        padding: 0;
        font-size: 12px;
    }

    .post-style-3-top .b2-post-badge {
        top: 10px;
        right: 10px;
        height: 24px;
        font-size: 12px;
    }

    .post-style-3-top .b2-post-badge.b2-post-badge-featured {
        left: 10px;
        width: 24px;
        height: 24px;
        font-size: 13px;
    }
}

/* ============ 写文章页设置项 ============ */
.b2-badge-setting {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.b2-badge-setting input[type="text"] {
    width: 120px;
    height: 34px;
    padding: 0 10px;
    box-sizing: border-box;
    border: 1px solid #e2e5ea;
    border-radius: 6px;
    font-size: 13px;
    background: #fff;
    color: #121212;
    outline: none;
    transition: border-color .2s ease, box-shadow .2s ease;
}

.b2-badge-setting input[type="text"]:focus {
    border-color: var(--b2color);
    box-shadow: 0 0 0 3px var(--b2lightcolor);
}

.b2-badge-color {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 34px;
    padding: 3px 4px 3px 6px;
    border: 1px solid #e2e5ea;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
}

.b2-badge-color input[type="color"] {
    width: 24px;
    height: 22px;
    padding: 0;
    border: 0;
    border-radius: 4px;
    background: none;
    cursor: pointer;
}

.b2-badge-color input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

.b2-badge-color input[type="color"]::-webkit-color-swatch {
    border: 0;
    border-radius: 4px;
}

/* 手动输入任意色值 */
.b2-badge-color .b2-badge-color-text {
    width: 78px;
    height: 26px;
    padding: 0 6px;
    box-sizing: border-box;
    border: 1px solid #e9ebef;
    border-radius: 4px;
    font-size: 12px;
    color: #4a4f57;
    background: #fbfbfc;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    outline: none;
}

.b2-badge-color .b2-badge-color-text:focus {
    border-color: var(--b2color);
    background: #fff;
}

/* 常用色板 */
.b2-badge-swatches {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.b2-badge-swatches button {
    width: 20px;
    height: 20px;
    padding: 0;
    border: 2px solid #fff;
    outline: 1px solid rgba(15, 23, 42, .14);
    border-radius: 50%;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease;
}

.b2-badge-swatches button:hover {
    transform: scale(1.15);
    box-shadow: 0 2px 6px rgba(15, 23, 42, .18);
}

.b2-badge-swatches button.picked {
    outline: 2px solid var(--b2color);
    outline-offset: 1px;
    transform: scale(1.1);
}

.b2-badge-swatches em {
    font-style: normal;
    font-size: 12px;
    color: #a8b0bd;
    margin-left: 2px;
}

.b2-badge-color span {
    font-size: 12px;
    color: #797C80;
    font-variant-numeric: tabular-nums;
}

.b2-badge-setting button.text {
    height: 34px;
    padding: 0 12px;
    border: 1px solid #e2e5ea;
    border-radius: 6px;
    background: #fff;
    color: #797C80;
    font-size: 12px;
    cursor: pointer;
}

.b2-badge-setting button.text:hover {
    color: var(--b2color);
    border-color: var(--b2lightcolor);
    background: var(--b2light);
}

/* 预览 */
.b2-badge-demo {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    border-radius: 8px;
    background: #f7f8fa;
    flex-wrap: wrap;
}

.b2-badge-preview {
    --b2-badge: #FF0000;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 24px;
    padding: 0 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .5px;
    color: #fff;
    text-shadow: 0 1px 1px rgba(0, 0, 0, .18);
    background-color: var(--b2-badge);
    background-image:
        linear-gradient(135deg, rgba(255, 255, 255, .42) 0%, rgba(255, 255, 255, 0) 52%),
        linear-gradient(180deg, rgba(255, 255, 255, .16) 0%, rgba(0, 0, 0, .08) 100%);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .3), 0 2px 8px -2px var(--b2-badge);
}

.b2-badge-preview.b2-badge-preview-featured {
    width: 24px;
    height: 24px;
    padding: 0;
    color: #000;
    font-weight: 800;
    background-color: #FF0000;
    background-image: linear-gradient(180deg, rgba(255, 255, 255, .22) 0%, rgba(0, 0, 0, .06) 100%);
    text-shadow: 0 1px 0 rgba(255, 255, 255, .35);
}

.b2-badge-demo em {
    font-style: normal;
    font-size: 12px;
    color: #98a2b3;
}

.b2-badge-featured {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    font-size: 13px;
    color: #4a4f57;
    cursor: pointer;
}

.b2-badge-featured input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--b2color);
    cursor: pointer;
}

/* 暗色模式 */
.b2dark .b2-badge-setting input[type="text"] {
    background: #24262b;
    border-color: #35383f;
    color: #e6e8eb;
}

.b2dark .b2-badge-color,
.b2dark .b2-badge-setting button.text {
    background: #24262b;
    border-color: #35383f;
}

.b2dark .b2-badge-color .b2-badge-color-text {
    background: #1e2025;
    border-color: #35383f;
    color: #d7dbe1;
}

.b2dark .b2-badge-color span {
    color: #9aa2b1;
}

.b2dark .b2-badge-demo {
    background: #1e2025;
}

.b2dark .b2-badge-featured {
    color: #c7ccd4;
}
