/* player.css */

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

:root {
    --primary-color: #ff6b00;
    --bg-color: #000;
    --control-bg: rgba(0, 0, 0, 0.9);
    --text-color: #fff;
}

body {
    background: #121212;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text-color);
}

/* Container principal */
.player-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.player-container {
    position: relative;
    width: 100%;
    background: var(--bg-color);
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 16 / 9;
}

/* Video */
#video-player {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Overlay chargement */
.loading-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10;
}

.loading-overlay.hidden {
    display: none;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Big play button overlay */
.play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    cursor: pointer;
    z-index: 5;
    transition: opacity 0.3s;
}

.play-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.play-overlay-btn {
    width: 80px;
    height: 80px;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, background 0.2s;
}

.play-overlay-btn:hover {
    transform: scale(1.1);
    background: #ff8533;
}

.play-overlay-btn svg {
    width: 36px;
    height: 36px;
    fill: white;
    margin-left: 4px;
}

/* Overlay publicite */
.ad-overlay {
    position: absolute;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    justify-content: center;
    padding: 10px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.ad-overlay.hidden {
    display: none;
}

.ad-overlay.position-top {
    top: 0;
}

.ad-overlay.position-bottom {
    bottom: 60px;
}

.ad-overlay.position-center {
    top: 50%;
    transform: translateY(-50%);
}

.ad-overlay.slide-up {
    animation: slideUp 0.3s ease forwards;
}

.ad-overlay.slide-down {
    animation: slideDown 0.3s ease forwards;
}

@keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes slideDown {
    from { transform: translateY(-100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.ad-content {
    position: relative;
    max-width: 100%;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
}

.ad-content img,
.ad-content iframe {
    display: block;
    max-width: 100%;
    height: auto;
}

.ad-close {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 24px;
    height: 24px;
    background: var(--primary-color);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
    z-index: 101;
}

.ad-close.hidden {
    display: none;
}

.ad-close:hover {
    transform: scale(1.1);
}

.ad-countdown {
    position: absolute;
    top: 5px;
    right: 30px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
    background: rgba(0, 0, 0, 0.5);
    padding: 2px 6px;
    border-radius: 3px;
}

.ad-countdown.hidden {
    display: none;
}

/* Barre de controles */
.controls-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, var(--control-bg));
    padding: 40px 10px 10px;
    opacity: 1;
    transition: opacity 0.3s;
}

.player-container.controls-hidden .controls-bar {
    opacity: 0;
}

/* Barre de progression */
.progress-container {
    position: relative;
    height: 20px;
    display: flex;
    align-items: center;
    cursor: pointer;
    margin-bottom: 8px;
}

.progress-bar {
    position: relative;
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    overflow: visible;
}

.progress-container:hover .progress-bar {
    height: 6px;
}

.progress-buffered {
    position: absolute;
    height: 100%;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 2px;
    width: 0;
}

.progress-played {
    position: absolute;
    height: 100%;
    background: var(--primary-color);
    border-radius: 2px;
    width: 0;
}

.progress-handle {
    position: absolute;
    width: 14px;
    height: 14px;
    background: var(--primary-color);
    border-radius: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(0);
    transition: transform 0.1s;
    left: 0;
}

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

.progress-tooltip {
    position: absolute;
    bottom: 100%;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    pointer-events: none;
    opacity: 0;
    transform: translateX(-50%);
    margin-bottom: 8px;
    white-space: nowrap;
}

.progress-container:hover .progress-tooltip {
    opacity: 1;
}

/* Controles principaux */
.controls-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.controls-left,
.controls-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.control-btn {
    background: transparent;
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
}

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

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

.control-btn .icon-pause,
.control-btn .icon-muted,
.control-btn .icon-compress {
    display: none;
}

.control-btn.playing .icon-play { display: none; }
.control-btn.playing .icon-pause { display: block; }

.control-btn.muted .icon-volume { display: none; }
.control-btn.muted .icon-muted { display: block; }

.control-btn.fullscreen .icon-expand { display: none; }
.control-btn.fullscreen .icon-compress { display: block; }

/* Volume */
.volume-container {
    display: flex;
    align-items: center;
}

.volume-slider {
    width: 0;
    opacity: 0;
    transition: width 0.2s, opacity 0.2s;
    accent-color: var(--primary-color);
}

.volume-container:hover .volume-slider {
    width: 80px;
    opacity: 1;
    margin-left: 8px;
}

/* Temps */
.time-display {
    color: white;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    margin-left: 8px;
}

.time-separator {
    margin: 0 4px;
    opacity: 0.7;
}

/* Menu vitesse */
.speed-container {
    position: relative;
}

#speed-label {
    font-size: 13px;
    font-weight: 600;
}

.speed-menu {
    position: absolute;
    bottom: 100%;
    right: 0;
    background: var(--control-bg);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.speed-menu.hidden {
    display: none;
}

.speed-menu button {
    display: block;
    width: 100%;
    padding: 8px 16px;
    background: transparent;
    border: none;
    color: white;
    font-size: 13px;
    cursor: pointer;
    text-align: left;
}

.speed-menu button:hover {
    background: rgba(255, 255, 255, 0.1);
}

.speed-menu button.active {
    color: var(--primary-color);
}

/* Infos video */
.video-info {
    padding: 16px 0;
    color: white;
}

.video-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.video-meta {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
}

.video-description {
    margin-top: 16px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.9);
}

/* Error state */
.error-message {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    text-align: center;
    padding: 20px;
    z-index: 50;
}

.error-message.hidden {
    display: none;
}

.error-message h3 {
    font-size: 18px;
    margin-bottom: 8px;
    color: var(--primary-color);
}

.error-message p {
    font-size: 14px;
    opacity: 0.8;
}

/* Responsive */
@media (max-width: 768px) {
    .player-wrapper {
        padding: 0;
    }

    .player-container {
        border-radius: 0;
    }

    .controls-bar {
        padding: 20px 8px 8px;
    }

    .control-btn {
        width: 32px;
        height: 32px;
    }

    .control-btn svg {
        width: 20px;
        height: 20px;
    }

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

    .video-info {
        padding: 12px;
    }

    .play-overlay-btn {
        width: 60px;
        height: 60px;
    }

    .play-overlay-btn svg {
        width: 28px;
        height: 28px;
    }
}

@media (max-width: 480px) {
    .time-display {
        font-size: 11px;
    }

    #speed-label {
        font-size: 11px;
    }

    .controls-left,
    .controls-right {
        gap: 4px;
    }
}

/* Promo overlay */
.promo-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.85);
    z-index: 200;
    animation: fadeIn 0.3s ease;
}

.promo-overlay.hidden {
    display: none;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.promo-box {
    position: relative;
    background: linear-gradient(145deg, #1a1a1a, #2d2d2d);
    border-radius: 16px;
    padding: 40px 50px;
    text-align: center;
    max-width: 90%;
    width: 400px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.1);
    animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.promo-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.6);
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    line-height: 1;
}

.promo-close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.promo-title {
    font-size: 22px;
    font-weight: 600;
    color: white;
    margin-bottom: 30px;
    line-height: 1.3;
}

.promo-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.promo-btn {
    display: block;
    padding: 16px 32px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    text-align: center;
}

.promo-btn-yes {
    background: linear-gradient(145deg, var(--primary-color), #e65c00);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 107, 0, 0.4);
}

.promo-btn-yes:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 0, 0.5);
}

.promo-btn-no {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
}

.promo-btn-no:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

@media (max-width: 480px) {
    .promo-box {
        padding: 30px 25px;
        width: 320px;
    }

    .promo-title {
        font-size: 18px;
        margin-bottom: 24px;
    }

    .promo-btn {
        padding: 14px 24px;
        font-size: 14px;
    }
}
