/**
 * Dopek Video Player Styles
 * @package phpBB Extension - Dopek Video
 * @copyright (c) 2018 skm Sujoy Kumar Mondal
 * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
 */

/* Dopek Video Player */
.dopek-video-player {
    position: relative;
    width: 100%;
    max-width: 1280px;
    background: #000;
    margin: 20px 0;
    border-radius: 4px;
    overflow: hidden;
}

.dopek-video-player video {
    width: 100%;
    height: auto;
    display: block;
    cursor: pointer;
    background: #000;
}

/* Only apply min-height and object-fit to individual embedded videos, not playlists */
.dopek-video-embed .dopek-video-player video {
    min-height: 360px;
    object-fit: contain;
}

.dopek-video-player video[poster] {
    object-fit: cover;
}

/* Poster image handling for individual embeds only */
.dopek-video-embed .dopek-video-player video[poster] {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.dopek-video-title {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0.8) 0%, transparent 100%);
    color: #fff;
    padding: 20px;
    font-size: 18px;
    font-weight: bold;
    line-height: 1;
    z-index: 2;
    pointer-events: none;
}

.dopek-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    background: rgba(0,0,0,0.7);
    border-radius: 50%;
    border: 3px solid #fff;
    cursor: pointer;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    color: #fff;
    transition: all 0.3s;
}

.dopek-play-btn:hover {
    background: rgba(255,0,0,0.8);
    transform: translate(-50%, -50%) scale(1.1);
}

.dopek-play-btn::before {
    content: '▶';
    margin-left: 5px;
}

.dopek-video-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 5;
    background: transparent;
    color: #fff;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 0;
    font-size: 0;
    line-height: 0;
    display: none;
    pointer-events: none;
    width: 40px;
    height: 40px;
    box-sizing: border-box;
}

.dopek-video-loader:before {
    content: "";
    display: block;
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    position: relative;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.dopek-video-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, transparent 100%);
    padding: 8px;
    display: none;
    z-index: 3;
    align-items: center;
    gap: 6px;
    pointer-events: auto;
    flex-wrap: nowrap !important;
    overflow: hidden;
}

.dopek-video-player.playing .dopek-video-controls,
.dopek-video-controls.show {
    display: flex;
}

.dopek-video-controls button {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 6px;
    transition: opacity 0.3s;
    pointer-events: auto;
    z-index: 4;
    position: relative;
    flex-shrink: 0;
    white-space: nowrap;
}

.dopek-video-controls button:hover {
    opacity: 0.7;
}

/* Copy buttons styling */
.dopek-copy-link-btn,
.dopek-copy-solo-btn {
    font-size: 16px !important;
    padding: 4px 6px !important;
}

.dopek-copy-link-btn:hover,
.dopek-copy-solo-btn:hover {
    opacity: 0.8;
    transform: scale(1.1);
}

/* Copy notification */
.dopek-copy-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
    padding: 12px 20px;
    border-radius: 4px;
    font-size: 14px;
    z-index: 10000;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.dopek-copy-notification.show {
    opacity: 1;
    transform: translateY(0);
}

/* Quality selector container - push to right side */
.dopek-quality-container {
    display: flex !important;
    align-items: center !important;
    margin-left: auto !important;
    flex-shrink: 0 !important;
}

/* Quality selector button */
.dopek-quality-btn {
    position: relative;
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 18px;
    padding: 5px 8px !important;
    flex-shrink: 0;
}

.dopek-quality-label {
    font-size: 10px;
    font-weight: 600;
    opacity: 0.9;
}

.dopek-quality-menu {
    display: none;
    position: absolute;
    bottom: 100%;
    right: 0;
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    padding: 8px 0;
    margin-bottom: 8px;
    min-width: 100px;
    z-index: 1000;
}

.dopek-quality-menu.show {
    display: block;
}

.dopek-quality-option {
    padding: 8px 16px;
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dopek-quality-option:hover {
    background: rgba(255, 255, 255, 0.1);
}

.dopek-quality-option.active {
    background: rgba(255, 255, 255, 0.2);
}

.dopek-quality-option.active::after {
    content: '✓';
    margin-left: 8px;
    color: #4CAF50;
    font-weight: bold;
}

.dopek-volume-control {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 1;
    min-width: 0;
}

.dopek-volume-slider {
    width: 60px;
    max-width: 60px;
    min-width: 40px;
    height: 4px;
    background: rgba(255,255,255,0.3);
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none;
    flex-shrink: 1;
}

.dopek-volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
}

.dopek-volume-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

/* Embedded Video Styles */
.dopek-video-embed {
    margin: 20px 0;
}

/* Playlist Styles - YouTube-like Layout */
.dopek-playlist {
    margin: 20px 0;
    display: flex;
    gap: 20px;
    flex-wrap: nowrap;
    align-items: flex-start;
}

/* Main video player container (left side) */
.dopek-playlist-main {
    flex: 0 0 65%;
    min-width: 0;
    max-width: 65%;
}

.dopek-playlist-main .dopek-video-player {
    margin: 0;
    width: 100%;
}

.dopek-playlist-main .dopek-video-player video {
    width: 100%;
    height: auto;
}

/* Sidebar video list (right side) */
.dopek-playlist-sidebar {
    flex: 0 0 35%;
    min-width: 0;
    max-width: 35%;
    max-height: 80vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 10px;
}

.dopek-playlist-sidebar::-webkit-scrollbar {
    width: 8px;
}

.dopek-playlist-sidebar::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.dopek-playlist-sidebar::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.dopek-playlist-sidebar::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Playlist item in sidebar - thumbnail style */
.dopek-playlist-item {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background 0.2s;
    background: transparent;
}

.dopek-playlist-item:hover {
    background: rgba(0, 0, 0, 0.05);
    transform: none;
}

.dopek-playlist-item.active {
    background: rgba(255, 0, 0, 0.1);
    border-left: 3px solid #ff0000;
}

/* Thumbnail in sidebar */
.dopek-playlist-item-thumb {
    flex: 0 0 168px;
    height: 94px;
    position: relative;
    border-radius: 4px;
    overflow: hidden;
    background: #000;
}

.dopek-playlist-item-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.dopek-playlist-item-thumb .dopek-play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 16px;
    opacity: 0;
    transition: opacity 0.2s;
}

.dopek-playlist-item:hover .dopek-play-overlay {
    opacity: 1;
}

.dopek-playlist-item.active .dopek-play-overlay {
    opacity: 1;
    background: rgba(255, 0, 0, 0.8);
}

/* Video info in sidebar */
.dopek-playlist-item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.dopek-playlist-item-title {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    line-height: 1.4;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dopek-playlist-item.active .dopek-playlist-item-title {
    color: #ff0000;
    font-weight: 600;
}

/* Hide full video player in sidebar items */
.dopek-playlist-item .dopek-video-player {
    display: none;
}

.dopek-playlist-link,
.dopek-video-link {
    display: inline-block;
    padding: 10px 20px;
    background: #ff0000;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    margin: 10px 0;
    transition: background 0.3s;
}

.dopek-playlist-link:hover,
.dopek-video-link:hover {
    background: #cc0000;
    color: #fff;
    text-decoration: none;
}

/* Video Page Container */
.dopek-video-container {
    max-width: 1280px;
    margin: 20px auto;
    padding: 0 20px;
}

/* Playlist Page Container */
.dopek-playlist-container {
    max-width: 1280px;
    margin: 20px auto;
    padding: 0 20px;
}

.dopek-playlist-container h1 {
    margin-bottom: 20px;
    color: #333;
}

/* Responsive */
@media (max-width: 768px) {
    .dopek-video-player {
        margin: 10px 0;
    }
    
    .dopek-video-title {
        font-size: 14px;
        padding: 10px;
    }
    
    .dopek-play-btn {
        width: 60px;
        height: 60px;
        font-size: 30px;
    }
    
    .dopek-video-controls {
        padding: 6px;
        gap: 4px;
    }
    
    .dopek-video-controls button {
        font-size: 16px;
        padding: 3px 5px;
    }
    
    .dopek-volume-slider {
        width: 40px !important;
        min-width: 30px !important;
    }
    
    .dopek-volume-control {
        gap: 4px;
    }
    
    .dopek-quality-btn {
        font-size: 15px !important;
        padding: 3px 4px !important;
    }
    
    .dopek-quality-label {
        font-size: 8px !important;
    }
    
    /* Stack playlist vertically on mobile */
    .dopek-playlist {
        flex-direction: column;
        flex-wrap: wrap;
    }
    
    .dopek-playlist-main {
        flex: 1 1 100%;
        min-width: 100%;
        max-width: 100%;
    }
    
    .dopek-playlist-sidebar {
        flex: 1 1 100%;
        min-width: 100%;
        max-width: 100%;
        max-height: 400px;
    }
    
    .dopek-playlist-item-thumb {
        flex: 0 0 120px;
        height: 68px;
    }
}

