/*
 * Copyright (C) 2025 Jema Technology
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
 */

/* Video Player Styles */

.video-player-container {
    position: relative;
    width: 100%;
    height: 100%;
    background-color: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.video-element {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Top Bar */
.video-top-bar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 16px 24px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.8), transparent);
    display: flex;
    justify-content: space-between;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 10;
    box-sizing: border-box;
}

.video-top-bar.visible {
    opacity: 1;
    pointer-events: none;
}

.video-top-bar > * {
    pointer-events: auto;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.video-title {
    color: #e8eaed;
    font-family: 'Roboto', sans-serif;
    font-size: 16px;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Floating Controls */
.video-controls {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 800px;
    background-color: rgba(32, 33, 36, 0.9); /* Dark background */
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none; /* Allow clicks to pass through when hidden */
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    z-index: 10;
}

.video-controls.visible {
    opacity: 1;
    pointer-events: auto;
}

.video-controls-row {
    display: flex;
    align-items: center;
    width: 100%;
}

/* Main Controls Row */
.main-controls {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    width: 100%;
}

.center-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
}

.volume-container, .right-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    width: auto;
}

.volume-container {
    justify-self: start;
}

.right-controls {
    justify-self: end;
}

/* Buttons */
.video-btn {
    background: none;
    border: none;
    color: #e8eaed;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
    pointer-events: auto;
}

.video-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.video-btn i {
    font-size: 24px;
}

/* Play/Pause Button is larger */
.center-controls .video-btn i {
    font-size: 32px;
}

/* Progress Row */
.progress-row {
    gap: 16px;
}

.time-display {
    color: #e8eaed;
    font-family: 'Roboto', sans-serif;
    font-size: 12px;
    min-width: 40px;
}

.progress-bar-container {
    flex: 1;
    position: relative;
    height: 20px;
    display: flex;
    align-items: center;
    cursor: pointer;
}

.progress-bar {
    width: 100%;
    height: 4px;
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    overflow: hidden;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
}

.progress-fill {
    height: 100%;
    background-color: var(--primary-color);
    width: 0%;
    transition: width 0.1s linear;
}

.seek-slider {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    margin: 0;
    z-index: 2;
}

/* Volume Slider */
.volume-slider {
    width: 80px;
    height: 4px;
    -webkit-appearance: none;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    outline: none;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
}

/* Menu Dropdown */
.video-menu-dropdown {
    position: absolute;
    background-color: #292a2d;
    border-radius: 8px;
    padding: 8px 0;
    min-width: 200px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.5);
    z-index: 20;
    color: #e8eaed;
    font-family: 'Roboto', sans-serif;
    font-size: 13px;
}

.menu-item {
    padding: 8px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.menu-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.menu-item .shortcut {
    color: #9aa0a6;
    margin-left: 16px;
}

.menu-item i {
    font-size: 16px;
    color: #9aa0a6;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .video-controls {
        width: 95%;
        bottom: 16px;
        padding: 12px;
    }
    
    .center-controls {
        gap: 16px;
    }
    
    .volume-container, .right-controls {
        width: auto;
    }
    
    .volume-slider {
        display: none; /* Hide volume slider on mobile to save space */
    }
}

/* Hide info button in fullscreen */
.video-player-container:fullscreen .video-info-btn {
    display: none;
}
