/**
 * ZONEMPLOI - SELECTEUR EN POPUP
 * ==============================
 * Styles du composant de selection (competences, secteurs, diplomes...).
 * S'appuie sur les jetons de zonemploi-ui.css, avec des valeurs de repli pour
 * fonctionner meme si cette feuille n'est pas chargee.
 */

.zs-select-cache {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* ============================================================
   ZONE DE SELECTION DANS LE FORMULAIRE
   ============================================================ */

.zs-zone {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--zu-bordure, #E6EEFC);
    border-radius: var(--zu-rayon, 14px);
    background: var(--zu-surface, #fff);
    transition: border-color .16s ease, box-shadow .16s ease;
}
.zs-zone:focus-within { border-color: var(--zu-primaire, #2563EB); box-shadow: 0 0 0 4px rgba(37, 99, 235, .11); }

.zs-puces { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; min-height: 26px; }

.zs-puce {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px 5px 13px;
    border-radius: 100px;
    background: var(--zu-primaire-clair, #EFF6FF);
    color: var(--zu-primaire, #2563EB);
    border: 1px solid var(--zu-primaire-bordure, #DBEAFE);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    animation: zs-puce-entree .18s ease-out;
}
@keyframes zs-puce-entree { from { opacity: 0; transform: scale(.9); } to { opacity: 1; transform: none; } }

.zs-puce-retirer {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px; height: 18px;
    border: 0; border-radius: 50%;
    background: rgba(37, 99, 235, .14);
    color: inherit;
    font-size: 15px; line-height: 1;
    cursor: pointer; padding: 0;
    transition: background-color .14s ease, color .14s ease;
}
.zs-puce-retirer:hover { background: var(--zu-danger, #EF4444); color: #fff; }

.zs-vide { font-size: 13px; color: var(--zu-neutre, #94A3B8); font-style: italic; }

.zs-ouvrir {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    align-self: flex-start;
    padding: 9px 18px;
    border-radius: 100px;
    border: 1px dashed var(--zu-bordure-forte, #CBD5E1);
    background: transparent;
    color: var(--zu-texte, #54595F);
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color .16s ease, color .16s ease, background-color .16s ease;
}
.zs-ouvrir:hover {
    border-style: solid;
    border-color: var(--zu-primaire, #2563EB);
    color: var(--zu-primaire, #2563EB);
    background: var(--zu-primaire-clair, #EFF6FF);
}
.zs-ouvrir-icone { font-size: 16px; line-height: 1; }

/* ============================================================
   FENETRE DE SELECTION
   ============================================================ */

.zs-modale {
    position: fixed;
    inset: 0;
    z-index: 100100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    background: rgba(39, 39, 39, .58);
    backdrop-filter: blur(3px);
}
.zs-modale.est-ouvert { display: flex; }

.zs-boite {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 640px;
    max-height: min(760px, calc(100vh - 48px));
    background: #fff;
    border-radius: var(--zu-rayon, 14px);
    box-shadow: 0 24px 60px rgba(16, 24, 40, .26);
    overflow: hidden;
    animation: zs-boite-entree .2s cubic-bezier(.34, 1.2, .64, 1);
}
@keyframes zs-boite-entree { from { opacity: 0; transform: translateY(-14px) scale(.98); } to { opacity: 1; transform: none; } }

.zs-entete {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 22px 16px;
    border-bottom: 1px solid var(--zu-bordure, #E6EEFC);
}
.zs-entete h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--zu-noir, #272727);
}
.zs-compteur { margin: 4px 0 0; font-size: 13px; color: var(--zu-texte-doux, #7A7A7A); }
.zs-compteur.zs-alerte { color: #9A3412; font-weight: 600; }

.zs-fermer {
    background: none; border: 0; padding: 0 4px;
    font-size: 26px; line-height: 1;
    color: var(--zu-neutre, #94A3B8);
    cursor: pointer;
    transition: color .16s ease, transform .16s ease;
}
.zs-fermer:hover { color: var(--zu-noir, #272727); transform: rotate(90deg); }

.zs-recherche-zone { padding: 16px 22px 12px; }
.zs-recherche {
    width: 100%;
    padding: 11px 18px;
    border: 1px solid var(--zu-bordure-forte, #CBD5E1);
    border-radius: 100px;
    font-family: inherit;
    font-size: 14.5px;
    transition: border-color .16s ease, box-shadow .16s ease;
}
.zs-recherche:focus {
    outline: none;
    border-color: var(--zu-primaire, #2563EB);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, .13);
}

/* ---- Suggestions ---- */

.zs-suggestions { padding: 0 22px 12px; }
.zs-suggestions-titre {
    margin: 0 0 8px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--zu-texte-doux, #7A7A7A);
}
.zs-suggestions-liste { display: flex; flex-wrap: wrap; gap: 7px; }
.zs-suggestion {
    padding: 6px 14px;
    border-radius: 100px;
    border: 1px solid #DDD6FE;
    background: #F5F3FF;
    color: #5B21B6;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color .14s ease, color .14s ease, transform .18s cubic-bezier(.34,1.4,.64,1);
}
.zs-suggestion:hover { background: #5B21B6; color: #fff; transform: translateY(-2px); }
.zs-suggestion.est-choisi { background: #5B21B6; color: #fff; }
.zs-suggestion.est-choisi::before { content: '✓ '; }

/* ---- Liste ---- */

.zs-liste {
    flex: 1;
    overflow-y: auto;
    padding: 4px 14px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.zs-item {
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    padding: 10px 12px;
    border: 0;
    border-radius: 9px;
    background: none;
    font-family: inherit;
    font-size: 14px;
    color: var(--zu-texte, #54595F);
    text-align: left;
    cursor: pointer;
    transition: background-color .13s ease;
}
.zs-item:hover { background: var(--zu-primaire-clair, #EFF6FF); }
.zs-item.est-choisi { background: var(--zu-primaire-clair, #EFF6FF); color: var(--zu-primaire, #2563EB); font-weight: 600; }

.zs-case {
    flex: 0 0 19px;
    width: 19px; height: 19px;
    border: 2px solid var(--zu-bordure-forte, #CBD5E1);
    border-radius: 6px;
    position: relative;
    transition: background-color .14s ease, border-color .14s ease;
}
.zs-item.est-choisi .zs-case {
    background: var(--zu-primaire, #2563EB);
    border-color: var(--zu-primaire, #2563EB);
}
.zs-item.est-choisi .zs-case::after {
    content: '';
    position: absolute;
    left: 5px; top: 1px;
    width: 5px; height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.zs-item-libelle { flex: 1; }
.zs-item-neuf {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: 2px 8px;
    border-radius: 100px;
    background: #ECFDF5;
    color: #065F46;
}

.zs-aucun { padding: 26px 12px; text-align: center; color: var(--zu-neutre, #94A3B8); font-size: 14px; margin: 0; }

/* ---- Creation ---- */

.zs-creation { padding: 8px 22px 4px; }
.zs-creer {
    display: block;
    width: 100%;
    padding: 11px 16px;
    border: 1px dashed var(--zu-primaire, #2563EB);
    border-radius: 10px;
    background: var(--zu-primaire-clair, #EFF6FF);
    color: var(--zu-primaire, #2563EB);
    font-family: inherit;
    font-size: 13.5px;
    text-align: left;
    cursor: pointer;
    transition: background-color .14s ease, color .14s ease;
}
.zs-creer:hover { background: var(--zu-primaire, #2563EB); color: #fff; }
.zs-creer:hover strong { color: #fff; }

/* ---- Pied ---- */

.zs-pied {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 15px 22px;
    border-top: 1px solid var(--zu-bordure, #E6EEFC);
    background: #F8FAFD;
}

/* Repli si zonemploi-ui.css n'est pas charge : les boutons du pied doivent
   rester utilisables et lisibles. */
.zs-pied .zu-btn:not([class*="zu-btn--"]) {
    padding: 10px 20px;
    border-radius: 100px;
    border: 1px solid #CBD5E1;
    background: #fff;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

@media (max-width: 620px) {
    .zs-modale { padding: 0; align-items: stretch; }
    .zs-boite { max-width: none; max-height: 100vh; border-radius: 0; }
    .zs-pied { position: sticky; bottom: 0; }
    .zs-pied .zu-btn { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .zs-boite, .zs-puce { animation: none; }
    .zs-suggestion:hover, .zs-fermer:hover { transform: none; }
}
