/* ============================================================
   子比商城仿抖音短视频带货 —— 前端样式
   移动端优先；PC 端自动降级为居中手机框。
   ============================================================ */

.qqdouyin-feed {
    position: relative;
    width: 100%;
    height: 100vh;
    background: #000;
    overflow: hidden;
}

/* 视频列表容器（垂直滑动） */
.qqdouyin-list {
    height: 100%;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.qqdouyin-list::-webkit-scrollbar {
    display: none;
}

/* 单条视频 */
.qqdouyin-item {
    position: relative;
    width: 100%;
    height: 100vh;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}
.qqdouyin-item video {
    width: 100%;
    height: 100%;
    /* 铺满全屏（抖音同款）：画幅不一致时裁切超出部分，不留黑边 */
    object-fit: cover;
    background: #000;
}
.qqdouyin-cover {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
    transition: opacity 0.3s ease;
}
/* 视频起播后封面淡出；未起播/暂停时显示封面，避免黑屏 */
.qqdouyin-cover.cover-off {
    opacity: 0;
}

/* 底部进度条（抖音同款，可点按/拖动跳转；播放中自动隐藏，暂停时常显可拖） */
.qqdouyin-progress {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 110px;   /* 80 + 30：上移30px */
    height: 20px;
    z-index: 10;
    display: flex;
    align-items: flex-end;
    cursor: pointer;
    touch-action: none;
    /* 视觉条抬高 3px，避免被底部导航栏边缘压住 */
    padding-bottom: 3px;
    transition: opacity 0.3s ease;
}
.qqdouyin-progress.zib-prog-hide {
    opacity: 0;
    pointer-events: none;
}
.qqdouyin-progress::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 3px;
    height: 3px;
    /* 深色半透明轨道：亮色/暗色画面下都可见 */
    background: rgba(0, 0, 0, 0.35);
}
.qqdouyin-progress .zib-prog-fill {
    position: relative;
    z-index: 1;
    width: 0;
    height: 3px;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.55);
}
/* 长按倍速提示 */
.qqdouyin-rate-tip {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    font-size: 15px;
    padding: 10px 20px;
    border-radius: 22px;
    z-index: 12;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}
.qqdouyin-rate-tip.show {
    opacity: 1;
}

.qqdouyin-play-icon {
    position: absolute;
    z-index: 3;
    font-size: 56px;
    color: rgba(255, 255, 255, 0.85);
    pointer-events: none;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
}

/* 右侧功能悬浮栏 */
.qqdouyin-actions {
    position: absolute;
    right: 10px;
    bottom: 120px;
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}
.qqdouyin-actions .zib-act {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #fff;
    cursor: pointer;
    user-select: none;
}
.qqdouyin-actions .zib-act .zib-act-ico {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    backdrop-filter: blur(2px);
    transition: transform 0.15s ease;
}
.qqdouyin-actions .zib-act:active .zib-act-ico {
    transform: scale(0.88);
}
.qqdouyin-actions .zib-act .zib-act-num {
    font-size: 12px;
    margin-top: 4px;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}
.qqdouyin-actions .zib-act.active .zib-act-ico {
    color: #ff2c55;
}
/* 收藏激活态：抖音同款金色 */
.qqdouyin-actions .zib-act-collect.active .zib-act-ico {
    color: #ffb800;
}
/* SVG 线性图标（抖音同款）统一尺寸与阴影 */
.qqdouyin-actions .zib-act-ico svg {
    width: 26px;
    height: 26px;
    display: block;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.45));
}
/* 头像包裹层：为下方关注「＋」号留出空间 */
.qqdouyin-actions .zib-avatar-wrap,
.qqdouyin-actions .zib-avatar-link {
    position: relative;
    margin-bottom: 14px;
}
/* 关注按钮：头像正下方小圆点（+ / ✓） */
.qqdouyin-actions .zib-follow-btn {
    position: absolute;
    left: 50%;
    bottom: -12px;
    transform: translateX(-50%);
    width: 22px;
    height: 22px;
    text-align: center;
    border-radius: 50%;
    background: #ff2c55;
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    line-height: 20px;
    cursor: pointer;
    z-index: 2;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
    transition: transform 0.15s ease, opacity 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}
.qqdouyin-actions .zib-follow-btn:active {
    transform: translateX(-50%) scale(0.88);
}
.qqdouyin-actions .zib-follow-btn.followed {
    background: #b9bec7;
}
.qqdouyin-actions .zib-follow-btn.busy {
    opacity: 0.5;
    pointer-events: none;
}
/* 分享按钮 SVG 图标对齐 */
.qqdouyin-actions .zib-act-share .zib-act-ico svg {
    display: block;
}
.qqdouyin-actions .zib-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 2px solid #fff;
    object-fit: cover;
    margin-bottom: 4px;
    background: #333;
}
.qqdouyin-actions .zib-avatar-link {
    display: block;
    line-height: 0;
    margin-bottom: 4px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.qqdouyin-actions .zib-avatar-link .zib-avatar {
    margin-bottom: 0;
    transition: transform 0.15s ease;
}
.qqdouyin-actions .zib-avatar-link:active .zib-avatar {
    transform: scale(0.92);
}

/* 底部信息栏 */
.qqdouyin-info {
    position: absolute;
    left: 12px;
    right: 80px;
    bottom: 194px;   /* 154 + 40：再次上移，避让进度条与底部边缘 */
    z-index: 5;
    color: #fff;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.7);
}
.qqdouyin-info .zib-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 6px;
    line-height: 1.4;
}
.qqdouyin-info .zib-desc {
    font-size: 13px;
    opacity: 0.92;
    line-height: 1.5;
    margin-bottom: 10px;
    max-height: 42px;
    overflow: hidden;
}
.qqdouyin-goods {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 30px;
    padding: 5px 12px 5px 5px;
    max-width: 100%;
    cursor: pointer;
    backdrop-filter: blur(4px);
}
.qqdouyin-goods img {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    object-fit: cover;
    background: #fff;
}
.qqdouyin-goods .zib-goods-name {
    font-size: 13px;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.qqdouyin-goods .zib-goods-price {
    color: #ffde59;
    font-weight: 700;
    font-size: 14px;
}

/* 加载/结束提示 */
.qqdouyin-loading,
.qqdouyin-end {
    text-align: center;
    color: #fff;
    padding: 14px;
    font-size: 13px;
}
.qqdouyin-disabled {
    text-align: center;
    padding: 40px 16px;
    color: #888;
}

/* ===================== 弹窗（底部抽屉） ===================== */
.qqdouyin-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}
.qqdouyin-modal.hide {
    display: none;
}
.qqdouyin-mask {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}
.qqdouyin-sheet {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 480px;
    max-height: 86vh;
    background: #fff;
    border-radius: 16px 16px 0 0;
    overflow-y: auto;
    animation: zibSlideUp 0.25s ease;
    -webkit-overflow-scrolling: touch;
}
@keyframes zibSlideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}
.qqdouyin-sheet .zib-sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid #f0f0f0;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 3;
}
.qqdouyin-sheet .zib-sheet-head h3 {
    margin: 0;
    font-size: 16px;
}
.qqdouyin-sheet .zib-sheet-close {
    font-size: 22px;
    cursor: pointer;
    color: #999;
    line-height: 1;
}

/* 商品弹窗内容 */
.zib-product-main {
    display: flex;
    gap: 12px;
    padding: 16px;
}
.zib-product-main img {
    width: 96px;
    height: 96px;
    border-radius: 10px;
    object-fit: cover;
    background: #f5f5f5;
}
.zib-product-main .zib-p-title {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 8px;
}
.zib-product-price {
    display: flex;
    align-items: baseline;
    gap: 8px;
}
.zib-product-price .zib-now {
    color: #ff2c55;
    font-size: 20px;
    font-weight: 700;
}
.zib-product-price .zib-ori {
    color: #999;
    text-decoration: line-through;
    font-size: 13px;
}
.zib-product-stock {
    color: #888;
    font-size: 12px;
    margin-top: 6px;
}
.zib-product-options {
    padding: 0 16px 8px;
}
.zib-product-options .zib-opt-group {
    margin-bottom: 12px;
}
.zib-product-options .zib-opt-group .zib-opt-label {
    font-size: 13px;
    color: #555;
    margin-bottom: 8px;
}
.zib-product-options .zib-opt-items {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.zib-product-options .zib-opt-item {
    padding: 6px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    background: #fafafa;
}
.zib-product-options .zib-opt-item.active {
    border-color: #ff2c55;
    color: #ff2c55;
    background: #fff0f3;
}
.zib-product-actions {
    display: flex;
    gap: 10px;
    padding: 12px 16px calc(16px + env(safe-area-inset-bottom));
    border-top: 1px solid #f0f0f0;
    position: sticky;
    bottom: 0;
    background: #fff;
}
.zib-product-actions .zib-btn {
    flex: 1;
    text-align: center;
    padding: 12px;
    border-radius: 24px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    border: none;
}
.zib-product-actions .zib-btn-cart {
    background: #ffe9ec;
    color: #ff2c55;
}
.zib-product-actions .zib-btn-buy {
    background: linear-gradient(90deg, #ff2c55, #ff5e3a);
    color: #fff;
}
.zib-product-link {
    text-align: center;
    padding: 0 16px 14px;
    font-size: 12px;
}
.zib-product-link a {
    color: #999;
    text-decoration: underline;
}

/* 评论弹窗 */
.zib-comment-list {
    padding: 0 16px;
    min-height: 120px;
}
.zib-comment-item {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 12px 0;
    border-bottom: 1px solid #f5f5f5;
}
.zib-comment-item > img {
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    background: #eee;
}
.zib-comment-item .zib-c-body {
    flex: 1;
    min-width: 0;
}
.zib-comment-item .zib-c-body .zib-c-name {
    font-size: 13px;
    color: #666;
    margin-bottom: 4px;
}
.zib-comment-item .zib-c-body .zib-c-content {
    font-size: 14px;
    line-height: 1.5;
    color: #222;
    word-break: break-word;
}
.zib-comment-item .zib-c-body .zib-c-date {
    font-size: 11px;
    color: #bbb;
    margin-top: 0;
}
/* @提及 高亮 */
.zib-mention {
    color: #ff2c55;
    font-weight: 600;
    font-style: normal;
}

/* 评论者昵称可点击 → @TA（仅限自己关注的人） */
.zib-c-name {
    cursor: pointer;
    display: inline-block;
}
.zib-c-name:active {
    opacity: 0.55;
}
.zib-comment-empty {
    text-align: center;
    color: #aaa;
    padding: 30px 0;
    font-size: 13px;
}
.zib-comment-input {
    display: flex;
    gap: 8px;
    padding: 12px 16px calc(14px + env(safe-area-inset-bottom));
    border-top: 1px solid #f0f0f0;
    position: sticky;
    bottom: 0;
    background: #fff;
}
.zib-comment-input textarea {
    flex: 1;
    border: 1px solid #e0e0e0;
    border-radius: 18px;
    padding: 8px 14px;
    font-size: 14px;
    resize: none;
    height: 38px;
    max-height: 90px;
}
.zib-comment-input .zib-send {
    background: #ff2c55;
    color: #fff;
    border: none;
    border-radius: 18px;
    padding: 0 18px;
    font-size: 14px;
    cursor: pointer;
}

/* 评论操作行：日期 + 回复/删除 */
.zib-c-foot {
    display: flex;
    align-items: center;
    gap: 14px;
}
.zib-c-act {
    font-size: 12px;
    color: #8a8a8a;
    cursor: pointer;
}
.zib-c-act:active {
    color: #ff2c55;
}
/* 楼中楼回复（嵌在主评下方的灰底块） */
.zib-c-replies {
    margin-top: 8px;
    background: #f6f7f9;
    border-radius: 8px;
    padding: 2px 10px;
}
.zib-comment-sub {
    border-bottom: none;
    padding: 8px 0;
}
.zib-comment-sub img {
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
}
/* 评论头像链接（点击进入用户主页，后台开关控制） */
.zib-comment-item > .zib-c-avatar-link {
    display: block;
    flex: 0 0 36px;
    line-height: 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.zib-comment-item > .zib-c-avatar-link img {
    display: block;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    background: #eee;
}
.zib-comment-sub > .zib-c-avatar-link {
    flex: 0 0 28px;
}
.zib-comment-sub > .zib-c-avatar-link img {
    width: 28px;
    height: 28px;
}
/* 回复状态条（输入框上方） */
.zib-replying {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px 0;
    font-size: 12px;
    color: #666;
}
/* 游客登录/注册提示条（替代评论输入框） */
.zib-login-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 12px 16px;
    padding: 12px;
    background: #f6f7f9;
    border-radius: 22px;
    color: #ff2c55;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.zib-login-bar:active {
    background: #ececf0;
}
.zib-replying.hide {
    display: none;
}
.zib-reply-cancel {
    color: #999;
    cursor: pointer;
}

/* Toast */
.qqdouyin-toast {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
    max-width: 80%;
    text-align: center;
}
.qqdouyin-toast.show {
    opacity: 1;
}

/* ===================== 移动端全屏模式（抖音式） ===================== */
/* JS 检测到短视频 feed 后给 body 加 qqdouyin-active：
   隐藏子比页头/页脚/悬浮按钮，feed 固定铺满到「底部导航栏上方」，
   保留底部导航栏（.footer-tabbar，固定悬浮在 bottom:0）。
   页面本身不再滚动，滑动只作用于视频列表（scroll-snap 逐屏切换）。 */
@media (max-width: 767px) {
    body.qqdouyin-active {
        overflow: hidden !important;
        height: 100% !important;
        overscroll-behavior: none;
    }
    body.qqdouyin-active header.header,
    body.qqdouyin-active footer.footer,
    body.qqdouyin-active .footer-tabbar-placeholder,
    body.qqdouyin-active .mobile-navbar,
    body.qqdouyin-active .float-btn,
    body.qqdouyin-active .fixed-body {
        display: none !important;
    }
    /* 底部导航栏（.footer-tabbar）保持显示 */
    body.qqdouyin-active .qqdouyin-feed {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: var(--qqdouyin-tabbar-h, calc(49px + env(safe-area-inset-bottom)));
        z-index: 999;
    }
    body.qqdouyin-active .qqdouyin-list {
        height: 100%;
    }
    body.qqdouyin-active .qqdouyin-item {
        height: 100%;
    }
}

/* ===================== PC 端降级 ===================== */
@media (min-width: 768px) {
    .qqdouyin-feed {
        height: 100vh;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .qqdouyin-list {
        width: 420px;
        height: 90vh;
        border-radius: 20px;
        /* 注意：必须保留纵向滚动（此前 overflow:hidden 把滚动一起关掉，导致 PC 无法滑动切换视频） */
        overflow-y: scroll;
        overflow-x: hidden;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    }
    .qqdouyin-item {
        height: 90vh;
    }
    /* 加载/结束提示固定在手机框底部，不再飘在旁边 */
    .qqdouyin-loading,
    .qqdouyin-end {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        bottom: calc(5vh + 10px);
        z-index: 5;
        text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
    }
}
