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

/* Player Overlay */
.video-player-overlay {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all var(--duration-normal) var(--ease-default);
}

.video-player-overlay.open {
    opacity: 1;
    visibility: visible;
}

.video-player-overlay.closing {
    opacity: 0;
}

/* Player Container */
.video-player-container {
    width: 100%;
    max-width: 1200px;
    max-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    border-radius: var(--radius-2xl);
    overflow: hidden;
    transform: scale(0.95) translateY(20px);
    transition: transform var(--duration-normal) var(--ease-bounce);
}

.video-player-overlay.open .video-player-container {
    transform: scale(1) translateY(0);
}

/* Fullscreen mode */
.video-player-container:fullscreen {
    max-width: 100%;
    max-height: 100%;
    border-radius: 0;
}

/* Player Header */
.video-player-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-subtle);
}

.video-player-info {
    flex: 1;
    min-width: 0;
}

.video-player-collection {
    font-size: var(--text-sm);
    color: var(--accent-primary);
    margin-bottom: var(--space-1);
}

.video-player-title {
    font-size: var(--text-xl);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

.video-player-title-arabic {
    font-family: var(--font-arabic);
    font-size: var(--text-lg);
    color: var(--text-secondary);
    direction: rtl;
}

.video-player-close {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: none;
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-default);
    flex-shrink: 0;
}

.video-player-close:hover {
    background: var(--danger-soft);
    color: var(--danger);
}

.video-player-close svg {
    width: 20px;
    height: 20px;
}

/* Video Wrapper */
.video-player-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
}

.vimeo-player-embed {
    width: 100%;
    height: 100%;
}

.vimeo-player-embed iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Loading State */
.video-player-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-4);
    background: rgba(0, 0, 0, 0.8);
    color: var(--text-primary);
}

.video-player-loading .loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border-default);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.video-player-loading .error-message {
    color: var(--danger);
    font-size: var(--text-lg);
}

/* Video Controls */
.video-player-controls {
    padding: var(--space-4) var(--space-5);
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-subtle);
}

/* Progress Bar */
.video-progress-container {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    margin-bottom: var(--space-3);
}

.video-progress-bar {
    flex: 1;
    height: 6px;
    background: var(--progress-bg);
    border-radius: var(--radius-full);
    cursor: pointer;
    position: relative;
    overflow: visible;
}

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

.video-progress-fill {
    height: 100%;
    background: var(--accent-primary);
    border-radius: var(--radius-full);
    position: relative;
    transition: width 0.1s linear;
}

.video-progress-handle {
    position: absolute;
    top: 50%;
    width: 14px;
    height: 14px;
    background: var(--accent-primary);
    border: 2px solid white;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity var(--duration-fast) var(--ease-default);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.video-progress-bar:hover .video-progress-handle {
    opacity: 1;
}

.video-time {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.video-time-separator {
    margin: 0 var(--space-1);
    color: var(--text-tertiary);
}

/* Controls Row */
.video-controls-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.video-controls-left,
.video-controls-right {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

/* Control Buttons */
.video-control-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-default);
}

.video-control-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.video-control-btn svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
    stroke: currentColor;
    stroke-width: 0;
}

.video-control-btn svg[viewBox="0 0 24 24"] path,
.video-control-btn svg[viewBox="0 0 24 24"] line,
.video-control-btn svg[viewBox="0 0 24 24"] polygon,
.video-control-btn svg[viewBox="0 0 24 24"] rect {
    fill: currentColor;
    stroke: none;
}

/* Play/Pause specific styling */
#btn-play-pause {
    width: 48px;
    height: 48px;
    background: var(--accent-primary);
    color: white;
    border-radius: var(--radius-full);
}

#btn-play-pause:hover {
    background: var(--accent-hover);
    transform: scale(1.05);
}

#btn-play-pause svg {
    width: 24px;
    height: 24px;
}

.icon-play {
    margin-left: 3px;
}

/* Volume Control */
.video-volume-control {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.volume-slider {
    width: 0;
    opacity: 0;
    transition: all var(--duration-fast) var(--ease-default);
    accent-color: var(--accent-primary);
}

.video-volume-control:hover .volume-slider {
    width: 80px;
    opacity: 1;
}

/* Playback Rate */
#playback-rate {
    font-size: var(--text-sm);
    font-weight: 600;
    min-width: 32px;
    text-align: center;
}

/* Video Description */
.video-player-description {
    padding: var(--space-4) var(--space-5);
    background: var(--bg-primary);
    border-top: 1px solid var(--border-subtle);
    max-height: 120px;
    overflow-y: auto;
}

.video-player-description h3 {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.video-player-description p {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    line-height: var(--leading-relaxed);
}

/* Responsive */
@media (max-width: 768px) {
    .video-player-overlay {
        align-items: flex-start;
        padding-top: 0;
    }

    .video-player-container {
        max-width: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    .video-player-header {
        padding: var(--space-3) var(--space-4);
    }

    .video-player-title {
        font-size: var(--text-lg);
    }

    .video-player-controls {
        padding: var(--space-3) var(--space-4);
    }

    .video-control-btn {
        width: 36px;
        height: 36px;
    }

    #btn-play-pause {
        width: 44px;
        height: 44px;
    }

    .video-volume-control:hover .volume-slider {
        width: 60px;
    }
}

/* Keyboard hint tooltip */
.video-player-container::after {
    content: 'Espace: lecture | ←→: avancer/reculer | M: muet | F: plein écran | Échap: fermer';
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    color: var(--text-tertiary);
    white-space: nowrap;
    opacity: 0;
    transition: opacity var(--duration-normal) var(--ease-default);
    pointer-events: none;
}

.video-player-overlay:not(:fullscreen) .video-player-container:hover::after {
    opacity: 0.6;
}
