/* ================================================================
   COVOITURAGE CITOYEN — CSS mobile-first complet
   Breakpoints : sm=480px  md=680px  lg=900px
   ================================================================ */

/* ── Variables ──────────────────────────────────────────────────── */
:root {
    --cov-green:      #2d6a4f;
    --cov-green-lt:   #52b788;
    --cov-green-bg:   #f0fdf4;
    --cov-accent:     #e76f51;
    --cov-gray:       #6b7280;
    --cov-gray-lt:    #f3f4f6;
    --cov-border:     #e5e7eb;
    --cov-text:       #1f2937;
    --cov-white:      #ffffff;
    --cov-radius:     12px;
    --cov-radius-sm:  8px;
    --cov-shadow:     0 2px 12px rgba(0,0,0,.08);
    --cov-shadow-md:  0 6px 24px rgba(45,106,79,.12);
    --cov-font:       'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ── Reset ──────────────────────────────────────────────────────── */
.covoit-wrap *, .covoit-wrap *::before, .covoit-wrap *::after { box-sizing: border-box; }

/* ── Conteneur ──────────────────────────────────────────────────── */
.covoit-wrap {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 14px 60px;
    font-family: var(--cov-font);
    color: var(--cov-text);
    font-size: 15px;
    line-height: 1.55;
}
@media (min-width: 680px) { .covoit-wrap { padding: 0 20px 60px; } }

/* ── En-tête ────────────────────────────────────────────────────── */
.covoit-header { text-align: center; margin: 22px 0 18px; }
.covoit-header h2 {
    font-size: clamp(1.25rem, 5vw, 1.8rem);
    font-weight: 700;
    color: var(--cov-green);
    margin: 0 0 5px;
    line-height: 1.25;
}
.covoit-subtitle { color: var(--cov-gray); font-size: .88rem; margin: 0; }

/* ================================================================
   BOUTONS — zone tactile 44px min (Apple HIG)
   ================================================================ */
.covoit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 10px 16px;
    min-height: 44px;
    border-radius: var(--cov-radius-sm);
    font-size: .9rem;
    font-weight: 600;
    font-family: var(--cov-font);
    cursor: pointer;
    text-decoration: none;
    border: 2px solid transparent;
    background: var(--cov-gray-lt);
    color: var(--cov-text);
    white-space: nowrap;
    transition: opacity .15s, background .15s, transform .1s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
}
.covoit-btn:hover        { opacity: .85; }
.covoit-btn:active       { transform: scale(.97); }
.covoit-btn:focus-visible { outline: 2px solid var(--cov-green); outline-offset: 2px; }
.covoit-btn--primary { background: var(--cov-green); color: var(--cov-white); }
.covoit-btn--outline { background: transparent; border-color: var(--cov-green); color: var(--cov-green); }
.covoit-btn--ghost   { background: transparent; color: var(--cov-gray); }
.covoit-btn--lg      { padding: 13px 24px; font-size: 1rem; min-height: 50px; }
.covoit-btn--sm      { padding: 7px 12px;  font-size: .82rem; min-height: 38px; }
.covoit-btn--full    { width: 100%; }

/* ================================================================
   ALERTES
   ================================================================ */
.covoit-alert {
    padding: 13px 15px;
    border-radius: var(--cov-radius);
    margin-bottom: 14px;
    font-size: .9rem;
    line-height: 1.5;
    border-left: 4px solid transparent;
}
.covoit-alert a { font-weight: 600; }
.covoit-alert--success { background: #dcfce7; color: #14532d; border-color: #22c55e; }
.covoit-alert--error   { background: #fee2e2; color: #7f1d1d; border-color: #ef4444; }
.covoit-alert--info    { background: #dbeafe; color: #1e3a5f; border-color: #3b82f6; }

/* ================================================================
   BADGES
   ================================================================ */
.covoit-badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: .76rem;
    font-weight: 600;
    white-space: nowrap;
    line-height: 1.4;
}
.covoit-badge--green  { background: #dcfce7; color: #14532d; }
.covoit-badge--gray   { background: var(--cov-gray-lt); color: var(--cov-gray); }
.covoit-badge--orange { background: #fef3c7; color: #92400e; }

.covoit-badge-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 4px;
    background: var(--cov-accent);
    color: #fff;
    border-radius: 10px;
    font-size: .68rem;
    font-weight: 700;
    margin-left: 4px;
    flex-shrink: 0;
    vertical-align: middle;
}

/* ================================================================
   CHAMPS — font-size 16px min pour éviter le zoom auto sur iOS
   ================================================================ */
.covoit-field { display: flex; flex-direction: column; }
.covoit-field label {
    display: block;
    font-size: .79rem;
    font-weight: 700;
    color: var(--cov-gray);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: .4px;
}
.req { color: var(--cov-accent); }

.covoit-input,
.covoit-search-form input[type="text"],
.covoit-search-form input[type="date"],
.covoit-search-form select,
.covoit-form input[type="text"],
.covoit-form input[type="date"],
.covoit-form input[type="time"],
.covoit-form select,
.covoit-form textarea {
    width: 100%;
    padding: 11px 13px;
    min-height: 46px;
    border: 1.5px solid var(--cov-border);
    border-radius: var(--cov-radius-sm);
    font-size: 16px;
    font-family: var(--cov-font);
    color: var(--cov-text);
    background: var(--cov-white);
    transition: border-color .15s, box-shadow .15s;
    -webkit-appearance: none;
    appearance: none;
}
.covoit-input:focus,
.covoit-search-form input:focus,
.covoit-search-form select:focus,
.covoit-form input:focus,
.covoit-form select:focus,
.covoit-form textarea:focus {
    border-color: var(--cov-green);
    outline: none;
    box-shadow: 0 0 0 3px rgba(45,106,79,.12);
}

/* ================================================================
   FORMULAIRE DE RECHERCHE
   ================================================================ */
.covoit-search-form {
    background: var(--cov-white);
    border-radius: var(--cov-radius);
    padding: 14px;
    box-shadow: var(--cov-shadow);
    border: 1px solid var(--cov-border);
    margin-bottom: 12px;
}

/* mobile : 1 col  →  sm : 2 cols  →  lg : 4 cols */
.covoit-search-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}
@media (min-width: 480px) {
    .covoit-search-grid { grid-template-columns: 1fr 1fr; }
    .covoit-field--btn  { grid-column: 1 / -1; flex-direction: row; gap: 8px; }
}
@media (min-width: 900px) {
    .covoit-search-grid { grid-template-columns: 1fr 1fr 148px auto; align-items: end; }
    .covoit-field--btn  { grid-column: auto; }
}

/* ── Actions rapides ────────────────────────────────────────────── */
.covoit-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
/* Sur mobile : boutons pleine largeur */
.covoit-actions .covoit-btn { flex: 1 1 140px; }
@media (min-width: 480px) { .covoit-actions .covoit-btn { flex: 0 0 auto; } }

/* ================================================================
   CARDS DE TRAJETS
   ================================================================ */
.covoit-cards { display: flex; flex-direction: column; gap: 10px; }

.covoit-card {
    background: var(--cov-white);
    border: 1.5px solid var(--cov-border);
    border-radius: var(--cov-radius);
    box-shadow: var(--cov-shadow);
    overflow: hidden;
    transition: box-shadow .2s, border-color .2s;
}
.covoit-card:hover { box-shadow: var(--cov-shadow-md); border-color: var(--cov-green-lt); }

.covoit-card__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    padding: 12px 14px 10px;
    background: var(--cov-green-bg);
    border-bottom: 1px solid #d1fae5;
    flex-wrap: wrap;
}
.covoit-card__trajet {
    font-size: clamp(.9rem, 2.4vw, 1.02rem);
    font-weight: 700;
    color: var(--cov-green);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    min-width: 0;
    flex: 1;
}
.covoit-card__arrow  { color: var(--cov-green-lt); flex-shrink: 0; }
.covoit-card__places {
    background: var(--cov-green);
    color: var(--cov-white);
    padding: 3px 10px;
    border-radius: 20px;
    font-size: .75rem;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
}
.covoit-card__body { padding: 11px 14px; }
.covoit-card__meta {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    font-size: .84rem;
    color: var(--cov-gray);
    margin-bottom: 6px;
    align-items: center;
}
.covoit-card__comment {
    font-size: .85rem;
    color: var(--cov-gray);
    font-style: italic;
    margin: 4px 0 0;
}
.covoit-card__footer {
    padding: 10px 14px;
    border-top: 1px solid var(--cov-border);
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
/* Sur mobile : boutons action pleine largeur */
.covoit-card__footer .covoit-btn { flex: 1 1 120px; }
@media (min-width: 480px) { .covoit-card__footer .covoit-btn { flex: 0 0 auto; } }

/* ================================================================
   ÉTATS VIDES
   ================================================================ */
.covoit-empty { text-align: center; padding: 44px 14px; color: var(--cov-gray); }
.covoit-empty__icon { font-size: 2.6rem; margin-bottom: 10px; }
.covoit-empty p { margin: 0 0 14px; }
.covoit-empty-small { color: var(--cov-gray); font-size: .84rem; padding: 8px 0; line-height: 1.6; }

/* ================================================================
   FORMULAIRE DE TRAJET
   ================================================================ */
.covoit-form {
    background: var(--cov-white);
    border-radius: var(--cov-radius);
    box-shadow: var(--cov-shadow);
    border: 1px solid var(--cov-border);
    overflow: hidden;
}
.covoit-form__section {
    padding: 18px 16px;
    border-bottom: 1px solid var(--cov-border);
}
@media (min-width: 680px) { .covoit-form__section { padding: 22px 24px; } }
.covoit-form__section h3 {
    margin: 0 0 14px;
    color: var(--cov-green);
    font-size: .82rem;
    text-transform: uppercase;
    letter-spacing: .5px;
}

/* grilles de champs */
.covoit-form__row { display: grid; gap: 12px; }
.covoit-form__row--2 { grid-template-columns: 1fr; }
.covoit-form__row--3 { grid-template-columns: 1fr; }
@media (min-width: 480px) { .covoit-form__row--2 { grid-template-columns: 1fr 1fr; } }
@media (min-width: 680px) { .covoit-form__row--3 { grid-template-columns: 1fr 1fr 1fr; } }

.covoit-form__footer { padding: 18px 16px; text-align: center; }
@media (min-width: 680px) { .covoit-form__footer { padding: 22px 24px; } }
.covoit-form__rgpd {
    font-size: .76rem;
    color: var(--cov-gray);
    margin-bottom: 14px;
    line-height: 1.5;
}
.covoit-form__footer .covoit-btn { width: 100%; }
@media (min-width: 480px) { .covoit-form__footer .covoit-btn { width: auto; } }

/* ================================================================
   ONGLETS
   ================================================================ */
.covoit-tabs {
    display: flex;
    gap: 2px;
    border-bottom: 2px solid var(--cov-border);
    margin-bottom: 16px;
    overflow-x: auto;           /* défilement horizontal sur petit écran */
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.covoit-tabs::-webkit-scrollbar { display: none; }

.covoit-tab {
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    padding: 10px 14px;
    font-size: .88rem;
    font-weight: 600;
    font-family: var(--cov-font);
    color: var(--cov-gray);
    cursor: pointer;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 44px;
    transition: color .15s, border-color .15s;
    -webkit-tap-highlight-color: transparent;
}
.covoit-tab:hover     { color: var(--cov-green); }
.covoit-tab--active   { color: var(--cov-green); border-bottom-color: var(--cov-green); }

.covoit-tab-panel               { display: none; }
.covoit-tab-panel--active       { display: block; }

/* ================================================================
   MESSAGERIE
   ================================================================ */

/* Sur mobile : sidebar au-dessus, chat en-dessous */
.covoit-messagerie {
    display: flex;
    flex-direction: column;
    border: 1.5px solid var(--cov-border);
    border-radius: var(--cov-radius);
    overflow: hidden;
    background: var(--cov-white);
    box-shadow: var(--cov-shadow);
    min-height: 420px;
}

/* Sur desktop : sidebar à gauche */
@media (min-width: 680px) {
    .covoit-messagerie {
        flex-direction: row;
        min-height: 520px;
    }
}

/* ── Sidebar ─────────────────────────────────────────────────────── */
.covoit-messagerie__sidebar {
    flex-shrink: 0;
    border-bottom: 1.5px solid var(--cov-border);
    overflow-x: auto;           /* défilement horizontal des convs sur mobile */
    overflow-y: hidden;
    display: flex;
    flex-direction: row;        /* liste horizontale sur mobile */
    -webkit-overflow-scrolling: touch;
    max-height: 120px;
}
@media (min-width: 680px) {
    .covoit-messagerie__sidebar {
        width: 260px;
        flex-direction: column;
        border-bottom: none;
        border-right: 1.5px solid var(--cov-border);
        overflow-x: hidden;
        overflow-y: auto;
        max-height: none;
    }
}

.covoit-sidebar-header {
    padding: 10px 14px;
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--cov-gray);
    background: var(--cov-gray-lt);
    border-bottom: 1px solid var(--cov-border);
    white-space: nowrap;
    flex-shrink: 0;
    display: none;              /* caché sur mobile (pas de place) */
}
@media (min-width: 680px) { .covoit-sidebar-header { display: block; } }

/* Conversation dans la sidebar */
.covoit-conv {
    display: flex;
    flex-direction: column;     /* vertical sur mobile */
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    text-decoration: none;
    color: var(--cov-text);
    transition: background .15s;
    flex-shrink: 0;
    min-width: 80px;
    text-align: center;
    border-right: 1px solid var(--cov-border);
    position: relative;
}
@media (min-width: 680px) {
    .covoit-conv {
        flex-direction: row;    /* horizontal sur desktop */
        min-width: 0;
        text-align: left;
        border-right: none;
        border-bottom: 1px solid var(--cov-border);
        padding: 12px 14px;
        gap: 10px;
    }
}
.covoit-conv:hover     { background: var(--cov-green-bg); }
.covoit-conv--active   { background: var(--cov-green-bg); }
@media (min-width: 680px) {
    .covoit-conv--active { border-left: 3px solid var(--cov-green); padding-left: 11px; }
}

.covoit-conv__avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--cov-green);
    color: var(--cov-white);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .9rem;
    flex-shrink: 0;
}
.covoit-conv__avatar--lg { width: 40px; height: 40px; font-size: 1.1rem; }

.covoit-conv__info { flex: 1; min-width: 0; }
.covoit-conv__name {
    font-weight: 600;
    font-size: .82rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 64px;
}
@media (min-width: 680px) { .covoit-conv__name { font-size: .9rem; max-width: none; } }
.covoit-conv__trajet {
    font-size: .74rem;
    color: var(--cov-gray);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
@media (min-width: 680px) { .covoit-conv__trajet { font-size: .78rem; } }

/* ── Zone principale ─────────────────────────────────────────────── */
.covoit-messagerie__main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 300px;
    overflow: hidden;
}
.covoit-chat__header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 13px;
    border-bottom: 1.5px solid var(--cov-border);
    background: var(--cov-gray-lt);
    flex-shrink: 0;
}
.covoit-chat__header > div:last-child { min-width: 0; }
.covoit-chat__header strong { display: block; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.covoit-chat__messages {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 9px;
    min-height: 160px;
}
@media (min-width: 680px) { .covoit-chat__messages { padding: 16px; } }

.covoit-chat__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    gap: 12px;
    color: var(--cov-gray);
    text-align: center;
    padding: 24px 14px;
}

/* ── Bulles de message ───────────────────────────────────────────── */
.covoit-message { display: flex; flex-direction: column; max-width: 88%; }
@media (min-width: 480px) { .covoit-message { max-width: 74%; } }

.covoit-message--moi { align-self: flex-end;  align-items: flex-end;   }
.covoit-message--eux { align-self: flex-start; align-items: flex-start; }
.covoit-message__author { font-size: .71rem; color: var(--cov-gray); margin-bottom: 2px; }
.covoit-message__bubble {
    padding: 9px 13px;
    border-radius: 16px;
    font-size: .9rem;
    line-height: 1.45;
    word-break: break-word;
}
.covoit-message--moi .covoit-message__bubble { background: var(--cov-green); color: var(--cov-white); border-bottom-right-radius: 4px; }
.covoit-message--eux .covoit-message__bubble { background: var(--cov-gray-lt); color: var(--cov-text);  border-bottom-left-radius: 4px; }
.covoit-message__date { font-size: .69rem; color: var(--cov-gray); margin-top: 3px; }

/* ── Zone de saisie ──────────────────────────────────────────────── */
.covoit-chat__input {
    display: flex;
    gap: 8px;
    padding: 9px 11px;
    border-top: 1.5px solid var(--cov-border);
    background: var(--cov-gray-lt);
    flex-shrink: 0;
    align-items: flex-end;
}
.covoit-chat__input textarea {
    flex: 1;
    border: 1.5px solid var(--cov-border);
    border-radius: var(--cov-radius-sm);
    padding: 10px 12px;
    font-size: 16px;
    font-family: var(--cov-font);
    resize: none;
    min-height: 44px;
    max-height: 100px;
    overflow-y: auto;
    -webkit-appearance: none;
    background: var(--cov-white);
    transition: border-color .15s;
}
.covoit-chat__input textarea:focus {
    border-color: var(--cov-green);
    outline: none;
    box-shadow: 0 0 0 3px rgba(45,106,79,.12);
}
.covoit-chat__input .covoit-btn { flex-shrink: 0; min-width: 80px; }

/* ================================================================
   DEMANDES REÇUES
   ================================================================ */
.covoit-demandes-list { display: flex; flex-direction: column; gap: 10px; }

.covoit-demande-item {
    background: var(--cov-white);
    border: 1.5px solid var(--cov-border);
    border-radius: var(--cov-radius);
    padding: 13px;
    box-shadow: var(--cov-shadow);
    display: grid;
    grid-template-columns: 40px 1fr;
    grid-template-areas:
        "avatar info"
        "avatar statut"
        "actions actions";
    gap: 6px 12px;
    align-items: start;
}
@media (min-width: 680px) {
    .covoit-demande-item {
        grid-template-columns: 40px 1fr auto auto;
        grid-template-areas: "avatar info statut actions";
        align-items: center;
        gap: 0 14px;
    }
}
.covoit-demande-avatar {
    grid-area: avatar;
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--cov-green);
    color: var(--cov-white);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 1rem;
}
.covoit-demande-info    { grid-area: info; min-width: 0; }
.covoit-demande-statut  { grid-area: statut; }
.covoit-demande-actions { grid-area: actions; display: flex; gap: 8px; flex-wrap: wrap; }
.covoit-demande-trajet  { font-size: .82rem; color: var(--cov-gray); margin-top: 2px; }
.covoit-demande-actions .covoit-btn { flex: 1 1 90px; }
@media (min-width: 480px) { .covoit-demande-actions .covoit-btn { flex: 0 0 auto; } }

/* ================================================================
   CARTE
   ================================================================ */
.covoit-map-legend {
    display: flex;
    gap: 10px;
    font-size: .82rem;
    color: var(--cov-gray);
    margin-bottom: 10px;
    flex-wrap: wrap;
    align-items: center;
}
.covoit-dot {
    display: inline-block;
    width: 10px; height: 10px;
    border-radius: 50%;
    margin-right: 3px;
    vertical-align: middle;
}
.covoit-dot--green { background: #22c55e; }
.covoit-dot--red   { background: #ef4444; }

#covoit-map {
    width: 100%;
    height: 280px;
    border-radius: var(--cov-radius);
    box-shadow: var(--cov-shadow);
    touch-action: pan-y;        /* scroll vertical autorisé, zoom géré par Leaflet */
}
@media (min-width: 480px) { #covoit-map { height: 380px; } }
@media (min-width: 680px) { #covoit-map { height: 480px; touch-action: auto; } }

.covoit-map-footer {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}
.covoit-map-footer .covoit-btn { flex: 1 1 140px; }
@media (min-width: 480px) { .covoit-map-footer .covoit-btn { flex: 0 0 auto; } }

.covoit-popup { font-family: var(--cov-font); font-size: .85rem; line-height: 1.5; min-width: 160px; }
.covoit-popup strong { display: block; margin-bottom: 3px; color: var(--cov-green); }
.covoit-popup-link { display: inline-block; margin-top: 7px; color: var(--cov-green); font-weight: 600; }

#covoit-form-map {
    width: 100%;
    height: 190px;
    border-radius: var(--cov-radius);
    margin-top: 10px;
    display: none;
}
@media (min-width: 480px) { #covoit-form-map { height: 240px; } }

/* ================================================================
   TOAST — centré en bas sur mobile, coin sur desktop
   ================================================================ */
.covoit-toast {
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100vw - 28px);
    max-width: 360px;
    background: #1f2937;
    color: var(--cov-white);
    padding: 13px 16px;
    border-radius: 10px;
    font-size: .9rem;
    font-family: var(--cov-font);
    box-shadow: 0 8px 32px rgba(0,0,0,.22);
    z-index: 99999;
    text-align: center;
    animation: covoitFadeUp .22s ease;
}
@media (min-width: 480px) {
    .covoit-toast {
        bottom: 22px;
        right: 22px;
        left: auto;
        transform: none;
        width: auto;
        max-width: 320px;
        text-align: left;
    }
}
.covoit-toast--success { background: var(--cov-green); }
.covoit-toast--error   { background: #dc2626; }

@keyframes covoitFadeUp {
    from { opacity: 0; transform: translateX(-50%) translateY(10px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
@media (min-width: 480px) {
    @keyframes covoitFadeUp {
        from { opacity: 0; transform: translateY(8px); }
        to   { opacity: 1; transform: translateY(0); }
    }
}

/* ================================================================
   FILTRES INTELLIGENTS
   ================================================================ */
.covoit-filters {
    background: var(--cov-white);
    border: 1.5px solid var(--cov-border);
    border-radius: var(--cov-radius);
    padding: 16px;
    box-shadow: var(--cov-shadow);
    margin-bottom: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
@media (min-width: 680px) { .covoit-filters { padding: 20px; } }

.covoit-filters__row {
    display: grid;
    gap: 12px;
    grid-template-columns: 1fr;
}
@media (min-width: 480px) {
    .covoit-filters__row--2 { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 680px) {
    .covoit-filters__row--3 { grid-template-columns: 1fr 1fr 1fr; }
}

.covoit-filters__footer {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding-top: 4px;
    border-top: 1px solid var(--cov-border);
    margin-top: 2px;
}
.covoit-filters__footer .covoit-btn { flex: 1 1 120px; }
@media (min-width: 480px) { .covoit-filters__footer .covoit-btn { flex: 0 0 auto; } }

/* ── Champ avec géostatus ────────────────────────────────────────── */
.covoit-input-geo { position: relative; }
.covoit-input-geo .covoit-input { padding-right: 38px; }
.covoit-geo-status {
    position: absolute;
    right: 11px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1rem;
    pointer-events: none;
}

/* ── Hint sous un champ ─────────────────────────────────────────── */
.covoit-field-hint { color: var(--cov-gray); font-size: .76rem; margin-top: 4px; }

/* ── Slider de distance ─────────────────────────────────────────── */
.covoit-distance-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}
.covoit-range {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    border-radius: 4px;
    background: var(--cov-border);
    outline: none;
    cursor: pointer;
    min-height: 0; /* override champ général */
    padding: 0;
    border: none;
}
.covoit-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 22px; height: 22px;
    border-radius: 50%;
    background: var(--cov-green);
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.covoit-range::-moz-range-thumb {
    width: 22px; height: 22px;
    border-radius: 50%;
    background: var(--cov-green);
    cursor: pointer;
    border: none;
}
.covoit-range:disabled { opacity: .4; cursor: not-allowed; }
.covoit-range-value {
    font-size: .84rem;
    font-weight: 700;
    color: var(--cov-green);
    white-space: nowrap;
    min-width: 72px;
    text-align: right;
}

/* ── Résumé des filtres actifs ───────────────────────────────────── */
.covoit-filter-summary {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 12px;
    font-size: .85rem;
}
.covoit-filter-summary__count {
    font-weight: 700;
    color: var(--cov-green);
}
.covoit-filter-tag {
    background: var(--cov-green-bg);
    color: var(--cov-green);
    border: 1px solid #bbf7d0;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: .78rem;
    font-weight: 600;
}

/* ── Badges supplémentaires ──────────────────────────────────────── */
.covoit-badge--distance { background: #eff6ff; color: #1d4ed8; }
.covoit-badge--complet  { background: #fee2e2; color: #991b1b; }

/* ── Card complète (grisée) ─────────────────────────────────────── */
.covoit-card--complet { opacity: .72; }
.covoit-card--complet .covoit-card__header { background: var(--cov-gray-lt); border-bottom-color: var(--cov-border); }

/* ── Header right (badges groupés) ──────────────────────────────── */
.covoit-card__header-right {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
    flex-shrink: 0;
}

/* ── Bouton danger (suppression) ────────────────────────────────── */
.covoit-btn--danger {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fca5a5;
}
.covoit-btn--danger:hover { background: #fecaca; opacity: 1; }

/* ── Badge places libres (au moins 2 libres mais des prises) ─── */
.covoit-badge--places { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }

/* ================================================================
   APPLICATION MONO-PAGE — NAVIGATION COMPLÈTE
   ================================================================ */

/* ── Reset sur la page app ──────────────────────────────────────── */
.covoit-app {
    display: flex;
    flex-direction: column;
    min-height: 80vh;
    font-family: var(--cov-font);
}

/* Quand l'app est active : réduire le padding du .covoit-wrap
   (les vues internes ont leur propre espacement) */
.covoit-app .covoit-wrap {
    padding-bottom: 24px;
}

/* ================================================================
   BARRE DE NAVIGATION SUPÉRIEURE
   ================================================================ */
.covoit-nav {
    background: var(--cov-green);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 12px rgba(0,0,0,.15);
}

.covoit-nav__inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    height: 56px;
}

/* ── Brand / Logo ───────────────────────────────────────────────── */
.covoit-nav__brand {
    display: flex;
    align-items: center;
    gap: 7px;
    text-decoration: none;
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
    margin-right: 6px;
}
.covoit-nav__brand:hover { opacity: .85; }
.covoit-nav__brand-icon  { font-size: 1.3rem; }
.covoit-nav__brand-name  { display: none; }
@media (min-width: 480px) { .covoit-nav__brand-name { display: inline; } }

/* ── Liens de navigation ────────────────────────────────────────── */
.covoit-nav__links {
    display: none;          /* cachés sur mobile → bottomnav */
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 1;
    gap: 2px;
}
@media (min-width: 600px) {
    .covoit-nav__links { display: flex; }
}

.covoit-nav__item { display: flex; }

.covoit-nav__link {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 12px;
    border-radius: 8px;
    text-decoration: none;
    color: rgba(255,255,255,.82);
    font-size: .88rem;
    font-weight: 600;
    position: relative;
    transition: background .15s, color .15s;
    min-height: 40px;
    white-space: nowrap;
}
.covoit-nav__link:hover       { background: rgba(255,255,255,.12); color: #fff; }
.covoit-nav__link--active     { background: rgba(255,255,255,.2);  color: #fff; }

.covoit-nav__icon  { font-size: 1.05rem; }
.covoit-nav__label { }
.covoit-nav__lock  { font-size: .72rem; opacity: .7; }

/* Badge sur lien nav */
.covoit-nav__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    background: var(--cov-accent);
    color: #fff;
    border-radius: 9px;
    font-size: .65rem;
    font-weight: 800;
    line-height: 1;
}

/* ── Utilisateur connecté (desktop) ─────────────────────────────── */
.covoit-nav__user {
    display: none;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    flex-shrink: 0;
}
@media (min-width: 760px) { .covoit-nav__user { display: flex; } }

.covoit-nav__avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,.25);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .9rem;
    flex-shrink: 0;
}
.covoit-nav__username {
    color: rgba(255,255,255,.9);
    font-size: .85rem;
    font-weight: 600;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.covoit-nav__logout {
    color: rgba(255,255,255,.7);
    font-size: 1.1rem;
    text-decoration: none;
    padding: 4px 6px;
    border-radius: 6px;
    transition: background .15s;
}
.covoit-nav__logout:hover { background: rgba(255,255,255,.15); color: #fff; }

/* Bouton connexion dans nav */
.covoit-nav .covoit-btn--outline {
    border-color: rgba(255,255,255,.6);
    color: #fff;
}
.covoit-nav .covoit-btn--outline:hover { background: rgba(255,255,255,.12); }

/* ================================================================
   CONTENU PRINCIPAL
   ================================================================ */
.covoit-app__main {
    flex: 1;
    /* Espace en bas pour la bottomnav mobile */
    padding-bottom: 72px;
}
@media (min-width: 600px) {
    .covoit-app__main { padding-bottom: 0; }
}

/* Titre de section sous la navbar */
.covoit-app__section-title {
    background: var(--cov-green-bg);
    border-bottom: 1px solid #d1fae5;
    padding: 12px 16px 10px;
}
@media (min-width: 680px) { .covoit-app__section-title { padding: 14px 24px 12px; } }

.covoit-app__h1 {
    margin: 0;
    font-size: clamp(1rem, 3.5vw, 1.3rem);
    font-weight: 700;
    color: var(--cov-green);
    max-width: 960px;
    margin-left: auto;
    margin-right: auto;
}

/* Supprime le header interne des vues (covoit-header)
   quand elles sont dans l'app — le titre est géré par covoit-app__section-title */
.covoit-app .covoit-header { display: none; }

/* ================================================================
   BARRE DE NAVIGATION BAS — MOBILE SEULEMENT
   ================================================================ */
.covoit-bottomnav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: #fff;
    border-top: 1.5px solid var(--cov-border);
    display: flex;
    align-items: stretch;
    z-index: 1000;
    box-shadow: 0 -2px 12px rgba(0,0,0,.08);
    /* Safe area iOS */
    padding-bottom: env(safe-area-inset-bottom, 0);
}
/* Cachée sur desktop — la topnav prend le relais */
@media (min-width: 600px) { .covoit-bottomnav { display: none; } }

.covoit-bottomnav__item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    text-decoration: none;
    color: var(--cov-gray);
    font-size: .68rem;
    font-weight: 600;
    transition: color .15s, background .15s;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    padding: 6px 4px 4px;
}
.covoit-bottomnav__item:active           { background: var(--cov-green-bg); }
.covoit-bottomnav__item--active          { color: var(--cov-green); }
.covoit-bottomnav__item--active::before  {
    content: '';
    position: absolute;
    top: 0; left: 20%; right: 20%;
    height: 3px;
    background: var(--cov-green);
    border-radius: 0 0 3px 3px;
}

.covoit-bottomnav__icon {
    font-size: 1.35rem;
    position: relative;
    line-height: 1;
}
.covoit-bottomnav__label { line-height: 1.1; }

/* Badge sur icône bottomnav */
.covoit-bottomnav__badge {
    position: absolute;
    top: -5px;
    right: -8px;
    min-width: 17px;
    height: 17px;
    padding: 0 3px;
    background: var(--cov-accent);
    color: #fff;
    border-radius: 9px;
    font-size: .6rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
}

/* ── Bloc "Rejoindre" avec sélecteur de places ──────────────────── */
.covoit-rejoindre {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.covoit-rejoindre__select {
    width: auto !important;
    min-width: 100px;
    flex-shrink: 0;
}

/* ================================================================
   CARTE AVEC ROUTAGE
   ================================================================ */

/* Layout carte + panneau */
.covoit-map-layout {
    display: flex;
    gap: 0;
    border-radius: var(--cov-radius);
    overflow: hidden;
    box-shadow: var(--cov-shadow);
    border: 1.5px solid var(--cov-border);
    position: relative;
}

/* Conteneur carte */
#covoit-map-container {
    flex: 1;
    position: relative;
    min-height: 300px;
}
#covoit-map {
    width: 100%;
    height: 380px;
    border-radius: 0;
    box-shadow: none;
    border: none;
}
@media (min-width: 480px) { #covoit-map { height: 440px; } }
@media (min-width: 680px) { #covoit-map { height: 520px; touch-action: auto; } }

/* Overlay chargement */
.covoit-map-loading {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(45,106,79,.92);
    color: #fff;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: .84rem;
    font-weight: 600;
    z-index: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    pointer-events: none;
}

/* ── Panneau latéral (desktop) / drawer (mobile) ────────────────── */
.covoit-map-panel {
    width: 260px;
    flex-shrink: 0;
    background: var(--cov-white);
    border-left: 1.5px solid var(--cov-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Sur mobile : caché par défaut, s'ouvre en overlay */
@media (max-width: 679px) {
    .covoit-map-panel {
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-height: 50%;
        border-left: none;
        border-top: 2px solid var(--cov-border);
        z-index: 400;
        transform: translateY(100%);
        transition: transform .28s ease;
    }
    .covoit-map-panel--open {
        transform: translateY(0);
    }
}

.covoit-map-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--cov-green-bg);
    border-bottom: 1px solid #d1fae5;
    flex-shrink: 0;
}
.covoit-map-panel__header h3 {
    margin: 0;
    font-size: .88rem;
    color: var(--cov-green);
}
.covoit-map-panel__close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    color: var(--cov-gray);
    padding: 4px;
    display: none;
}
@media (max-width: 679px) { .covoit-map-panel__close { display: block; } }

.covoit-map-panel__body {
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch;
}

/* ── Trajet dans le panneau ─────────────────────────────────────── */
.covoit-panel-trajet {
    padding: 10px 13px;
    border-bottom: 1px solid var(--cov-border);
    cursor: pointer;
    transition: background .15s;
}
.covoit-panel-trajet:hover   { background: var(--cov-green-bg); }
.covoit-panel-trajet:last-child { border-bottom: none; }

.covoit-panel-trajet__route {
    font-size: .88rem;
    font-weight: 700;
    color: var(--cov-green);
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.covoit-panel-trajet__meta {
    font-size: .74rem;
    color: var(--cov-gray);
    line-height: 1.5;
}
.covoit-panel-trajet__communes {
    font-size: .72rem;
    color: var(--cov-green);
    margin-top: 4px;
    font-style: italic;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.covoit-panel-trajet__distance {
    margin-top: 4px;
}

/* ── Marqueurs sur la carte ─────────────────────────────────────── */
.covoit-marker {
    width: 26px;
    height: 26px;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    border: 2px solid rgba(255,255,255,.8);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .65rem;
    font-weight: 800;
    color: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,.25);
}
.covoit-marker--depart  { border-radius: 50%; transform: none; }
.covoit-marker--arrivee { }

/* Popup enrichie */
.covoit-popup { font-size: .84rem; line-height: 1.55; min-width: 170px; }
.covoit-popup strong { display: block; color: var(--cov-green); margin-bottom: 3px; font-size: .9rem; }
.covoit-popup-communes { margin-top: 5px; font-size: .76rem; color: var(--cov-green); font-style: italic; }
.covoit-popup-link { display: inline-block; margin-top: 7px; color: var(--cov-green); font-weight: 700; }

/* Bouton toggle panel (mobile) */
#covoit-toggle-panel { display: inline-flex; }
@media (min-width: 680px) { #covoit-toggle-panel { display: none; } }
