/**
 * Diplomes 2024 - Styles formations Univ-Droit
 * Modernisé pour UIkit 3 (jl-*) - Janvier 2026
 */

/* ==========================================================================
   Variables CSS
   ========================================================================== */
:root {
    --diplome-primary: #0f7173;
    --diplome-primary-dark: #071013;
    --diplome-accent: #E63946;
    --diplome-card-bg: rgba(0, 0, 0, 0.30);
    --diplome-card-border: #d2d2d2;
    --diplome-logo-bg: #ffffff;
    --diplome-text-shadow: 3px 3px 6px #000000;
    --diplome-filter-bg: #fafafa;
    --diplome-filter-border: #dadada;
    --diplome-results-border: #e2a7a7;
}

/* ==========================================================================
   Section Diplôme - En-tête
   ========================================================================== */
.jl-section-diplome {
    margin: 50px 0 30px 0;
}

.jl-section-diplome h2 {
    margin-bottom: 0.5em;
}

.jl-section-diplome h3 {
    margin-top: 0;
    color: #666;
}

/* ==========================================================================
   Barre de filtres horizontale
   ========================================================================== */
.formations-filters-wrapper {
    width: 100%;
}

/* Layout principal avec flexbox pour desktop */
.formations-main-row {
    display: flex;
    align-items: stretch;
    gap: 15px;
}

.formations-filters-bar {
    flex: 1 1 auto;
    background: var(--diplome-filter-bg);
    border-radius: 8px;
    border: solid 1px var(--diplome-filter-border);
    padding: 15px 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.formations-filters-bar .jl-input,
.formations-filters-bar .jl-select {
    font-family: sans-serif;
    color: #616161;
    font-size: 0.95em;
    height: 40px;
}

/* Icône de recherche positionnée dans l'input */
.formations-filters-bar .jl-inline {
    position: relative;
    display: block;
}

.formations-filters-bar .jl-form-icon {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 40px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
}

.formations-filters-bar .jl-inline .jl-input {
    padding-left: 40px;
}

.formations-filters-bar .jl-input:focus,
.formations-filters-bar .jl-select:focus {
    border-color: var(--diplome-primary);
}

/* Bouton recherche */
.formations-search-btn {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
}

.formations-search-btn .jl-button-primary {
    background-color: var(--diplome-primary);
    border-color: var(--diplome-primary);
    height: 100%;
    min-height: 72px;
    padding: 15px 30px;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 500;
    white-space: nowrap;
}

.formations-search-btn .jl-button-primary:hover {
    background-color: var(--diplome-primary-dark);
    border-color: var(--diplome-primary-dark);
}

/* Bouton reset des filtres */
.filter-reset {
    background-color: #fff;
    border: 1px solid var(--diplome-accent);
    color: var(--diplome-accent);
    height: 100%;
    min-height: 72px;
    padding: 15px 20px;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-reset:hover {
    background-color: var(--diplome-accent);
    color: #fff;
}

.filter-reset.hidden {
    display: none !important;
}

.filter-reset-mobile {
    background-color: #fff;
    border: 1px solid var(--diplome-accent);
    color: var(--diplome-accent);
    height: 48px;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
}

.filter-reset-mobile:hover {
    background-color: var(--diplome-accent);
    color: #fff;
}

.filter-reset-mobile.hidden {
    display: none !important;
}

/* Tom Select - Conteneur parent */
.formations-filters-bar .ts-field {
    position: relative;
}

/* Tom Select - styles personnalisés */
.formations-filters-bar .ts-wrapper {
    width: 100% !important;
    max-width: 100% !important;
}

.formations-filters-bar .ts-control {
    color: #616161;
    height: 38px;
    min-height: 38px;
    max-height: 38px;
    padding: 0 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    font-size: 0.9em;
    line-height: 36px;
    overflow: hidden;
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
}

.formations-filters-bar .ts-control > input {
    height: 36px;
    line-height: 36px;
}

.formations-filters-bar .ts-control:focus,
.formations-filters-bar .ts-wrapper.focus .ts-control {
    border-color: var(--diplome-primary);
    box-shadow: 0 0 0 2px rgba(15, 113, 115, 0.15);
}

.formations-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;
}

.formations-filters-bar .ts-dropdown .option {
    padding: 8px 12px;
    font-size: 0.9em;
}

.formations-filters-bar .ts-dropdown .option.active {
    background-color: var(--diplome-primary);
    color: #fff;
}

.formations-filters-bar .ts-dropdown .option:hover {
    background-color: rgba(15, 113, 115, 0.1);
}

.formations-filters-bar .ts-dropdown .option.active:hover {
    background-color: var(--diplome-primary-dark);
}

/* Tom Select - Items sélectionnés (multiple) */
.formations-filters-bar .ts-control .item {
    background: var(--diplome-primary);
    color: #fff;
    border-radius: 3px;
    padding: 0 5px;
    margin: 0 2px;
    font-size: 0.8em;
    line-height: 24px;
    height: 24px;
    white-space: nowrap;
}

.formations-filters-bar .ts-control .item .remove {
    color: rgba(255, 255, 255, 0.7);
    border-left-color: rgba(255, 255, 255, 0.3);
    line-height: 24px;
}

.formations-filters-bar .ts-control .item .remove:hover {
    color: #fff;
    background: rgba(0, 0, 0, 0.1);
}

/* Tom Select - Placeholder */
.formations-filters-bar .ts-control input::placeholder {
    color: #999;
}

/* Bouton mobile (caché par défaut sur desktop, visible sur mobile) */
.formations-search-btn-mobile {
    display: none !important;
}

.formations-search-btn-mobile .jl-button-primary {
    background-color: var(--diplome-primary);
    border-color: var(--diplome-primary);
    height: 48px;
}

.formations-search-btn-mobile .jl-button-primary:hover {
    background-color: var(--diplome-primary-dark);
    border-color: var(--diplome-primary-dark);
}

/* ==========================================================================
   Filtres Licence (parcours et niveaux)
   ========================================================================== */
.formations-licence-filters {
    display: block;
    width: 100%;
    padding: 15px;
    background: var(--diplome-filter-bg);
    border-radius: 8px;
    border: solid 1px var(--diplome-filter-border);
}

.filter-chip {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 6px 12px;
    margin: 3px 5px !important;
    font-size: 0.85em;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-chip:hover {
    border-color: var(--diplome-primary);
    background: rgba(15, 113, 115, 0.05);
}

.filter-chip input:checked + span {
    color: var(--diplome-primary);
    font-weight: 600;
}

.filter-separator {
    display: inline-block;
    width: 1px;
    height: 30px;
    background: var(--diplome-filter-border);
    margin: 0 10px;
}

/* Zone résultats */
.formations-results-area {
    width: 100%;
}

/* ==========================================================================
   En-tête résultats
   ========================================================================== */
#header-results {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 15px;
    width: 100%;
    padding: 15px 0;
    margin-bottom: 20px;
    border-bottom: solid 2px var(--diplome-results-border);
    min-height: 60px;
}

.totalresult {
    font-weight: 600;
    font-size: 1.15em;
    text-align: right;
    color: var(--diplome-primary);
    background: linear-gradient(135deg, rgba(15, 113, 115, 0.1) 0%, rgba(15, 113, 115, 0.02) 100%);
    padding: 12px 20px;
    border-radius: 8px;
    border-left: 4px solid var(--diplome-primary);
    box-shadow: 0 2px 8px rgba(15, 113, 115, 0.1);
}

.totalresult small {
    font-weight: 400;
    color: #666;
    font-size: 0.85em;
    margin-left: 5px;
}

/* ==========================================================================
   Filtres par mentions (section repliable)
   ========================================================================== */
.filters-collapse-wrapper {
    flex: 1;
}

.filters-toggle {
    border-radius: 6px !important;
    font-size: 0.85em !important;
    padding: 8px 14px !important;
    transition: all 0.2s ease;
}

.filters-toggle:hover {
    background-color: var(--diplome-primary) !important;
    color: #fff !important;
}

.filters-toggle .filters-count {
    color: #888;
    font-weight: 400;
}

.filters-toggle:hover .filters-count {
    color: rgba(255, 255, 255, 0.8);
}

#filters-content {
    margin-top: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.filters-mentions-inner {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-content: flex-start;
}

span.formafilter {
    display: inline-block;
    background: var(--diplome-primary);
    color: #ffffff;
    font-size: 0.75em;
    padding: 6px 10px;
    margin: 2px 3px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

span.formafilter:hover,
span.formafilter:focus {
    background-color: var(--diplome-primary-dark);
    color: #ffffff;
}

span.formafilter.active {
    background: #232323;
    color: #ffffff;
}

/* ==========================================================================
   Cartes formations
   ========================================================================== */


.item-formation2018 a {
    text-decoration: none;
    color: inherit;
    display: block;
    min-height: 260px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
} 

.item-formation2018 a:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}



  /* 
.item-formation2018 {
    width: 100%;
    max-width: 330px;
    height: 260px;
    display: block;
    padding: 0 !important;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.item-formation2018:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.item-formation2018 a {
    text-decoration: none;
    color: inherit;
    display: block;
    height: 100%;
}
    */

.formcard {
    position: relative;
    width: 100%;
    height: 100%;
    background-position: center center;
    background-size: cover;
    background-repeat: no-repeat;
}

.formation-content2018 {
    background-color: var(--diplome-card-bg);
    width: 100%;
    height: 100%;
    border: solid 1px var(--diplome-card-border);
    padding: 10px;
    display: flex;
    flex-direction: column;
}

h2.titre-formation2018 {
    text-shadow: var(--diplome-text-shadow);
    color: #FFFFFF;
    text-align: center;
    font-weight: 500;
    font-size: 1.4em;
    margin: 10px 5px 5px 5px;
    line-height: 1.2;
}

h3.faculte-formation2018 {
    text-shadow: var(--diplome-text-shadow);
    font-size: 1em;
    font-weight: 400;
    margin: 8px 5px;
    color: #FFFFFF;
    text-align: center;
}

h6.lieu-formation2018,
h6.lieu-formation2018_multi {
    text-shadow: var(--diplome-text-shadow);
    font-size: 0.9em;
    font-weight: 400;
    margin: 0 0 8px 0;
    color: #FFFFFF;
    text-align: center;
    line-height: 1.3;
}

h6.lieu-formation2018_multi {
    font-size: 0.85em;
    line-height: 1.2;
}

/* Logo établissement */
div.logoform {
    background-color: var(--diplome-logo-bg);
    position: absolute;
    bottom: 0;
    left: 0;
    text-align: center;
    padding: 8px 10px;
    margin: 0;
    width: 100%;
    min-height: 60px;
    max-height: 70px;
    border-top: solid 1px var(--diplome-card-border);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    overflow: hidden;
    box-sizing: border-box;
}

/* Masquer les logoform vides (orphelins hors des cartes) */
#container-results > div.logoform {
    display: none !important;
}

.logoform img {
    max-height: 50px;
    max-width: 120px;
    object-fit: contain;
    flex-shrink: 1;
}

/* ==========================================================================
   Message "pas de résultats"
   ========================================================================== */
.no-results-container {
    padding-top: 50px;
    height: 400px;
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
    border-radius: 8px;
    overflow: hidden;
    text-align: center;
}

.no-results-container h1 {
    text-align: center;
    padding-top: 20px;
    color: #333;
}

.no-results-container p {
    font-size: 1.2em;
    font-weight: 500;
    text-align: center;
    color: #555;
}

/* ==========================================================================
   Indicateur de chargement
   ========================================================================== */
.ajax-indicator {
    display: block;
    padding: 40px 20px;
    min-height: 150px;
}

.ajax-indicator.hidden {
    display: none !important;
}

/* Loader fixe sur mobile/tablette */
@media (max-width: 959px) {
    .ajax-indicator:not(.hidden) {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(255, 255, 255, 0.95);
        z-index: 1000;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        min-height: 100vh;
    }
}

/* Loader animé Univ-Droit */
.cssload-univ {
    display: none;
}

.cssload-univ.loading {
    display: block;
}

.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(--diplome-accent); animation-delay: -0.32s; }
.cssload-ball_2 { background: var(--diplome-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);
    }
}

/* ==========================================================================
   Carte Leaflet
   ========================================================================== */
#idmap {
    width: 100%;
    min-height: 500px;
    border-radius: 8px;
    overflow: hidden;
}

#idmap .leaflet-container {
    height: 100%;
    min-height: 500px;
}

#map {
    width: 100%;
    height: 100%;
    min-height: 500px;
}

/* Popup carte */
.leaflet-popup-content {
    max-width: 280px;
}

.leaflet-popup-content h5 {
    margin: 5px 0;
    color: var(--diplome-primary);
}

.leaflet-popup-content img {
    max-width: 100%;
    height: auto;
    margin-top: 8px;
    border-radius: 4px;
}

/* ==========================================================================
   Onglets Grille / Carte
   ========================================================================== */
.jl-subnav-pill > .jl-active > a {
    background-color: var(--diplome-primary);
}

.jl-subnav-pill > li > a:hover {
    background-color: var(--diplome-primary-dark);
    color: #fff;
}

/* Fix: Permettre le scroll dans le switcher */
#results-content {
    overflow: visible !important;
    height: auto !important;
}

#results-content > li {
    overflow: visible !important;
    height: auto !important;
}

#results-content > li.jl-active {
    overflow: visible !important;
}

#container-results {
    overflow: visible !important;
    height: auto !important;
    min-height: 400px;
}


/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 959px) {
    .item-formation2018 {
        max-width: 100%;
        height: 240px;
    }

    h2.titre-formation2018 {
        font-size: 1.2em;
    }

    h3.faculte-formation2018 {
        font-size: 0.9em;
    }

    /* Barre de filtres sur tablette/mobile */
    .formations-main-row {
        display: block;
    }

    .formations-filters-bar {
        display: block;
        width: 100%;
        padding: 12px 15px;
    }

    /* Masquer bouton desktop, afficher bouton mobile */
    .formations-search-btn {
        display: none !important;
    }

    .formations-search-btn-mobile {
        display: flex !important;
    }

    .formations-licence-filters {
        padding: 12px;
    }

    .formations-licence-filters > .jl-grid {
        margin-left: 0 !important;
    }

    /* Tom Select sur tablette */
    .formations-filters-bar .ts-field {
        margin-bottom: 10px;
    }

    .formations-filters-bar .ts-wrapper {
        width: 100% !important;
        max-width: 100% !important;
    }

    .formations-filters-bar .ts-control {
        height: 36px;
        min-height: 36px;
        max-height: 36px;
    }

    .filter-chip {
        padding: 5px 10px;
        font-size: 0.8em;
    }
}

@media (max-width: 639px) {
    .item-formation2018 {
        height: 220px;
    }

    h2.titre-formation2018 {
        font-size: 1.1em;
    }

    div.logoform {
        min-height: 50px;
        padding: 5px 8px;
    }

    .logoform img {
        max-height: 40px;
    }

    .jl-subnav-pill {
        justify-content: center !important;
    }

    /* Barre de filtres sur mobile */
    .formations-filters-bar {
        padding: 10px;
    }

    .formations-filters-bar .jl-input,
    .formations-filters-bar .jl-select {
        height: 38px;
        font-size: 0.9em;
    }

    /* Tom Select plus compact sur mobile */
    .formations-filters-bar .ts-field {
        width: 100%;
        margin-bottom: 10px;
    }

    .formations-filters-bar .ts-wrapper {
        width: 100% !important;
        max-width: 100% !important;
    }

    .formations-filters-bar .ts-control {
        height: 36px;
        min-height: 36px;
        max-height: 36px;
        padding: 0 8px;
        font-size: 0.85em;
    }

    /* Filtres licence : layout vertical sur mobile */
    .formations-licence-filters {
        padding: 10px;
    }

    .formations-licence-filters > .jl-grid {
        display: block !important;
        margin-left: 0 !important;
    }

    .formations-licence-filters .filter-group-label {
        display: block;
        width: 100%;
        margin-bottom: 8px;
    }

    .formations-licence-filters .filter-group-options {
        display: block;
        width: 100%;
        margin-bottom: 5px;
    }

    .formations-licence-filters .filter-group-separator {
        display: block;
        width: 100%;
        height: 1px;
        background: var(--diplome-filter-border);
        margin: 12px 0;
    }

    .filter-chip {
        padding: 4px 8px;
        font-size: 0.75em;
        margin: 2px;
    }

    .filter-separator {
        display: none;
    }
}

/* ==========================================================================
   Quicksearch input (filtre côté client)
   ========================================================================== */
#quicksearch {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9em;
}

#quicksearch:focus {
    border-color: var(--diplome-primary);
    outline: none;
}

/* ==========================================================================
   Utilitaires
   ========================================================================== */
.jl-text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.jl-text-truncate-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* =============================================
   FORMATIONS FILTER PILLS (extrait de custom.css — mars 2026)
   ============================================= */
.jl-formations .jl-subnav.jl-subnav-pill {
  flex-wrap: wrap;
  gap: 0.5rem 0.2rem;
  margin-bottom: 0.75rem;
}
.jl-formations .jl-subnav.jl-subnav-pill > li {
  margin: 0;
}
.jl-formations .jl-subnav.jl-subnav-pill > li > a {
  font-size: 0.875rem;
  line-height: 1.3;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  background: #f4f4f4;
  color: #333;
  transition: background 0.2s ease, color 0.2s ease;
}
.jl-formations .jl-subnav.jl-subnav-pill > li > a:hover {
  background: #e0e0e0;
  color: #000;
}
.jl-formations .jl-subnav.jl-subnav-pill > li.jl-active > a {
  background: #619b8a;
  color: #fff;
}
.jl-formations .jl-subnav {
  margin-left: 0;
  padding-bottom: 8px;
  border-bottom: solid 1px #eaeaea;
}
