/* Page "GPs autour de moi" — géolocalisation, carte + liste (design épuré) */

.gnm-page {
    min-height: 100vh;
    background: var(--gray-50, #f8fafc);
}

/* ── Hero / barre de recherche ── */
.gnm-hero {
    background: #fff;
    border-bottom: 1px solid var(--gray-200, #e2e8f0);
    padding: 3rem 1.5rem 2.75rem;
}

.gnm-hero-inner {
    max-width: 880px;
    margin: 0 auto;
    text-align: center;
}

.gnm-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    background: var(--primary-bg, #eef2ff);
    color: var(--primary, #4f46e5);
    padding: .35rem .9rem;
    border-radius: var(--radius-full, 999px);
    font-size: .78rem;
    font-weight: 600;
    letter-spacing: .01em;
    margin-bottom: 1rem;
}

.gnm-hero-title {
    font-size: clamp(1.75rem, 3.5vw, 2.375rem);
    font-weight: 800;
    letter-spacing: -.02em;
    color: var(--gray-900, #0f172a);
    margin-bottom: .5rem;
}

.gnm-hero-subtitle {
    color: var(--gray-500, #64748b);
    font-size: 1rem;
    margin-bottom: 2rem;
}

.gnm-locate-bar {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    align-items: center;
    justify-content: center;
    background: #fff;
    padding: .625rem;
    border: 1px solid var(--gray-200, #e2e8f0);
    border-radius: var(--radius-lg, 1rem);
    box-shadow: var(--shadow-sm, 0 1px 3px rgba(0, 0, 0, .1));
}

.gnm-locate-divider {
    font-size: .78rem;
    font-weight: 600;
    color: var(--gray-400, #94a3b8);
    text-transform: uppercase;
    letter-spacing: .04em;
}

.gnm-address-form {
    display: flex;
    align-items: center;
    gap: .375rem;
    flex: 1 1 260px;
    background: var(--gray-50, #f8fafc);
    border: 1px solid var(--gray-200, #e2e8f0);
    border-radius: var(--radius, .5rem);
    padding: .25rem .25rem .25rem .875rem;
    transition: border-color .15s;
}

.gnm-address-form:focus-within {
    border-color: var(--primary, #4f46e5);
    background: #fff;
}

.gnm-address-icon {
    color: var(--gray-400, #94a3b8);
    font-size: .85rem;
}

.gnm-address-input {
    border: none;
    background: transparent;
    padding: .625rem .25rem;
    font-size: .9rem;
    color: var(--gray-800, #1e293b);
    outline: none;
    min-width: 0;
}

.gnm-address-input::placeholder {
    color: var(--gray-400, #94a3b8);
}

.gnm-address-submit {
    padding: .625rem 1rem;
}

.gnm-radius-group {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .85rem;
    font-weight: 600;
    color: var(--gray-600, #475569);
    white-space: nowrap;
    padding: 0 .25rem;
}

.gnm-radius-select {
    border: 1px solid var(--gray-200, #e2e8f0);
    background: var(--gray-50, #f8fafc);
    border-radius: var(--radius-sm, .375rem);
    padding: .5rem .625rem;
    font-size: .85rem;
    font-weight: 600;
    color: var(--gray-800, #1e293b);
    cursor: pointer;
}

/* ── Filtres de trajet (destination / date / poids) ── */
.gnm-trip-filters {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    align-items: flex-end;
    justify-content: center;
    background: #fff;
    padding: .875rem;
    margin-top: .75rem;
    border: 1px solid var(--gray-200, #e2e8f0);
    border-radius: var(--radius-lg, 1rem);
    box-shadow: var(--shadow-sm, 0 1px 3px rgba(0, 0, 0, .1));
}

.gnm-trip-field {
    display: flex;
    flex-direction: column;
    gap: .3rem;
    text-align: left;
}

/* .gnm-trip-field-arrival {
    flex: 1 1 200px;
} */

.gnm-trip-field label {
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--gray-500, #64748b);
}

.gnm-trip-field input,
.gnm-trip-field select {
    border: 1px solid var(--gray-200, #e2e8f0);
    background: var(--gray-50, #f8fafc);
    border-radius: var(--radius-sm, .375rem);
    padding: .55rem .7rem;
    font-size: .875rem;
    color: var(--gray-800, #1e293b);
}

/* .top-bar est fixed et haute de 64px : sans ça, le focus JS sur
   #gnm-arrival-input (déclenché quand on géolocalise sans destination
   saisie) scrolle le champ jusqu'au tout haut du viewport et le fait
   passer sous la topbar, entraînant badge/titre du hero avec lui. */
.gnm-address-input,
.gnm-trip-field input,
.gnm-trip-field select {
    scroll-margin-top: 80px;
}

.gnm-trip-field input:focus,
.gnm-trip-field select:focus {
    outline: none;
    border-color: var(--primary, #4f46e5);
    background: #fff;
}

.gnm-trip-submit {
    padding: .625rem 1.25rem;
    white-space: nowrap;
}

.gnm-status {
    margin-top: 1rem;
    color: var(--gray-500, #64748b);
    font-size: .85rem;
    font-weight: 500;
    min-height: 1.2em;
}

/* ── Tabs mobile ── */
.gnm-tabs {
    display: flex;
    border-bottom: 1px solid var(--gray-200, #e2e8f0);
    background: #fff;
    position: sticky;
    /* .top-bar (topbar.html.twig) est fixed, 64px de haut, z-index 1030 :
       il faut coller les tabs juste sous elle, pas sous top:0 qui les ferait
       passer derrière la topbar au scroll. */
    top: 64px;
    z-index: 5;
}

.gnm-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: .875rem;
    border: none;
    background: none;
    font-weight: 600;
    font-size: .875rem;
    color: var(--gray-400, #94a3b8);
    cursor: pointer;
    border-bottom: 2px solid transparent;
}

.gnm-tab.active {
    color: var(--primary, #4f46e5);
    border-bottom-color: var(--primary, #4f46e5);
}

/* ── Layout carte / liste ── */
.gnm-split {
    display: flex;
    max-width: 1400px;
    margin: 0 auto;
    min-height: 70vh;
}

.gnm-list-panel {
    width: 400px;
    flex-shrink: 0;
    padding: 1.5rem;
    overflow-y: auto;
    max-height: calc(100vh - 4rem);
}

.gnm-map-panel {
    flex: 1;
    position: sticky;
    top: 0;
    height: calc(100vh - 4rem);
    padding: 1.5rem 1.5rem 1.5rem 0;
}

#gnm-map {
    width: 100%;
    height: 100%;
    border-radius: var(--radius-lg, 1rem);
    border: 1px solid var(--gray-200, #e2e8f0);
    background: var(--gray-100, #f1f5f9);
}

.leaflet-container {
    font-family: inherit;
    border-radius: var(--radius-lg, 1rem);
}

/* mobile-first-patch.css force `!important` sitewide sur `div`, `img` et `[class*="container"]`
   (max-width:100%, height:auto) pour éviter les débordements mobiles. Ces règles très larges
   s'appliquent aussi aux panneaux/conteneurs internes de Leaflet (volontairement larges à 0
   pour le positionnement absolu des tuiles/marqueurs en %) et cassent tout leur rendu. On
   neutralise toute interférence à l'intérieur de la carte. */
.leaflet-container,
.leaflet-container * {
    max-width: none !important;
}

.leaflet-container .leaflet-tile-pane img,
.leaflet-container img.leaflet-tile {
    width: 256px !important;
    height: 256px !important;
    max-height: none !important;
}

.gnm-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: .875rem;
    color: var(--gray-400, #94a3b8);
    padding: 3.5rem 1.5rem;
}

.gnm-empty-icon {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--gray-100, #f1f5f9);
    font-size: 1.35rem;
    color: var(--gray-300, #cbd5e1);
}

.gnm-empty p {
    max-width: 34ch;
    font-size: .875rem;
    line-height: 1.5;
}

.gnm-empty-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .625rem;
    justify-content: center;
}

.gnm-list {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

/* ── Carte GP ── */
.gnm-result {
    gap: .875rem;
    background: #fff;
    border: 1px solid var(--gray-200, #e2e8f0);
    border-radius: var(--radius-md, .75rem);
    padding: .875rem;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s, transform .15s;
}

.gnm-result:hover,
.gnm-result:focus-visible {
    border-color: var(--primary-light, #818cf8);
    box-shadow: var(--shadow-md, 0 4px 14px rgba(79, 70, 229, .1));
    transform: translateY(-1px);
}

.gnm-result.active {
    border-color: var(--primary, #4f46e5);
    background: var(--primary-bg, #eef2ff);
}

.gnm-result-avatar {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
    border-radius: 50%;
    overflow: hidden;
    background: var(--gray-100, #f1f5f9);
}

.gnm-result-avatar img {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    object-fit: cover;
}

.gnm-avatar-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .8rem;
    font-weight: 700;
    color: var(--primary, #4f46e5);
    background: var(--primary-bg, #eef2ff);
}

.gnm-result-body {
    flex: 1;
    min-width: 0;
}

.gnm-result-head {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: .3rem;
}

.gnm-result-name {
    font-size: .9375rem;
    font-weight: 700;
    margin: 0;
    color: var(--gray-900, #0f172a);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gnm-result-badge {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    flex-shrink: 0;
    background: #fffbeb;
    color: #b45309;
    font-size: .68rem;
    font-weight: 700;
    padding: .2rem .5rem;
    border-radius: var(--radius-full, 999px);
    text-transform: uppercase;
    letter-spacing: .02em;
}

.gnm-result-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    font-size: .78rem;
    color: var(--gray-500, #64748b);
    margin-bottom: .4rem;
}

.gnm-result-meta i {
    color: var(--primary, #4f46e5);
    margin-right: .2rem;
}

.gnm-result-trip {
    font-size: .78rem;
    color: var(--gray-600, #475569);
    margin: 0 0 .5rem;
}

.gnm-result-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    color: #fff;
}

.gnm-result-link {
    font-size: .78rem;
    font-weight: 600;
    color: var(--primary, #4f46e5);
    text-decoration: none;
}

.gnm-result-link i {
    margin-left: .2rem;
    font-size: .7rem;
}

.gnm-result-reserve {
    font-size: .78rem;
    padding: .4rem .875rem;
}

/* ── Marqueurs Leaflet personnalisés ── */
.gnm-map-marker-wrap {
    background: transparent;
    border: none;
}

.gnm-map-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #fff;
    border: 2.5px solid var(--primary, #4f46e5);
    box-shadow: 0 2px 8px rgba(15, 23, 42, .25);
    overflow: hidden;
    cursor: pointer;
    transition: transform .15s;
}

.gnm-map-marker:hover {
    transform: scale(1.08);
}

.gnm-map-marker img {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    object-fit: cover;
}

.gnm-map-marker .gnm-avatar-fallback {
    font-size: .78rem;
}

.gnm-map-marker-elite {
    border-color: #d97706;
    box-shadow: 0 2px 10px rgba(217, 119, 6, .35);
}

.gnm-map-marker-tail {
    display: block;
    width: 10px;
    height: 10px;
    background: #fff;
    border-right: 2.5px solid var(--primary, #4f46e5);
    border-bottom: 2.5px solid var(--primary, #4f46e5);
    transform: rotate(45deg);
    margin: -7px auto 0;
}

.gnm-map-marker-elite + .gnm-map-marker-tail {
    border-color: #d97706;
}

.gnm-center-marker-wrap {
    background: transparent;
    border: none;
}

.gnm-center-marker {
    display: block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--primary, #4f46e5);
    border: 3px solid #fff;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, .25), 0 2px 6px rgba(15, 23, 42, .3);
}

/* ── Bottom sheet mobile ── */
.gnm-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: #fff;
    border-radius: 1.25rem 1.25rem 0 0;
    padding: .75rem 1.25rem calc(1.5rem + env(safe-area-inset-bottom, 0px));
    max-height: 85vh;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform .25s ease;
    z-index: 1050;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, .15);
}

.gnm-sheet.gnm-sheet-open {
    transform: translateY(0);
}

.gnm-sheet-handle {
    width: 40px;
    height: 4px;
    background: var(--gray-300, #cbd5e1);
    border-radius: var(--radius-full, 999px);
    margin: 0 auto .875rem;
}

#gnm-sheet-content h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--gray-900, #0f172a);
    margin: 0 0 .35rem;
}

#gnm-sheet-content p {
    font-size: .85rem;
    color: var(--gray-500, #64748b);
    margin: 0 0 1rem;
}

.gnm-sheet-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .4);
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease;
    z-index: 1040;
}

.gnm-sheet-overlay.gnm-sheet-open {
    opacity: 1;
    pointer-events: auto;
}

/* ── Responsive ── */
@media (max-width: 767.98px) {
    .gnm-hero {
        padding: 2rem 1.25rem 1.75rem;
    }

    .gnm-split {
        min-height: unset;
    }

    .gnm-list-panel,
    .gnm-map-panel {
        display: none;
        width: 100%;
        max-height: unset;
        padding: 1rem;
    }

    .gnm-list-panel.gnm-panel-visible,
    .gnm-map-panel.gnm-panel-visible {
        display: block;
    }

    /* .bottom-nav-mobile (mobile-responsive.css) est fixed en bas de l'écran,
       ~70px + zone de sécurité iOS : sans cette soustraction, le bas de la
       carte (contrôles de zoom, attribution Leaflet) reste caché derrière. */
    .gnm-map-panel {
        height: calc(100vh - 9rem - 70px - env(safe-area-inset-bottom, 0px));
    }

    .gnm-locate-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .gnm-locate-divider {
        display: none;
    }

    .gnm-address-form {
        flex: 1 1 auto;
    }

    .gnm-radius-group {
        justify-content: space-between;
    }

    .gnm-radius-select {
        flex: 1;
    }

    .gnm-trip-filters {
        flex-direction: column;
        align-items: stretch;
    }

    .gnm-trip-submit {
        width: 100%;
        justify-content: center;
    }

    /* Empêche Safari iOS de zoomer automatiquement au focus (déclenché par
       tout input/select avec un font-size < 16px). */
    .gnm-address-input,
    .gnm-trip-field input,
    .gnm-trip-field select,
    .gnm-radius-select {
        font-size: 16px;
    }
}

@media (min-width: 768px) {
    .gnm-list-panel,
    .gnm-map-panel {
        display: block !important;
    }

    .gnm-sheet,
    .gnm-sheet-overlay {
        display: none;
    }
}
