* { box-sizing: border-box; }

body {
    margin: 0;
    background-color: #0f0f0f;
    color: #f1f1f1;
    font-family: 'Roboto', 'Arial', sans-serif;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* --- Barre de contrôles (Haut) --- */
.controls {
    background: #1e1e1e;
    padding: 10px;
    border-bottom: 1px solid #333;
    display: flex;
    gap: 20px;
    justify-content: center;
    align-items: center;
    font-size: 14px;
    flex-shrink: 0;
    z-index: 10;
    transition: transform 0.3s ease-in-out; /* Animation fluide */
}
input[type="file"] { font-size: 12px; }

/* --- Layout Principal (Vidéo + Chat) --- */
.main-container {
    display: flex;
    flex: 1;
    height: 100%; 
    width: 100%;
    overflow: hidden;
}

/* Zone Vidéo */
.video-section {
    flex: 1;
    background: black;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0; 
    min-height: 0;
}

video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Zone Chat (Fixe à droite) */
.chat-section {
    width: 350px;
    background: #18181b;
    border-left: 1px solid #303032;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    height: 100%;
}

.chat-header {
    padding: 10px 15px;
    border-bottom: 1px solid #303032;
    font-size: 14px;
    text-transform: uppercase;
    color: #aaa;
    background: #1e1e1e;
    text-align: center;
    flex-shrink: 0;
}

#chatStream {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    scrollbar-width: thin;
    scrollbar-color: #555 #18181b;
}

/* --- Style des Messages --- */
.chat-msg {
    display: flex;
    align-items: flex-start;
    margin-bottom: 8px;
    font-size: 13px;
    line-height: 1.4;
    animation: fadeIn 0.1s ease-out;
}

.avatar-img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    margin-right: 10px;
    flex-shrink: 0;
}

.msg-content {
    word-break: break-word;
    width: 100%;
}

.author-name {
    color: #a2a2a2;
    font-weight: 500;
    margin-right: 4px;
}
.chat-msg:nth-child(odd) .author-name { color: #3ea6ff; } 
.chat-msg:nth-child(3n) .author-name { color: #ffca28; }

.text-content { color: #ffffff; }

.emote-img {
    vertical-align: middle;
    height: 24px;
    width: auto;
    margin: 0 2px;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* --- MODE IMMERSIF (Barre cachée) --- */

/* Zone invisible en haut pour déclencher l'apparition */
#hoverZone {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 20px; /* Zone sensible de 20px */
    z-index: 20;
    display: none; /* Désactivé tant que les fichiers ne sont pas chargés */
}

/* Quand le mode immersif est activé via JS */
body.immersive #hoverZone {
    display: block;
}

body.immersive .controls {
    position: fixed;
    top: 0;
    width: 100%;
    transform: translateY(-100%); /* On cache la barre vers le haut */
    background: rgba(30, 30, 30, 0.95); /* Légère transparence */
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}

/* Apparition de la barre au survol de la zone ou de la barre elle-même */
body.immersive #hoverZone:hover ~ .controls,
body.immersive .controls:hover {
    transform: translateY(0);
}