/* css/classes.css */

/* Le conteneur de détails pour les classes, au centre */
.classes-details-container {
    /* CORRECTION MAJEURE ICI */
    flex: 1;
    /* Laisse Flexbox calculer la largeur exacte sans déborder */
    max-width: calc(50% - 20px);
    /* 50% maximum MOINS la marge pour ne jamais créer de scrollbar horizontale globale */

    position: relative;
    top: auto;

    overflow-y: auto;
    overflow-x: hidden;
    /* Sécurité absolue contre le débordement horizontal interne */

    border-radius: 5px;
    background-color: rgba(0, 0, 0, 0.7);
    display: none;
    /* Rendu visible par JS */
    flex-direction: column;
    height: auto;
    margin-right: 20px;
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
    z-index: 1;

    box-sizing: border-box;
    /* Indispensable pour que les marges internes ne gonflent pas la boîte */
}

/* ================== EN TÊTES ================== */
.class-header {
    display: flex;
    align-items: center;
    padding: 20px 25px;
    gap: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    width: 100%;
    box-sizing: border-box;
}

.class-header img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.5));
}

.class-header h2 {
    margin: 0;
    font-size: 2em;
    color: #fff;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8);
    font-family: 'h73bold', sans-serif;
    letter-spacing: 1px;
}

/* Couleurs des en-têtes selon la classe */
.chef-header {
    background: linear-gradient(135deg, rgba(231, 76, 60, 0.2), rgba(192, 57, 43, 0.5));
    border-bottom-color: rgba(231, 76, 60, 0.4);
}

.cueilleur-header {
    background: linear-gradient(135deg, rgba(163, 122, 204, 0.2), rgba(121, 75, 170, 0.5));
    border-bottom-color: rgba(163, 122, 204, 0.4);
}

.jardinier-header {
    background: linear-gradient(135deg, rgba(104, 253, 214, 0.2), rgba(40, 150, 120, 0.5));
    border-bottom-color: rgba(104, 253, 214, 0.4);
}

.maitre-des-betes-header {
    background: linear-gradient(135deg, rgba(91, 155, 213, 0.2), rgba(41, 128, 185, 0.5));
    border-bottom-color: rgba(91, 155, 213, 0.4);
}

.personne-libre-header {
    background: linear-gradient(135deg, rgba(127, 140, 141, 0.2), rgba(84, 93, 94, 0.5));
    border-bottom-color: rgba(127, 140, 141, 0.4);
}

/* ================== CONTENU ET LISTES ================== */
.class-content {
    padding: 25px;
    width: 100%;
    box-sizing: border-box;
    /* Empêche les 25px de padding de faire déborder la div */
}

.class-description {
    font-size: 1.1em;
    line-height: 1.6;
    color: #ddd;
    margin-bottom: 30px;
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 5px;
    border-left: 4px solid #68fdd6;
}

.class-description:last-child {
    margin-bottom: 0;
}

.traits-section h4 {
    font-size: 1.3em;
    color: #68fdd6;
    margin-bottom: 20px;
    border-bottom: 1px dashed rgba(104, 253, 214, 0.3);
    padding-bottom: 10px;
}

.traits-list {
    list-style-type: none;
    padding-left: 0;
    /* Retire l'espacement gauche par défaut du HTML qui cause des scrollbars */
    margin: 0;
    width: 100%;
    box-sizing: border-box;
}

.traits-list li {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 20px;
    background: rgba(0, 0, 0, 0.3);
    padding: 15px;
    border-radius: 5px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.2s;

    width: 100%;
    box-sizing: border-box;
    word-break: break-word;
    /* Protège le conteneur contre les mots trop longs */
}

.traits-list li:hover {
    background: rgba(255, 255, 255, 0.05);
}

.trait-image {
    width: 50px;
    height: 50px;
    object-fit: contain;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.1);
    padding: 5px;
    flex-shrink: 0;
    /* Empêche l'image de s'écraser si le texte à côté est trop long */
}

.trait-text {
    flex: 1;
    /* Prend l'espace restant */
    font-size: 0.95em;
    color: #ccc;
    line-height: 1.5;
}

.trait-text span {
    display: block;
    color: #fff;
    font-weight: bold;
    margin-bottom: 5px;
    font-size: 1.1em;
}

/* Styles spécifiques pour le wrapper global */
.classes-details-wrapper {
    flex: 1;
    display: none;
    flex-direction: column;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    border-radius: 5px;
    margin-right: 20px;
    
    /* CORRECTION : On met la marge du bas à 0 pour s'aligner avec le tableau */
    margin-bottom: 0;

    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;

    /* CORRECTION : On supprime max-height: 80vh; et on force la hauteur à 100% */
    height: 100%;
    min-width: 0;
}

/* Force le conteneur interne à prendre toute la largeur sans déborder */
.classes-details-wrapper .classes-details-container {
    width: 100% !important;
    max-width: none !important;
    background: transparent !important;
    box-shadow: none !important;
    margin: 0 !important;
    padding-bottom: 0 !important;
    box-sizing: border-box;
    /* Obligatoire */
    overflow-x: hidden;

    /* NOUVEAU : Empêche le conteneur de s'écraser et désactive son scroll interne */
    flex: 0 0 auto !important;
    overflow-y: visible !important;
}

.classes-comments-section {
    width: 100%;
    box-sizing: border-box;
    margin-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
}

/* Espacement spécifique pour le wrapper principal sur la page des classes */
.classes-main-wrapper {
    margin-top: 20px;
}