/**
 * com_profils — styles frontend
 * (C) 2026 i-FormaSite — GPL-2.0-or-later
 */

.com-profils {
    --profils-line: var(--labo-line, #dce6f0);
    --profils-muted: var(--labo-muted, #5a6e84);
}

.profils-intro {
    color: var(--profils-muted);
    max-width: 60ch;
}

/* Formulaire Mon profil */
.profils-fieldset {
    border: 1px solid var(--profils-line);
    border-radius: 1rem;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    background: #fff;
}

.profils-fieldset legend {
    font-size: .85rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--profils-muted);
    padding-inline: .5rem;
}

.profils-grid {
    display: grid;
    gap: 0 1.25rem;
}

@media (min-width: 768px) {
    .profils-grid { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
}

.profils-form .control-group { margin-bottom: .9rem; }
.profils-form .control-label label { font-weight: 600; font-size: .92rem; }

.profils-actions { margin-top: .5rem; }

/* Annuaire */
.profils-badge-langue {
    display: inline-block;
    vertical-align: middle;
    font-size: .85rem;
    font-weight: 600;
    background: var(--labo-blue-light, #eaf2fb);
    color: var(--labo-blue-deep, #0a4a8c);
    border-radius: 100px;
    padding: .25em .9em;
    margin-left: .5rem;
}

.profils-filtres {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    margin-block: 1rem 1.5rem;
}

.profils-filtres input[type="search"] { flex: 1 1 220px; }
.profils-filtres select { flex: 0 1 220px; width: auto; }

.profils-count {
    color: var(--profils-muted);
    font-size: .9rem;
}

/* Newsletters (archive par groupe) */
.profils-news-archive { list-style: none; margin: 1.2rem 0 0; padding: 0; display: grid; gap: .7rem; }

.profils-news-card { margin: 0; }

.profils-news-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.2rem;
    background: #fff;
    border: 1px solid var(--profils-line);
    border-radius: 1rem;
    text-decoration: none;
    color: inherit;
    transition: box-shadow .15s ease, border-color .15s ease, transform .15s ease;
}
.profils-news-link:hover {
    border-color: var(--labo-blue, #0f61b4);
    box-shadow: 0 8px 22px -16px rgba(8, 46, 88, .4);
    transform: translateY(-1px);
}

.profils-news-icon {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--labo-blue-light, #eaf2fb);
    color: var(--labo-blue-deep, #0a4a8c);
}

.profils-news-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: .15rem; }

.profils-news-subject { font-weight: 600; color: var(--labo-ink, #16324c); line-height: 1.35; }

.profils-news-preheader {
    font-size: .88rem;
    color: var(--profils-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profils-news-datebadge {
    flex: 0 0 auto;
    font-size: .82rem;
    font-weight: 600;
    color: var(--labo-blue-deep, #0a4a8c);
    background: var(--labo-blue-light, #eaf2fb);
    border-radius: 100px;
    padding: .25em .8em;
    white-space: nowrap;
}

@media (max-width: 560px) {
    .profils-news-link { flex-wrap: wrap; }
    .profils-news-preheader { white-space: normal; }
    .profils-news-datebadge { order: 3; }
}

/* Mon profil : édition de la photo */
.profils-photo-edit {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex-wrap: wrap;
}

.profils-photo-preview img,
.profils-photo-initiales {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--labo-blue-light, #eaf2fb);
    background: var(--labo-blue-light, #eaf2fb);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.9rem;
    font-weight: 700;
    color: var(--labo-blue-deep, #0a4a8c);
}

.profils-photo-preview { position: relative; }
.profils-photo-preview [hidden] { display: none !important; }
.profils-photo-chosen {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--labo-blue-light, #eaf2fb);
}
.profils-photo-placeholder { color: var(--labo-blue, #0f61b4); }

.profils-photo-controls { display: flex; flex-direction: column; gap: .4rem; }

.profils-photo-file { display: inline-block; cursor: pointer; }
.labo-btn-sm { padding: 8px 16px; font-size: .85rem; }

.profils-photo-filename { font-size: .88rem; color: var(--profils-muted); }

.profils-photo-hint {
    margin: 0;
    font-size: .82rem;
    color: var(--profils-muted);
}

.profils-photo-remove {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .88rem;
    color: var(--profils-muted);
    cursor: pointer;
}

/* Annuaire en cartes */
.profils-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.1rem;
    margin-block: 1rem 1.5rem;
}

.profils-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid var(--profils-line);
    border-radius: 1rem;
    padding: 1.1rem 1.2rem;
    box-shadow: 0 8px 22px -16px rgba(8, 46, 88, .35);
}

.profils-card-head {
    display: flex;
    align-items: center;
    gap: .85rem;
    margin-bottom: .75rem;
}

.profils-card-avatar {
    flex: 0 0 auto;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--labo-blue-light, #eaf2fb);
    background: var(--labo-blue-light, #eaf2fb);
}

.profils-card-initiales {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.35rem;
    color: var(--labo-blue-deep, #0a4a8c);
}

.profils-card-nom {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0 0 .15rem;
    line-height: 1.25;
}

.profils-card-profession {
    display: inline-block;
    font-size: .78rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--labo-green-deep, #5a7d0e);
    background: rgba(143, 190, 34, .14);
    border-radius: 100px;
    padding: .2em .8em;
}

.profils-card-infos {
    list-style: none;
    margin: 0 0 .85rem;
    padding: 0;
    font-size: .92rem;
    color: var(--profils-muted);
    flex: 1 1 auto;
}

.profils-card-infos li { padding-block: .18rem; }

.profils-card-infos a { color: var(--labo-blue-deep, #0a4a8c); text-decoration: none; }
.profils-card-infos a:hover { color: var(--labo-blue, #0f61b4); }

.profils-info-etablissement { font-weight: 600; color: inherit; }

.profils-card-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .4rem;
    border-top: 1px solid var(--profils-line);
    padding-top: .7rem;
}

.profils-card-foot .profils-badge-langue { margin-left: 0; }

.profils-badge-acym {
    display: inline-block;
    font-size: .8rem;
    font-weight: 600;
    border-radius: 100px;
    padding: .25em .9em;
}

.profils-badge-acym.is-ok { background: rgba(143, 190, 34, .16); color: #45660a; }
.profils-badge-acym.is-off { background: rgba(224, 145, 20, .14); color: #8a5a0a; }
.profils-badge-acym.is-none { background: rgba(90, 110, 132, .12); color: var(--profils-muted); }

/* Drapeaux (langue de correspondance) */
.profils-flag {
    display: inline-flex;
    width: 26px;
    height: 18px;
    border-radius: 3px;
    overflow: hidden;
    box-shadow: 0 0 0 1px rgba(8, 46, 88, .18);
    flex: 0 0 auto;
}

.profils-flag svg { width: 100%; height: 100%; display: block; }

.profils-flag-titre { vertical-align: middle; margin-left: .5rem; }

/* Pictos de contact */
.profils-picto {
    display: inline-flex;
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    color: var(--labo-blue, #0f61b4);
    opacity: .75;
}

.profils-picto svg { width: 100%; height: 100%; }

.profils-card-infos li {
    display: flex;
    align-items: flex-start;
    gap: .5rem;
}

.profils-card-infos .profils-picto { margin-top: .18em; }

/* Avatar cliquable */
.profils-avatar-btn {
    padding: 0;
    border: 0;
    background: none;
    cursor: zoom-in;
    border-radius: 50%;
    line-height: 0;
    flex: 0 0 auto;
}

.profils-avatar-btn:focus-visible { outline: 3px solid var(--labo-blue, #0f61b4); outline-offset: 2px; }

/* Badge AcyMailing cliquable */
button.profils-badge-acym { border: 0; cursor: pointer; font: inherit; font-size: .8rem; font-weight: 600; }
button.profils-badge-acym:hover { filter: brightness(.94); }

/* Dialogues (photo + newsletters) */
.profils-dialog {
    border: 0;
    border-radius: 1rem;
    padding: 0;
    max-width: min(92vw, 560px);
    box-shadow: 0 30px 60px -20px rgba(8, 46, 88, .5);
}

.profils-dialog::backdrop { background: rgba(8, 46, 88, .55); }

.profils-dialog-inner { position: relative; padding: 1.25rem 1.5rem; }

.profils-dialog-close {
    position: absolute;
    top: .5rem;
    right: .6rem;
    border: 0;
    background: none;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    color: var(--profils-muted);
}

.profils-dialog-close:hover { color: var(--labo-blue-deep, #0a4a8c); }

.profils-dialog-photo img {
    display: block;
    max-width: 100%;
    max-height: 70vh;
    margin-inline: auto;
    border-radius: .75rem;
}

.profils-dialog-photo .profils-dialog-title {
    text-align: center;
    font-weight: 600;
    margin: .75rem 0 0;
}

.profils-dialog-news .profils-dialog-heading {
    font-size: 1.1rem;
    margin: 0 0 .15rem;
    padding-right: 1.5rem;
}

.profils-dialog-news .profils-dialog-title {
    color: var(--profils-muted);
    font-weight: 600;
    margin: 0 0 .8rem;
}

.profils-news-list { max-height: 55vh; overflow-y: auto; }

.profils-news-list ul { list-style: none; margin: 0; padding: 0; }

.profils-news-list li {
    display: flex;
    flex-direction: column;
    gap: .1rem;
    padding: .55rem 0;
    border-top: 1px solid var(--profils-line);
}

.profils-news-list strong { font-weight: 600; line-height: 1.3; }

.profils-news-date { font-size: .8rem; color: var(--profils-muted); }

.profils-news-loading { text-align: center; font-size: 1.4rem; color: var(--profils-muted); }

/* Défilement infini */
.profils-pagination[hidden] { display: none; }

.profils-scroll-sentinel {
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profils-scroll-sentinel.is-loading::after {
    content: "";
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 50%;
    border: 3px solid var(--profils-line);
    border-top-color: var(--labo-blue, #0f61b4);
    animation: profils-spin .7s linear infinite;
}

@keyframes profils-spin {
    to { transform: rotate(360deg); }
}

.profils-table-wrap { overflow-x: auto; }

.profils-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border: 1px solid var(--profils-line);
    border-radius: 1rem;
    overflow: hidden;
}

.profils-table th, .profils-table td {
    padding: .6rem .85rem;
    border-bottom: 1px solid var(--profils-line);
    text-align: left;
}

.profils-table thead th {
    font-size: .78rem;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--profils-muted);
}

.profils-table tbody tr:nth-child(odd) { background: rgba(15, 97, 180, .03); }
.profils-table tbody tr:last-child td { border-bottom: 0; }

/* Pot de miel anti-robots */
.profils-hp {
    position: absolute !important;
    left: -9999px !important;
    width: 1px; height: 1px;
    overflow: hidden;
}
