/**
 * Annuaire EC 2026 - Styles annuaire Enseignants-Chercheurs & Doctorants
 * Modernise pour UIkit 3 (jl-*) - Janvier 2026
 * Inspire de diplomes2024.css - Filtres horizontaux
 */

/* ==========================================================================
   Variables CSS
   ========================================================================== */
:root {
    --annuaire-primary: #219897;
    --annuaire-primary-dark: #1a7f7e;
    --annuaire-accent: #E63946;
    --annuaire-filter-bg: #fafafa;
    --annuaire-filter-border: #dadada;
    --annuaire-results-border: #219897;
    --annuaire-card-bg: #ffffff;
    --annuaire-card-border: #e0e0e0;
    --annuaire-card-hover-border: #E63946;
    --annuaire-text-muted: #585858;
    --annuaire-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --annuaire-shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.15);
}

/* ==========================================================================
   Container principal
   ========================================================================== */
.annuaire-container {
    width: 100%;
    max-width: 100%;
}

/* ==========================================================================
   Barre de filtres horizontale
   ========================================================================== */
.annuaire-filters-wrapper {
    width: 100%;
    margin-bottom: 20px;
}

.annuaire-filters-bar {
    background: var(--annuaire-filter-bg);
    border: 1px solid var(--annuaire-filter-border);
    border-radius: 8px;
    padding: 15px 20px;
    box-shadow: var(--annuaire-shadow);
}

/* Labels des filtres */
.annuaire-filters-bar .filter-label {
    display: block;
    font-size: 0.8em;
    font-weight: 600;
    color: #555;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.annuaire-filters-bar .filter-label .fa {
    margin-right: 4px;
    color: var(--annuaire-primary);
}

.annuaire-filters-bar .jl-input,
.annuaire-filters-bar .jl-select {
    font-family: sans-serif;
    color: #616161;
    font-size: 0.95em;
    height: 40px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
}

.annuaire-filters-bar .jl-input:focus,
.annuaire-filters-bar .jl-select:focus {
    border-color: var(--annuaire-primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(33, 152, 151, 0.15);
}

.annuaire-filters-bar .jl-input::placeholder {
    color: #999;
}

/* Bouton rechercher */
.annuaire-search-btn .jl-button-primary {
    background-color: var(--annuaire-primary);
    border-color: var(--annuaire-primary);
    height: 40px;
    padding: 0 20px;
    border-radius: 4px;
    font-size: 0.95em;
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.annuaire-search-btn .jl-button-primary:hover {
    background-color: var(--annuaire-primary-dark);
    border-color: var(--annuaire-primary-dark);
}

/* Bouton reset */
.filter-reset-wrapper {
    align-self: flex-end;
    padding-bottom: 0;
}

.filter-reset {
    background: transparent;
    border: 1px solid var(--annuaire-accent);
    color: var(--annuaire-accent);
    height: 40px;
    padding: 0 15px;
    border-radius: 4px;
    font-size: 0.9em;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.filter-reset:hover {
    background: var(--annuaire-accent);
    color: #fff;
}

.filter-reset.hidden {
    display: none !important;
}

/* ==========================================================================
   Tom Select - Styles personnalises
   ========================================================================== */

/* Masquer le select original quand Tom Select est initialise */
.annuaire-filters-bar select.tomselected,
.annuaire-filters-bar .ts-wrapper + select,
.annuaire-filters-bar .ts-wrapper select {
    display: none !important;
}

/* Le select original avant initialisation Tom Select */
.annuaire-filters-bar select[multiple]:not(.tomselected) {
    height: 40px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    width: 100%;
}

.annuaire-filters-bar .ts-wrapper {
    width: 100% !important;
    max-width: 100% !important;
}

.annuaire-filters-bar .ts-control {
    color: #616161;
    height: 40px;
    min-height: 40px;
    padding: 0 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    font-size: 0.9em;
    line-height: 38px;
    overflow: hidden;
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
}

.annuaire-filters-bar .ts-control > input {
    height: 38px;
    line-height: 38px;
}

.annuaire-filters-bar .ts-control:focus,
.annuaire-filters-bar .ts-wrapper.focus .ts-control {
    border-color: var(--annuaire-primary);
    box-shadow: 0 0 0 2px rgba(33, 152, 151, 0.15);
}

.annuaire-filters-bar .ts-dropdown {
    max-height: 300px;
    border-color: #ddd;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
}

.annuaire-filters-bar .ts-dropdown .option {
    padding: 8px 12px;
    font-size: 0.9em;
}

.annuaire-filters-bar .ts-dropdown .option.active {
    background-color: var(--annuaire-primary);
    color: #fff;
}

.annuaire-filters-bar .ts-dropdown .option:hover {
    background-color: rgba(33, 152, 151, 0.1);
}

.annuaire-filters-bar .ts-dropdown .option.active:hover {
    background-color: var(--annuaire-primary-dark);
}

/* Tom Select - Items selectionnes (multiple) */
.annuaire-filters-bar .ts-control .item {
    background: var(--annuaire-primary);
    color: #fff;
    border-radius: 3px;
    padding: 2px 6px;
    margin: 2px;
    font-size: 0.8em;
    line-height: 20px;
    height: auto;
    white-space: nowrap;
}

.annuaire-filters-bar .ts-control .item .remove {
    color: rgba(255, 255, 255, 0.7);
    border-left-color: rgba(255, 255, 255, 0.3);
}

.annuaire-filters-bar .ts-control .item .remove:hover {
    color: #fff;
    background: rgba(0, 0, 0, 0.1);
}

/* Placeholder Tom Select */
.annuaire-filters-bar .ts-control input::placeholder {
    color: #999;
}

/* ==========================================================================
   Checkboxes fonctions (ligne 2)
   ========================================================================== */
.annuaire-filters-bar .fonction-group {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 8px 12px;
    min-height: 40px;
}

.annuaire-filters-bar .fonction-group .jl-checkbox-label {
    display: inline-flex;
    align-items: center;
    margin-right: 20px;
    margin-bottom: 0;
    font-size: 0.9em;
    cursor: pointer;
    white-space: nowrap;
}

.annuaire-filters-bar .fonction-group .jl-checkbox {
    margin-right: 6px;
}

.annuaire-filters-bar .fonction-group .jl-checkbox-label:hover {
    color: var(--annuaire-primary);
}

/* ==========================================================================
   Abecedaire (surcharge custom.css)
   ========================================================================== */
.annuaire-container #alpha-bar,
.annuaire-alphabet {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 5px;
    padding: 15px 10px;
    margin-bottom: 20px;
    background: var(--annuaire-filter-bg) !important;
    border-radius: 8px;
    border: 1px solid var(--annuaire-filter-border);
    overflow-x: visible;
}

.annuaire-container #alpha-bar .alpha-link,
.annuaire-alphabet .alpha-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 4px !important;
    font-size: 0.85em;
    font-weight: 500;
    text-decoration: none;
    color: #333 !important;
    background: #fff !important;
    border: 1px solid #ddd;
    padding: 0 !important;
    margin: 0 !important;
    transition: all 0.2s ease;
}

.annuaire-container #alpha-bar .alpha-link:hover,
.annuaire-alphabet .alpha-link:hover {
    background: var(--annuaire-primary) !important;
    border-color: var(--annuaire-primary);
    color: #fff !important;
}

.annuaire-container #alpha-bar .alpha-link.jl-active,
.annuaire-alphabet .alpha-link.jl-active {
    background: var(--annuaire-primary) !important;
    border-color: var(--annuaire-primary);
    color: #fff !important;
    font-weight: 600;
}

.annuaire-container #alpha-bar .alpha-link[data-alpha="*"],
.annuaire-alphabet .alpha-link[data-alpha="*"] {
    width: auto;
    padding: 0 12px !important;
}

/* ==========================================================================
   En-tete resultats
   ========================================================================== */
.annuaire-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    width: 100%;
    padding: 15px 0;
    margin-bottom: 20px;
    border-bottom: solid 2px var(--annuaire-results-border);
    min-height: 50px;
}

.resultsHeader {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 12px 15px;
    background: linear-gradient(135deg, rgba(33, 152, 151, 0.08) 0%, rgba(33, 152, 151, 0.02) 100%);
    border-radius: 8px;
    border-left: 4px solid var(--annuaire-primary);
}

.resultsHeader .primary {
    color: #333;
    font-weight: 600;
    font-size: 1em;
}

.resultsHeader .secondary {
    color: #666;
    font-style: italic;
    font-size: 0.9em;
}

/* ==========================================================================
   Cartes EC
   ========================================================================== */
.itemEC2021 {
    position: relative;
    overflow: hidden;
    line-height: 18px;
    width: 100%;
    max-width: 320px;
    height: 220px;
    background-color: var(--annuaire-card-bg);
    border: solid 2px var(--annuaire-card-border);
    border-radius: 8px;
    margin: 0 auto;
    padding: 12px;
    filter: grayscale(60%);
    opacity: 0.9;
    transition: all 0.2s ease;
    box-shadow: var(--annuaire-shadow);
}

.itemEC2021:hover {
    filter: grayscale(0%);
    opacity: 1;
    border-color: var(--annuaire-card-hover-border);
    background-color: #ffffff;
    transform: scale(1.02);
    box-shadow: var(--annuaire-shadow-hover);
    z-index: 10;
}

.itemEC2021 a {
    text-decoration: none;
    color: inherit;
    display: block;
    height: 100%;
}

/* Photo EC */
.ItemEC2021-img {
    position: absolute;
    bottom: 12px;
    left: 12px;
}

.ItemEC2021-thumbnail {
    position: relative;
    width: 90px;
    height: 90px;
    overflow: hidden;
    border-radius: 50%;
    border: 2px solid #e0e0e0;
}

.ItemEC2021-thumbnail img {
    position: absolute;
    left: 50%;
    top: 50%;
    height: 100%;
    width: auto;
    transform: translate(-50%, -50%);
}

.ItemEC2021-thumbnail img.portrait {
    width: 100%;
    height: auto;
}

.nologo .ItemEC2021-img {
    position: relative;
    margin: 15px auto 0;
    left: auto;
    bottom: auto;
}

.nologo .ItemEC2021-thumbnail {
    margin: 0 auto;
}

/* Logo labo */
.ItemEC2021-labologo {
    position: absolute;
    bottom: 8px;
    right: 8px;
    height: 80px;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
}

img.ItemEC2021-labo {
    max-width: 60px;
    max-height: 60px;
    object-fit: contain;
}

/* Nom et infos */
h4.ItemEC2021-nom {
    text-align: center;
    font-size: 1.1em;
    font-weight: 600;
    width: 100%;
    margin: 8px 0 5px 0;
    padding: 0 10px;
    line-height: 1.3;
    color: #333;
}

div.ItemEC2021-corps,
div.corpsection2021,
div.fonction2021 {
    color: var(--annuaire-text-muted);
    text-align: center;
    width: 100%;
    font-size: 0.8em;
    line-height: 1.4;
    padding: 0 10px;
}

div.ItemEC2021-cnu,
div.cnusection2021 {
    text-align: center;
    width: 100%;
    font-size: 0.75em;
    line-height: 1.3;
    color: var(--annuaire-text-muted);
    padding: 0 10px;
}

div.fonction2021 {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: auto;
    background-color: var(--annuaire-accent);
    color: white;
    padding: 3px 8px;
    font-size: 0.7em;
    border-radius: 4px;
    text-align: center;
}

/* ==========================================================================
   Indicateur de chargement
   ========================================================================== */
.ajax-indicator-wrapper {
    width: 100%;
    min-height: 150px;
    display: none;
    align-items: center;
    justify-content: center;
}

body.loading .ajax-indicator-wrapper {
    display: flex;
}

.ajax-indicator {
    display: block;
    padding: 40px 20px;
}

.ajax-indicator.hidden {
    display: none !important;
}

/* Loader anime Univ-Droit */
.cssload-univ {
    display: flex;
    align-items: center;
    justify-content: center;
}

.cssload-container-general {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.cssload-internal {
    width: 20px;
    height: 20px;
}

.cssload-ballcolor {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    animation: cssload-bounce 1.4s infinite ease-in-out both;
}

.cssload-ball_1 { background: var(--annuaire-accent); animation-delay: -0.32s; }
.cssload-ball_2 { background: var(--annuaire-primary); animation-delay: -0.16s; }
.cssload-ball_3 { background: #fca311; animation-delay: 0s; }
.cssload-ball_4 { background: #14213d; animation-delay: 0.16s; }

@keyframes cssload-bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* ==========================================================================
   Message d'accueil
   ========================================================================== */
.annuaire-welcome {
    padding: 60px 20px;
}

.annuaire-welcome .jl-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 1px solid #e9ecef;
}

.annuaire-welcome h2 {
    color: var(--annuaire-primary);
    font-weight: 600;
}

.annuaire-welcome .jl-text-primary {
    color: var(--annuaire-primary) !important;
}

.annuaire-welcome .jl-list {
    margin-top: 20px;
}

.annuaire-welcome .jl-list li {
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.annuaire-welcome .jl-list li:last-child {
    border-bottom: none;
}

.annuaire-welcome .jl-text-success {
    color: var(--annuaire-primary) !important;
    margin-right: 8px;
}

/* ==========================================================================
   Grille des resultats
   ========================================================================== */
#container-results {
    min-height: 400px;
}

#container-results > div {
    margin-bottom: 15px;
}

/* ==========================================================================
   Cartes EC (format UIkit 3 genere par le backend)
   ========================================================================== */
.annuaire-container #container-results .jl-card {
    transition: all 0.2s ease;
    filter: grayscale(50%);
    opacity: 0.9;
}

.annuaire-container #container-results .jl-card:hover {
    filter: grayscale(0%);
    opacity: 1;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.annuaire-container #container-results .jl-card-header {
    padding: 15px;
}

.annuaire-container #container-results .jl-card-title {
    font-size: 1em;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.annuaire-container #container-results .jl-card-body {
    padding: 10px 15px;
    min-height: 70px;
}

.annuaire-container #container-results .jl-card img.jl-border-circle {
    border: 2px solid #e0e0e0;
    transition: border-color 0.2s ease;
}

.annuaire-container #container-results .jl-card:hover img.jl-border-circle {
    border-color: var(--annuaire-primary);
}

.annuaire-container #container-results .jl-badge-primary {
    background-color: var(--annuaire-accent);
}

.annuaire-container #container-results a {
    text-decoration: none;
    color: inherit;
    display: block;
}

/* ==========================================================================
   Message "pas de resultats"
   ========================================================================== */
.no-results-container {
    padding: 50px 20px;
    text-align: center;
    background: #f8f9fa;
    border-radius: 8px;
    margin: 20px 0;
}

.no-results-container h3 {
    color: #666;
    margin-bottom: 10px;
}

.no-results-container p {
    color: #888;
    font-size: 0.95em;
}

/* ==========================================================================
   Chosen select (fallback)
   ========================================================================== */
.chosen-container {
    width: 100% !important;
}

.chosen-container .chosen-single {
    height: 40px;
    line-height: 38px;
    border-radius: 4px;
    border-color: #ddd;
    background: #fff;
}

.chosen-container .chosen-drop {
    border-color: #ddd;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.chosen-container-active .chosen-single {
    border-color: var(--annuaire-primary);
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1199px) {
    .itemEC2021 {
        max-width: 280px;
        height: 200px;
    }

    h4.ItemEC2021-nom {
        font-size: 1em;
    }

    .ItemEC2021-thumbnail {
        width: 80px;
        height: 80px;
    }
}

@media (max-width: 959px) {
    .annuaire-filters-bar {
        padding: 12px 15px;
    }

    .annuaire-alphabet {
        gap: 4px;
        padding: 10px 8px;
    }

    .annuaire-alphabet .alpha-link {
        width: 28px;
        height: 28px;
        font-size: 0.8em;
    }

    .itemEC2021 {
        max-width: 100%;
        height: 190px;
    }

    h4.ItemEC2021-nom {
        font-size: 0.95em;
    }

    div.ItemEC2021-corps,
    div.corpsection2021 {
        font-size: 0.75em;
    }

    .ItemEC2021-thumbnail {
        width: 70px;
        height: 70px;
    }

    /* Loader fixe sur mobile */
    body.loading .ajax-indicator-wrapper {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(255, 255, 255, 0.95);
        z-index: 1000;
        min-height: 100vh;
    }

    /* Tom Select sur tablette */
    .annuaire-filters-bar .ts-control {
        height: 38px;
        min-height: 38px;
    }
}

@media (max-width: 639px) {
    .annuaire-filters-bar {
        padding: 10px;
    }

    .annuaire-filters-bar .filter-label {
        font-size: 0.75em;
        margin-bottom: 4px;
    }

    .annuaire-filters-bar .jl-input,
    .annuaire-filters-bar .jl-select {
        height: 38px;
        font-size: 0.9em;
    }

    .annuaire-alphabet {
        gap: 3px;
        padding: 8px 5px;
        overflow-x: auto;
        flex-wrap: nowrap;
        justify-content: flex-start;
    }

    .annuaire-alphabet .alpha-link {
        width: 26px;
        height: 26px;
        font-size: 0.75em;
        flex-shrink: 0;
    }

    .itemEC2021 {
        height: 180px;
        padding: 10px;
    }

    h4.ItemEC2021-nom {
        font-size: 0.9em;
        margin: 5px 0;
    }

    .ItemEC2021-thumbnail {
        width: 60px;
        height: 60px;
    }

    .resultsHeader {
        flex-direction: column;
        text-align: center;
        gap: 5px;
    }

    .resultsHeader .primary,
    .resultsHeader .secondary {
        text-align: center;
    }

    /* Bouton reset pleine largeur */
    .filter-reset-wrapper {
        width: 100%;
        margin-top: 10px;
        align-self: auto;
    }

    .filter-reset {
        width: 100%;
    }

    /* Tom Select compact sur mobile */
    .annuaire-filters-bar .ts-control {
        height: 36px;
        min-height: 36px;
        padding: 0 8px;
        font-size: 0.85em;
    }

    /* Fonctions en colonne sur mobile */
    .annuaire-filters-bar .fonction-group {
        flex-direction: column;
        align-items: flex-start;
        padding: 10px;
    }

    .annuaire-filters-bar .fonction-group .jl-checkbox-label {
        margin-right: 0;
        margin-bottom: 8px;
    }

    .annuaire-filters-bar .fonction-group .jl-checkbox-label:last-child {
        margin-bottom: 0;
    }
}

/* ==========================================================================
   Mode doctorants (filtres reduits)
   ========================================================================== */
.annuaire-container.mode-doctorants .annuaire-alphabet {
    display: none;
}

.annuaire-container.mode-doctorants .annuaire-filters-secondary {
    display: none;
}

/* ==========================================================================
   Utilitaires
   ========================================================================== */
.hidden {
    display: none !important;
}

.jl-card-default {
    border: solid 1px #f5f5f5;
}

/* Fix pour les fieldsets dans les filtres secondaires */
.section-group label,
.corps-group label,
.fonction-group label {
    display: inline-flex;
    align-items: center;
    margin-right: 15px;
    margin-bottom: 8px;
    font-size: 0.9em;
    cursor: pointer;
    color: #333;
}

.section-group .jl-checkbox,
.corps-group .jl-checkbox,
.fonction-group .jl-checkbox {
    margin-right: 6px;
}

/* Labels pour les groupes de filtres */
.filter-group-title {
    font-size: 0.85em;
    font-weight: 600;
    color: #555;
    margin-bottom: 8px;
    display: block;
}

/* Separateur entre groupes */
.filter-group-separator {
    width: 1px;
    height: 30px;
    background: var(--annuaire-filter-border);
    margin: 0 15px;
    display: inline-block;
    vertical-align: middle;
}

@media (max-width: 959px) {
    .filter-group-separator {
        display: none;
    }
}

/* =============================================
   ALPHA BAR (extrait de custom.css — mars 2026)
   ============================================= */
#alpha-bar {
  background-color: #219897;
  padding: 0.5rem 1rem;
  border-radius: 0.25rem;
  overflow-x: auto;
}
#alpha-bar .alpha-link {
  display: inline-block;
  padding: 0.3rem 0.6rem;
  margin: 0 0.2rem;
  border-radius: 999px;
  color: #fff;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.2s ease;
}
#alpha-bar .alpha-link:hover {
  background-color: #1a807b;
  color: #fff;
}
#alpha-bar .alpha-link.jl-active {
  background-color: #fff;
  color: #219897;
  font-weight: bold;
}

