/**
 * Cartoon2：图片与背景图加载前显示「加载中」，避免慢网空白。
 * 配合 assets/user/js/theme/cartoon2/image-loading.js（.acg-img-load-host / .acg-img-loaded）
 */

@keyframes acg-img-spin {
    to {
        transform: rotate(360deg);
    }
}

.acg-img-load-host {
    position: relative;
    background-color: rgba(15, 23, 42, 0.06);
}

.acg-img-load-host::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 28px;
    height: 28px;
    margin: -14px 0 0 -14px;
    border: 3px solid rgba(12, 132, 209, 0.2);
    border-top-color: #0c84d1;
    border-radius: 50%;
    animation: acg-img-spin 0.7s linear infinite;
    z-index: 2;
    pointer-events: none;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.acg-img-load-host::after {
    content: "加载中";
    position: absolute;
    left: 50%;
    top: calc(50% + 18px);
    transform: translateX(-50%);
    z-index: 2;
    font-size: 12px;
    color: #64748b;
    white-space: nowrap;
    pointer-events: none;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.acg-img-load-host.acg-img-loaded::before,
.acg-img-load-host.acg-img-loaded::after {
    opacity: 0;
    visibility: hidden;
}

/* 加载完成后去掉占位底色，避免 contain / 比例与容器不一致时露出灰边 */
.acg-img-load-host.acg-img-loaded {
    background-color: transparent;
}

/*
 * 内部为 <img>：仅用透明度过渡。
 * 商品详情 .item-cover 在 index.css 中为 position:absolute + inset:0 填满 .acg-cover；
 * 若此处写 position:relative 会覆盖该规则，导致主图按内容尺寸撑出卡片边框。
 */
.acg-img-load-host > img.item-cover {
    z-index: 3;
    opacity: 0;
    transition: opacity 0.35s ease;
}

.acg-img-load-host > img:not(.item-cover) {
    position: relative;
    z-index: 3;
    opacity: 0;
    transition: opacity 0.35s ease;
}

.acg-img-load-host.acg-img-loaded > img {
    opacity: 1;
}

/* 购物首页列表封面：背景图模式占位高度 */
.item-list .acg-thumb.acg-img-load-host:not(.acg-img-loaded) {
    min-height: 120px;
}

/* 商品详情推荐区 / 同分类导航缩略图（背景图模式） */
.acg-item-recommend-grid .acg-thumb.acg-img-load-host:not(.acg-img-loaded) {
    min-height: 100px;
}

.acg-item-related-nav-card__thumb.acg-img-load-host:not(.acg-img-loaded) {
    min-height: 3.5rem;
}

/* 分类芯片图标：区域小，只保留转圈 */
.chip-icon.acg-img-load-host::after {
    display: none;
}

.chip-icon.acg-img-load-host::before {
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
    border-width: 2px;
}

/* 顶栏品牌链接：历史版本曾对 .brand-logo 套过 host，去掉灰底与加载层 */
.navbar .navbar-brand.acg-img-load-host {
    background-color: transparent !important;
}

.navbar .navbar-brand.acg-img-load-host::before,
.navbar .navbar-brand.acg-img-load-host::after {
    display: none !important;
    content: none !important;
}

.navbar .navbar-brand.acg-img-load-host .brand-logo {
    opacity: 1 !important;
}

/* 顶栏用户区按钮：旧版曾对头像套过 host */
.navbar .user-info-box .dropdown-toggle.acg-img-load-host,
.navbar .dropdown-toggle.acg-img-load-host {
    background-color: transparent !important;
}

.navbar .user-info-box .dropdown-toggle.acg-img-load-host::before,
.navbar .user-info-box .dropdown-toggle.acg-img-load-host::after,
.navbar .dropdown-toggle.acg-img-load-host::before,
.navbar .dropdown-toggle.acg-img-load-host::after {
    display: none !important;
    content: none !important;
}

.navbar .user-info-box .dropdown-toggle.acg-img-load-host .user-avatar,
.navbar .dropdown-toggle.acg-img-load-host .user-avatar {
    opacity: 1 !important;
}
