/**
 * IMPORT CV PAR IA - STYLES
 * =========================
 * Reprend le vocabulaire visuel deja en place dans easyrecrute-admin.css
 * (cartes blanches, rayon 10px, ombre legere, bleu #2563eb).
 */

/* ---------------------------------------------- badges dans la liste candidats */

.er-import-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 2px;
}

.er-import-badge,
.er-duplicate-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.4;
    padding: 2px 7px;
    border-radius: 8px;
    white-space: nowrap;
    cursor: help;
}

.er-import-badge {
    background: #ede9fe;
    color: #5b21b6;
    border: 1px solid #ddd6fe;
}

.er-duplicate-badge {
    background: #fff7ed;
    color: #9a3412;
    border: 1px solid #fed7aa;
}

/* ------------------------------------------------------------------- modale */

#easyrecrute-import-modal {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 24px 16px;
    overflow-y: auto;
}

#easyrecrute-import-modal.open {
    display: flex;
}

#easyrecrute-import-modal::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .55);
    backdrop-filter: blur(4px);
}

.eri-inner {
    /* Centrage vertical par marges automatiques.
       Le conteneur reste en flex-start et defile : des marges auto absorbent
       l'espace libre quand il y en a, et se replient a zero quand la fenetre
       depasse l'ecran. Un centrage par align-items rognerait alors le haut, et
       la zone de depot deviendrait inatteignable sur un petit ecran. */
    margin-top: auto;
    margin-bottom: auto;

    position: relative;
    width: 100%;
    max-width: 860px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 48px);
}

.eri-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid #e6e6e6;
}

.eri-header h2 {
    margin: 0;
    font-size: 18px;
    color: #1a202c;
}

.eri-close {
    background: none;
    border: 0;
    font-size: 28px;
    line-height: 1;
    color: #94a3b8;
    cursor: pointer;
    padding: 0 4px;
}

.eri-close:hover {
    color: #1a202c;
}

.eri-body {
    padding: 20px 22px;
    overflow-y: auto;
    flex: 1;
}

.eri-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 22px;
    border-top: 1px solid #e6e6e6;
    background: #f8fafc;
    border-radius: 0 0 12px 12px;
}

.eri-footer-info {
    font-size: 13px;
    color: #475569;
}

/* ---------------------------------------------------------------- dropzone */

.eri-dropzone {
    border: 2px dashed #cbd5e1;
    border-radius: 10px;
    padding: 28px 20px;
    text-align: center;
    transition: border-color .2s, background .2s;
}

.eri-dropzone.survol {
    border-color: #2563eb;
    background: #eff6ff;
}

.eri-dropzone-titre {
    margin: 0 0 4px;
    font-size: 16px;
    font-weight: 600;
    color: #1a202c;
}

.eri-dropzone-aide {
    margin: 0 0 14px;
    font-size: 13px;
    color: #64748b;
}

/* Le bouton « Parcourir » heritait des classes er-btn de l'ancienne feuille,
   qui ne s'appliquent plus : il se retrouvait blanc sur blanc. On lui donne
   son propre style, verrouille contre les surcharges du theme. */
#eri-parcourir,
#eri-parcourir:hover,
#eri-parcourir:focus,
#eri-parcourir:visited {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 24px;
    border: 0;
    border-radius: 100px;
    background: #2563eb;
    color: #fff !important;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background-color .18s ease, transform .22s cubic-bezier(.34,1.4,.64,1), box-shadow .22s ease;
}
#eri-parcourir:hover {
    background: #1d4ed8;
    transform: translateY(-2px);
    box-shadow: 0 10px 22px -6px rgba(37, 99, 235, .55);
}
#eri-parcourir:active { transform: translateY(0) scale(.98); }

/* ----------------------------------------------------------------- options */

.eri-option {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 16px 0 4px;
    font-size: 13px;
    color: #334155;
    cursor: pointer;
}

.eri-option input {
    margin-top: 3px;
    flex: 0 0 auto;
}

.eri-option small {
    display: block;
    color: #64748b;
    font-size: 12px;
    margin-top: 2px;
}

/* -------------------------------------------------------------- progression */

.eri-progress {
    margin: 18px 0 10px;
}

.eri-progress-barre {
    height: 8px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
}

.eri-progress-barre span {
    display: block;
    height: 100%;
    width: 0;
    background: #2563eb;
    border-radius: 999px;
    transition: width .3s ease;
}

.eri-progress-texte {
    margin: 6px 0 0;
    font-size: 12px;
    color: #64748b;
}

/* ------------------------------------------------------------ liste fichiers */

.eri-liste {
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
}

.eri-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 13px;
    border-bottom: 1px solid #f1f5f9;
}

.eri-item-nom {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #1a202c;
}

.eri-item-poids {
    color: #94a3b8;
    font-size: 12px;
    flex: 0 0 auto;
}

.eri-item-etat {
    flex: 0 0 auto;
    max-width: 45%;
    text-align: right;
    font-size: 12px;
    font-weight: 600;
}

.etat-attente .eri-item-etat { color: #94a3b8; }
.etat-encours .eri-item-etat { color: #2563eb; }
.etat-ok      .eri-item-etat { color: #10b981; }
.etat-doublon .eri-item-etat { color: #f59e0b; }
.etat-erreur  .eri-item-etat { color: #ef4444; }

.etat-encours { background: #eff6ff; }
.etat-erreur  { background: #fef2f2; }

/* ------------------------------------------------------------ recapitulatif */

.eri-recap {
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid #e6e6e6;
}

.eri-recap h3 {
    margin: 0 0 4px;
    font-size: 15px;
    color: #1a202c;
}

.eri-recap-aide {
    margin: 0 0 14px;
    font-size: 12px;
    color: #64748b;
}

.eri-fiche {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 12px;
    background: #fff;
}

.eri-fiche-entete {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.eri-fiche-score {
    font-size: 12px;
    font-weight: 600;
    color: #2563eb;
    white-space: nowrap;
}

.eri-alerte {
    margin: 0 0 8px;
    padding: 7px 10px;
    border-radius: 6px;
    font-size: 12px;
}

.eri-alerte-doublon  { background: #fff7ed; color: #9a3412; border: 1px solid #fed7aa; }
.eri-alerte-manquant { background: #fefce8; color: #854d0e; border: 1px solid #fef08a; }
.eri-alerte-info     { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

.eri-champs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    margin-bottom: 10px;
}

.eri-champs label {
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: .02em;
}

.eri-champs input {
    padding: 7px 9px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 400;
    text-transform: none;
    letter-spacing: normal;
    color: #1a202c;
    width: 100%;
    box-sizing: border-box;
}

.eri-champs input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.eri-fiche-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.eri-fiche-message {
    font-size: 12px;
    color: #10b981;
}

.eri-fiche-message.erreur {
    color: #ef4444;
}

/* ---------------------------------------------------------------- responsive */

@media (max-width: 640px) {
    #easyrecrute-import-modal {
        padding: 0;
    }

    .eri-inner {
        max-width: 100%;
        border-radius: 0;
        max-height: 100vh;
    }

    .eri-footer {
        border-radius: 0;
    }

    .eri-item {
        flex-wrap: wrap;
    }

    .eri-item-etat {
        max-width: 100%;
        text-align: left;
        width: 100%;
    }
}

/* ============================================================
   CONFIRMATION D'UN DOUBLON
   ============================================================
   Rien n'est enregistre tant que le recruteur n'a pas tranche. Le bloc doit
   donc etre visible sans ambiguite : il n'informe pas, il attend une reponse.
   ------------------------------------------------------------ */

.eri-doublon {
    margin: 6px 0 10px;
    padding: 14px 16px;
    border: 1px solid #FDE68A;
    border-left: 4px solid #F59E0B;
    border-radius: 10px;
    background: #FFFBEB;
}
.eri-doublon-titre { margin: 0 0 4px; font-size: 14px; font-weight: 700; color: #92400E; }
.eri-doublon-detail { margin: 0 0 6px; font-size: 13px; color: #78350F; }
.eri-doublon-aide { margin: 0 0 12px; font-size: 12.5px; color: #92400E; }
.eri-doublon-erreur { color: #991B1B; font-weight: 600; }
.eri-doublon-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Reprise manuelle d'un dossier en échec.
   Le fichier reste en mémoire du navigateur : après une coupure réseau,
   redemander à l'utilisateur de le redéposer — et de retrouver lesquels
   ont échoué sur un lot de 400 — n'aurait aucun sens. */
.eri-reprise {
    margin-left: auto;
    flex: none;
    background: #fff;
    border: 1px solid #2563eb;
    color: #2563eb;
    border-radius: 6px;
    padding: 3px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}
.eri-reprise:hover { background: #2563eb; color: #fff; }
.eri-reprise:focus-visible { outline: 2px solid #1d4ed8; outline-offset: 2px; }
