/* ==========================================================================
   Module : Profils
   Design moderne cohérent avec mod_partenaires_osc
   Palette inspirée du logo de l'Observatoire Social Centre-Val de Loire
   ========================================================================== */

:root {
    --mod-profils-primary: #c6007e;
    --mod-profils-primary-light: #f061b5;
    --mod-profils-teal: #2b6376;
    --mod-profils-secondary: #7cb82f;
    --mod-profils-secondary-dark: #5e8f22;
    --mod-profils-dark: #2c2c2c;
    --mod-profils-text: #4a4a4a;
    --mod-profils-muted: #6b7280;
    --mod-profils-bg: #ffffff;
    --mod-profils-surface: #f8f9fa;
    --mod-profils-border: rgba(0, 0, 0, 0.08);
    --mod-profils-radius: 16px;
    --mod-profils-shadow: 0 4px 18px rgba(0, 0, 0, 0.08);
    --mod-profils-shadow-hover: 0 12px 32px rgba(0, 0, 0, 0.14);
    --mod-profils-transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.mod-profils {
    background: var(--mod-profils-bg);
    border: 1px solid var(--mod-profils-border);
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    padding: 1.25rem;
    margin: 1rem 0;
}

.mod-profils__title {
    display: block;
    width: 100%;
    text-align: left;
    margin: 0 0 1.25rem;
    padding-bottom: 0.5rem;
    color: var(--mod-profils-secondary);
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.3;
    border-bottom: 2px solid var(--mod-profils-border);
}

.mod-profils__title .gras {
    font-weight: 800;
}

/* Panneau « paramètres » : sélection de l'année et du territoire */
.mod-profils__form {
    display: grid;
    grid-template-columns: minmax(220px, 320px) 1fr;
    gap: 32px;
    margin: 0 0 1.75rem;
    padding: 24px;
    align-items: start;
    background: linear-gradient(180deg, #eedda717, #ffffff);
    border: 1px solid var(--mod-profils-border);
    border-radius: 20px;
}

/* Colonne de sélection des années (pastilles) */
.mod-profils__annees-titre {
    font-size: 14px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--mod-profils-teal);
    font-weight: 700;
}

.mod-profils__annees hr {
    border: none;
    height: 1px;
    width: 100%;
    max-width: 238px;
    margin: 8px 0 16px;
    background: linear-gradient(120deg, var(--mod-profils-primary), #eedda7, var(--mod-profils-secondary));
}

.mod-profils__annees-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.mod-profils__annee {
    padding: 9px 18px;
    border-radius: 999px;
    border: 1px solid #d6e6bc;
    color: var(--mod-profils-teal);
    font-weight: 600;
    cursor: pointer;
    background: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
}

.mod-profils__annee:hover,
.mod-profils__annee:focus-visible {
    border-color: var(--mod-profils-primary-light);
    box-shadow: 0 4px 14px rgba(198, 0, 126, 0.25);
    outline: none;
}

.mod-profils__annee.is-active {
    background: linear-gradient(120deg, var(--mod-profils-primary-light), var(--mod-profils-primary));
    color: #fff;
    border: 0;
    box-shadow: 0 8px 18px rgba(198, 0, 126, 0.35);
}

/* Colonne des champs (territoire + bouton) */
.mod-profils__fields {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 480px;
}

.mod-profils__field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.mod-profils__label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--mod-profils-muted);
}

.mod-profils__select,
#div_liste_decoupages_profils select,
#div_liste_annees_profils select,
#div_liste_territoires select {
    width: 100%;
    min-height: 44px;
    padding: 0.6rem 2.5rem 0.6rem 1rem;
    border: 1px solid var(--mod-profils-border);
    border-radius: 12px;
    background-color: var(--mod-profils-surface);
    color: var(--mod-profils-dark);
    font-size: 0.9375rem;
    font-weight: 600;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%237cb82f' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.mod-profils__select:hover,
#div_liste_decoupages_profils select:hover,
#div_liste_annees_profils select:hover,
#div_liste_territoires select:hover {
    border-color: rgba(198, 0, 126, 0.35);
    background-color: #ffffff;
}

.mod-profils__select:focus,
#div_liste_decoupages_profils select:focus,
#div_liste_annees_profils select:focus,
#div_liste_territoires select:focus {
    outline: 3px solid rgba(124, 184, 47, 0.35);
    outline-offset: 2px;
    border-color: var(--mod-profils-secondary);
    background-color: #ffffff;
}

.mod-profils__select:disabled,
#div_liste_territoires select:disabled {
    background-color: #eef0f2;
    color: var(--mod-profils-muted);
    border-color: var(--mod-profils-border);
    box-shadow: none;
    cursor: not-allowed;
    opacity: 1;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23a3a3a3' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
}

.mod-profils__select:disabled:hover,
#div_liste_territoires select:disabled:hover {
    border-color: var(--mod-profils-border);
    background-color: #eef0f2;
}

.mod-profils__actions {
    display: flex;
    justify-content: center;
    margin: 1.5rem 0;
}

.mod-profils__button,
#generer_profil {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 999px;
    font-size: 0.9375rem;
    font-weight: 700;
    color: #ffffff;
    background: linear-gradient(135deg, var(--mod-profils-secondary), var(--mod-profils-secondary-dark));
    box-shadow: 0 2px 8px rgba(124, 184, 47, 0.25);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.mod-profils__button:hover,
#generer_profil:hover,
.mod-profils__button:focus,
#generer_profil:focus {
    transform: scale(1.03);
    box-shadow: 0 4px 12px rgba(124, 184, 47, 0.35);
}

.mod-profils__export {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    margin: 1.5rem 0;
}

.boutons_profils {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    min-width: 220px;
    padding: 0.6rem 1.25rem;
    border-radius: 999px;
    font-size: 0.875rem;
    font-weight: 600;
    color: #ffffff;
    background: linear-gradient(135deg, var(--mod-profils-primary), #9e0063);
    box-shadow: 0 2px 8px rgba(198, 0, 126, 0.25);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: none;
}

.boutons_profils:hover,
.boutons_profils:focus {
    transform: scale(1.03);
    box-shadow: 0 4px 12px rgba(198, 0, 126, 0.35);
}

.boutons_profils .mod-profils__icon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

/* Panneau « résultats » : n'apparaît qu'une fois le profil généré */
.mod-profils__results {
    overflow-x: auto;
}

.mod-profils__results:not(:empty) {
    padding: 24px;
    background: var(--mod-profils-bg);
    border: 1px solid var(--mod-profils-border);
    border-radius: 20px;
    box-shadow: var(--mod-profils-shadow);
}

.mod-profils__results:not(:empty)::before {
    content: "";
    display: block;
    height: 1px;
    width: 100%;
    margin: 0 auto 1.25rem;
    border-radius: 999px;
    background: linear-gradient(120deg, var(--mod-profils-primary), #eedda7, var(--mod-profils-secondary));
}

.mod-profils__results > .mod-profils__export:first-child {
    margin-top: 0;
}

.tableau_profil {
    width: 100%;
    border-collapse: collapse;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.05);
    font-size: 0.875rem;
    margin: 1rem 0;
}

.tableau_profil thead {
    background: #f0f5e6;
    color: #c6007e;
    border-bottom: 2px solid #7cb82f;
}

/* Ligne de titre de catégorie sans fond */
.tableau_profil thead tr:first-child td {
    background: #ffffff;
    border-bottom: none;
    padding: 0.2rem 0;
}

.tableau_profil th,
.tableau_profil td {
    padding: 0.1rem 0.1rem;
    text-align: center;
    border-bottom: 1px solid #d6e6bc;
    line-height: 1.2;
}

.tableau_profil th {
    font-weight: 700;
    background-color: #f0f5e6 !important;
}

th {
    font-weight: 700;
    background-color: #f0f5e6 !important;
}

.tableau_profil tbody tr {
    transition: background-color 0.15s ease;
}

.tableau_profil tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

.tableau_profil tbody tr {
    border: 1px solid #d6e6bc !important;
}

.tableau_profil tbody tr td:nth-child(1) {
    background-color: #ffffff;
    color: #2c2c2c;
    text-align: left;
    padding-left: 0.5rem;
    border-left: 3px solid #c6007e;
    font-weight: 600;
}

.tableau_profil tbody tr td:nth-child(2),
.tableau_profil tbody tr td:nth-child(3),
.tableau_profil tbody tr td:nth-child(4),
.tableau_profil tbody tr td:nth-child(5),
.tableau_profil tbody tr td:nth-child(7) {
    color: #2c2c2c;
}

.mod-profils__indicator {
    text-align: left;
    font-weight: 500;
    max-width: 420px;
}

.tableau_profil th:nth-child(2),
.tableau_profil th:nth-child(3),
.tableau_profil th:nth-child(4),
.tableau_profil th:nth-child(5),
.tableau_profil th:nth-child(7),
.tableau_profil td:nth-child(2),
.tableau_profil td:nth-child(3),
.tableau_profil td:nth-child(4),
.tableau_profil td:nth-child(5),
.tableau_profil td:nth-child(7) {
    width: 65px;
}

.tableau_profil td img {
    max-width: 160px;
    height: auto;
}

.mod-profils__note-lecture {
    display: block;
    width: 100%;
    max-width: 700px;
    height: auto;
    margin: 0.5rem auto;
}

#div_point_jaune_annotation_schema {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background-color: #e4c573;
    vertical-align: middle;
    margin: 0 0.25rem;
}

.nom_categorie {
    color: #2c2c2c;
    font-size: 0.9rem;
    font-weight: 700;
    margin: 0;
    padding: 0;
    text-align: left;
}

.sources_profils {
    font-size: 0.8125rem;
    color: #6c757d;
    font-style: italic;
    margin: 0.5rem 0 0 0;
    padding: 0 0.2cm;
    background: transparent;
    border-radius: 8px;
    border-left: 3px solid #c6007e;
}

.categorie_profil {
    margin-bottom: 2rem;
}

/* Classes utilitaires conservées */
.titre_vert {
    color: var(--mod-profils-secondary);
}

.vert {
    color: var(--mod-profils-secondary);
}

.gras {
    font-weight: bold;
}

@media (max-width: 900px) {
    .mod-profils__form {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .mod-profils__fields {
        max-width: none;
    }
}
