/**
 * STYLES CSS - ClubRadio 24/7 Overlay OBS
 * ========================================
 * Design optimisé pour OBS Studio (1920x1080)
 * Performance: Utilisation de GPU acceleration (transform, opacity)
 */

/* ============================================
   RÉINITIALISATION ET BASE
   ============================================ */

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

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #000000;
    color: #ffffff;
}

/* ============================================
   BARRE DE PROGRESSION (HORS 16:9)
   ============================================ */

.progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.95), rgba(0, 0, 0, 0.85));
    backdrop-filter: blur(10px);
    z-index: 9999;
    padding: 10px 20px;
}

.video-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.video-title {
    font-size: 18px;
    font-weight: 600;
    color: #ffffff;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: 20px;
}

.video-time {
    font-size: 16px;
    font-weight: 500;
    color: #00d4ff;
    font-variant-numeric: tabular-nums;
    margin-right: 20px;
}

.video-remaining {
    font-size: 14px;
    font-weight: 500;
    color: #ffa500;
    font-variant-numeric: tabular-nums;
}

.progress-track {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #00d4ff 0%, #0096ff 100%);
    width: 0%;
    transition: width 0.3s ease-out;
    border-radius: 2px;
}

/* ============================================
   CONTENEUR PRINCIPAL OBS (1920x1080)
   ============================================ */

.obs-container {
    position: relative;
    width: 1920px;
    height: 1080px;
    margin: 70px auto 0;
    /* Ajout de marge en haut pour la barre */
    background-color: #000000;
    overflow: hidden;
    border-radius: 15px;
}

/* ============================================
   ZONE DE LECTURE VIDÉO
   ============================================ */

.video-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000000;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Vidéo principale */
.main-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* Préserver le ratio 16:9 */
    background-color: #000000;
    opacity: 1;
    transition: opacity 0.5s ease-in-out;
}

.main-video.fade-out {
    opacity: 0;
}

.main-video.fade-in {
    opacity: 1;
}

/* Lecteur audio (invisible mais présent) */
.music-player {
    display: none;
}

/* Conteneur YouTube */
.youtube-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    background-color: #000000;
}

.youtube-container.active {
    display: block;
}

.youtube-container iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* ============================================
   INDICATEURS DE CHARGEMENT ET ERREUR
   ============================================ */

.loading-indicator,
.error-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
}

.loading-indicator.visible,
.error-indicator.visible {
    opacity: 1;
    visibility: visible;
}

/* Spinner de chargement */
.spinner {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(255, 255, 255, 0.2);
    border-top-color: #00d4ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

.loading-text,
.error-text {
    font-size: 24px;
    font-weight: 500;
    color: #ffffff;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.8);
}

.error-icon {
    font-size: 72px;
    margin-bottom: 20px;
}

.error-indicator {
    background: rgba(255, 0, 0, 0.1);
    padding: 40px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

/* ============================================
   BANDEAU D'INFORMATIONS (TICKER BAR)
   ============================================ */

.ticker-bar {
    position: fixed;
    top: 70px;
    left: 0;
    width: 100%;
    height: 50px;
    background: transparent;
    backdrop-filter: none;
    display: none;
    align-items: center;
    z-index: 200;
    overflow: hidden;
    border-top: none;
}

/* Conteneur du message défilant */
.ticker-content {
    flex: 1;
    overflow: hidden;
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}

.ticker-message {
    display: inline-block;
    white-space: nowrap;
    font-size: 28px;
    font-weight: 600;
    color: #ffffff;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5),
        2px 2px 4px rgba(0, 0, 0, 0.4);
    padding-right: 50vw;
    /* Espacement pour assurer la continuité */
    animation: scroll-ticker 25s linear infinite;
    animation-play-state: running;
}

/* Animation de défilement */
@keyframes scroll-ticker {
    from {
        transform: translateX(100%);
    }

    to {
        transform: translateX(-100%);
    }
}

/* Mode pause pour le ticker (message fixe) */
.ticker-content.paused .ticker-message {
    animation-play-state: paused;
    transform: translateX(0);
}

/* ============================================
   OVERLAY: INFORMATIONS COMPLÉMENTAIRES
   ============================================ */

.info-overlay {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    z-index: 150;
    pointer-events: none;
}

/* Indicateur de pause musicale */
.music-indicator {
    position: absolute;
    top: 20px;
    left: 20px;
    display: inline-flex;
    align-items: center;
    background: linear-gradient(135deg, rgba(255, 100, 200, 0.3), rgba(200, 0, 255, 0.2));
    padding: 15px 30px;
    border-radius: 12px;
    backdrop-filter: blur(15px);
    border: 2px solid rgba(255, 100, 200, 0.6);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    font-size: 24px;
    font-weight: 700;
    color: #ffffff;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.8);
    opacity: 0;
    transform: translateX(-20px);
    transition: opacity 0.5s ease-in-out, transform 0.5s ease-in-out;
}

.music-indicator.visible {
    opacity: 1;
    transform: translateX(0);
}

/* Animation de pulsation pour l'indicateur musical */
.music-indicator.visible {
    animation: pulse-music 2s ease-in-out infinite;
}

@keyframes pulse-music {

    0%,
    100% {
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    }

    50% {
        box-shadow: 0 8px 32px rgba(255, 100, 200, 0.6);
    }
}

/* ============================================
   RESPONSIVE (pour tests en local)
   ============================================ */

@media screen and (max-width: 1920px) {
    .obs-container {
        width: 100vw;
        height: 56.25vw;
        /* Ratio 16:9 */
        max-height: 100vh;
        max-width: 177.78vh;
        /* Ratio 16:9 inverse */
    }

    /* Ajuster les tailles de police proportionnellement */
    .ticker-message {
        font-size: 1.67vw;
        /* 32px pour 1920px */
    }

    #currentTime {
        font-size: 1.46vw;
        /* 28px pour 1920px */
    }

    .music-indicator {
        font-size: 1.25vw;
        /* 24px pour 1920px */
    }
}

/* ============================================
   OPTIMISATIONS PERFORMANCE
   ============================================ */

/* Accélération GPU pour les animations */
.ticker-message,
.main-video,
.music-indicator,
.progress-fill,
.spinner {
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Désactiver la sélection de texte (pour overlay) */
.obs-container {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* ============================================
   CLASSES UTILITAIRES
   ============================================ */

.hidden {
    display: none !important;
}

.invisible {
    opacity: 0 !important;
    visibility: hidden !important;
}

.visible {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Mode debug (affiche les bordures) */
body.debug .obs-container {
    outline: 2px solid red;
}

body.debug .video-container {
    outline: 2px solid blue;
}

body.debug .ticker-bar {
    outline: 2px solid green;
}

body.debug .info-overlay {
    outline: 2px solid yellow;
}