/* --- Variables et Style de Base --- */
:root {
    --neon-blue: #00FFFF;
    --neon-blue-light: #88FFFF;
    --neon-blue-dark: #008080;
    --bg-dark: #0a0a0a;
    --bg-medium: #1a1a1a;
    --bg-light: #2c2c2c;
    --text-color: #e0e0e0;
    --error-red: #FF4500;
}

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-color);
    margin: 0;
    padding: 20px;
    overflow-x: hidden;
}

/* --- Éléments Principaux de la Page --- */
h1 {
    color: var(--neon-blue);
    margin-bottom: 30px;
    text-align: center;
    text-shadow: 0 0 8px var(--neon-blue), 0 0 15px rgba(0, 255, 255, 0.5);
    font-size: 2.8em;
    animation: neonPulse 2s infinite alternate;
}

@keyframes neonPulse {
    from { text-shadow: 0 0 8px var(--neon-blue), 0 0 15px rgba(0, 255, 255, 0.5); }
    to { text-shadow: 0 0 12px var(--neon-blue), 0 0 20px rgba(0, 255, 255, 0.7); }
}

.top-nav {
  display: flex;
  justify-content: center;
  padding: 2rem;
  gap: 2rem;
  
}

.live-button {
  text-decoration: none;
  color: #00e6e6; /* Couleur cyan électrique pour le texte */
  background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 100%); /* Dégradé sombre pour la profondeur */
  padding: 1rem 2.5rem;
  border-radius: 50px; /* Bords très arrondis pour un look moderne */
  font-family: 'Montserrat', sans-serif; /* Police moderne et audacieuse */
  font-size: 1.2rem;
  font-weight: 700;
  transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1); /* Transition plus douce */
  box-shadow: 
    0 0 15px rgba(0, 230, 230, 0.4), /* Ombre néon subtile */
    0 0 5px rgba(0, 230, 230, 0.6) inset; /* Lumière interne */
  border: 2px solid #00e6e6; /* Bordure lumineuse */
  position: relative;
  overflow: hidden; /* Cache les débordements des effets */
}

.live-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.1); /* Effet de balayage lumineux */
  transform: skewX(-30deg);
  transition: all 0.7s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.live-button:hover {
  color: #fff; /* Texte blanc au survol */
  background: linear-gradient(135deg, #1f0c2a 0%, #2a0c3a 100%); /* Dégradé plus foncé au survol */
  box-shadow: 
    0 0 25px rgba(0, 230, 230, 0.7), /* Lumière néon plus intense */
    0 0 10px rgba(0, 230, 230, 0.8) inset,
    0 0 40px rgba(0, 230, 230, 0.5); /* Effet de halo */
  transform: translateY(-5px) scale(1.05); /* Lève et agrandit légèrement le bouton */
  border-color: #8cffff; /* Bordure plus claire au survol */
}

.live-button:hover::before {
  left: 100%; /* L'effet de balayage traverse le bouton */
}

/* --- Conteneur Principal --- */
.container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    max-width: 1600px;
    width: 100%;
    margin: 20px auto;
    padding: 25px;
    background-color: var(--bg-medium);
    border-radius: 12px;
    box-shadow: 0 0 40px rgba(0, 255, 255, 0.4);
    border: 1px solid var(--neon-blue-dark);
}

/* --- Section Lecteur Vidéo --- */
#video-player-container {
    flex: 1;
    order: 1; /* Lecteur à gauche sur grand écran */
    min-width: 300px;
    max-width: 600px;
    background-color: #000;
    border: 1px solid var(--neon-blue-dark);
    border-radius: 10px;
    box-shadow: 0 0 25px rgba(0, 255, 255, 0.3);
    aspect-ratio: 16 / 9;
}

#video-player {
    width: 100%;
    height: 100%;
    border-radius: 8px;
}

/* --- Section Liste des Films (regroupant les contrôles et la grille) --- */
.list-section-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex: 1;
    order: 2; /* Section liste à droite */
    min-width: 300px;
}

.controls-container {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
}

#search-input,
#genre-select {
    padding: 12px 15px;
    border: 2px solid var(--neon-blue-dark);
    background-color: var(--bg-dark);
    color: var(--neon-blue-light);
    border-radius: 6px;
    font-size: 1.1em;
    outline: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

#search-input {
    flex: 2 1 200px; /* Grandit 2x plus vite, base de 200px */
}

#genre-select {
    flex: 1 1 150px; /* Grandit 1x, base de 150px */
}

#search-input:focus, #genre-select:focus {
    border-color: var(--neon-blue);
    box-shadow: 0 0 10px var(--neon-blue);
}

#search-input::placeholder {
    color: rgba(136, 255, 255, 0.6);
}

/* --- Grille des Films --- */
#movie-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 25px;
    max-height: 80vh;
    overflow-y: auto;
    padding-right: 10px;
}

#movie-list::-webkit-scrollbar { width: 8px; }
#movie-list::-webkit-scrollbar-track { background: var(--bg-medium); border-radius: 10px; }
#movie-list::-webkit-scrollbar-thumb { background-color: var(--neon-blue-dark); border-radius: 10px; border: 2px solid var(--bg-medium); }
#movie-list::-webkit-scrollbar-thumb:hover { background-color: var(--neon-blue); }

/* --- Vignette de Film (Movie Item) --- */
.movie-item {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 280px;
    background-color: var(--bg-light);
    border: 1px solid var(--neon-blue-dark);
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.movie-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 0 15px var(--neon-blue);
    border-color: var(--neon-blue-light);
}

.movie-item .image-container {
    width: 100%;
    height: 75%;
    overflow: hidden;
}

.movie-item img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    background-color: var(--bg-dark);
}

.movie-item p.movie-title {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    margin: 0;
    min-height: 60px;
    font-size: 1em;
    font-weight: bold;
    color: var(--neon-blue-light);
}

.movie-rating {
    position: absolute;
    top: 8px;
    right: 8px;
    background-color: rgba(0, 0, 0, 0.75);
    color: white;
    padding: 3px 8px;
    border-radius: 5px;
    font-size: 0.9em;
    font-weight: bold;
    z-index: 10;
}
.movie-rating::before {
    content: '⭐ ';
    font-size: 0.8em;
}

/* --- Messages (Chargement & Erreur) --- */
#loading-message {
    text-align: center;
    margin-top: 30px;
    font-size: 1.5em;
    color: var(--neon-blue-light);
    font-weight: bold;
    text-shadow: 0 0 8px var(--neon-blue);
}

#loading-message[style*="color: red"] {
    color: var(--error-red) !important;
    text-shadow: 0 0 8px var(--error-red);
}

/* --- Media Queries --- */
@media (max-width: 1024px) {
    .container {
        flex-direction: column;
    }
    #video-player-container, .list-section-container {
        order: 0;
        max-width: none;
    }
    #movie-list {
        max-height: 60vh;
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}

@media (max-width: 768px) {
    body { padding: 10px; }
    h1 { font-size: 2em; }
    .container { padding: 15px; }
    #movie-list {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 15px;
        max-height: 50vh;
    }
    .movie-item { min-height: 200px; }
    .movie-item p.movie-title { font-size: 0.9em; min-height: 40px; }
    #search-input { font-size: 1em; }
}

@media (max-width: 480px) {
    #movie-list {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 10px;
        max-height: 45vh;
    }
    .movie-item { min-height: 170px; }
    .movie-item .image-container { height: 60%; }
    .movie-item p.movie-title { font-size: 0.85em; }
}


/* Assure que le conteneur du lecteur a une taille minimale et un fond sombre */
#player-wrapper {
    position: relative;
    width: 100%;
    /* Hauteur ajustable selon vos préférences, 
       ou utilisez un aspect-ratio si vous voulez un format 16/9 fixe */
    min-height: 400px; 
    background-color: #000; /* Fond noir si l'image ne charge pas */
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden; /* Pour couper l'image si elle dépasse */
}

/* Style spécifique pour l'image placeholder */
.player-placeholder {
    width: 100%;
    height: 100%;
    object-fit: cover; /* L'image couvre toute la zone sans être déformée (elle peut être rognée) */
    /* Alternative: utilisez 'contain' si vous voulez voir l'image entière avec des bandes noires */
    /* object-fit: contain; */ 
    display: block;
}

/* Quand le JS active la vidéo, on s'assure qu'elle prend toute la place */
#player-wrapper video,
#player-wrapper iframe {
    width: 100%;
    height: 100%;
    /* On s'assure que la vidéo passe par-dessus le placeholder si jamais il reste */
    position: absolute; 
    top: 0;
    left: 0;
    object-fit: contain; /* Pour la vidéo, on préfère souvent 'contain' pour ne pas rogner l'image */
}