* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #0f0f0f;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: #fff;
}

.container {
    width: 100%;
    max-width: 1200px;
    background: #000;
    border-radius: 0;
    overflow: hidden;
    position: relative;
}

.video-wrapper {
    position: relative;
    width: 100%;
    background: #000;
    cursor: pointer;
}

#videoPlayer {
    width: 100%;
    height: auto;
    display: block;
    outline: none;
}

.controls-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.4) 50%, transparent 100%);
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.video-wrapper:hover .controls-overlay,
.video-wrapper.controls-visible .controls-overlay {
    opacity: 1;
    pointer-events: all;
}

/* Masquer complètement les contrôles en plein écran après inactivité */
.video-wrapper.controls-hidden .controls-overlay {
    opacity: 0 !important;
    pointer-events: none !important;
    visibility: hidden !important;
}

/* Désactiver le hover quand les contrôles sont masqués */
.video-wrapper.controls-hidden:hover .controls-overlay {
    opacity: 0 !important;
    pointer-events: none !important;
    visibility: hidden !important;
}

/* Masquer le curseur de la souris en plein écran après inactivité */
.video-wrapper.controls-hidden {
    cursor: none !important;
}

.video-wrapper.controls-hidden #videoPlayer {
    cursor: none !important;
}

/* Masquer tous les éléments de contrôle individuellement */
.video-wrapper.controls-hidden .progress-bar-container,
.video-wrapper.controls-hidden .custom-controls,
.video-wrapper.controls-hidden .time-display,
.video-wrapper.controls-hidden .control-btn,
.video-wrapper.controls-hidden .volume-container {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

.progress-bar-container {
    padding: 0 12px;
    padding-bottom: 4px;
    position: relative;
    height: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.progress-bar {
    width: 100%;
    height: 5px;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    border-radius: 0;
    outline: none;
    cursor: pointer;
    margin: 0;
    position: relative;
    z-index: 2;
}

.progress-bar-track {
    position: absolute;
    top: 50%;
    left: 12px;
    right: 12px;
    height: 3px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 0;
    pointer-events: none;
    transform: translateY(-50%);
    transition: height 0.1s;
}

.progress-bar-fill {
    position: absolute;
    top: 50%;
    left: 12px;
    height: 3px;
    background: #9333EA;
    border-radius: 0;
    pointer-events: none;
    transform: translateY(-50%);
    transition: height 0.1s, width 0.1s linear;
    width: var(--progress, 0%);
}

.progress-bar-indicator {
    position: absolute;
    top: 50%;
    left: calc(var(--progress, 0%) + 12px);
    width: 12px;
    height: 12px;
    background: #9333EA;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 0.2s, transform 0.2s;
    pointer-events: none;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.8);
}

.progress-bar-container:hover .progress-bar-track,
.progress-bar-container:hover .progress-bar-fill {
    height: 4px;
}

.progress-bar-container:hover .progress-bar-indicator {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.progress-bar:active ~ .progress-bar-container .progress-bar-indicator {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.2);
}

.progress-bar::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    background: transparent;
    cursor: pointer;
    border: none;
    position: relative;
    z-index: 3;
}

.progress-bar::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: transparent;
    border: none;
    cursor: pointer;
    position: relative;
    z-index: 3;
}

.custom-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    height: 48px;
}

.control-btn {
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.control-btn:active {
    background: rgba(255, 255, 255, 0.15);
}

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

.time-display {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 100px;
}

.spacer {
    flex: 1;
}

.volume-container {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.volume-slider-wrapper {
    width: 0;
    overflow: hidden;
    transition: width 0.2s;
    opacity: 0;
}

.volume-container:hover .volume-slider-wrapper {
    width: 80px;
    opacity: 1;
}

.volume-bar {
    width: 100%;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 0;
    outline: none;
    cursor: pointer;
}

.volume-bar::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.1s;
}

.volume-bar:hover::-webkit-slider-thumb,
.volume-bar:active::-webkit-slider-thumb {
    opacity: 1;
}

.volume-bar::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.1s;
}

.volume-bar:hover::-moz-range-thumb,
.volume-bar:active::-moz-range-thumb {
    opacity: 1;
}

.volume-bar::-moz-range-progress {
    background: #fff;
    height: 4px;
}

.volume-bar::-webkit-slider-runnable-track {
    background: rgba(255, 255, 255, 0.2);
    height: 4px;
}

.volume-bar::-moz-range-track {
    background: rgba(255, 255, 255, 0.2);
    height: 4px;
}

/* Masquer les contrôles natifs du navigateur */
#videoPlayer::-webkit-media-controls {
    display: none !important;
}

#videoPlayer::-webkit-media-controls-enclosure {
    display: none !important;
}

/* Style pour le plein écran */
.video-wrapper:fullscreen {
    background: #000;
    width: 100vw !important;
    height: 100vh !important;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.video-wrapper:fullscreen #videoPlayer {
    width: 100vw;
    height: 100vh;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.video-wrapper:fullscreen .controls-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10;
}

/* Barre de progression visible en plein écran */
.video-wrapper:fullscreen .progress-bar-indicator {
    opacity: 1;
}

.video-info {
    padding: 20px;
    background: #1a1a1a;
    color: #fff;
}

.video-info h2 {
    margin-bottom: 20px;
    font-size: 24px;
    color: #fff;
}

.embed-section {
    margin-top: 20px;
}

.embed-section h3 {
    margin-bottom: 10px;
    font-size: 18px;
    color: #ccc;
}

.embed-code {
    display: flex;
    gap: 10px;
    align-items: center;
}

.embed-code input {
    flex: 1;
    padding: 10px;
    background: #000;
    border: 1px solid #333;
    color: #fff;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    border-radius: 4px;
}

.embed-code input:focus {
    outline: none;
    border-color: #9333EA;
}

.copy-btn {
    padding: 10px 20px;
    background: #9333EA;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s;
}

.copy-btn:hover {
    background: #7c2dd9;
}

.copy-btn:active {
    background: #6b21a8;
}

.no-video {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 400px;
    color: #fff;
    font-size: 18px;
}

/* Bouton Skip Intro */
.skip-intro-btn {
    position: absolute;
    bottom: 60px;
    right: 20px;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid #9333EA;
    color: #fff;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    z-index: 100;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(147, 51, 234, 0.3);
}

.skip-intro-btn:hover {
    background: rgba(147, 51, 234, 0.9);
    border-color: #9333EA;
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(147, 51, 234, 0.5);
}

.skip-intro-btn:active {
    transform: scale(0.98);
}

.skip-intro-icon {
    display: flex;
    align-items: center;
}

.skip-intro-icon svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.skip-intro-text {
    white-space: nowrap;
}

/* Animation d'apparition du bouton Skip Intro */
.skip-intro-btn {
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Masquer le bouton Skip Intro quand les contrôles sont cachés en plein écran */
.video-wrapper.controls-hidden .skip-intro-btn {
    opacity: 0 !important;
    pointer-events: none !important;
    visibility: hidden !important;
}

/* Responsive */
@media (max-width: 768px) {
    body {
        padding: 0;
    }
    
    .container {
        border-radius: 0;
    }
    
    .custom-controls {
        padding: 6px 8px;
        height: 44px;
    }
    
    .time-display {
        font-size: 12px;
        min-width: 80px;
    }
    
    .volume-slider-wrapper {
        width: 60px !important;
        opacity: 1 !important;
    }
    
    .video-info {
        padding: 15px;
    }
    
    .video-info h2 {
        font-size: 20px;
    }
    
    .embed-code {
        flex-direction: column;
        align-items: stretch;
    }
    
    .embed-code input {
        font-size: 11px;
    }
    
    .skip-intro-btn {
        right: 10px;
        padding: 10px 16px;
        font-size: 12px;
    }
    
    .skip-intro-text {
        display: none;
    }
    
    .skip-intro-icon svg {
        width: 24px;
        height: 24px;
    }
}

/* ============================================
   NOUVELLES FONCTIONNALITÉS
   ============================================ */

/* Contrôle de vitesse de lecture */
.playback-speed-container {
    position: relative;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.playback-speed-btn {
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    font-size: 13px;
    font-weight: 600;
    min-width: 40px;
}

.playback-speed-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.playback-speed-menu {
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    background: rgba(0, 0, 0, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 6px 0;
    min-width: 100px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px) scale(0.95);
    transition: opacity 0.2s, visibility 0.2s, transform 0.2s;
    z-index: 10000;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    pointer-events: none;
}

.playback-speed-container:hover .playback-speed-menu,
.playback-speed-menu.show {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) scale(1) !important;
    pointer-events: all !important;
}

/* S'assurer que le menu reste visible même quand les contrôles sont cachés */
.video-wrapper.controls-hidden .playback-speed-menu.show {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: all !important;
}

.playback-speed-option {
    padding: 10px 20px;
    color: #fff;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 14px;
    text-align: center;
    white-space: nowrap;
}

.playback-speed-option:hover {
    background: rgba(255, 255, 255, 0.1);
}

.playback-speed-option.active {
    background: rgba(147, 51, 234, 0.3);
    color: #9333EA;
    font-weight: 600;
}

/* Miniature au survol de la barre de progression */
.progress-preview {
    position: absolute;
    bottom: calc(100% + 12px);
    left: 50%;
    width: 160px;
    height: 90px;
    background: #000;
    border: 2px solid #9333EA;
    border-radius: 6px;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-50%) translateY(8px);
    transition: opacity 0.15s, visibility 0.15s, transform 0.15s;
    pointer-events: none;
    z-index: 10000;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
}

.progress-preview.show {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateX(-50%) translateY(0) !important;
}

/* S'assurer que l'aperçu reste visible même quand les contrôles sont cachés */
.video-wrapper.controls-hidden .progress-preview.show {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: none !important;
}

.progress-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.progress-preview-time {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent);
    color: #fff;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 500;
    text-align: center;
}

/* Bouton Picture-in-Picture */
.pip-btn {
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.2s;
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    visibility: visible;
}

.pip-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.pip-btn:active {
    background: rgba(255, 255, 255, 0.15);
}

.pip-btn svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

/* Le bouton PiP reste visible car il fait partie des contrôles essentiels */

/* Amélioration accessibilité - Focus visible */
.control-btn:focus-visible,
.playback-speed-btn:focus-visible,
.pip-btn:focus-visible,
.progress-bar:focus-visible,
.volume-bar:focus-visible {
    outline: 2px solid #9333EA;
    outline-offset: 2px;
}

/* Amélioration contraste pour accessibilité */
.time-display {
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.control-btn[aria-label]:focus-visible {
    outline: 3px solid #9333EA;
    outline-offset: 2px;
}

/* Styles pour mobile - Gestes tactiles */
@media (max-width: 768px) {
    .video-wrapper {
        touch-action: pan-y;
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
    }
    
    .playback-speed-menu {
        bottom: auto;
        top: 100%;
        margin-top: 8px;
        margin-bottom: 0;
    }
    
    .playback-speed-container:hover .playback-speed-menu {
        transform: translateY(0);
    }
    
    .progress-preview {
        width: 120px;
        height: 68px;
    }
    
    /* Améliorer la zone tactile sur mobile */
    .control-btn,
    .playback-speed-btn,
    .pip-btn {
        min-width: 44px;
        min-height: 44px;
        padding: 10px;
    }
    
    .progress-bar {
        height: 8px;
    }
    
    .progress-bar-container {
        height: 8px;
        padding-bottom: 8px;
    }
}

/* Animation pour les notifications de raccourcis clavier */
.keyboard-hint {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
    padding: 12px 20px;
    border-radius: 8px;
    border: 2px solid #9333EA;
    font-size: 14px;
    z-index: 10000;
    opacity: 0;
    transform: translateY(-20px);
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.keyboard-hint.show {
    opacity: 1;
    transform: translateY(0);
}

.keyboard-hint kbd {
    background: rgba(147, 51, 234, 0.3);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-weight: 600;
    margin: 0 4px;
}

/* Indicateur de reprise automatique */
.resume-indicator {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.95);
    color: #fff;
    padding: 16px 24px;
    border-radius: 8px;
    border: 2px solid #9333EA;
    font-size: 14px;
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 16px;
    opacity: 0;
    transform: translateY(-20px);
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 16px rgba(147, 51, 234, 0.4);
    min-width: 300px;
    flex-wrap: wrap;
}

.resume-indicator.show {
    opacity: 1 !important;
    transform: translateY(0) !important;
    pointer-events: all !important;
    visibility: visible !important;
}

.resume-indicator span {
    flex: 1;
    min-width: 200px;
}

.resume-indicator button {
    background: #9333EA;
    color: #fff;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: background 0.2s;
}

.resume-indicator button:hover {
    background: #7c2dd9;
}

/* Amélioration du contraste pour les lecteurs d'écran */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Amélioration du contraste pour la barre de progression */
.progress-bar-track {
    background: rgba(255, 255, 255, 0.4);
}

.progress-bar-fill {
    background: #9333EA;
    box-shadow: 0 0 4px rgba(147, 51, 234, 0.5);
}
