/* --- Conteneurs principaux --- */
.gpc-search-container {
    margin-bottom: 15px;
}

.gpc-filters-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 25px;
}

/* --- Lignes de filtres --- */
.gpc-category-filters,
.gpc-season-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

/* Labels pour les lignes de filtres */
.gpc-filter-label {
    font-size: 0.9em;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Style commun pour tous les boutons de filtre (Pills) */
.gpc-category-filter,
.season-filter-btn {
    padding: 8px 16px;
    border: 1px solid #ddd;
    background-color: #fff;
    color: #555;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 500;
    border-radius: 20px; /* Style Pill */
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.gpc-category-filter:hover,
.season-filter-btn:hover {
    background-color: #f1f1f1;
    border-color: #ccc;
    transform: translateY(-1px);
}

/* Style pour les boutons de filtre ACTIFS */
.gpc-category-filter.active,
.season-filter-btn.active {
    background-color: #333; /* Couleur par défaut */
    color: #fff;
    border-color: #333;
    box-shadow: 0 2px 5px rgba(0,0,0,0.15);
}

/* Couleurs spécifiques pour les catégories si besoin */
.gpc-category-filter.active {
    background-color: #333;
    border-color: #333;
}

/* Couleurs pour les boutons de saison ACTIFS */
.season-filter-btn.season-color-0.active {
    background-color: #0073aa;
    border-color: #0073aa;
}
.season-filter-btn.season-color-1.active {
    background-color: #d54e21;
    border-color: #d54e21;
}
.season-filter-btn.season-color-2.active {
    background-color: #46b450;
    border-color: #46b450;
}
.season-filter-btn.season-color-3.active {
    background-color: #7e70af;
    border-color: #7e70af;
}

/* --- Couleurs pour la bordure supérieure des boutons de CATÉGORIE ACTIFS --- */
.gpc-category-filter.gpc-category-color-0.active {
    border-top-color: #008080; /* Turquoise */
}
.gpc-category-filter.gpc-category-color-1.active {
    border-top-color: #c71585; /* Magenta */
}
.gpc-category-filter.gpc-category-color-2.active {
    border-top-color: #b8860b; /* Or */
}
.gpc-category-filter.gpc-category-color-3.active {
    border-top-color: #708090; /* Ardoise */
}

/* --- Champ de recherche --- */
#gpc-chore-search {
    width: 100%;
    padding: 10px 12px;
    font-size: 1em;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
    /* Assure que le padding n'augmente pas la largeur totale */
    transition: border-color 0.2s ease-in-out;
}

#gpc-chore-search:focus {
    border-color: #0073aa;
    /* On retire l'ombre pour un effet plus sobre */
    outline: none;
}

/* --- Conteneur des colonnes --- */
.gpc-chores-container {
    /* Assure une couleur de texte par défaut lisible pour tout le conteneur */
    color: #333;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    /* Suppression de la bordure et de l'overflow pour séparer les colonnes */
}

.gpc-chores-column {
    flex: 1;
    min-width: 280px;
    background-color: #f9f9f9; /* Fond des colonnes */
    border-radius: 8px;
    padding-bottom: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}


/* --- Couleurs de colonnes distinctes par niveau --- */
.gpc-chores-column[data-level-key="debutant"] {
    background-color: #f8faff;
}
.gpc-chores-column[data-level-key="novice"] {
    background-color: #fdf5ff;
}
.gpc-chores-column[data-level-key="intermediaire"] {
    background-color: #fffbf5;
}

.gpc-chores-column h2 {
    margin-top: 0;
    padding: 15px;
    margin-bottom: 10px;
    border-bottom: 2px solid #ccc;
    border-radius: 8px 8px 0 0;
    font-size: 1.4em;
    /* S'assure que les titres ont la bonne couleur */
    color: inherit;
    background-color: #f5f5f5;
    text-align: center;
}

/* En-têtes colorés par niveau (état par défaut, sans filtre de saison actif) */
.gpc-chores-column[data-level-key="debutant"] h2 {
    background-color: #e3f2fd;
    border-bottom-color: #90caf9;
}
.gpc-chores-column[data-level-key="novice"] h2 {
    background-color: #f3e5f5;
    border-bottom-color: #ce93d8;
}
.gpc-chores-column[data-level-key="intermediaire"] h2 {
    background-color: #fff3e0;
    border-bottom-color: #ffb74d;
}

/* Compteur dans les en-têtes */
.gpc-chore-count {
    font-weight: normal;
    font-size: 0.7em;
    opacity: 0.7;
}

/* Suppression de l'override de couleur des colonnes (les colonnes gardent leur propre couleur) */


.gpc-chores-column ul {
    list-style: none;
    padding: 0 15px;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.chore-item {
    padding: 12px;
    margin: 0; /* Margin géré par le gap du ul */
    background-color: #fff !important;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    /* On utilise flexbox pour centrer le contenu verticalement */
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    z-index: 1;
}

.chore-item:hover {
    z-index: 99999;
}


/* --- Séparateurs alphabétiques --- */
.chore-alpha-divider {
    text-align: center;
    color: #aaa;
    font-size: 0.75em;
    font-weight: 600;
    padding: 4px 0;
    border-bottom: 1px dashed #ddd;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}


.chore-title {
    margin-bottom: 6px;
    /* On transforme le titre en conteneur flex pour aligner ses enfants */
    display: flex;
    justify-content: center;
    align-items: center;
    /* Aligne verticalement au centre pour un meilleur rendu */
    gap: 6px;
    /* Espace entre les éléments du titre */
    flex-wrap: wrap;
}

.chore-main-title {
    font-weight: bold;
    font-size: 1.1em;
}

.gpc-pot-commun-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75em;
    font-weight: bold;
    /* Style par défaut (quand aucune saison n'est sélectionnée) */
    background-color: transparent;
    color: #555;
    border: 1px solid #ccc;
    /* Pour s'assurer qu'il ne passe pas à la ligne si le titre est long */
    white-space: nowrap;
}

.gpc-advanced-indicator {
    font-weight: bold;
    color: #333;
    font-size: 1em;
}

/* --- Couleurs pour les badges de Pot Commun --- */
/* Couleur 0 (Turquoise) */
.gpc-pot-commun-badge.gpc-badge-color-0 {
    color: #004d4d;
    border-color: #b2d8d8;
    background-color: #e0f2f1;
}
/* Couleur 1 (Magenta) */
.gpc-pot-commun-badge.gpc-badge-color-1 {
    color: #8b004c;
    border-color: #f0b8d8;
    background-color: #fae6f2;
}
/* Couleur 2 (Or) */
.gpc-pot-commun-badge.gpc-badge-color-2 {
    color: #805b08;
    border-color: #e6d1a1;
    background-color: #fdf8e1;
}
/* Couleur 3 (Ardoise) */
.gpc-pot-commun-badge.gpc-badge-color-3 {
    color: #2f4f4f;
    border-color: #b0c4de;
    background-color: #e6eaf0;
}

/* --- Boutons pills colorés (inspirés du plugin programme-cours) --- */
.chore-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    flex-wrap: nowrap;
}

.chore-link-item {
    position: relative;
    z-index: 20;
}

.gc-media-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
    padding: 0 8px !important;
    width: auto !important;
    min-width: 68px !important;
    height: 26px !important;
    border-radius: 5px !important;
    border: none !important;
    cursor: pointer !important;
    transition: opacity 0.15s ease, transform 0.15s ease !important;
    text-decoration: none !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15) !important;
    font-size: 11px !important;
    font-family: inherit !important;
    line-height: 1 !important;
    font-weight: 700 !important;
    color: #ffffff !important;
    text-transform: uppercase !important;
    letter-spacing: 0.03em !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
}

.gc-media-btn:hover {
    opacity: 0.85;
    transform: translateY(-1px);
}

/* Cache de force les icônes de liens externes injectées par le thème Divi ou d'autres plugins */
.gc-media-btn:after, 
.gc-media-btn::after, 
.gc-media-btn::before,
.gc-media-btn > :not(.dashicons):not(img) {
    display: none !important;
}

.gc-media-btn .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    line-height: 14px;
    color: #fff !important;
}

/* Couleurs des boutons */
.chore-link-item a.gc-pdf-btn {
    background-color: #2563eb;
}
.chore-link-item a.gc-demo-btn {
    background-color: #dc2626;
}
.chore-link-item a.gc-cours-btn {
    background-color: #d97706;
}

/* --- Tooltip miniature au survol --- */
.chore-preview-tooltip {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
    z-index: 9999;
    padding: 4px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
    pointer-events: none;
    width: max-content;
}

.chore-link-item:hover .chore-preview-tooltip {
    visibility: visible;
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.chore-preview-tooltip img {
    width: 200px !important;
    max-width: none !important;
    height: auto !important;
    min-height: 112px !important;
    background-color: #f5f5f5;
    border-radius: 4px;
    display: block;
}

/* Flèche du tooltip */
.chore-preview-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #fff;
}
.chore-preview-tooltip::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 7px solid transparent;
    border-top-color: #ddd;
}



.no-chores-message {
    font-style: italic;
    color: #888;
    justify-content: center;
}

/* Force la suppression des puces de liste qui pourraient apparaître sur certains navigateurs */
.gpc-chores-column li::marker {
    content: none;
}

.fancybox__slide.is-iframe .fancybox__content {
    padding: 0;
}

.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__content {
    background: transparent !important;
    border: 0 !important;
    padding: 0 !important;
    height: 100% !important;
    width: 800px !important;
    z-index: 1 !important;
}

.fancybox__container {
    --fancybox-bg: rgba(24, 24, 27, 0.83) !important;
    /* On force FancyBox à être au-dessus de tous les autres éléments (comme un header "sticky") */
    z-index: 99999 !important;
}

/*
 * Correction pour les appareils mobiles :
 * Décale la fenêtre FancyBox vers le bas pour qu'elle ne soit pas cachée par l'en-tête du site.
 * La valeur de 'top' et 'height' doit correspondre à la hauteur de votre en-tête.
 */
@media screen and (max-width: 782px) {
    .fancybox__container {
        top: 3% !important;
        height: 95% !important;
    }

    .fancybox__html5video,
    .fancybox__iframe {
        height: 87% !important;
        width: 100% !important;
    }
}

/* Style pour la légende */
.gpc-chores-legend {
    margin-bottom: 20px;
    margin-top: 20px;
    padding: 10px 15px;
    font-size: 0.85em;
    color: #777;
    text-align: center;
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 6px;
}

.gpc-chores-legend p {
    margin: 0;
}

/* --- Onglets mobile : affichage par niveaux --- */
.gpc-mobile-tabs {
    display: none;
}

@media screen and (max-width: 768px) {
    /* Afficher les onglets mobile */
    .gpc-mobile-tabs {
        display: flex;
        border-bottom: 2px solid #ddd;
        margin-top: 20px;
        margin-bottom: 20px;
    }

    .gpc-mobile-tab {
        flex: 1;
        text-align: center;
        padding: 14px 5px;
        font-size: 1em;
        font-weight: 600;
        cursor: pointer;
        border: none;
        background: #f5f5f5;
        color: #888;
        transition: all 0.2s ease;
        border-bottom: 3px solid transparent;
    }

    .gpc-mobile-tab.active {
        color: #333;
        background: #fff;
        border-bottom-color: #0073aa;
    }

    .gpc-mobile-tab[data-level="debutant"].active {
        border-bottom-color: #2563eb;
    }
    .gpc-mobile-tab[data-level="novice"].active {
        border-bottom-color: #9333ea;
    }
    .gpc-mobile-tab[data-level="intermediaire"].active {
        border-bottom-color: #d97706;
    }

    /* Masquer les colonnes par défaut sur mobile */
    .gpc-chores-column {
        display: none;
    }

    /* Afficher uniquement la colonne active */
    .gpc-chores-column.gpc-mobile-active {
        display: block;
        width: 100%;
    }

    /* Cacher les h2 sur mobile (remplacés par les onglets) */
    .gpc-chores-column h2 {
        display: none;
    }

    /* Tooltip au survol : désactivé sur mobile */
    .chore-preview-tooltip {
        display: none !important;
        visibility: hidden !important;
    }

    /* Grossir les boutons d'action (PDF, Démo, Cours) sur mobile */
    .gc-media-btn {
        width: auto !important;
        min-width: 75px !important;
        height: 32px !important;
        font-size: 12px !important;
        padding: 0 10px !important;
        border-radius: 6px !important;
        gap: 5px !important;
    }
    
    .gc-media-btn .dashicons {
        font-size: 16px !important;
        width: 16px !important;
        height: 16px !important;
        line-height: 16px !important;
    }
}

/* ==========================================================================
   PHASE 2 : Améliorations UI/UX (Animations, Sticky Headers, Highlight)
   ========================================================================== */

/* 10. Sticky Headers */
.gpc-chores-column h2 {
    position: sticky;
    top: 0;
    z-index: 10;
}

/* 11. Animations d'entrée (Fade In Up) */
.chore-item {
    animation: gpc-fade-in-up 0.4s ease forwards;
    opacity: 0;
    transform: translateY(10px);
}

.chore-item:nth-child(1) { animation-delay: 0.05s; }
.chore-item:nth-child(2) { animation-delay: 0.1s; }
.chore-item:nth-child(3) { animation-delay: 0.15s; }
.chore-item:nth-child(4) { animation-delay: 0.2s; }
.chore-item:nth-child(5) { animation-delay: 0.25s; }
.chore-item:nth-child(6) { animation-delay: 0.3s; }
.chore-item:nth-child(7) { animation-delay: 0.35s; }
.chore-item:nth-child(8) { animation-delay: 0.4s; }
.chore-item:nth-child(9) { animation-delay: 0.45s; }
.chore-item:nth-child(n+10) { animation-delay: 0.5s; }

@keyframes gpc-fade-in-up {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 9. Feedback recherche + Highlight */
.gpc-search-feedback {
    display: block;
    margin-top: 8px;
    font-size: 0.9em;
    color: #666;
    text-align: center;
}

.gpc-search-highlight {
    background-color: rgba(255, 235, 59, 0.6);
    padding: 0 2px;
    border-radius: 2px;
}

/* 18. Compteur Global (Légende) */
.gpc-global-counter {
    background: #fff;
    border: 1px solid #ddd;
    border-left: 4px solid #0073aa;
    border-radius: 6px;
    padding: 12px 15px;
    margin: 10px auto 25px auto;
    font-size: 0.95em;
    color: #444;
    max-width: 850px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px 12px;
}

/* ==========================================================================
   PHASE 3 : Accessibilité & UI (Scroll)
   ========================================================================== */

/* 24. Bouton Scroll-to-top */
.gpc-scroll-to-top {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 45px;
    height: 45px;
    background-color: #333;
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 20px;
    line-height: 45px;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease, background-color 0.2s ease;
    z-index: 1000;
}

.gpc-scroll-to-top.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.gpc-scroll-to-top:hover {
    background-color: #555;
}