/* ========================================
   iOS 全屏模式 - 简化修复版本
   ======================================== */

/* 1. 隐藏非视频元素 */
body.ios-fullscreen-active .app.player-page.ios-fullscreen > .header,
body.ios-fullscreen-active .app.player-page.ios-fullscreen > .player-tabs,
body.ios-fullscreen-active .app.player-page.ios-fullscreen > .player-content {
    display: none !important;
}

/* 2. video-container 填满屏幕 */
body.ios-fullscreen-active .app.player-page.ios-fullscreen > .video-container {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    display: block !important;
    z-index: 10000 !important;
}

/* 3. 视频元素 */
body.ios-fullscreen-active .app.player-page.ios-fullscreen .video-player {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100vh !important;
    object-fit: contain !important;
    z-index: 1 !important;
    background: #000 !important;
}

/* 4. 弹幕容器 */
body.ios-fullscreen-active .app.player-page.ios-fullscreen .danmaku-container {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: 100vh !important;
    z-index: 2 !important;
    pointer-events: none !important;
}

/* 5. 顶部控件 - 固定在左上角 */
body.ios-fullscreen-active .app.player-page.ios-fullscreen .controls-top {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    padding: 12px !important;
    padding-top: calc(env(safe-area-inset-top, 20px) + 12px) !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    z-index: 10001 !important;
    background: transparent !important;
    pointer-events: auto !important;
}

/* 5.1 返回按钮 - 确保可点击 */
body.ios-fullscreen-active .app.player-page.ios-fullscreen .fullscreen-back-btn {
    z-index: 10002 !important;
    pointer-events: auto !important;
    touch-action: manipulation !important;
}

/* 6. 底部控件 - 固定在底部 */
body.ios-fullscreen-active .app.player-page.ios-fullscreen .controls-bottom {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    padding: 12px 16px !important;
    padding-bottom: calc(env(safe-area-inset-bottom, 20px) + 12px) !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 12px !important;
    z-index: 99999 !important;
    background: transparent !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* 6.0 确保video-controls可见 */
body.ios-fullscreen-active .app.player-page.ios-fullscreen .video-controls {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

body.ios-fullscreen-active .app.player-page.ios-fullscreen .video-controls.hidden {
    opacity: 0 !important;
}

/* 6.1 底部控件元素对齐 */
body.ios-fullscreen-active .app.player-page.ios-fullscreen .controls-bottom .play-btn,
body.ios-fullscreen-active .app.player-page.ios-fullscreen .controls-bottom .episodes-btn,
body.ios-fullscreen-active .app.player-page.ios-fullscreen .controls-bottom .fullscreen-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 36px !important;
    min-height: 36px !important;
    height: 36px !important;
}

body.ios-fullscreen-active .app.player-page.ios-fullscreen .controls-bottom .progress-bar {
    display: flex !important;
    align-items: center !important;
    height: 4px !important;
    min-height: 4px !important;
}

body.ios-fullscreen-active .app.player-page.ios-fullscreen .controls-bottom .time-display {
    display: flex !important;
    align-items: center !important;
    white-space: nowrap !important;
}

/* 6.2 选集面板 - 固定在右侧 */
body.ios-fullscreen-active .app.player-page.ios-fullscreen .fullscreen-episodes-panel {
    position: fixed !important;
    top: 0 !important;
    right: -100% !important;
    left: auto !important;
    width: 45% !important;
    max-width: 200px !important;
    height: 100vh !important;
    z-index: 10000 !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transition: right 0.3s ease, opacity 0.3s ease !important;
}

body.ios-fullscreen-active .app.player-page.ios-fullscreen .fullscreen-episodes-panel.show {
    right: 0 !important;
    left: auto !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* 6.3 选集弹窗显示时，video-play-overlay可点击关闭弹窗 */
body.ios-fullscreen-active .app.player-page.ios-fullscreen .fullscreen-episodes-panel.show ~ .video-play-overlay {
    display: flex !important;
    z-index: 9999 !important;
    pointer-events: auto !important;
}

/* 7. 播放覆盖层 - 只在暂停时显示 */
body.ios-fullscreen-active .app.player-page.ios-fullscreen .video-play-overlay {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 80px !important;
    z-index: 50 !important;
    background: transparent !important;
    pointer-events: auto !important;
}

body.ios-fullscreen-active .app.player-page.ios-fullscreen .video-play-overlay.hidden {
    display: none !important;
    pointer-events: none !important;
}

/* 8. video-controls 容器本身不需要定位 */
body.ios-fullscreen-active .app.player-page.ios-fullscreen .video-controls {
    position: static !important;
}

/* 9. 返回按钮 */
body.ios-fullscreen-active .app.player-page.ios-fullscreen .fullscreen-back-btn {
    flex-shrink: 0 !important;
    margin-right: 12px !important;
    background: transparent !important;
}

/* 9.1 所有按钮透明背景 */
body.ios-fullscreen-active .app.player-page.ios-fullscreen .control-btn {
    background: transparent !important;
}

body.ios-fullscreen-active .app.player-page.ios-fullscreen .episodes-btn {
    background: transparent !important;
}

body.ios-fullscreen-active .app.player-page.ios-fullscreen .fullscreen-btn {
    background: transparent !important;
}

body.ios-fullscreen-active .app.player-page.ios-fullscreen .play-btn {
    background: transparent !important;
}

/* 10. video-info */
body.ios-fullscreen-active .app.player-page.ios-fullscreen .video-info {
    flex: 1 !important;
    min-width: 0 !important;
    overflow: hidden !important;
}

/* 11. 进度条 */
body.ios-fullscreen-active .app.player-page.ios-fullscreen .progress-bar {
    flex: 1 !important;
    min-width: 0 !important;
}

/* 12. 横屏模式 */
@media screen and (orientation: landscape) {
    body.ios-fullscreen-active .app.player-page.ios-fullscreen .video-player {
        height: 100vh !important;
    }

    body.ios-fullscreen-active .app.player-page.ios-fullscreen .danmaku-container {
        height: 100vh !important;
    }

    body.ios-fullscreen-active .app.player-page.ios-fullscreen .controls-top {
        padding-top: calc(env(safe-area-inset-top, 10px) + 12px) !important;
    }

    body.ios-fullscreen-active .app.player-page.ios-fullscreen .controls-bottom {
        padding-bottom: calc(env(safe-area-inset-bottom, 10px) + 12px) !important;
    }

    body.ios-fullscreen-active .app.player-page.ios-fullscreen .fullscreen-episodes-panel {
        width: 30% !important;
        max-width: 180px !important;
    }
}
