* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: #080f13;
    font-family: 'Roboto', sans-serif;
    margin: 0;
    padding: 0;
    height: 100vh;
    overflow: hidden;
}

.video-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    background: rgba(26, 26, 26, 0.8);
    overflow: hidden;
    cursor: none;
}

.video-container.show-cursor {
    cursor: default;
}

.video-container *:focus,
.video-container *:focus-visible {
    outline: none;
}

.video-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    background: #000;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

video {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    display: block;
    aspect-ratio: 16/9;
}

/* Si la vidéo est plus large que l'écran */
@media (max-aspect-ratio: 16/9) {
    video {
        width: 100%;
        height: auto;
    }
}

/* Si la vidéo est plus haute que l'écran */
@media (min-aspect-ratio: 16/9) {
    video {
        width: auto;
        height: 100%;
    }
}

.controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(8, 15, 19, 0.95));
    padding: 20px;
    transform: translateY(100%);
    transition: transform 0.3s ease, opacity 0.3s ease;
    opacity: 0;
}

.controls.show {
    transform: translateY(0);
    opacity: 1;
}

.progress-container {
    margin-bottom: 15px;
    position: relative;
    padding: 5px 0;
}

.time-tooltip {
    position: absolute;
    bottom: 15px;
    background: rgba(8, 15, 19, 0.9);
    color: #ffffff;
    padding: 5px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    pointer-events: none;
    opacity: 0;
    transform: translateX(-50%);
    transition: opacity 0.2s ease;
    border: 1px solid rgba(64, 139, 234, 0.5);
    box-shadow: 0 0 10px rgba(64, 139, 234, 0.3);
}

.time-tooltip.active {
    opacity: 1;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    cursor: pointer;
    position: relative;
    overflow: visible;
}

.progress-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: #408bea;
    width: 0%;
    border-radius: 3px;
    transition: width 0.1s ease;
    box-shadow: 0 0 15px rgba(64, 139, 234, 0.6);
}

.progress-thumb {
    position: absolute;
    top: 50%;
    left: 0%;
    width: 16px;
    height: 16px;
    background: #ffffff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    cursor: pointer;
    opacity: 1;
    transition: transform 0.1s ease;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.8),
                0 0 25px rgba(64, 139, 234, 0.4);
    z-index: 10;
}

.progress-thumb:hover {
    transform: translate(-50%, -50%) scale(1.2);
}

.controls-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.controls-left,
.controls-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.control-btn {
    width: 45px;
    height: 45px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 9px;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
}

.control-btn:hover {
    background: rgba(64, 139, 234, 0.3);
    box-shadow: 0 0 20px rgba(64, 139, 234, 0.5);
    transform: translateY(-2px);
}

.control-btn.active {
    background: rgba(64, 139, 234, 0.5);
    box-shadow: 0 0 20px rgba(64, 139, 234, 0.7);
}

.play-btn:hover {
    box-shadow: 0 0 40px rgba(64, 139, 234, 0.8);
    transform: scale(1.05);
    background: rgba(64, 139, 234, 0.8);
}

.time-display {
    color: #ffffff;
    font-size: 14px;
    font-weight: 400;
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 12px;
    border-radius: 9px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 10px rgba(64, 139, 234, 0.3);
}

.volume-container {
    display: flex;
    align-items: center;
}

.icon {
    width: 20px;
    height: 20px;
    fill: currentColor;
    filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.3));
}

.play-icon {
    width: 24px;
    height: 24px;
}

.video-info {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(8, 15, 19, 0.7);
    padding: 0;
    border-radius: 9px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transform: translateY(-100%);
    transition: transform 0.3s ease, opacity 0.3s ease;
    opacity: 0;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-info.show {
    transform: translateY(0);
    opacity: 1;
}

.video-divider {
    display: none;
}

.video-text-info {
    display: none;
}

.video-title {
    position: absolute;
    bottom: 100px;
    left: 20px;
    right: 20px;
    color: #ffffff;
    font-size: 18px;
    font-weight: 700;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
    z-index: 10;
    pointer-events: none;
    transform: translateY(100%);
    transition: transform 0.3s ease, opacity 0.3s ease;
    opacity: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.video-title.show {
    transform: translateY(0);
    opacity: 1;
}

.video-subtitle {
    display: none;
}

.loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top: 3px solid #408bea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: none;
}

.video-container.fullscreen-scale * {
    transform: scale(1);
    transform-origin: center center;
}

.video-container.fullscreen-scale .icon {
    transition: transform 0.3s ease;
}

#settingsBtn.active {
    background: rgba(64, 139, 234, 0.5);
    box-shadow: 0 0 20px rgba(64, 139, 234, 0.7);
}

#settingsBtn .icon {
    transition: transform 0.3s ease;
}

#settingsBtn.active .icon {
    transform: rotate(180deg);
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

.loading.active {
    display: block;
}

.quality-selector {
    position: absolute;
    bottom: 115px;
    right: 20px;
    transform: translateY(-20px);
    background: rgba(8, 15, 19, 0.9);
    border-radius: 9px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 10px;
    display: none;
    flex-direction: column;
    gap: 8px;
    min-width: 120px;
}

.quality-selector.show {
    display: flex;
}

.quality-option {
    background: transparent;
    border: none;
    color: #ffffff;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s ease;
    text-align: left;
}

.quality-option:hover {
    background: rgba(64, 139, 234, 0.3);
}

/* Styles pour les menus de paramètres */
.settings-menu {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.settings-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 500;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    background: rgba(255, 255, 255, 0.05);
}

.settings-back-icon {
    width: 16px;
    height: 16px;
    fill: currentColor;
    margin-right: 10px;
    transform: rotate(180deg);
}

.settings-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: transparent;
    border: none;
    color: #ffffff;
    cursor: pointer;
    transition: background 0.2s ease;
    font-size: 14px;
}

.settings-option:hover {
    background: rgba(64, 139, 234, 0.2);
}

.settings-option.active {
    background: rgba(64, 139, 234, 0.3);
    color: #408bea;
}

.settings-option-label {
    flex: 1;
    text-align: left;
}

.settings-option-value {
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
    margin-right: 8px;
}

.settings-arrow {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.top-controls {
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 10;
    transform: translateY(-100%);
    transition: transform 0.3s ease, opacity 0.3s ease;
    opacity: 0;
}

.top-controls.show {
    transform: translateY(0);
    opacity: 1;
}

.seek-indicator {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: #ffffff;
    font-size: 24px;
    font-weight: 700;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 15;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
}

.seek-indicator.left {
    left: 50px;
    transform: translateY(-50%) translateX(-20px);
}

.seek-indicator.right {
    right: 50px;
    transform: translateY(-50%) translateX(20px);
}

.seek-indicator.active {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

/* Menu contextuel personnalisé */
.context-menu {
    position: absolute;
    background: rgba(8, 15, 19, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 9px;
    padding: 8px 0;
    min-width: 200px;
    z-index: 100;
    display: none;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
}

.context-menu.show {
    display: block;
}

.context-menu-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: #ffffff;
    cursor: pointer;
    transition: background 0.2s ease;
    font-size: 14px;
    gap: 12px;
}

.context-menu-item:hover {
    background: rgba(64, 139, 234, 0.3);
}

.context-menu-item.disabled {
    color: rgba(255, 255, 255, 0.5);
    cursor: not-allowed;
}

.context-menu-item.disabled:hover {
    background: transparent;
}

.context-menu-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 4px 0;
}

.context-menu-footer {
    padding: 8px 16px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 4px;
}

.side-menu {
    position: absolute;
    top: 10px;
    right: 0px;
    width: 300px;
    height: calc(100vh - 40px);
    background: rgba(8, 15, 19, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 5;
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
}

.side-menu.open {
    transform: translateX(0);
}

.side-menu-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 20px;
    min-height: 65px;
}

.side-menu-title {
    color: #ffffff;
    font-size: 18px;
    font-weight: 700;
    text-shadow: 0 0 10px rgba(64, 139, 234, 0.5);
}

.side-menu-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.2);
    margin: 0 20px 20px 20px;
    box-shadow: 0 0 10px rgba(64, 139, 234, 0.3);
}

.side-menu-content {
    flex: 1;
    padding: 0 20px 20px 20px;
    overflow-y: auto;
}

#menuBtn:hover {
    background: rgba(64, 139, 234, 0.3);
    box-shadow: 0 0 20px rgba(64, 139, 234, 0.5);
    transform: none !important;
}

/* Overlay pub */
.ad-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(8, 15, 19, 0.97), rgba(15, 25, 35, 0.97));
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    flex-direction: column;
    padding: 20px;
    text-align: center;
    backdrop-filter: blur(20px);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.ad-message {
    color: #ffffff;
    max-width: 520px;
    background: rgba(8, 15, 19, 0.9);
    padding: 40px;
    border-radius: 16px;
    border: 1px solid rgba(64, 139, 234, 0.4);
    box-shadow: 0 0 40px rgba(64, 139, 234, 0.4),
                0 10px 50px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    transform: scale(0.95);
    animation: popIn 0.4s ease forwards;
}

@keyframes popIn {
    to {
        transform: scale(1);
    }
}

.ad-message p {
    margin-bottom: 20px;
    font-size: 17px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.95);
    font-weight: 400;
}

.ad-message p:first-child {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 25px;
    text-shadow: 0 0 15px rgba(64, 139, 234, 0.5);
}

.ad-message .warning {
    font-size: 14px;
    color: rgba(255, 102, 102, 0.9);
    margin-bottom: 25px;
    padding: 12px;
    background: rgba(255, 102, 102, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(255, 102, 102, 0.3);
    font-weight: 500;
}

#adOverlay button {
    padding: 14px 32px;
    border: none;
    border-radius: 9px;
    background: linear-gradient(135deg, #408bea, #5ca3ff);
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 0 20px rgba(64, 139, 234, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
}

#adOverlay button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

#adOverlay button:hover::before {
    left: 100%;
}

#adOverlay button:hover {
    background: linear-gradient(135deg, #2c6bcf, #408bea);
    box-shadow: 0 0 30px rgba(64, 139, 234, 0.8);
    transform: translateY(-2px);
}

#adOverlay button:active {
    transform: translateY(0);
}

/* =========================
   RESPONSIVE MOBILE
   ========================= */

/* Petits écrans (smartphones en portrait) */
@media (max-width: 480px) {
    .controls {
        padding: 12px;
    }
    
    .controls-left,
    .controls-right {
        gap: 8px;
    }
    
    .control-btn {
        width: 32px;
        height: 32px;
    }
    
    .icon {
        width: 14px;
        height: 14px;
    }
    
    .play-icon {
        width: 18px;
        height: 18px;
    }
    
    .time-display {
        font-size: 11px;
        padding: 6px 8px;
    }
    
    .controls-left .control-btn:not(.play-btn):not(#fullscreenBtn):not(#settingsBtn) {
        display: none;
    }
    
    .controls-right .control-btn:not(#fullscreenBtn):not(#settingsBtn) {
        display: none;
    }
    
    .video-info {
        width: 32px;
        height: 32px;
        top: 12px;
        left: 12px;
    }
    
    .back-icon {
        width: 14px;
        height: 14px;
    }
    
    .video-title {
        font-size: 14px;
        bottom: 70px;
        left: 12px;
        right: 12px;
    }
    
    .progress-container {
        padding: 8px 0;
        margin-bottom: 10px;
    }
    
    .progress-thumb {
        width: 16px;
        height: 16px;
    }
    
    .top-controls {
        padding: 0 12px;
        top: 12px;
    }
    
    .seek-indicator {
        font-size: 18px;
    }
    
    .seek-indicator.left {
        left: 15px;
    }
    
    .seek-indicator.right {
        right: 15px;
    }
    
    .side-menu {
        width: calc(100vw - 24px);
        top: 12px;
        right: 12px;
        height: calc(100vh - 24px);
    }
    
    .ad-message {
        padding: 25px 20px;
    }
    
    .ad-message p:first-child {
        font-size: 16px;
    }
    
    .ad-message p {
        font-size: 14px;
    }
    
    #adOverlay button {
        padding: 10px 24px;
        font-size: 14px;
    }
}

/* Écrans moyens (smartphones en paysage et petites tablettes) */
@media (min-width: 481px) and (max-width: 768px) {
    .controls {
        padding: 15px;
    }
    
    .controls-left,
    .controls-right {
        gap: 10px;
    }
    
    .control-btn {
        width: 38px;
        height: 38px;
    }
    
    .icon {
        width: 16px;
        height: 16px;
    }
    
    .play-icon {
        width: 20px;
        height: 20px;
    }
    
    .time-display {
        font-size: 12px;
        padding: 7px 10px;
    }
    
    .video-info {
        width: 38px;
        height: 38px;
        top: 15px;
        left: 15px;
    }
    
    .back-icon {
        width: 16px;
        height: 16px;
    }
    
    .video-title {
        font-size: 16px;
        bottom: 80px;
        left: 15px;
        right: 15px;
    }
    
    .progress-container {
        padding: 8px 0;
        margin-bottom: 12px;
    }
    
    .progress-thumb {
        width: 17px;
        height: 17px;
    }
    
    .top-controls {
        padding: 0 15px;
        top: 15px;
    }
    
    .seek-indicator {
        font-size: 20px;
    }
    
    .seek-indicator.left {
        left: 18px;
    }
    
    .seek-indicator.right {
        right: 18px;
    }
    
    .side-menu {
        width: 280px;
        top: 15px;
        right: 15px;
        height: calc(100vh - 30px);
    }
    
    .side-menu-header {
        padding: 15px;
        min-height: 50px;
    }
    
    .side-menu-title {
        font-size: 16px;
    }
    
    .side-menu-divider {
        margin: 0 15px 15px 15px;
    }
    
    .side-menu-content {
        padding: 0 15px 15px 15px;
    }
    
    .ad-message {
        padding: 30px 25px;
    }
    
    .ad-message p:first-child {
        font-size: 18px;
    }
    
    .ad-message p {
        font-size: 15px;
    }
    
    #adOverlay button {
        padding: 12px 28px;
        font-size: 15px;
    }
}

/* Portrait spécifique pour smartphones */
@media (max-width: 768px) and (orientation: portrait) {
    .controls-left .control-btn:not(.play-btn):not(#fullscreenBtn):not(#settingsBtn) {
        display: none;
    }
    
    .controls-right .control-btn:not(#fullscreenBtn):not(#settingsBtn) {
        display: none;
    }
    
    .controls-left .time-display {
        display: flex;
    }
}

/* Tablettes en portrait */
@media (min-width: 769px) and (max-width: 1024px) and (orientation: portrait) {
    .video-title {
        bottom: 90px;
    }
    
    .time-display {
        font-size: 13px;
    }
}

/* Grands écrans */
@media (min-width: 1440px) {
    .video-title {
        font-size: 20px;
        bottom: 110px;
    }
    
    .controls {
        padding: 25px;
    }
}