/* --- STYLES FINAUX POUR LE TABLEAU DES BALS --- */
.tableau-bals-country {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 1em;
    font-family: sans-serif;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.15);
    background-color: #ffffff;
    color: #333333;
}

.tableau-bals-country thead tr {
    background-color: #009879 !important;
    color: #ffffff;
    text-align: left;
    height: auto;
}

.tableau-bals-country thead th {
    padding: 6px 10px;
    /* Padding vertical réduit pour un en-tête plus fin */
    font-weight: bold;
    background-color: #009879 !important;
    border-right: none;
    /* Supprime les lignes verticales de l'en-tête */
    border-bottom: none;
    /* Supprime la ligne du bas de l'en-tête */
}

.tableau-bals-country th,
#gbc-bals-container .tableau-bals-country td {
    padding: 0px 0px;
    border-bottom: 1px solid #e8e8e8;
    vertical-align: middle;
    overflow-wrap: break-word;
    position: relative;
    /* Nécessaire pour positionner le pseudo-élément */
}

/* Création du séparateur vertical personnalisé */
#gbc-bals-container .tableau-bals-country td:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 15%;
    /* Marge en haut */
    bottom: 15%;
    /* Marge en bas */
    right: 0;
    width: 1px;
    background-color: #e8e8e8;
}

/* La hauteur fixe est supprimée pour un affichage plus flexible */
.tableau-bals-country tbody tr {
    height: 150px;
}

.tableau-bals-country tbody tr.gbc-info-toggle-row,
.tableau-bals-country tbody tr.gbc-info-content-row {
    height: auto;
    background-color: transparent !important;
}

.tableau-bals-country tbody tr:nth-of-type(even),
.tableau-bals-country tbody tr.alt,
.tableau-bals-country tbody tr.odd {
    background-color: transparent !important;
}

.tableau-bals-country tbody tr:last-of-type {
    /* La bordure est maintenant gérée par les cellules */
}

/* Bordure de séparation renforcée pour les bals */
.tableau-bals-country .gbc-main-row:not(.has-info-row) td {
    border-bottom: 1px solid #dddddd;
}

.tableau-bals-country th:nth-child(1),
.tableau-bals-country td:nth-child(1) {
    width: 11%;
}

.tableau-bals-country th:nth-child(2),
.tableau-bals-country td:nth-child(2) {
    width: 21%;
}

.tableau-bals-country th:nth-child(3),
.tableau-bals-country td:nth-child(3) {
    width: 16%;
    text-align: center;
}

.tableau-bals-country th:nth-child(4),
.tableau-bals-country td:nth-child(4) {
    width: 15%;
}

.tableau-bals-country th:nth-child(5),
.tableau-bals-country td:nth-child(5) {
    width: 10%;
}

.tableau-bals-country th:nth-child(6),
.tableau-bals-country td:nth-child(6) {
    width: 27%;
}

.preview-with-download-wrapper {
    display: grid;
    grid-template-rows: 1fr auto;
    /* Ligne 1 (image) prend l'espace, Ligne 2 (bouton) s'adapte */
    height: 100%;
    /* Prend toute la hauteur de la cellule */
    box-sizing: border-box;
    /* Inclut le padding dans la hauteur */
    padding: 3px 0;
    /* Ajoute un peu d'espace en haut et en bas */
    justify-items: center;
    /* Centre horizontalement les éléments (image, bouton) */
    align-content: center;
    /* Centre verticalement le bloc image+bouton */
}

.tableau-bals-country td:nth-child(6) .preview-with-download-wrapper {
    gap: 3px;
}

.tableau-bals-country td:nth-child(3) .preview-with-download-wrapper {
    max-width: 120px;
    margin: 0 auto;
}

.preview-with-download-wrapper .preview-link {
    display: flex;
    align-items: center;
    /* Centre verticalement l'image/icône dans son espace */
}

.tableau-bals-country td:nth-child(3) .apercu-affiche {
    max-width: 110px;
    max-height: 130px;
    width: auto;
    height: auto;
}

.preview-with-download-wrapper .apercu-affiche {
    display: block;
    max-width: 140px;
    height: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.preview-with-download-wrapper .preview-link:hover .apercu-affiche {
    transform: scale(1.03);
    z-index: 10;
    position: relative;
}

.preview-with-download-wrapper .preview-icon {
    font-size: 2.5rem;
    text-decoration: none;
}

.preview-with-download-wrapper .download-button {
    display: block;
    font-size: 11px;
    color: #0073aa;
    text-decoration: none;
    padding: 0;
    line-height: 1.2;
    /* Réduit la hauteur de la ligne pour coller au texte */
    cursor: pointer;
    z-index: 1;
    position: relative;
}

.preview-with-download-wrapper .download-button:hover {
    text-decoration: underline;
}

.tableau-bals-country td:nth-child(6) .multiple-previews-container {
    display: grid;
    gap: 5px;
    height: 100%;
    place-items: center;
}

.tableau-bals-country td:nth-child(6) .multiple-previews-container {
    grid-template-columns: repeat(auto-fit, minmax(85px, 1fr));
    max-width: 220px;
    margin: 0 auto;
}

.tableau-bals-country td:nth-child(6) .has-multiple-rows {
    grid-template-columns: repeat(2, 1fr);
    max-width: 190px;
}

.tableau-bals-country td:nth-child(6) .multiple-previews-container:not(.has-multiple-rows) .preview-with-download-wrapper {
    max-width: 120px;
}

.tableau-bals-country td:nth-child(6) .multiple-previews-container:not(.has-multiple-rows) .apercu-affiche {
    max-width: 110px;
    max-height: 130px;
    width: auto;
    height: auto;
}

.tableau-bals-country td:nth-child(6) .has-multiple-rows .preview-with-download-wrapper {
    max-width: 85px;
}

.tableau-bals-country td:nth-child(6) .has-multiple-rows .apercu-affiche {
    max-width: 65px;
    max-height: 60px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.tableau-bals-country td:nth-child(6) .download-button {
    font-size: 11px;
    padding: 2px 6px;
    white-space: nowrap;
}

.tableau-bals-country td:nth-child(6) .has-multiple-rows .download-button {
    font-size: 9px;
    padding: 2px 4px;
}

.tableau-bals-country td:nth-child(6) .preview-icon {
    font-size: 28px;
}

.tableau-bals-country td:nth-child(6) .has-multiple-rows .preview-icon {
    font-size: 22px;
}

@media screen and (max-width: 768px) {
    .tableau-bals-country thead {
        display: none;
    }

    .tableau-bals-country tr {
        display: block;
        border-bottom: 3px solid #009879;
        padding-bottom: 10px;
    }

    .tableau-bals-country tbody tr {
        height: auto;
    }

    .tableau-bals-country td {
        padding-left: 50%;
        position: relative;
        border-bottom: 1px dotted #ccc;
        box-sizing: border-box;
        font-size: 16px;
        display: flex;
        align-items: center;
        justify-content: flex-end;
        min-height: 40px;
        padding-right: 15px !important;
    }

    .tableau-bals-country td:last-child {
        border-bottom: none;
    }

    .tableau-bals-country td::before {
        content: attr(data-label);
        position: absolute;
        left: 15px;
        font-weight: bold;
        text-align: left;
        white-space: nowrap;
    }

    .tableau-bals-country td[data-label=\"Club\"] strong {
        font-size: 1.3em;
        line-height: 1.2;
    }

    /* Réduit le padding-left pour laisser plus d'espace au nom du club */
    .tableau-bals-country td[data-label="Club"] {
        padding-left: 15% !important; /* Au lieu de 50% */
        text-align: right;
        min-width: 0;
    }
    
    /* Le nom du club revient à la ligne si nécessaire */
    .tableau-bals-country td[data-label="Club"] strong {
        font-size: 1.1em !important; /* Garde la taille normale */
        line-height: 1.3; /* Meilleur espacement entre les lignes */
        flex-basis: 100%;
        word-wrap: break-word;
        overflow-wrap: break-word;
        white-space: normal !important; /* Permet le retour à la ligne */
        max-width: 100%;
        display: inline-block;
    }

    .tableau-bals-country .col-club-mobile-wrapper {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        gap: 10px;
    }

    .tableau-bals-country th:nth-child(n),
    .tableau-bals-country td:nth-child(n) {
        width: 100% !important;
    }

    .tableau-bals-country td:nth-child(3) .preview-with-download-wrapper,
    .tableau-bals-country td:nth-child(6) .multiple-previews-container {
        margin: 10px 0;
        /* Supprime le centrage automatique horizontal (auto) */
        max-width: 250px;
    }

    .tableau-bals-country td:nth-child(6) .multiple-previews-container {
        padding-bottom: 10px;
    }

    .tableau-bals-country td[data-label=\"Affiche\"],
    .tableau-bals-country td[data-label=\"Playlist\"] {
        /* On aligne le contenu à droite pour laisser de la place au label à gauche */
        justify-content: flex-end !important;
        padding-top: 15px;
        /* Ajoute un peu d'espace en haut pour ne pas coller le label */
    }

    /* Correction pour la ligne "+ d'infos" en vue mobile */
    .gbc-info-row td {
        display: block !important;
        /* Force l'affichage en bloc pour éviter le flex vertical */
        text-align: left !important;
        /* Garantit l'alignement à gauche */
        padding: 8px 15px !important;
        /* Applique un padding uniforme, sans le décalage de 50% */
        min-height: auto !important;
        /* La hauteur s'adapte au contenu */
    }

    .gbc-info-content-wrapper {
        padding: 0px 15px 20px 15px !important;
        margin-top: -10px !important;
        font-size: 1em !important;
        font-style: italic !important;
        color: #333 !important;
    }

    span.gbc-end-date-label {
        padding: 0px 2% 0px 2% !important;
    }
}

.f-button.is-close-btn {
    position: fixed !important;
    top: 5px !important;
    right: 10px !important;
    z-index: 9999 !important;
}

.fancybox__container:not(.is-compact) .fancybox__slide.has-close-btn {
    padding-top: 0px;
}

.fancybox__container {
    /* On s'assure que FancyBox se place bien par-dessus la barre d'admin */
    padding-top: 0px;
    --fancybox-bg: rgba(24, 24, 27, 0.83) !important;
}

.fancybox__content {
    background: transparent !important;
    border: 0 !important;
    padding: 0 !important;
    height: 100% !important;
}

/* Dans public/public-styles.css */
.gbc-month-title {
    margin-top: 40px;
    margin-bottom: 10px;
    color: white;
    /* Ou la couleur de votre thème */
}

/* Correction du padding pour les iframes dans Fancybox */
/* Cela remplace la règle .fancybox__content { padding: 0 !important; } qui est trop large */
.fancybox__slide.is-iframe .fancybox__content {
    padding: 0;
}

/* --- Animation de fondu pour les images --- */
.apercu-affiche {
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

.apercu-affiche.is-visible {
    opacity: 1;
}

.gbc-end-date-label {
    font-size: 0.9em;
    color: #555;
}

.gbc-cp-prefix {
    font-weight: bold;
}

/* Couleurs spécifiques pour chaque département des Pays de la Loire */
.gbc-cp-prefix-44 {
    color: #0077B6;
}

/* Loire-Atlantique - Bleu */
.gbc-cp-prefix-49 {
    color: #D9534F;
}

/* Maine-et-Loire - Rouge */
.gbc-cp-prefix-53 {
    color: #5CB85C;
}

/* Mayenne - Vert */
.gbc-cp-prefix-72 {
    color: #F0AD4E;
}

/* Sarthe - Orange */
.gbc-cp-prefix-85 {
    color: #6f42c1;
}

/* Vendée - Violet */

/* --- Styles pour la ligne "Plus d'infos" --- */
/* Supprime la bordure entre le bal et sa ligne d'info */
#gbc-bals-container .tableau-bals-country .gbc-main-row.has-info-row td {
    border-bottom: none;
}

.tableau-bals-country .gbc-info-row {
    height: auto !important;
    /* Annule la hauteur fixe de 150px héritée */
}

#gbc-bals-container .tableau-bals-country tr.gbc-info-row>td {
    padding: 0 !important;
    /* On force la suppression du padding de la cellule elle-même */
    background-color: #ffffff;
    /* Fond blanc identique aux autres lignes */
    height: auto;
    text-align: left !important;
    /* Annule le centrage hérité du thème */
    border-bottom: 1px solid #dddddd !important;
    /* Bordure harmonisée pour séparer du bal suivant */
    border-right: none;
    /* S'assure qu'il n'y a pas de bordure verticale */
}

.gbc-info-content-wrapper {
    padding: 0px 15px 20px 7%;
    /* Padding avec un retrait à gauche fixe et des espacements verticaux ajustés */
    margin-top: -10px;
    font-size: 1em;
    /* Texte légèrement plus petit */
    font-style: italic;
    color: #333;
}

.gbc-info-prefix {
    font-weight: bold;
    font-style: normal;
    margin-right: 8px;
}

.gbc-info-prefix .dashicons {
    font-size: 25px;
    vertical-align: middle;
    position: relative;
    top: -5px;
    margin-right: 10px;
}