/* ==========================================================================
   Cartes — offre, article, pays, accès rapide, appel à l'action, statistique.
   Peu d'ombre : la bordure porte la séparation, l'ombre signale le survol.
   ========================================================================== */

.card {
    --bs-card-bg: var(--surface);
    --bs-card-border-color: var(--border);
    --bs-card-border-radius: var(--radius-lg);
    --bs-card-inner-border-radius: calc(var(--radius-lg) - 1px);
    --bs-card-spacer-x: var(--space-5);
    --bs-card-spacer-y: var(--space-5);
    --bs-card-cap-bg: var(--surface);
    --bs-card-cap-padding-y: var(--space-4);
    --bs-card-cap-padding-x: var(--space-5);
    --bs-card-title-color: var(--primary-deep);
}

.card-header { font-family: var(--font-heading); font-weight: 700; color: var(--primary-deep); }

/* Carte entièrement cliquable : le lien du titre couvre la carte */
.card-link-cover::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: inherit;
}

.is-hoverable {
    transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.is-hoverable:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
}

/* Tuile d'icône */
.icon-tile {
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    border-radius: var(--radius);
    background: var(--primary-soft);
    color: var(--primary);
    font-size: var(--text-lg);
}

.icon-tile-sm { width: 36px; height: 36px; font-size: var(--text-base); border-radius: var(--radius-sm); }
.icon-tile-lg { width: 56px; height: 56px; font-size: var(--text-xl); border-radius: var(--radius-lg); }
.icon-tile-primary { background: var(--primary-soft); color: var(--primary); }
.icon-tile-solid { background: var(--primary); color: var(--on-primary); }
.icon-tile-jaune { background: var(--accent); color: var(--on-accent); }
.icon-tile-accent { background: var(--accent-light); color: var(--accent-text); }
.icon-tile-deep { background: var(--primary-deep); color: var(--accent); }
.icon-tile-success { background: var(--success-soft); color: var(--success); }
.icon-tile-danger { background: var(--danger-soft); color: var(--danger); }
.icon-tile-danger { background: var(--danger-soft); color: var(--danger); }
.icon-tile-secondary { background: var(--neutral-soft); color: var(--text-secondary); }

/* --------------------------------------------------------------------------
   Offre
   -------------------------------------------------------------------------- */
.job-card {
    position: relative;
    display: flex;
    gap: var(--space-3);
    padding: var(--space-4);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
}

.job-card__logo {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    flex: 0 0 auto;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    font-family: var(--font-heading);
    font-weight: 800;
    color: var(--primary);
}

.job-card__logo img { width: 100%; height: 100%; object-fit: contain; }
.job-card__body { flex: 1 1 auto; min-width: 0; }

.job-card__title {
    margin: 0 0 2px;
    font-size: var(--text-base);
    line-height: 1.35;
}

.job-card__title a { color: var(--primary-deep); }
.job-card:hover .job-card__title a { color: var(--primary); }

.job-card__company {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-1) var(--space-2);
    margin: 0 0 var(--space-2);
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.job-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1) var(--space-4);
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: var(--text-sm);
    color: var(--text-muted);
}

.job-card__meta li { display: inline-flex; align-items: center; gap: .375rem; }
.job-card__meta .is-salary { color: var(--primary-deep); font-weight: 600; }

.job-card__aside {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-2);
    flex: 0 0 auto;
}

/* Liste d'offres réunies dans un seul cadre (maquette A) */
.job-list {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    overflow: hidden;
}

.job-list .job-card {
    border: 0;
    border-radius: 0;
}

.job-list .job-card + .job-card { border-top: 1px solid var(--border); }
.job-list .job-card:hover { background: var(--primary-softer); box-shadow: none; }

/* Sur mobile et tablette étroite : le type de contrat et les actions passent sous le texte, le titre garde toute la largeur */
@media (max-width: 767.98px) {
    .job-card { flex-wrap: wrap; gap: var(--space-2) var(--space-3); padding: var(--space-3); }
    .job-card__logo { width: 40px; height: 40px; }
    .job-card__body { flex: 1 1 0; }
    .job-card__title { font-size: .9375rem; line-height: 1.3; overflow-wrap: anywhere; }
    .job-card__company { margin-bottom: var(--space-1); font-size: .8125rem; }
    .job-card__meta { gap: 2px var(--space-3); font-size: .8125rem; }

    .job-card__aside {
        flex: 1 0 100%;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        padding-left: calc(40px + var(--space-3));
    }

    .job-card__aside:not(:has(*)) { display: none; }
    .job-card__aside .badge { --bs-badge-padding-x: .5rem; --bs-badge-padding-y: .2rem; --bs-badge-font-size: .6875rem; }
}

/* --------------------------------------------------------------------------
   Article
   -------------------------------------------------------------------------- */
.article-card {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
}

.article-card__media {
    position: relative;
    aspect-ratio: 16 / 9;
    background: var(--primary-soft);
    color: var(--primary);
}

.article-card__media img { width: 100%; height: 100%; object-fit: cover; }

.article-card__media .placeholder-icon {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-size: var(--text-2xl);
    opacity: .6;
}

.article-card__media .badge {
    position: absolute;
    left: var(--space-3);
    bottom: var(--space-3);
}

.article-card__body {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    flex: 1 1 auto;
    padding: var(--space-4);
}

.article-card__title {
    margin: 0;
    font-size: var(--text-base);
    line-height: 1.4;
}

.article-card__title a { color: var(--primary-deep); }
.article-card:hover .article-card__title a { color: var(--primary); }

.article-card__excerpt {
    display: -webkit-box;
    margin: 0;
    overflow: hidden;
    font-size: var(--text-sm);
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.article-card__meta {
    display: flex;
    gap: var(--space-3);
    margin-top: auto;
    font-size: var(--text-xs);
    color: var(--text-muted);
}

/* Variante horizontale : vignette à gauche (colonnes latérales) */
.article-card--row { flex-direction: row; align-items: flex-start; height: auto; border: 0; border-radius: 0; background: transparent; }
.article-card--row .article-card__media { width: 84px; aspect-ratio: 1; flex: 0 0 auto; border-radius: var(--radius); overflow: hidden; }
.article-card--row .article-card__body { padding: 0 0 0 var(--space-3); }

/* Sur mobile : carte en rangée, vignette à gauche, sans extrait */
@media (max-width: 575.98px) {
    .article-card:not(.article-card--row) { flex-direction: row; }
    .article-card:not(.article-card--row) .article-card__media { width: 108px; aspect-ratio: auto; flex: 0 0 auto; }
    .article-card:not(.article-card--row) .article-card__media img { position: absolute; inset: 0; }
    .article-card:not(.article-card--row) .article-card__body { gap: var(--space-1); min-width: 0; padding: var(--space-3); }
    .article-card:not(.article-card--row) .article-card__title { font-size: .9375rem; line-height: 1.3; overflow-wrap: anywhere; }
    .article-card:not(.article-card--row) .article-card__excerpt { display: none; }

    .article-card:not(.article-card--row) .article-card__media .badge {
        --bs-badge-padding-x: .4rem;
        --bs-badge-padding-y: .15rem;
        --bs-badge-font-size: .625rem;
        left: var(--space-1);
        bottom: var(--space-1);
        display: block;
        max-width: calc(100% - 2 * var(--space-1));
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/* --------------------------------------------------------------------------
   Pays
   -------------------------------------------------------------------------- */
.country-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--primary-deep);
}

.country-card__flag {
    width: 32px;
    height: 24px;
    flex: 0 0 auto;
    border-radius: 4px;
    object-fit: cover;
    box-shadow: 0 0 0 1px var(--border);
}

.country-card__name { flex: 1 1 auto; min-width: 0; font-weight: 600; font-size: var(--text-sm); }
.country-card__count { font-size: var(--text-xs); color: var(--text-muted); }

/* Sur mobile, deux cartes par rangée : le nom du pays sur toute la largeur, le nombre d'offres dessous */
@media (max-width: 575.98px) {
    div.country-card {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        align-items: center;
        gap: 0 var(--space-2);
        padding: var(--space-2) var(--space-3);
    }

    div.country-card > .icon-tile,
    div.country-card > .country-card__flag { grid-row: 1 / span 2; }
    div.country-card > .icon-tile { width: 30px; height: 30px; font-size: var(--text-sm); }
    div.country-card > .country-card__name { overflow: visible; white-space: normal; line-height: 1.25; overflow-wrap: anywhere; }
    div.country-card > .country-card__count { grid-column: 2; }
}

/* --------------------------------------------------------------------------
   Accès rapide : icône, titre, description courte, action
   -------------------------------------------------------------------------- */
.quick-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    height: 100%;
    padding: var(--space-4);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
}

.quick-card__title { margin: var(--space-2) 0 0; font-size: var(--text-base); }
.quick-card__text { margin: 0; font-size: var(--text-sm); }

.quick-card__action {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    margin-top: auto;
    padding-top: var(--space-2);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--primary);
}

.quick-card__action i { transition: transform var(--transition); }
.quick-card:hover .quick-card__action i { transform: translateX(3px); }

/* Sur mobile : rangée compacte, icône à gauche */
@media (max-width: 575.98px) {
    .quick-card {
        flex-direction: row;
        align-items: center;
        gap: var(--space-3);
        padding: var(--space-3);
    }

    .quick-card__title { margin: 0; }
    .quick-card__text { display: none; }
    .quick-card__action { margin: 0 0 0 auto; padding: 0; }
    .quick-card__action span { display: none; }
}

/* --------------------------------------------------------------------------
   Appel à l'action
   -------------------------------------------------------------------------- */
.cta-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    height: 100%;
    padding: var(--space-5);
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--primary-softer);
}

.cta-card__title { margin: 0; font-size: var(--text-xl); }
.cta-card__text { margin: 0; }
.cta-card__actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: auto; padding-top: var(--space-2); }

.cta-card--deep {
    border-color: var(--primary-deep);
    background: var(--primary-deep);
}

.cta-card--deep .cta-card__title { color: var(--on-primary); }
.cta-card--deep .cta-card__text,
.cta-card--deep .check-list li { color: var(--on-deep-muted); }
.cta-card--deep .check-list li::before { color: var(--accent); }
.cta-card--deep .eyebrow { color: var(--accent); }

/* Motif discret dans l'angle : deux arcs, sans image */
.cta-card--deep::after {
    content: '';
    position: absolute;
    right: -70px;
    bottom: -70px;
    width: 220px;
    height: 220px;
    border: 28px solid var(--deep-surface);
    border-radius: 50%;
    pointer-events: none;
}

.cta-card > * { position: relative; z-index: 1; }

/* --------------------------------------------------------------------------
   Statistique (tableaux de bord)
   -------------------------------------------------------------------------- */
.stat-card .card-body {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4);
}

.stat-label { margin: 0; font-size: var(--text-sm); color: var(--text-secondary); }

.stat-value {
    margin: 0;
    font-family: var(--font-heading);
    font-size: var(--text-2xl);
    font-weight: 800;
    line-height: 1.2;
    color: var(--primary-deep);
}

.stat-hint { margin: 0; font-size: var(--text-xs); color: var(--text-muted); }
.stat-hint.is-positive { color: var(--success); }

/* Avatar */
.avatar {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-size: var(--text-sm);
    font-weight: 700;
    object-fit: cover;
    text-transform: uppercase;
}

.avatar-sm { width: 32px; height: 32px; font-size: var(--text-xs); }
.avatar-lg { width: 64px; height: 64px; font-size: var(--text-lg); }

/* --------------------------------------------------------------------------
   Tableaux de pilotage (administration, SPEC.md §48.2)
   -------------------------------------------------------------------------- */

/* Évolution d'un indicateur : une flèche et un signe, la couleur ne fait que les souligner */
.stat-delta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-1);
    margin: 0;
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--text-secondary);
}

.stat-delta span { font-weight: 400; color: var(--text-muted); }
.stat-delta.is-up { color: var(--success); }
.stat-delta.is-down { color: var(--danger); }

/* Un montant se coupe entre le nombre et sa devise, jamais au milieu d'un mot */
.stat-card .stat-value { overflow-wrap: normal; word-break: normal; }

/* Graphique en colonnes */
.chart { margin: 0; }

.chart__legend {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-4);
    margin: 0 0 var(--space-3);
    padding: 0;
    list-style: none;
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.chart__legend li { display: inline-flex; align-items: center; gap: var(--space-2); }

.chart__swatch { width: 12px; height: 12px; border-radius: 3px; }
.chart__swatch--1, .bar-list__bar--1 { background: var(--chart-1); }
.chart__swatch--2, .bar-list__bar--2 { background: var(--chart-2); }
.chart__swatch--3, .bar-list__bar--3 { background: var(--chart-3); }

.chart__plot { display: block; width: 100%; height: auto; max-height: 300px; }
.chart__grid { stroke: var(--border); stroke-width: 1; }
.chart__tick { fill: var(--text-muted); font-size: 11px; }
.chart__hit { fill: transparent; }
.chart__column:hover .chart__hit { fill: var(--primary-softer); }
.chart__bar--1 { fill: var(--chart-1); }
.chart__bar--2 { fill: var(--chart-2); }
.chart__bar--3 { fill: var(--chart-3); }

.chart__empty { margin: 0; padding: var(--space-5) 0; text-align: center; color: var(--text-muted); }

.chart__data { margin-top: var(--space-3); font-size: var(--text-sm); }
.chart__data summary { cursor: pointer; color: var(--primary); font-weight: 600; }
.chart__data .table-responsive { max-height: 320px; margin-top: var(--space-2); overflow-y: auto; }

/* Liste à barres : répartition, entonnoir */
.bar-list { display: grid; gap: var(--space-3); margin: 0; padding: var(--space-3); list-style: none; }
.bar-list__head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); }
.bar-list__label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-list__value { font-weight: 700; white-space: nowrap; }
.bar-list__track { height: 8px; margin-top: var(--space-1); border-radius: 4px; background: var(--neutral-soft); overflow: hidden; }
.bar-list__bar { display: block; height: 100%; min-width: 2px; border-radius: 4px; }
.bar-list__hint { display: block; margin-top: var(--space-1); font-size: var(--text-xs); color: var(--text-muted); }

/* File « À traiter » du tableau de bord */
.attention-list { display: grid; margin: 0; padding: 0; list-style: none; }

@media (min-width: 768px) {
    .attention-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1200px) {
    .attention-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.attention-list__item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    border-bottom: 1px solid var(--border);
    color: var(--text);
    text-decoration: none;
}

.attention-list__item:hover { background: var(--primary-softer); color: var(--primary); }
.attention-list__label { flex: 1; min-width: 0; font-weight: 600; }

/* --------------------------------------------------------------------------
   Mises en avant de nos offres (<x-card.promo>, SPEC.md §52)
   -------------------------------------------------------------------------- */
.promo-card {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-lg);
    background: var(--primary-softer);
}

.promo-card--accent { border-color: transparent; background: var(--accent-light); }
.promo-card--deep { border-color: transparent; background: var(--neutral-soft); }
.promo-card__body { flex: 1 1 220px; min-width: 0; }
.promo-card__eyebrow { margin: 0; font-size: var(--text-xs); font-weight: 600; letter-spacing: .02em; text-transform: uppercase; color: var(--text-secondary); }
.promo-card__title { margin: 0; font-weight: 700; color: var(--primary-deep); overflow-wrap: anywhere; }
.promo-card__text { margin: 0; font-size: var(--text-sm); color: var(--text-secondary); overflow-wrap: anywhere; }
.promo-card__action { flex: 0 0 auto; }

/* Dans une liste d'offres réunies dans un cadre : l'encart suit le rythme des lignes */
.job-list .promo-card { border-width: 1px 0 0; border-style: solid; border-color: var(--border); border-radius: 0; }

/* Tuile de la fenêtre de l'accueil : toute la tuile est le lien */
.promo-tile {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: inherit;
    text-decoration: none;
    transition: border-color .15s ease, background-color .15s ease;
}

.promo-tile:hover,
.promo-tile:focus-visible { border-color: var(--primary); background: var(--primary-softer); color: inherit; }
.promo-tile__body { display: grid; flex: 1 1 auto; min-width: 0; gap: 2px; }
.promo-tile__body strong { color: var(--primary-deep); overflow-wrap: anywhere; }
.promo-tile__body small { color: var(--text-secondary); overflow-wrap: anywhere; }
.promo-tile__arrow { flex: 0 0 auto; color: var(--text-muted); }

.spotlight__lead { margin: 0 0 var(--space-3); color: var(--text-secondary); }
.spotlight__grid { display: grid; gap: var(--space-2); }
.spotlight .modal-footer { justify-content: space-between; }
