/* 20260814 start */
/* 评论图片上传/预览/查看器 —— 与 frontend/bgw_web@9b1cd50 对齐 */

/* -------- 上传按钮 + 缩略图预览 -------- */
.comment-upload {
    margin-top: .625rem;
}

.comment-upload-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 180px;
    height: 40px;
    padding: 0;
    border: 2px solid #fc0f7e;
    border-radius: 6px;
    background: transparent;
    color: #fc0f7e;
    font-size: 18px;
    font-weight: 600;
    line-height: 40px;
    cursor: pointer;
    box-sizing: border-box;
    transition: background .15s, color .15s;
}

.comment-upload-btn:hover {
    background: #fc0f7e;
    color: #fff;
}

.comment-upload-btn.is-disabled { opacity: .5; cursor: not-allowed; }
.comment-upload-btn.is-disabled:hover { background: transparent; color: #1abc9d; }

/* 屏幕外定位替代 display:none：某些浏览器对不可见 file input 的 .click() 会静默拒绝 */
.comment-upload-input {
    position: absolute !important;
    left: -9999px !important;
    top: -9999px !important;
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.comment-upload-tip {
    color: #888;
    font-size: 12px;
    margin-left: 8px;
}

.comment-upload-preview {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-top: .625rem;
}

.comment-upload-thumb {
    position: relative;
    width: 3rem;
    height: 3rem;
    background: #2a2a2a;
    overflow: visible;
}

.comment-upload-thumb img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    object-fit: cover;
}

.comment-upload-remove {
    position: absolute;
    top: -.45rem;
    right: -.45rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    height: 1rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #333;
    color: #fff;
    font-size: .75rem;
    line-height: 1;
    cursor: pointer;
}

/* 上传中进度条（叠在缩略图底部） */
.comment-upload-progress {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 3px;
    background: rgba(0,0,0,.15);
}
.comment-upload-progress > span {
    display: block;
    height: 100%;
    background: #1abc9d;
    width: 0;
    transition: width .2s;
}
.comment-upload-thumb.is-error {
    outline: 1px solid #e74c3c;
}
.comment-upload-thumb.is-error::after {
    content: attr(data-error);
    position: absolute;
    left: 0; right: 0; bottom: 0;
    background: rgba(231,76,60,.9);
    color: #fff;
    font-size: 10px;
    padding: 1px 2px;
    text-align: center;
    line-height: 1.1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* -------- 评论内容里的图片组 -------- */
#comments .comment-image-group {
    display: flex;
    align-items: flex-end;
    gap: .5rem;
    margin-top: .625rem;
}

#comments .comment-image-group.is-single {
    width: 40%;
    max-width: 18rem;
}

#comments .comment-image-grid {
    display: grid;
    gap: .5rem;
}

#comments .comment-image-group.is-multiple .comment-image-grid {
    width: 18.75rem;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

#comments .comment-image-item {
    position: relative;
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    background: #1f1f1f;
    cursor: pointer;
    overflow: hidden;
}

/* 多张时超过 3 张自动隐藏（Lightbox 里翻全部） */
#comments .comment-image-item:nth-child(n + 4) {
    display: none;
}

#comments .comment-image-group.is-single .comment-image-item {
    max-height: 300px;
}

#comments .comment-image-group.is-multiple .comment-image-item {
    aspect-ratio: 1 / 1;
}

#comments .comment-image-grid img {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    border: 0 !important;
}

#comments .comment-image-group.is-single img {
    height: auto !important;
    max-height: 300px !important;
    object-fit: contain;
}

#comments .comment-image-group.is-multiple img {
    height: 100% !important;
    max-height: none !important;
    object-fit: cover;
}

#comments .comment-image-count {
    flex: 0 0 auto;
    color: #bbb;
    font-size: .75rem;
    line-height: 1.2;
    white-space: nowrap;
}

/* -------- Lightbox 全屏预览 -------- */
body.comment-image-viewer-open {
    overflow: hidden !important;
    touch-action: none;
}

.comment-image-viewer {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: none;
    align-items: center;
    justify-content: center;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: rgba(0, 0, 0, .92);
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.comment-image-viewer:not(.is-active) {
    display: none !important;
}

.comment-image-viewer.is-active {
    display: flex;
}

.comment-image-viewer-img {
    display: block !important;
    max-width: 80vw !important;
    max-height: 100vh !important;
    max-height: 100dvh !important;
    margin: 0 !important;
    border: 0 !important;
    object-fit: contain;
    height: auto;
}

.comment-image-viewer.is-error .comment-image-viewer-img {
    width: min(70vw, 20rem) !important;
    height: min(70vw, 20rem) !important;
    background: rgba(255, 255, 255, .08);
}

.comment-image-viewer-close,
.comment-image-viewer-nav {
    position: absolute;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    background: rgba(255, 255, 255, .14);
    color: #fff;
    cursor: pointer;
}

.comment-image-viewer-close {
    top: 1rem;
    right: 1rem;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    font-size: 1rem;
}

.comment-image-viewer-nav {
    top: 50%;
    width: 2.5rem;
    height: 3.5rem;
    transform: translateY(-50%);
    font-size: 2rem;
}

.comment-image-viewer-nav.is-prev { left: 1rem; }
.comment-image-viewer-nav.is-next { right: 1rem; }

.comment-image-viewer.is-single .comment-image-viewer-nav {
    display: none;
}

.comment-image-viewer-counter {
    position: absolute;
    left: 50%;
    bottom: 1rem;
    transform: translateX(-50%);
    color: #fff;
    font-size: .875rem;
}

/* -------- H5 适配 -------- */
@media (max-width: 767.98px) {
    .comment-upload-btn {
        width: 117px;
        height: 26px;
        font-size: 12px;
        font-weight: 500;
        line-height: 26px;
    }

    .comment-upload-thumb,
    .comment-upload-thumb img {
        width: 60px !important;
        height: 60px !important;
    }

    #comments .comment-image-group.is-single {
        width: 40%;
        min-width: 7rem;
    }

    #comments .comment-image-group.is-multiple {
        flex-direction: column;
        align-items: flex-start;
        gap: .375rem;
    }

    #comments .comment-image-group.is-multiple .comment-image-grid {
        width: min(100%, 18.75rem);
    }

    #comments .comment-image-count {
        font-size: 12px;
        line-height: 1;
    }

    .comment-image-viewer-img{
        max-width: 75vw !important;
    }
    .comment-image-viewer-nav.is-prev{
        left: 0.3rem;
    }
    .comment-image-viewer-nav.is-next{
        right: 0.3rem;
    }
}

/* -------- 后台评论管理紧凑缩略图（不在 #comments 前缀内） -------- */
.comment-image-group.is-admin {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    margin: 6px 0 0;
}
.comment-image-group.is-admin .comment-image-grid {
    display: contents;
}
.comment-image-group.is-admin .comment-image-item {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 2px;
    border: 1px solid #eee;
    background: #fafafa;
    cursor: zoom-in;
    overflow: hidden;
}
.comment-image-group.is-admin .comment-image-item img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
/* 20260814 end */
