/* ============================================================
   L2M - Nos Références : Barre de recherche + Liste de cartes
   ============================================================ */

/* ------------------------------------------------------------
   Section wrapper — aucun espacement : Divi gère le fond et les marges
   ------------------------------------------------------------ */
.l2m-references-section {
    width: 100%;
}

/* Accessibilité */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ------------------------------------------------------------
   Barre de recherche unifiée (Mission dropdown + input texte)
   ------------------------------------------------------------ */
.l2m-searchbar {
    display: flex;
    align-items: center;
    background: var(--l2m-white);
    border-radius: var(--l2m-radius-btn);
    box-shadow: 0 2px 16px rgba(19, 53, 91, 0.12);
    height: 58px;
    overflow: visible;
    position: relative;
    margin-bottom: 32px;
}

/* --- Côté gauche : Mission --- */
.l2m-searchbar__mission {
    position: relative;
    flex-shrink: 0;
}

.l2m-searchbar__mission-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 58px;
    padding: 0 20px 0 24px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--l2m-blue);
    font-size: 15px;
    font-family: inherit;
    font-weight: 500;
    white-space: nowrap;
    outline: none;
    border-radius: var(--l2m-radius-btn) 0 0 var(--l2m-radius-btn);
    transition: color var(--l2m-transition);
}

.l2m-searchbar__mission-btn:hover,
.l2m-searchbar__mission-btn:focus-visible {
    color: var(--l2m-teal);
}

.l2m-searchbar__mission-icon {
    color: var(--l2m-blue);
    flex-shrink: 0;
}

.l2m-searchbar__chevron {
    color: var(--l2m-blue);
    transition: transform var(--l2m-transition);
    flex-shrink: 0;
}

.l2m-searchbar__mission-btn[aria-expanded="true"] .l2m-searchbar__chevron {
    transform: rotate(180deg);
}

/* Dropdown liste */
.l2m-searchbar__dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 340px;
    background: var(--l2m-white);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(19, 53, 91, 0.18);
    list-style: none;
    margin: 0;
    padding: 8px 0;
    z-index: 100;
}

.l2m-searchbar__dropdown[hidden] {
    display: none;
}

.l2m-searchbar__dropdown,
.l2m-searchbar__dropdown li {
    list-style: none !important;
    margin: 0;
    padding-left: 0;
}

.l2m-searchbar__option {
    list-style: none !important;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    font-size: 14px;
    color: var(--l2m-blue);
    cursor: pointer;
    transition: background var(--l2m-transition);
    line-height: 1.4;
    user-select: none;
}

.l2m-searchbar__option:hover {
    background: var(--l2m-gray-bg);
}

.l2m-searchbar__option--active {
    color: var(--l2m-teal);
    font-weight: 600;
}

/* --- Case à cocher personnalisée --- */
.l2m-checkbox {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    border: 2px solid var(--l2m-gray-border);
    border-radius: 4px;
    background: var(--l2m-white);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--l2m-transition), border-color var(--l2m-transition);
}

.l2m-searchbar__option--active .l2m-checkbox {
    background: var(--l2m-teal);
    border-color: var(--l2m-teal);
}

/* Coche SVG via ::after */
.l2m-searchbar__option--active .l2m-checkbox::after {
    content: '';
    display: block;
    width: 5px;
    height: 9px;
    border: 2px solid var(--l2m-white);
    border-top: none;
    border-left: none;
    transform: rotate(45deg) translateY(-1px);
}

/* --- Séparateur vertical --- */
.l2m-searchbar__sep {
    width: 1px;
    height: 28px;
    background: var(--gcid-body-color);
    flex-shrink: 0;
    opacity: 0.4;
}

/* --- Côté droit : Recherche texte --- */
.l2m-searchbar__search {
    display: flex;
    align-items: center;
    flex: 1;
    gap: 10px;
    padding: 0 24px;
}

.l2m-searchbar__search-icon {
    color: var(--l2m-blue);
    flex-shrink: 0;
}

.l2m-searchbar__input {
    flex: 1;
    height: 100%;
    border: none;
    background: none;
    font-size: 15px;
    font-family: inherit;
    color: var(--l2m-blue);
    outline: none;
    min-width: 0;
}

.l2m-searchbar__input::placeholder {
    color: var(--l2m-gray-mid);
    font-weight: 400;
}

/* ------------------------------------------------------------
   Compteur de résultats
   ------------------------------------------------------------ */
.l2m-references-count {
    text-align: right;
    font-size: 14px;
    font-weight: 600;
    color: var(--l2m-teal);
    padding-bottom: 16px;
    margin-bottom: 20px;
    min-height: 20px;
    border-bottom: 1px solid var(--l2m-gray-border);
}

/* ------------------------------------------------------------
   Liste de cartes (colonne verticale)
   ------------------------------------------------------------ */
.l2m-references-list {
    display: flex;
    flex-direction: column;
    gap: 24px;
    margin-bottom: 48px;
    min-height: 100px;
    transition: opacity 0.2s ease;
}

.l2m-references-list.l2m--loading {
    opacity: 0.5;
    pointer-events: none;
}

/* Message aucun résultat */
.l2m-no-results {
    text-align: center;
    font-size: 16px;
    color: var(--l2m-gray);
    padding: 40px 0;
    margin: 0;
}

/* ------------------------------------------------------------
   Carte référence (horizontale)
   ------------------------------------------------------------ */
.l2m-ref-card {
    border-radius: var(--l2m-radius-card);
    background: var(--l2m-white);
    box-shadow: var(--l2m-shadow-card);
    overflow: hidden;
    transition: transform var(--l2m-transition), box-shadow var(--l2m-transition);
}

.l2m-ref-card:hover {
    transform: translateY(-3px);
    box-shadow: 4px 8px 24px rgba(0, 0, 0, 0.18);
}

.l2m-ref-card__link {
    display: flex;
    flex-direction: row;
    height: 100%;
    min-height: 180px;
    text-decoration: none;
    color: inherit;
}

/* --- Image gauche --- */
.l2m-ref-card__img-wrap {
    flex-shrink: 0;
    width: 300px;
    overflow: hidden;
    background: var(--l2m-gray-bg);
    border-radius: var(--l2m-radius-card) 0 0 var(--l2m-radius-card);
}

.l2m-ref-card__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.l2m-ref-card:hover .l2m-ref-card__img {
    transform: scale(1.04);
}

.l2m-ref-card__img--placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--l2m-gray-bg) 0%, var(--l2m-gray-border) 100%);
}

/* --- Corps de la carte : 2 colonnes --- */
.l2m-ref-card__body {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 40px;
    padding: 28px 36px;
    align-content: center;
}

/* --- Colonne --- */
.l2m-ref-card__col {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* --- Champ individuel --- */
.l2m-ref-card__field {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.l2m-ref-card__field-icon {
    flex-shrink: 0;
    color: var(--l2m-teal);
    margin-top: 2px;
    display: flex;
    align-items: center;
}

.l2m-ref-card__field-icon svg {
    stroke: var(--l2m-teal);
}

.l2m-ref-card__field > div {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.l2m-ref-card__field-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--l2m-teal);
    letter-spacing: 0.8px;
    text-transform: uppercase;
    line-height: 1.2;
}

.l2m-ref-card__field-value {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--l2m-blue);
    line-height: 1.4;
}

/* ------------------------------------------------------------
   Pagination / En voir plus
   ------------------------------------------------------------ */
.l2m-references-pagination {
    display: flex;
    justify-content: center;
    margin-top: 8px;
}

/* Bouton "En voir plus" */
.l2m-btn-more {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px 24px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    color: var(--l2m-blue);
    transition: color var(--l2m-transition), transform var(--l2m-transition);
}

.l2m-btn-more:hover {
    color: var(--l2m-teal);
    transform: translateY(2px);
}

.l2m-btn-more__icon {
    width: 40px;
    height: 40px;
    object-fit: contain;
    display: block;
}

.l2m-btn-more:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    transform: none;
}

/* ============================================================
   CARTES HOME — [l2m_references_home]
   ============================================================ */

.l2m-home-refs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 28px;
    width: 100%;
}

.l2m-home-card {
    border-radius: var(--l2m-radius-card);
    background: var(--l2m-white);
    box-shadow: var(--l2m-shadow-card);
    overflow: hidden;
    transition: transform var(--l2m-transition), box-shadow var(--l2m-transition);
}

.l2m-home-card:hover {
    transform: translateY(-4px);
    box-shadow: 4px 8px 24px rgba(0, 0, 0, 0.18);
}

.l2m-home-card__link {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    height: 100%;
}

.l2m-home-card__img-wrap {
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: var(--l2m-radius-card) var(--l2m-radius-card) 0 0;
}

.l2m-home-card__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.l2m-home-card:hover .l2m-home-card__img {
    transform: scale(1.04);
}

.l2m-home-card__img--placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--l2m-gray-bg) 0%, var(--l2m-gray-border) 100%);
}

.l2m-home-card__body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 18px 20px 22px;
}

.l2m-home-card__ville {
    font-size: 15px;
    font-weight: 600;
    color: var(--l2m-teal);
    line-height: 1.3;
}

.l2m-home-card__mission {
    font-size: 14px;
    font-weight: 700;
    color: var(--l2m-blue);
    line-height: 1.3;
}

.l2m-home-card__surface {
    font-size: 13px;
    font-weight: 400;
    color: var(--l2m-gray);
    line-height: 1.4;
}


/* ============================================================
   RESPONSIVE
   ============================================================ */

/* Tablette (≤ 1024px) */
@media (max-width: 1024px) {
    .l2m-ref-card__img-wrap {
        width: 240px;
    }

    .l2m-ref-card__body {
        padding: 24px 28px;
        gap: 8px 28px;
    }

    .l2m-searchbar {
        height: 52px;
    }
    .l2m-searchbar__mission-btn {
        height: 52px;
        padding: 0 16px 0 18px;
        font-size: 14px;
    }
    .l2m-searchbar__dropdown {
        min-width: 280px;
    }
}

/* Tablette portrait (≤ 768px) */
@media (max-width: 768px) {
    /* Home : 2 colonnes */
    .l2m-home-refs {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    /* Carte passe en colonne */
    .l2m-ref-card__link {
        flex-direction: column;
        min-height: auto;
    }

    .l2m-ref-card__img-wrap {
        width: 100%;
        height: 220px;
        border-radius: var(--l2m-radius-card) var(--l2m-radius-card) 0 0;
    }

    .l2m-ref-card__body {
        grid-template-columns: 1fr 1fr;
        padding: 20px 20px;
        gap: 8px 20px;
    }

    /* Searchbar verticale */
    .l2m-searchbar {
        flex-direction: column;
        height: auto;
        border-radius: 20px;
        padding: 8px 0;
    }
    .l2m-searchbar__mission {
        width: 100%;
    }
    .l2m-searchbar__mission-btn {
        width: 100%;
        height: 44px;
        justify-content: flex-start;
        border-radius: 0;
        padding: 0 20px;
    }
    .l2m-searchbar__sep {
        width: 80%;
        height: 1px;
        margin: 0 auto;
    }
    .l2m-searchbar__search {
        width: 100%;
        padding: 0 20px;
        height: 44px;
    }
    .l2m-searchbar__dropdown {
        min-width: 100%;
    }
}

/* Mobile (≤ 540px) */
@media (max-width: 540px) {
    /* Home : 1 colonne */
    .l2m-home-refs {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    /* 1 colonne de champs */
    .l2m-ref-card__body {
        grid-template-columns: 1fr;
        padding: 16px;
        gap: 14px 0;
    }

    .l2m-ref-card__img-wrap {
        height: 180px;
    }

    .l2m-references-count {
        text-align: left;
    }
}
