/* ========================================
   Player Styles
   ======================================== */

:root {
    --player-accent: #fe2a47;
}

.player-wrapper {
    position: relative;
    background: var(--bg-primary);
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.player {
    position: relative;
    width: 100%;
    aspect-ratio: 9/16;
    max-width: 420px;
    background: #000;
    overflow: hidden;
}

.player video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    cursor: pointer;
}

/* --- Play overlay --- */
.player-play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.player-play-overlay.visible {
    opacity: 1;
}
.player-play-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    cursor: pointer;
}
.player-play-overlay.visible .player-play-icon {
    animation: playIconPulse 0.6s ease forwards;
}
@keyframes playIconPulse {
    0%   { transform: scale(0.8); opacity: 0; }
    40%  { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1);   opacity: 1; }
}

/* --- Controls bar --- */
.player-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}
.player-controls.visible {
    opacity: 1;
    pointer-events: auto;
}
.player-controls-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px 10px;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
}

/* --- Progress bar --- */
.player-progress {
    width: 100%;
    height: 4px;
    background: rgba(255,255,255,0.2);
    cursor: pointer;
    position: relative;
    transition: height 0.15s ease;
    touch-action: none;
}
.player-progress:hover,
.player-progress:active {
    height: 8px;
}
.player-progress-buffered {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: rgba(255,255,255,0.3);
    border-radius: 2px;
}
.player-progress-played {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: var(--player-accent);
    border-radius: 2px;
}
.player-progress-thumb {
    position: absolute;
    top: 50%;
    width: 14px;
    height: 14px;
    background: var(--player-accent);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 0.15s ease;
    pointer-events: none;
    box-shadow: 0 0 4px rgba(0,0,0,0.4);
}
.player-progress:hover .player-progress-thumb,
.player-progress:active .player-progress-thumb {
    opacity: 1;
}
body.player-fullscreen .player-progress-thumb {
    width: 16px;
    height: 16px;
    opacity: 1;
}

/* --- Control buttons --- */
.player-btn {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.9;
    transition: opacity 0.2s;
    touch-action: manipulation;
    min-width: 38px;
    min-height: 38px;
}
.player-btn:hover { opacity: 1; }
.player-time {
    color: rgba(255,255,255,0.8);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.player-ep-indicator {
    color: rgba(255,255,255,0.6);
    font-size: 12px;
    white-space: nowrap;
    background: rgba(255,255,255,0.1);
    padding: 2px 8px;
    border-radius: 10px;
}
.player-spacer { flex: 1; }
.player.hide-cursor { cursor: none; }

/* --- Native Fullscreen API (:fullscreen / -webkit-full-screen) --- */
.player:fullscreen,
.player:-webkit-full-screen {
    position: absolute !important;
    top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    aspect-ratio: auto !important;
    background: #000 !important;
}
.player:fullscreen video,
.player:-webkit-full-screen video {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
}

/* --- Fake fullscreen (iOS fallback via body class + inline styles) --- */
body.player-fullscreen {
    overflow: hidden !important;
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    overscroll-behavior-x: none;
}
html.player-fullscreen {
    overflow: hidden !important;
    height: 100%;
    overscroll-behavior-x: none;
}
body.player-fullscreen .header,
body.player-fullscreen .watch-breadcrumb,
body.player-fullscreen .watch-cost-notice,
body.player-fullscreen .watch-vip-notice {
    display: none !important;
}

/* --- Player lock overlay --- */
.player-wrapper.blurred.locked video { filter: blur(20px); pointer-events: none; }
.player-wrapper.locked .player { pointer-events: none; }
.player-wrapper.locked .player-lock-overlay { pointer-events: auto; }

.player-lock-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: rgba(0,0,0,0.65);
    z-index: 10;
}
.player-lock-icon {
    color: rgba(255,255,255,0.9);
}
.player-lock-text {
    color: rgba(255,255,255,0.9);
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    line-height: 1.5;
}
.player-unlock-btn {
    width: 240px;
    height: 48px;
    background: linear-gradient(90deg, #E52E2E 0%, #EB4C46 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.player-unlock-btn:active { opacity: 0.85; }

/* --- Responsive --- */
@media (max-width: 768px) {
    .player {
        max-width: 100%;
        aspect-ratio: 9/16;
        max-height: 50vh;
    }
}
