/* ==========================================================================
   Cartes & étiquettes — design system partagé (style LinkedIn)
   --------------------------------------------------------------------------
   Objectif : un même rendu quel que soit l'endroit — sidebar d'un parcours,
   blocs de compétences, listes de cours. Chaque carte porte son icône, son
   titre, et une rangée d'étiquettes pour les petites informations (heures,
   coefficient, nombre de cours, compétence).

   Pourquoi un fichier dédié : les règles précédentes vivaient dans
   parcours-hero.css, où elles se faisaient écraser par les styles globaux
   de la page (le texte redevenait invisible). Ici tout est autonome, avec
   des préfixes explicites, et le fond/blanc est forcé sur chaque carte.

   Usage : <link rel="stylesheet" href="{{ asset('css/components/cards.css') }}">
   Tout est préfixé `cv-` (card / tag) pour éviter toute collision.
   ========================================================================== */

/* --- Étiquettes (tags) ---------------------------------------------------
   La petite information qui ne mérite pas une ligne entière : heures,
   coefficient, nombre de cours. Toujours sur une seule ligne, jamais de
   retour à la ligne involontaire (white-space: nowrap). */
.cv-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
    background: #eef2f7;
    color: #334155;
    border: 1px solid #dbe3ee;
    vertical-align: middle;
}

.cv-tag i {
    font-size: 0.8em;
    opacity: 0.85;
}

.cv-tag--primary {
    background: #e8f0fe;
    color: #1a56db;
    border-color: #c7d7f8;
}

.cv-tag--soft {
    background: #f1f5f9;
    color: #475569;
    border-color: #e2e8f0;
}

.cv-tag--dark {
    background: #1a365d;
    color: #ffffff;
    border-color: #1a365d;
}

.cv-tag--dark i {
    opacity: 0.7;
}

/* --- Rows d'étiquettes ---------------------------------------------------- */
.cv-tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

/* --- Carte principale -----------------------------------------------------
   Le modèle LinkedIn : icône en médaillon à gauche, titre au centre,
   étiquettes en bas. Le fond blanc et la bordure sont forcés pour ne pas
   dépendre du contexte d'appel. */
.cv-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px 14px;
    text-decoration: none;
    color: #1e293b;
    transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.cv-card:hover {
    border-color: #c7d7f8;
    box-shadow: 0 6px 18px rgba(26, 54, 93, 0.12);
    transform: translateY(-2px);
    color: #1a365d;
    text-decoration: none;
}

/* Médaillon de l'icône */
.cv-card-avatar {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    background: #eef2f7;
    color: #1a365d;
}

.cv-card:hover .cv-card-avatar {
    background: #1a365d;
    color: #ffffff;
}

.cv-card-avatar--primary {
    background: #e8f0fe;
    color: #1a56db;
}

.cv-card-avatar--primary:hover {
    background: #1a56db;
}

/* Corps */
.cv-card-body {
    flex: 1 1 auto;
    min-width: 0;
}

.cv-card-title {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.35;
    color: inherit;
    margin: 0;
}

.cv-card-subtitle {
    display: block;
    font-size: 0.72rem;
    line-height: 1.45;
    color: #64748b;
    margin-top: 2px;
}

.cv-card-tags {
    margin-top: 6px;
}

/* --- Variante compacte (sidebar) -----------------------------------------
   Deux colonnes dans un espace étroit : on réduit le médaillon, on masque
   le sous-titre si l'appelant le demande, on garde les étiquettes
   essentielles. */
.cv-card--compact {
    gap: 9px;
    padding: 9px 11px;
    border-radius: 10px;
}

.cv-card--compact .cv-card-avatar {
    width: 30px;
    height: 30px;
    font-size: 0.8rem;
    border-radius: 8px;
}

.cv-card--compact .cv-card-title {
    font-size: 0.78rem;
}

.cv-card--compact .cv-card-tags {
    margin-top: 4px;
}

/* Titre sur 2 lignes max, avec ellipse — évite qu'un titre long
   désaligne la grille. */
.cv-card-title--clamp {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* --- Grille compacte ------------------------------------------------------
   S'adapte à la largeur disponible : 1 colonne si l'espace est très
   étroit, 2 dès qu'il y a la place, 3 sur les grandes sidebars. */
.cv-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 8px;
}

/* --- Groupe de cartes (un bloc de compétences) --------------------------- */
.cv-group {
    margin-bottom: 16px;
}

.cv-group:last-child {
    margin-bottom: 0;
}

.cv-group-header {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 9px;
}

/* Puces numérotées des blocs */
.cv-group-index {
    flex: 0 0 auto;
    width: 21px;
    height: 21px;
    border-radius: 50%;
    background: #1a365d;
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.cv-group-index--neutral {
    background: #64748b;
}

.cv-group-name {
    font-size: 0.76rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.3;
    min-width: 0;
}

.cv-group-meta {
    margin-left: auto;
    flex: 0 0 auto;
}

.cv-group-hint {
    font-size: 0.67rem;
    color: #64748b;
    font-style: italic;
    margin: -2px 0 12px;
}

/* --------------------------------------------------------------------------
   Adaptation mobile : une seule colonne, médaillon intact.
   -------------------------------------------------------------------------- */
@media (max-width: 767.98px) {
    .cv-card-grid {
        grid-template-columns: 1fr;
    }

    .cv-group-header {
        flex-wrap: wrap;
    }
}
