/* Annuaire des organisations : grille de cartes portée depuis la maquette
   orga-portal (référence design de l'épopée). Les avatars réutilisent
   .org-avatar (relation-map.css). */

/* Surtitre de page (« Référentiel d'organisations », « Profil »...) : partagé
   par les entêtes de pages, pas seulement l'annuaire. */
.directory-eyebrow {
    display: block;
    margin-bottom: 2px;
    color: #7d8c90;
    font-size: 0.66rem;
    font-weight: 900;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

/* ---- Barre d'outils : recherche + filtre projet ---- */

.directory-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding-bottom: 17px;
    border-bottom: 1px solid #dfe7e9;
}

.search-control {
    position: relative;
    width: min(420px, 100%);
}

.search-control > i {
    position: absolute;
    top: 50%;
    left: 13px;
    z-index: 2;
    color: #98a5a8;
    transform: translateY(-50%);
}

.search-control .form-control {
    padding-left: 37px;
}

.directory-toolbar .form-select {
    width: 210px;
}

/* ---- Grille ---- */

.organization-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 15px;
    padding-top: 18px;
}

/* ---- Carte organisation ---- */

.organization-card {
    display: flex;
    overflow: hidden;
    flex-direction: column;
    border: 1px solid #dfe7e9;
    border-radius: 14px;
    background: #fff;
    transition: 0.18s ease;
}

/* La carte d'un partenaire n'a qu'une section : on l'étire pour que le bas
   des cartes reste aligné sur une même ligne de la grille. */
.partner-card-note {
    flex: 1;
}

.organization-card:hover {
    border-color: #b8d2d6;
    box-shadow: 0 9px 28px rgba(30, 52, 59, 0.09);
    transform: translateY(-2px);
}

.organization-card.inactive {
    opacity: 0.65;
}

.organization-card-main {
    display: block;
    width: 100%;
    padding: 16px;
    text-align: left;
    text-decoration: none;
    color: inherit;
}

.organization-card-main:hover {
    color: inherit;
}

.organization-card-top {
    display: flex;
    align-items: flex-start;
    gap: 11px;
}

.organization-card-top > span:nth-child(2) {
    min-width: 0;
    flex: 1;
}

.organization-card-top strong,
.organization-card-top small {
    display: block;
}

.organization-card-top strong {
    font-size: 0.85rem;
}

.organization-card-top small {
    overflow: hidden;
    margin-top: 4px;
    color: #748489;
    font-size: 0.66rem;
    line-height: 1.4;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.organization-card-top > i {
    color: #a1adaf;
    font-size: 0.78rem;
}

.organization-card-section {
    padding: 11px 16px;
    border-top: 1px solid #edf1f2;
}

.card-section-label {
    display: block;
    margin-bottom: 7px;
    color: #99a5a8;
    font-size: 0.56rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.relation-summary {
    display: flex;
    align-items: center;
    gap: 7px;
    color: #748489;
    font-size: 0.65rem;
}

.relation-summary > span:nth-child(2) {
    overflow: hidden;
    flex: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.summary-count {
    display: grid;
    width: 23px;
    height: 23px;
    flex: 0 0 23px;
    place-items: center;
    color: #7161a8;
    font-size: 0.61rem;
    font-weight: 900;
    border-radius: 7px;
    background: #f1eff9;
}

.relation-summary small {
    padding: 2px 5px;
    border-radius: 999px;
    background: #f0f3f4;
}

.project-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.project-link-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 8px;
    color: #086572;
    font-size: 0.63rem;
    font-weight: 700;
    text-decoration: none;
    border: 1px solid #d3e5e7;
    border-radius: 999px;
    background: #f3f9fa;
}

a.project-link-chip:hover {
    color: #fff;
    border-color: #086572;
    background: #086572;
}

/* ---- État vide (aucune organisation ou recherche sans résultat) ---- */

.empty-directory {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 50px 20px;
    color: #748489;
}

.empty-directory i {
    margin-bottom: 9px;
    font-size: 1.8rem;
}

/* Pastille de présence sur l'avatar (annuaire des utilisateurs). */
.user-online-dot {
    position: absolute;
    right: -2px;
    bottom: -2px;
    width: 11px;
    height: 11px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: #2eae60;
}

/* ---- Cartes utilisateur : alignement d'une même ligne ----
   Le nombre d'organisations et d'accès projet varie d'une personne à l'autre.
   Sans hauteur commune ni pied ancré, les boutons flottent à des hauteurs
   différentes et la grille devient illisible. */

.user-grid .organization-card {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Les actions restent en pied de carte quelle que soit la hauteur du contenu. */
.user-grid .organization-card-actions {
    margin-top: auto;
}

/* Espace réservé aux accès projet. La liste est bornée à trois projets côté
   template (le reste est compté), donc la hauteur reste prévisible : pas de
   défilement caché, et les cartes d'une même ligne gardent leur pied aligné. */
.user-grid .project-access-list {
    min-height: 3.1rem;
}

/* Un projet et ses applications forment un bloc : le nom sur sa ligne, les
   applications indentées dessous. Sans cela, dès qu'une application passait à
   la ligne elle semblait appartenir au projet suivant. */
.user-grid .project-access-group + .project-access-group {
    margin-top: 7px;
}

.user-grid .project-access-project {
    display: block;
    color: #6c7a7e;
    font-size: 0.68rem;
    font-weight: 600;
}

.user-grid .project-access-apps {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
    padding-left: 9px;
    border-left: 2px solid #edf1f2;
}

/* Puce d'accès applicatif, non scopée : elle sert dans la grille des
   utilisateurs comme sur la fiche projet. Même vocabulaire visuel que les
   puces d'organisation - une carte n'a pas la place pour des boutons bordés.
   Le retrait reste explicite (croix + survol rouge) sans dominer la lecture. */
.project-app-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    color: #55666a;
    font-size: 0.63rem;
    font-weight: 700;
    border: 1px solid #e2e8ea;
    border-radius: 999px;
    background: #f7f9fa;
    transition: 0.15s ease;
}

.project-app-chip i {
    color: #a9b6ba;
    font-size: 0.8rem;
    transition: 0.15s ease;
}

.project-app-chip:hover {
    color: #b02a2a;
    border-color: #e8b4b4;
    background: #fdf3f3;
}

.project-app-chip:hover i {
    color: #b02a2a;
}
