/* --- Thème et Polices --- */
:root {
    --primary-bg-color: #121212;
    --secondary-bg-color: #1e1e1e;
    --primary-text-color: #e0e0e0;
    --accent-color: #03dac6;
    --sidebar-width: 350px;
    --ad-column-width: 300px; /* Largeur de la colonne de pub */
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--primary-bg-color);
    color: var(--primary-text-color);
    overflow: hidden; /* Empêche le défilement de la page principale */
}

/* --- Disposition Générale --- */
#app-container {
    display: flex;
    height: 100vh;
}

#sidebar {
    width: var(--sidebar-width);
    background-color: var(--secondary-bg-color);
    padding: 1rem;
    box-shadow: 2px 0 5px rgba(0,0,0,0.3);
    z-index: 10;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    transition: width 0.3s ease-in-out;
}

#main-content {
    flex-grow: 1;
    display: flex; /* Changement pour une disposition flex */
    padding: 1rem; /* Réduction du padding */
    gap: 1rem; /* Espace entre le lecteur et la pub */
    /* La marge à gauche est supprimée car la sidebar est fixe */
}

#video-wrapper {
    flex-grow: 1; /* Le lecteur prend l'espace restant */
    display: flex;
    height: calc(100vh - 2rem); /* Hauteur complète moins le padding */
}

#player {
    width: 100%;
    height: 100%;
    background-color: #000;
}

/* Ajustement pour Video.js */
.video-js {
    width: 100% !important;
    height: 100% !important;
    font-size: 1.5rem;
    color: #444;
}

#player::before {
    content: "Sélectionnez une chaîne pour commencer";
}

/* --- Colonne de Publicité --- */
#ad-column {
    width: var(--ad-column-width);
    min-width: var(--ad-column-width); /* Empêche la colonne de rétrécir */
    height: calc(100vh - 2rem); /* Hauteur complète moins le padding */
    display: flex;
    justify-content: center;
    align-items: center;
}

.ad-container-vertical {
    width: 100%;
    height: 100%;
    background-color: #1e1e1e;
    border: 1px solid #444;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* --- Barre latérale --- */
#search-container {
    height: 40px;
    margin-bottom: 1rem;
}

#channel-list {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow-y: auto;
    flex-grow: 1;
}

#channel-list li {
    padding: 12px 10px;
    border-bottom: 1px solid #333;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out;
}

#channel-list li:hover {
    background-color: #2a2a2a;
}

#channel-list li.active {
    background-color: var(--accent-color);
    color: var(--primary-bg-color);
    font-weight: bold;
}

.player-error {
    color: #ff8a80;
}

#search-input {
    width: 100%;
    padding: 8px;
    background-color: #333;
    border: 1px solid #444;
    border-radius: 4px;
    color: var(--primary-text-color);
    box-sizing: border-box;
}

/* --- Bouton de Don --- */
#donation-container {
    padding: 1rem 0;
    text-align: center;
}

.donation-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: 8px;
    background-color: #FFDD00; /* Couleur officielle de Buy Me a Coffee */
    color: #000000;
    text-decoration: none;
    font-weight: bold;
    transition: background-color 0.3s;
}

.donation-button:hover {
    background-color: #f0c400;
}

.donation-button img {
    width: 24px;
    margin-right: 10px;
}

/* Responsive adjustments */
@media (max-width: 1200px) { /* Point de rupture pour cacher la pub */
    #ad-column {
        display: none;
    }
}

@media (max-width: 768px) {
    body {
        overflow-y: auto; /* PERMET le défilement vertical sur mobile */
    }

    :root {
        --sidebar-width: 100%;
    }

    #app-container {
        flex-direction: column;
        height: auto; /* Permet au conteneur de s'adapter à la hauteur du contenu */
    }

    #sidebar {
        width: 100%;
        height: 40vh; /* Hauteur ajustée pour la liste des chaînes */
        box-shadow: none;
        order: 1; /* Affiche la liste des chaînes en PREMIER */
    }

    #main-content {
        flex-direction: column; /* Lecteur au-dessus de la pub sur mobile */
        height: auto;
        padding: 1rem 0;
        order: 2; /* Affiche le lecteur et la pub en DEUXIEME */
    }
    
    #video-wrapper {
        height: 60vh; /* Le lecteur prend plus de place */
        width: 100%;
    }

    #ad-column {
        display: block; /* Ré-afficher la colonne de pub */
        width: 100%;
        height: auto; /* Hauteur auto */
        margin-top: 1rem;
    }

    .ad-container-vertical {
        min-height: 90px; /* Hauteur minimale pour la pub mobile */
    }
}
