/**
 * XPD 选片端 - 模块内部样式
 * Swiper幻灯片、Avatar头像、QRCode二维码、FaceDetection人脸检测
 */

/* ============================================
   Swiper 幻灯片模块
   ============================================ */
.module-swiper .swiper-container {
    width: 100%;
    height: 100%;
}

.module-swiper .swiper-slide {
    display: flex;
    justify-content: center;
    align-items: center;
    background: transparent;
    width: 100%;
    height: 100%;
}

.module-swiper .media-item {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.module-swiper .media-item.video {
    object-fit: contain;
}

/* ============================================
   Avatar 头像模块
   ============================================ */
.module-avatar {
    background: rgba(26, 26, 26, 0.85);
}

.module-avatar .avatar-inner {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    overflow-y: auto;
    overflow-x: hidden;
}

/* 头像区域滚动条美化 */
.module-avatar .avatar-inner::-webkit-scrollbar {
    width: 4px;
}
.module-avatar .avatar-inner::-webkit-scrollbar-track {
    background: transparent;
}
.module-avatar .avatar-inner::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
}

.module-avatar .avatar-list {
    display: flex;
    align-items: center;
    justify-content: center;
    align-content: flex-start;
    flex-wrap: wrap;
    gap: 1.5%;
    width: 100%;
    height: auto;
    overflow: visible;
    padding: 4px 0;
}

.module-avatar .avatar-item {
    flex-shrink: 0;
    position: relative;
    transition: all 0.3s ease;
    cursor: pointer;
    aspect-ratio: 1;
    /* 宽度由 JS 动态计算 */
}

.module-avatar .avatar-item img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #333;
    transition: all 0.3s ease;
}

.module-avatar .avatar-item:hover img {
    transform: scale(1.1);
    border-color: #888;
}

.module-avatar .avatar-item.highlight {
    z-index: 5;
}

.module-avatar .avatar-item.highlight img {
    border: 4px solid #ff6b6b;
    box-shadow: 0 0 20px rgba(255, 107, 107, 0.6);
    transform: scale(1.5);
}

/* ============================================
   QRCode 二维码模块
   ============================================ */
.module-qrcode {
    background: transparent;
}

.module-qrcode .qrcode-inner {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: transparent;
    border-radius: 12px;
    padding: 10px;
    box-sizing: border-box;
    overflow: visible;
}

.module-qrcode .qrcode-image {
    width: 100%;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px;
    object-fit: contain;
    margin: 0;
}

.module-qrcode .qrcode-canvas-wrap {
    width: 100%;
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
}

.module-qrcode .qrcode-canvas-wrap canvas {
    width: 100%;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px;
    object-fit: contain;
}

/* ============================================
   Text 文本模块
   ============================================ */
.module-text {
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.module-text .text-inner {
    color: #000;
    background: #fff;
    padding: 0.3em 0.8em;
    border-radius: 0.4em;
    font-size: calc(0.6 * var(--module-height, 24px));
    font-weight: 600;
    text-align: center;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    box-sizing: border-box;
}

/* ============================================
   人脸检测状态指示器（独立模块内）
   ============================================ */
.module-face-status {
    display: none;
}

.module-face-status.active {
    display: flex;
}

.face-status-inner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 20px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 13px;
    white-space: nowrap;
}

.face-status-inner .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #666;
    flex-shrink: 0;
}

.face-status-inner .dot.loading { background: #f0ad4e; animation: pulse 1s infinite; }
.face-status-inner .dot.active { background: #5cb85c; }
.face-status-inner .dot.matched { background: #ff6b6b; animation: pulse 0.5s infinite; }
.face-status-inner .dot.error { background: #d9534f; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* 隐藏摄像头视频元素 */
#cameraVideo {
    position: fixed;
    top: -9999px;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

/* ============================================
   响应式：模块内容自适应
   ============================================ */
@media (max-width: 1024px) {
    .module-qrcode .qrcode-tip {
        font-size: 10px;
    }
    .avatar-item {
        border-width: 2px;
    }
}
