/* ==========================================================================
   yunbo.net 卡片悬停试看 - 面板样式 v2
   文件: static/ds3/css/hover-preview2.css
   引入: template/ds3/name/public/include.html
   关键设计:
     - 独立文件,不追加到 style_add.css
     - 默认 display:none,由 JS 加 .breakpoint-ok 才显示
     - 宽度 --pw JS 动态设,高度用 aspect-ratio: var(--ratio)
     - 断点 992px 默认,可由管理台配置修改
   ========================================================================== */

/* === 悬停预览面板 === */
.poster-preview-panel {
    position: fixed;
    z-index: 9999;
    width: var(--pw, 320px);
    background: #000;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, .45);
    overflow: hidden;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity .2s ease;
    --ratio: 2/3;
    display: none;          /* 默认隐藏,由 .breakpoint-ok 开启 */
}

.poster-preview-panel.breakpoint-ok {
    display: block;
}

.poster-preview-panel.is-active {
    pointer-events: auto;
    opacity: 1;
    visibility: visible;
}

/* 视频元素 - 等比缩放,跟封面比例联动 */
.poster-preview-panel .pp-video {
    width: 100%;
    height: 100%;               /* 填满 panel (panel 宽高由 JS 直接设) */
    object-fit: cover;
    background: #000;
    display: block;
}

/* ★ 试看结束后隐藏 video (用 class 控制,不被 JS inline style 覆盖) */
.poster-preview-panel .pp-video.pp-video-hidden {
    display: none !important;
}

/* 加载动画 */
.poster-preview-panel .pp-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, .5);
    color: #fff;
    z-index: 2;
    font-size: 13px;
    flex-direction: column;
    gap: 12px;
    cursor: default;
}
.poster-preview-panel .pp-loading.pp-loading-hidden { display: none !important; }

.poster-preview-panel .pp-loading::before {
    content: '';
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255, 255, 255, .25);
    border-top-color: #fff;
    border-radius: 50%;
    animation: pp-spin .9s linear infinite;
}

/* 错误状态:不要旋转圈 */
.poster-preview-panel .pp-loading.pp-loading-error {
    background: rgba(0, 0, 0, .75);
    cursor: pointer;
}
.poster-preview-panel .pp-loading.pp-loading-error::before {
    display: none;
}

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

/* 错误 / 试看结束文案 */
.poster-preview-panel .pp-error {
    color: #fff;
    text-align: center;
    padding: 0 16px;
    font-size: 13px;
    line-height: 1.5;
    user-select: none;
}
.poster-preview-panel .pp-error a {
    color: #4fc3f7;
    text-decoration: underline;
}

/* 独立错误层 (试看结束 / 视频不可用) - 取代黑屏的 .pp-loading 容器 */
.poster-preview-panel .pp-error-wrap {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 10px;
    background: rgba(0, 0, 0, .75);
    color: #fff;
    z-index: 3;
    cursor: pointer;
    font-size: 14px;
    text-align: center;
    padding: 0 16px;
    line-height: 1.5;
    user-select: none;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .8);
}
.poster-preview-panel .pp-error-wrap .pp-error-icon {
    font-size: 32px;
    line-height: 1;
    opacity: .95;
}
.poster-preview-panel .pp-error-wrap .pp-error-text a {
    color: #4fc3f7;
    text-decoration: underline;
}

/* 声音切换按钮 */
.poster-preview-panel .pp-sound {
    position: absolute;
    right: 8px;
    bottom: 8px;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, .55);
    color: #fff;
    cursor: pointer;
    z-index: 3;
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s;
    padding: 0;
}

.poster-preview-panel .pp-sound:hover {
    background: rgba(0, 0, 0, .85);
}

/* 卡片源高亮 (源卡片轻微浮起) */
.public-list-box.pp-source {
    position: relative;
    z-index: 2;
}

/* === 全局关停开关 (紧急用) === */
html.no-hover-preview .poster-preview-panel {
    display: none !important;
}