/* ==========================================================================
   Passagers d'un trajet
   - fiche du trajet (services/covoiturage-detail) : bloc .cvd-riders, une
     tuile par place, prise ou libre, sens par sens ;
   - cartes de la liste (services/covoiturage-trajets) : .cv-trip-riders,
     les avatars des inscrits.
   Prenom, initiale et photo pour les membres connectes, silhouettes sinon.
   ========================================================================== */

/* ---- Fiche du trajet ---- */
.cvd-riders {
    scroll-margin-top: 100px;
    margin-bottom: 20px;
    padding: 22px 24px;
    border: 1px solid var(--color-divider);
    border-radius: 18px;
    background: var(--color-white);
}

.cvd-riders-head {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
}

.cvd-riders-icon {
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: #eaf0fd;
    color: #3f6ad8;
    font-size: 16px;
}

.cvd-riders-titles { flex: 1; min-width: 0; }
.cvd-riders-titles h2 { margin: 0 0 2px; font-size: 18px; font-weight: 800; color: #16191d; }
.cvd-riders-titles p { margin: 0; font-size: 13.5px; color: #6b7280; }

.cvd-riders-link {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    font-weight: 700;
    color: var(--color-primary);
    text-decoration: none;
}
.cvd-riders-link:hover { color: var(--color-primary-dark, #e13800); text-decoration: underline; }
.cvd-riders-link i { font-size: 11px; }

/* Un bloc par sens : cote a cote quand la place le permet */
.cvd-riders-legs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(400px, 100%), 1fr));
    gap: 16px;
}

.cvd-riders-leg {
    min-width: 0;
    padding: 16px;
    border: 1px solid #eceef1;
    border-radius: 14px;
    background: #fafbfc;
}

.cvd-riders-leg-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.cvd-riders-dir {
    flex: 0 0 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: #fff1e9;
    color: var(--color-primary);
    font-size: 13px;
}
.cvd-riders-dir.is-return { background: #eaf0fd; color: #3f6ad8; }

.cvd-riders-leg-title { flex: 1; min-width: 0; }
.cvd-riders-leg-title strong { display: block; font-size: 14px; font-weight: 700; color: #16191d; }
.cvd-riders-leg-title small {
    display: block;
    overflow: hidden;
    font-size: 12.5px;
    color: #6b7280;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.cvd-riders-count {
    flex: 0 0 auto;
    padding: 5px 11px;
    border-radius: 999px;
    background: #e8f7ee;
    color: #1a9d5c;
    font-size: 12.5px;
    font-weight: 600;
    white-space: nowrap;
}
.cvd-riders-count strong { font-weight: 800; }
.cvd-riders-count.is-full { background: #fdecec; color: #d92d20; }

/* Les places */
.cvd-seats {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
    gap: 10px;
}

.cvd-seat {
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 14px 8px 12px;
    border: 1px solid #e4e7ec;
    border-radius: 14px;
    background: var(--color-white);
    text-align: center;
}

.cvd-seat-avatar {
    position: relative;
    width: 48px;
    height: 48px;
    margin-bottom: 8px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 50%;
    background: #16191d;
    color: var(--color-white);
    font-size: 15px;
    font-weight: 700;
}
.cvd-seat-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* Prenom et nom : deux lignes au plus, sans deborder de la tuile */
.cvd-seat strong {
    display: -webkit-box;
    max-width: 100%;
    overflow: hidden;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    font-size: 13.5px;
    font-weight: 700;
    line-height: 1.3;
    color: #16191d;
    overflow-wrap: anywhere;
}
.cvd-seat small {
    max-width: 100%;
    overflow: hidden;
    font-size: 11.5px;
    color: #6b7280;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* Place prise pour un accompagnant du passager */
.cvd-seat.is-guest .cvd-seat-avatar { background: #eef0f3; color: #475467; font-size: 14px; }

/* Sa propre place */
.cvd-seat small.cvd-seat-you {
    margin-top: 3px;
    padding: 1px 8px;
    border-radius: 999px;
    background: var(--color-primary);
    color: var(--color-white);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.cvd-seat.is-me { border-color: var(--color-primary); background: #fff7f3; }
.cvd-seat.is-me .cvd-seat-avatar { box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--color-primary); }

/* Place libre */
.cvd-seat.is-free { border-style: dashed; border-color: #d0d5dd; background: transparent; }
.cvd-seat.is-free .cvd-seat-avatar {
    border: 2px dashed #d0d5dd;
    background: transparent;
    color: #98a2b3;
    font-size: 14px;
}
.cvd-seat.is-free strong { color: #1a9d5c; }

.cvd-riders-note {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 14px 0 0;
    font-size: 12.5px;
    color: #6b7280;
}
.cvd-riders-note i { color: #98a2b3; }
.cvd-riders-note a { font-weight: 700; color: var(--color-primary); }

@media (max-width: 640px) {
    .cvd-riders { padding: 18px 14px; }
    .cvd-riders-head { flex-wrap: wrap; }
    .cvd-riders-link { width: 100%; padding-left: 56px; }
    .cvd-riders-leg { padding: 14px 12px; }
    .cvd-seats { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; }
    .cvd-seat { padding: 12px 6px 10px; }
    .cvd-seat-avatar { width: 42px; height: 42px; font-size: 14px; }
}

/* ---- Cartes de la liste ---- */
.cv-trip-riders {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border: 1px solid var(--color-divider);
    border-radius: 14px;
    background: var(--color-white);
}

.cv-riders-stack { flex: 0 0 auto; display: flex; }

.cv-rider {
    position: relative;
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border: 2px solid var(--color-white);
    border-radius: 50%;
    background: #16191d;
    color: var(--color-white);
    font-size: 11px;
    font-weight: 700;
}
.cv-rider + .cv-rider { margin-left: -9px; }
.cv-rider img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cv-rider.is-more { background: #eef0f3; color: #475467; }

.cv-trip-riders-text { min-width: 0; }
.cv-trip-riders-text strong { display: block; font-size: 13.5px; font-weight: 700; color: #16191d; }
.cv-trip-riders-text small {
    display: block;
    overflow: hidden;
    font-size: 12px;
    color: #6b7280;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* Demande en attente de l'accord du conducteur (validation manuelle) */
.cvd-seat.is-pending { border-style: dashed; border-color: #fdb022; background: #fffcf5; }
.cvd-seat.is-pending small { color: #b54708; }
.cvd-seat small.cvd-seat-wait { font-weight: 700; }
.cvd-seat.is-pending small.cvd-seat-you { background: #f79009; color: var(--color-white); }
