/* HALLOPlay WebPlayer - Player Styles */

/* ==================== PLAYER OVERLAY ==================== */
.player-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 1000;
}

.player-container {
    position: relative;
    width: 100%;
    height: 100%;
}

.video-player {
    width: 100%;
    height: 100%;
    background: #000;
    object-fit: contain;
}

/* ==================== AD CONTAINER ==================== */
.ad-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

.ad-container.active {
    pointer-events: auto;
}

/* ==================== SUBTITLES / TEXT TRACKS ==================== */
/* Shaka Player text container */
.shaka-text-container,
.player-container .shaka-text-container,
.live-player-container .shaka-text-container {
    position: absolute !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 12% !important;
    top: auto !important;
    text-align: center !important;
    pointer-events: none !important;
    z-index: 50 !important;
    display: block !important;
    visibility: visible !important;
}

.shaka-text-container span,
.shaka-text-container div {
    background: rgba(0, 0, 0, 0.85) !important;
    color: #fff !important;
    font-size: 28px !important;
    font-family: Arial, sans-serif !important;
    padding: 6px 16px !important;
    border-radius: 6px !important;
    line-height: 1.5 !important;
    display: inline-block !important;
    max-width: 85% !important;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.9) !important;
}

/* Native video text tracks (WebVTT) */
video::cue {
    background: rgba(0, 0, 0, 0.85) !important;
    color: #fff !important;
    font-size: 26px !important;
    font-family: Arial, sans-serif !important;
    line-height: 1.5 !important;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.9) !important;
}

video::-webkit-media-text-track-container {
    position: absolute !important;
    bottom: 12% !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    text-align: center !important;
    z-index: 50 !important;
    overflow: visible !important;
    transform: none !important;
}

video::-webkit-media-text-track-display {
    background: rgba(0, 0, 0, 0.85) !important;
    padding: 6px 16px !important;
    border-radius: 6px !important;
    display: inline-block !important;
}

/* Force text track visibility in live player */
.live-player-container video::cue,
#live-video::cue {
    background: rgba(0, 0, 0, 0.85) !important;
    color: #fff !important;
    font-size: 28px !important;
}

/* ==================== PLAYER CONTROLS ==================== */
.player-controls {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.7) 0%,
        transparent 20%,
        transparent 80%,
        rgba(0, 0, 0, 0.7) 100%
    );
    opacity: 0;
    transition: opacity var(--transition-normal);
    z-index: 5;
}

.player-overlay:hover .player-controls,
.player-controls.visible {
    opacity: 1;
}

.controls-top {
    display: flex;
    align-items: center;
    padding: 20px 30px;
    gap: 20px;
}

.controls-center {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 40px;
}

.controls-bottom {
    display: flex;
    align-items: center;
    padding: 20px 30px;
    gap: 16px;
}

/* ==================== CONTROL BUTTONS ==================== */
.control-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    cursor: pointer;
}

.control-btn:hover,
.control-btn.focused {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.control-btn svg {
    width: 24px;
    height: 24px;
}

.control-btn-large {
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.2);
}

.control-btn-large svg {
    width: 40px;
    height: 40px;
}

.control-btn-small {
    width: 40px;
    height: 40px;
}

.control-btn-small svg {
    width: 20px;
    height: 20px;
}

/* ==================== PLAYER TITLE ==================== */
.player-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==================== PROGRESS BAR ==================== */
.progress-container {
    flex: 1;
    height: 40px;
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 0 10px;
}

.progress-bar {
    position: relative;
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    overflow: visible;
}

.progress-buffered {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 3px;
}

.progress-played {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: var(--accent-color);
    border-radius: 3px;
}

.progress-handle {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translate(-50%, -50%) scale(0);
    width: 16px;
    height: 16px;
    background: var(--accent-color);
    border-radius: 50%;
    transition: transform var(--transition-fast);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.progress-container:hover .progress-handle,
.progress-container.focused .progress-handle {
    transform: translate(-50%, -50%) scale(1);
}

.progress-container:hover .progress-bar {
    height: 8px;
}

/* ==================== TIME DISPLAY ==================== */
.time-display {
    font-size: var(--font-size-sm);
    font-variant-numeric: tabular-nums;
    min-width: 50px;
    text-align: center;
    color: var(--text-secondary);
}

/* ==================== PLAYER LOADING ==================== */
.player-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 6;
    display: none;
}

.player-loading.visible {
    display: block;
}

.player-loading .loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--bg-tertiary);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* ==================== TRACK MENU ==================== */
.track-menu {
    position: absolute;
    bottom: 80px;
    right: 20px;
    background: rgba(20, 20, 20, 0.95);
    border-radius: var(--radius-md);
    padding: 16px;
    min-width: 200px;
    z-index: 20;
    display: none;
}

.track-menu.visible {
    display: block;
}

.track-menu-title {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    margin-bottom: 12px;
    text-transform: uppercase;
}

.track-option {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.track-option:hover,
.track-option.focused {
    background: rgba(255, 255, 255, 0.1);
}

.track-option.active {
    color: var(--accent-color);
}

.track-option-check {
    width: 20px;
    margin-right: 10px;
}

/* ==================== LIVE INDICATOR ==================== */
.live-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--accent-color);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 600;
    text-transform: uppercase;
}

.live-indicator-dot {
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    animation: livePulse 1.5s ease-in-out infinite;
}

@keyframes livePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ==================== CHANNEL INFO OVERLAY ==================== */
.channel-info-overlay {
    position: absolute;
    bottom: 100px;
    left: 30px;
    background: rgba(0, 0, 0, 0.8);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    max-width: 500px;
    opacity: 0;
    transform: translateY(20px);
    transition: all var(--transition-normal);
    z-index: 10;
}

.channel-info-overlay.visible {
    opacity: 1;
    transform: translateY(0);
}

.channel-info-logo {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-md);
    object-fit: contain;
    background: white;
    padding: 8px;
}

.channel-info-details {
    flex: 1;
}

.channel-info-name {
    font-size: var(--font-size-lg);
    font-weight: 600;
    margin-bottom: 8px;
}

.channel-info-program {
    font-size: var(--font-size-md);
    color: var(--text-secondary);
}

.channel-info-time {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    margin-top: 4px;
}

/* ==================== SKIP INDICATOR ==================== */
.skip-indicator {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.7);
    padding: 20px 30px;
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    opacity: 0;
    transition: opacity var(--transition-fast);
    z-index: 15;
    pointer-events: none;
}

.skip-indicator.visible {
    opacity: 1;
}

.skip-indicator-left {
    left: 20%;
}

.skip-indicator-right {
    right: 20%;
}

.skip-indicator svg {
    width: 48px;
    height: 48px;
    margin-bottom: 8px;
}

.skip-indicator-text {
    font-size: var(--font-size-lg);
    font-weight: 600;
}

/* ==================== ERROR OVERLAY ==================== */
.player-error {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 20;
}

.player-error-icon {
    width: 64px;
    height: 64px;
    color: var(--accent-color);
    margin-bottom: 20px;
}

.player-error-title {
    font-size: var(--font-size-xl);
    font-weight: 600;
    margin-bottom: 10px;
}

.player-error-message {
    font-size: var(--font-size-md);
    color: var(--text-secondary);
    margin-bottom: 20px;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .controls-top,
    .controls-bottom {
        padding: 15px 20px;
    }

    .control-btn-large {
        width: 60px;
        height: 60px;
    }

    .control-btn-large svg {
        width: 30px;
        height: 30px;
    }

    .controls-center {
        gap: 20px;
    }

    .player-title {
        font-size: var(--font-size-md);
    }

    .channel-info-overlay {
        left: 15px;
        right: 15px;
        bottom: 80px;
    }
}

@media (max-width: 480px) {
    .control-btn {
        width: 40px;
        height: 40px;
    }

    .control-btn svg {
        width: 20px;
        height: 20px;
    }

    .control-btn-large {
        width: 50px;
        height: 50px;
    }

    .time-display {
        font-size: var(--font-size-xs);
        min-width: 40px;
    }
}
