﻿/* ThreeGigs v25 Custom Video Player - Fixed */

:root {
    --player-bg: rgba(0, 0, 0, 0.9);
    --player-glass: rgba(255, 255, 255, 0.1);
    --player-glass-hover: rgba(255, 255, 255, 0.15);
    --player-border: rgba(255, 255, 255, 0.2);
    --player-text: #ffffff;
    --player-text-secondary: rgba(255, 255, 255, 0.7);
    --player-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    --player-radius: var(--tg-radius-lg);
    --player-transition: all 0.3s var(--tg-ease-smooth);
    --player-control-size: 44px;
}

/* === VIDEO PLAYER CONTAINER === */
.tg-video-player {
    position: relative;
    width: 100%;
    background: #000;
    border-radius: var(--player-radius);
    overflow: hidden;
    box-shadow: var(--player-shadow);
    isolation: isolate;
    aspect-ratio: 16 / 9;
    min-height: 300px;
    z-index: 1; /* Ensure video player is above other elements */
}

    .tg-video-player.fullscreen {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 9999;
        border-radius: 0;
        aspect-ratio: unset;
    }

/* === VIDEO ELEMENT === */
.tg-video-element {
    width: 100%;
    height: 100%;
    display: block;
    background: #000;
    object-fit: cover;
    cursor: pointer;
}

.tg-video-player.fullscreen .tg-video-element {
    object-fit: contain;
}

/* === IFRAME CONTAINER (for embeds) === */
.tg-video-embed {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
}

    .tg-video-embed iframe {
        width: 100%;
        height: 100%;
        border: none;
    }

/* === BIG PLAY BUTTON === */
.tg-big-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    background: var(--player-bg);
    backdrop-filter: blur(16px);
    border: 3px solid var(--tg-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--player-transition);
    z-index: 100; /* High z-index to ensure it's clickable */
    color: var(--player-text);
    font-size: 2rem;
    pointer-events: auto; /* Ensure it can receive clicks */
}

    .tg-big-play-btn:hover {
        transform: translate(-50%, -50%) scale(1.1);
        background: var(--tg-primary);
        box-shadow: 0 0 30px rgba(138, 43, 226, 0.5);
    }

    .tg-big-play-btn:active {
        transform: translate(-50%, -50%) scale(0.95);
    }

/* === LOADING INDICATOR === */
.tg-video-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    color: var(--player-text);
    z-index: 5;
}

.tg-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--player-border);
    border-top: 3px solid var(--tg-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* === VIDEO CONTROLS === */
.tg-video-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    padding: 2rem 1rem 1rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 20;
}

    .tg-video-player:hover .tg-video-controls,
    .tg-video-controls:hover {
        opacity: 1;
    }

.tg-controls-overlay {
    background: var(--player-glass);
    backdrop-filter: blur(16px);
    border: 1px solid var(--player-border);
    border-radius: var(--tg-radius-md);
    padding: 0.75rem;
}

.tg-controls-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* === CONTROL BUTTONS === */
.tg-play-btn,
.tg-volume-btn,
.tg-fullscreen-btn,
.tg-source-btn {
    width: var(--player-control-size);
    height: var(--player-control-size);
    background: transparent;
    border: none;
    border-radius: var(--tg-radius-sm);
    color: var(--player-text);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--player-transition);
    flex-shrink: 0;
}

    .tg-play-btn:hover,
    .tg-volume-btn:hover,
    .tg-fullscreen-btn:hover,
    .tg-source-btn:hover {
        background: var(--player-glass-hover);
        transform: scale(1.1);
    }

.tg-play-btn {
    font-size: 1.2rem;
}

/* === TIME DISPLAY === */
.tg-time-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--player-text);
    font-size: 0.875rem;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.tg-time-separator {
    color: var(--player-text-secondary);
}

/* === PROGRESS BAR === */
.tg-progress-container {
    flex: 1;
    height: var(--player-control-size);
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 0 0.5rem;
}

.tg-progress-bar {
    position: relative;
    width: 100%;
    height: 4px;
    background: var(--player-border);
    border-radius: 2px;
    overflow: hidden;
}

.tg-progress-filled {
    height: 100%;
    background: var(--tg-primary);
    border-radius: 2px;
    transition: width 0.1s ease;
}

.tg-progress-handle {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    background: var(--tg-primary);
    border: 2px solid white;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.tg-progress-container:hover .tg-progress-handle {
    opacity: 1;
}

.tg-progress-container:hover .tg-progress-bar {
    height: 6px;
}

/* === VOLUME CONTROLS === */
.tg-volume-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tg-volume-slider {
    width: 80px;
    height: 4px;
    background: var(--player-border);
    border-radius: 2px;
    cursor: pointer;
    position: relative;
}

.tg-volume-bar {
    height: 100%;
    background: var(--tg-primary);
    border-radius: 2px;
    width: 100%;
    transition: width 0.1s ease;
}

.tg-volume-slider:hover {
    height: 6px;
}

/* === SOURCE SELECTOR === */
.tg-source-selector {
    position: relative;
}

/* === RESPONSIVE DESIGN === */
@media (max-width: 768px) {
    .tg-video-controls {
        padding: 1rem 0.5rem 0.5rem;
    }

    .tg-controls-row {
        gap: 0.5rem;
    }

    .tg-time-display {
        font-size: 0.75rem;
    }

    .tg-volume-container {
        display: none; /* Hide volume on mobile */
    }

    .tg-progress-container {
        padding: 0 0.25rem;
    }

    .tg-volume-slider {
        width: 60px;
    }
}

/* === ACCESSIBILITY === */
@media (prefers-reduced-motion: reduce) {
    .tg-video-player,
    .tg-big-play-btn,
    .tg-video-controls,
    .tg-progress-filled,
    .tg-progress-handle,
    .tg-volume-bar {
        transition: none;
    }

    .tg-loading-spinner {
        animation: none;
    }
}

/* === FOCUS STATES === */
.tg-play-btn:focus,
.tg-volume-btn:focus,
.tg-fullscreen-btn:focus,
.tg-source-btn:focus,
.tg-big-play-btn:focus {
    outline: 2px solid var(--tg-primary);
    outline-offset: 2px;
}

/* === TOUCH OPTIMIZATIONS === */
@media (hover: none) and (pointer: coarse) {
    .tg-video-controls {
        opacity: 1; /* Always show on touch devices */
    }

    .tg-play-btn,
    .tg-volume-btn,
    .tg-fullscreen-btn,
    .tg-source-btn {
        min-width: 48px;
        min-height: 48px;
    }
}

/* === ERROR STATES === */
.tg-video-player.error .tg-big-play-btn {
    background: rgba(220, 38, 38, 0.9);
    border-color: rgb(220, 38, 38);
    color: white;
}

    .tg-video-player.error .tg-big-play-btn:hover {
        background: rgb(220, 38, 38);
        transform: translate(-50%, -50%);
    }

/* === INTEGRATION WITH EXISTING STREAM WATCH STYLES === */
.video-container .tg-video-player {
    width: 100%;
    height: 100%;
    border-radius: 0; /* Override for seamless integration */
}

.stream-content .video-container {
    position: relative;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: var(--tg-radius-lg);
    overflow: hidden;
}
