/* DPlayer播放器专用样式 - 最小化样式，避免与style.css冲突 */

/* 播放器容器样式 - 支持横屏和竖屏视频 */
.MacPlayer {
    position: relative;
    width: 100%;
    background: #000;
    overflow: hidden;
    /* 默认横屏比例 16:9 */
    aspect-ratio: 16 / 9;
    /* 确保在 aspect-ratio 计算前也有最小高度，防止初始时高度为 0 */
    /* 使用较大的最小高度，确保即使宽度很小也能有足够的高度用于居中显示 */
}

/* 视频就绪后，移除初始占位策略 */
.MacPlayer.video-ready {
   position: relative;
    width: 100%;
    background: #000;
    overflow: hidden;
    aspect-ratio: auto;
}

/* 竖屏视频样式 */
.MacPlayer.vertical-video {
    border-radius: 30px;
    /* 竖屏比例 9:16 */
    max-width: 400px;
    margin: 0 auto;
    aspect-ratio: auto;
}

/* DPlayer容器样式 */
.video-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
    overflow: hidden;
    /* 保持最小高度，防止布局塌陷 */
    /* min-height: 400px;  */
}

/* 视频错误覆盖层 */
.video-error-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    /* 确保即使父容器高度未确定时也有最小高度，防止初始时高度为 0 */
    min-height: 400px;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000; /* 提高 z-index，确保在 DPlayer 之上 */
    pointer-events: auto; /* 错误信息可以交互 */
    /* 移除 flexbox，因为子元素使用绝对定位 */
}

/* 视频加载覆盖层 */
.video-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    /* 确保即使父容器高度未确定时也有最小高度，防止初始时高度为 0 */
    min-height: 400px;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000; /* 提高 z-index，确保在 DPlayer 之上 */
    pointer-events: none; /* 允许点击穿透到视频（如果需要） */
    /* 移除 flexbox，因为子元素使用绝对定位 */
}

/* 加载和错误容器样式 - 使用相对于覆盖层的绝对定位居中 */
/* 注意：覆盖层必须使用 position: absolute 且 inset: 0 来占满 .MacPlayer */
.loading-container,
.error-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: white;
    z-index: 1001; /* 确保在覆盖层之上 */
    /* 确保即使在父容器高度未确定时也能居中显示 */
    white-space: nowrap;
    /* 如果覆盖层高度为 0，使用视口中心作为后备（当 top: 50% 为 0 时，transform 仍会居中） */
}

.loading-container .loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #e50914;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
    display: block; /* 确保显示 */
}

.loading-container p {
    color: white;
    font-size: 16px;
    margin: 0;
    font-weight: 500;
}

.error-container .error-icon {
    margin-bottom: 20px;
    color: #e50914;
}

.error-container h3 {
    font-size: 18px;
    margin-bottom: 10px;
    color: white;
}

.error-container p {
    color: rgba(255, 255, 255, 0.8);
    margin: 0;
}

/* 旋转动画 */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 弹窗样式 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.modal-content {
    background: white;
    border-radius: 8px;
    padding: 0;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 20px 0 20px;
    border-bottom: 1px solid #eee;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    color: #333;
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    color: #666;
}

.modal-close:hover {
    color: #333;
}

.modal-body {
    padding: 20px;
}

.modal-body p {
    margin: 0 0 10px 0;
    color: #666;
    line-height: 1.5;
}

/* DPlayer 根容器样式 - 确保有足够的高度 */
.video-container .dplayer,
.video-container .dplayer-container {
    width: 100% !important;
    height: 100% !important;
    min-height: 100% !important;
}

/* DPlayer 视频容器和视频元素样式 */
.dplayer-video-wrap {
    position: relative !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 100% !important;
    display: flex !important;
    align-items: center !important; /* 垂直居中 */
    justify-content: center !important; /* 水平居中 */
    overflow: hidden;
}

.dplayer-video-wrap .dplayer-video {
    width: auto !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important; /* 保持视频比例，完整显示 */
    display: block !important; /* 显示视频 */
    margin: auto !important; /* 额外的居中保障 */
}

/* 响应式设计 - 移动设备适配 */
/* @media (max-width: 768px) {
    .MacPlayer {
        border-radius: 0;
        margin: 0 -20px;
        width: calc(100% + 40px);
    }
    
    .MacPlayer.vertical-video {
        max-width: 100%;
        margin: 0 -20px;
        width: calc(100% + 40px);
    }
}

@media (max-width: 480px) {
    .MacPlayer.vertical-video {
        max-width: 100%;
        margin: 0 -10px;
        width: calc(100% + 20px);
    }
} */

@media(max-width: 1025px) {
    .MacPlayer.vertical-video {
    border-radius: 25px !important;
    max-width: 80%;
    margin: 0 auto;
    aspect-ratio: auto;
}
}
