/* Carte du reseau SEGUR - styles isoles sous .segur-carte pour l'integration WordPress */

.page {
    max-width: 1240px;
    margin: 0 auto;
    padding: 32px 16px;
}

html {
    scrollbar-gutter: stable; /* la carte ne change pas de largeur quand la barre de defilement apparait */
}

body {
    margin: 0;
    background: #FAFAF8;
}

/* Mode integration (iframe) : pas de fond ni de marge, la page parente gere la hauteur */
.is-embed,
.is-embed body {
    background: transparent;
    overflow: hidden;
}

.is-embed .page {
    max-width: none;
    padding: 0;
}

.is-embed .segur-carte {
    box-shadow: none;
}

.segur-carte {
    --sc-red: #E31E26;
    --sc-red-dark: #C0151C;
    --sc-covered: #F9D9DA;
    --sc-covered-hover: #F2AFB2;
    --sc-free: #EFEEEA;
    --sc-free-hover: #E2E0DA;
    --sc-ink: #292929;
    --sc-muted: #6B6B6B;
    --sc-line: #E8E6E1;
    --sc-panel: #FFFFFF;
    --sc-radius: 14px;

    display: grid;
    grid-template-columns: 340px 1fr;
    /* Hauteur adaptee a l'ecran : 75 % de la fenetre, entre 600 et 900 px.
       --sc-host-h = hauteur de la fenetre du visiteur (transmise par la page parente en mode integration) */
    height: clamp(600px, calc(var(--sc-host-h, 100vh) * 0.75), 900px);
    background: var(--sc-panel);
    border: 1px solid var(--sc-line);
    border-radius: var(--sc-radius);
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(41, 41, 41, 0.06);
    font-family: "Roboto Condensed", "Arial Narrow", Arial, sans-serif;
    color: var(--sc-ink);
    line-height: 1.4;
    position: relative;
}

.segur-carte *,
.segur-carte *::before,
.segur-carte *::after {
    box-sizing: border-box;
}

.segur-carte button {
    font: inherit;
    color: inherit;
}

/* ---------- Panneau liste ---------- */

.sc-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    border-right: 1px solid var(--sc-line);
}

.sc-head {
    padding: 26px 24px 18px;
    border-bottom: 1px solid var(--sc-line);
}

.sc-kicker {
    margin: 0 0 4px;
    color: var(--sc-red);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1.7px;
    text-transform: uppercase;
}

.sc-title {
    margin: 0 0 16px;
    font-size: 26px;
    font-weight: 400;
    line-height: 1.15;
}

.sc-count {
    font-weight: 700;
    color: var(--sc-red);
}

.sc-search {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 14px;
    height: 42px;
    border: 1px solid var(--sc-line);
    border-radius: 999px;
    background: #FAFAF8;
    transition: border-color .2s, box-shadow .2s;
}

.sc-search:focus-within {
    border-color: var(--sc-red);
    box-shadow: 0 0 0 3px rgba(227, 30, 38, .12);
    background: #fff;
}

.sc-search svg {
    width: 18px;
    height: 18px;
    flex: none;
    fill: none;
    stroke: var(--sc-muted);
    stroke-width: 2;
    stroke-linecap: round;
}

.sc-search input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    font: inherit;
    font-size: 15px;
    color: var(--sc-ink);
}

.sc-search input::-webkit-search-cancel-button {
    filter: grayscale(1);
    opacity: .6;
    cursor: pointer;
}

.sc-list {
    list-style: none;
    margin: 0;
    padding: 8px 0;
    overflow-y: auto;
    flex: 1;
    scrollbar-width: thin;
    scrollbar-color: rgba(227, 30, 38, .25) transparent;
}

.sc-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 24px;
    border: 0;
    border-left: 3px solid transparent;
    background: none;
    text-align: left;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}

.sc-item:hover,
.sc-item.is-hover {
    background: #FBF7F6;
}

.sc-item:focus-visible {
    outline: 2px solid var(--sc-red);
    outline-offset: -2px;
}

.sc-item.is-active {
    background: #FDF0F0;
    border-left-color: var(--sc-red);
}

.sc-item-dot {
    width: 10px;
    height: 10px;
    flex: none;
    border-radius: 50%;
    background: var(--sc-red);
    box-shadow: 0 0 0 3px rgba(227, 30, 38, .15);
}

.sc-item--free .sc-item-dot {
    background: #fff;
    border: 2px solid #B9B6AE;
    box-shadow: none;
}

.sc-item-body {
    flex: 1;
    min-width: 0;
}

.sc-item-city {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 17px;
    font-weight: 600;
    line-height: 1.2;
}

.sc-item-meta {
    display: block;
    margin-top: 2px;
    font-size: 13.5px;
    font-weight: 300;
    color: var(--sc-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sc-item-chevron {
    width: 16px;
    height: 16px;
    flex: none;
    fill: none;
    stroke: #B9B6AE;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform .15s, stroke .15s;
}

.sc-item:hover .sc-item-chevron,
.sc-item.is-active .sc-item-chevron {
    stroke: var(--sc-red);
    transform: translateX(2px);
}

.sc-badge {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 999px;
    background: var(--sc-ink);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .6px;
    text-transform: uppercase;
}

.sc-list-sep {
    margin: 10px 24px 4px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--sc-muted);
}

.sc-more-row {
    padding: 8px 18px 14px;
}

.sc-more {
    width: 100%;
    height: 44px;
    border: 1.5px solid var(--sc-red);
    border-radius: 999px;
    background: #fff;
    color: var(--sc-red) !important;
    font-size: 15px !important;
    font-weight: 600;
    letter-spacing: .5px;
    text-transform: uppercase;
    cursor: pointer;
    transition: background .15s, color .15s;
}

.sc-more:hover {
    background: var(--sc-red);
    color: #fff !important;
}

.sc-empty {
    margin: 0;
    padding: 20px 24px;
    color: var(--sc-muted);
    font-size: 15px;
}

/* ---------- Carte ---------- */

.sc-map {
    position: relative;
    min-width: 0;
    min-height: 0;
    background:
        radial-gradient(circle at 60% 40%, #FFFFFF 0%, #F6F5F1 100%);
    overflow: hidden;
}

.sc-svg {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: pan-y;
    cursor: grab;
}

.sc-svg:active {
    cursor: grabbing;
}

.sc-dep {
    fill: var(--sc-free);
    stroke: #fff;
    stroke-width: .8;
    vector-effect: non-scaling-stroke;
    stroke-linejoin: round;
    cursor: pointer;
    transition: fill .2s;
}

.sc-dep:not(.is-covered):hover {
    fill: var(--sc-free-hover);
}

.sc-dep.is-covered {
    fill: var(--sc-covered);
}

.sc-deps.has-selection .sc-dep.is-covered:not(.is-selected):not(.is-hover) {
    fill: #F6E6E6;
}

/* Survol d'une agence (point, liste ou departement) : tout son territoire en rouge */
.sc-svg .sc-dep.is-covered.is-hover,
.sc-svg .sc-dep.is-selected {
    fill: var(--sc-red);
}

.sc-dep.is-free-selected {
    fill: #D8D5CD;
    stroke: var(--sc-ink);
    stroke-width: 1.2;
}

.sc-marker {
    cursor: pointer;
}

.sc-marker circle {
    fill: var(--sc-red);
    stroke: #fff;
    stroke-width: 2;
    transition: r .2s;
}

.sc-marker .sc-halo {
    fill: rgba(227, 30, 38, .18);
    stroke: none;
    opacity: 0;
    transition: opacity .2s;
}

.sc-marker.is-active .sc-halo,
.sc-marker:hover .sc-halo {
    opacity: 1;
}

.sc-marker.is-active circle.sc-pin {
    fill: var(--sc-ink);
}

.sc-marker text {
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: .3px;
    fill: var(--sc-ink);
    paint-order: stroke;
    stroke: rgba(255, 255, 255, .92);
    stroke-width: 3.5px;
    stroke-linejoin: round;
    pointer-events: none;
    text-transform: uppercase;
}

.sc-drom {
    transition: opacity .25s;
}

.sc-drom.is-hidden {
    opacity: 0;
    pointer-events: none;
}

.sc-drom-box {
    cursor: pointer;
    outline: none;
}

.sc-drom-frame {
    fill: rgba(255, 255, 255, .7);
    stroke: var(--sc-line);
    rx: 8;
    transition: fill .2s, stroke .2s;
}

/* La case entiere recoit le clic : le territoire et le cadre ne l'interceptent pas */
.sc-drom-box .sc-drom-frame,
.sc-drom-box .sc-dep,
.sc-drom-box text {
    pointer-events: none;
}

.sc-drom-hit {
    fill: transparent;
    pointer-events: all;
}

.sc-drom-box.is-hover .sc-drom-frame,
.sc-drom-box:focus-visible .sc-drom-frame {
    fill: #fff;
    stroke: var(--sc-red);
    stroke-width: 1.5;
}

.sc-drom-box.is-hover .sc-dep {
    fill: var(--sc-free-hover);
}

.sc-drom-box.is-hover text,
.sc-drom-box.is-selected text {
    fill: var(--sc-ink);
}

.sc-drom-box.is-selected .sc-drom-frame {
    fill: #fff;
    stroke: var(--sc-ink);
    stroke-width: 1.5;
}

.sc-drom-box text {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .4px;
    fill: var(--sc-muted);
    text-anchor: middle;
    text-transform: uppercase;
}

/* ---------- Controles, legende, aides ---------- */

.sc-controls {
    position: absolute;
    right: 16px;
    bottom: 64px;
    display: flex;
    flex-direction: column;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 2px 10px rgba(41, 41, 41, .12);
    overflow: hidden;
}

.sc-controls button {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border: 0;
    border-bottom: 1px solid var(--sc-line);
    background: #fff;
    cursor: pointer;
}

.sc-controls button:last-child {
    border-bottom: 0;
}

.sc-controls button:hover {
    background: #FDF0F0;
}

.sc-controls button:focus-visible {
    outline: 2px solid var(--sc-red);
    outline-offset: -2px;
}

.sc-controls svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: var(--sc-ink);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sc-legend {
    position: absolute;
    right: 16px;
    bottom: 16px;
    display: flex;
    gap: 16px;
    margin: 0;
    padding: 7px 12px;
    list-style: none;
    border-radius: 999px;
    background: rgba(255, 255, 255, .9);
    box-shadow: 0 1px 6px rgba(41, 41, 41, .08);
    font-size: 13px;
    color: var(--sc-muted);
}

.sc-legend li {
    display: flex;
    align-items: center;
    gap: 6px;
}

.sc-swatch {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.sc-swatch--covered {
    background: var(--sc-covered-hover);
}

.sc-swatch--free {
    background: var(--sc-free);
    border: 1px solid #D8D5CD;
}

.sc-hint {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
    padding: 10px 16px;
    border-radius: 999px;
    background: rgba(41, 41, 41, .85);
    color: #fff;
    font-size: 14px;
    pointer-events: none;
}

.sc-tooltip {
    position: absolute;
    z-index: 3;
    padding: 7px 11px;
    border-radius: 8px;
    background: var(--sc-ink);
    color: #fff;
    font-size: 13.5px;
    line-height: 1.3;
    pointer-events: none;
    white-space: nowrap;
    transform: translate(-50%, calc(-100% - 12px));
    box-shadow: 0 4px 14px rgba(0, 0, 0, .18);
}

.sc-tooltip small {
    display: block;
    color: #F2AFB2;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .4px;
    text-transform: uppercase;
}

/* ---------- Fiche agence ---------- */

.sc-card {
    position: absolute;
    z-index: 4;
    top: 16px;
    right: 16px;
    width: 330px;
    max-height: calc(100% - 132px);
    overflow-y: auto;
    padding: 22px 22px 20px;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 12px 40px rgba(41, 41, 41, .16);
    animation: sc-in .22s ease-out;
}

@keyframes sc-in {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: none; }
}

.sc-card-close {
    position: absolute;
    top: 12px;
    right: 12px;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
}

.sc-card-close:hover {
    background: #F4F3EF;
}

.sc-card-close svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: var(--sc-ink);
    stroke-width: 2;
    stroke-linecap: round;
}

.sc-card-kicker {
    margin: 0 0 2px;
    color: var(--sc-red);
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: 1.6px;
    text-transform: uppercase;
}

.sc-card-title {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 36px 16px 0;
    font-size: 26px;
    font-weight: 400;
    line-height: 1.15;
}

.sc-card-section {
    padding: 14px 0;
    border-top: 1px solid var(--sc-line);
}

.sc-card-label {
    margin: 0 0 8px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--sc-muted);
}

.sc-people {
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.sc-person {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
}

.sc-avatar {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    flex: none;
    border-radius: 50%;
    background: #FDF0F0;
    color: var(--sc-red);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .5px;
}

.sc-mail {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sc-mail-address {
    flex: 1;
    min-width: 0;
    font-size: 16px;
    overflow-wrap: anywhere;
    user-select: all;
}

.sc-mail + .sc-mail {
    margin-top: 8px;
}

.sc-people--contact {
    margin-bottom: 12px;
}

/* Numero de telephone : lien d'appel sur mobile, simple texte sur ordinateur */
.sc-tel {
    color: var(--sc-red) !important;
    font-weight: 600;
    text-decoration: none !important;
    letter-spacing: .3px;
}

@media (hover: hover) and (pointer: fine) {
    .sc-tel {
        color: inherit !important;
        font-weight: inherit;
        pointer-events: none;
    }
}

.sc-copy {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: none;
    height: 34px;
    padding: 0 12px;
    border: 1.5px solid var(--sc-red);
    border-radius: 999px;
    background: #fff;
    color: var(--sc-red) !important;
    font-size: 13px !important;
    font-weight: 600;
    letter-spacing: .4px;
    text-transform: uppercase;
    cursor: pointer;
    transition: background .15s, color .15s;
}

.sc-copy:hover {
    background: var(--sc-red);
    color: #fff !important;
}

.sc-copy svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sc-copy.is-done {
    border-color: #2E9E4F;
    background: #2E9E4F;
    color: #fff !important;
}

.sc-deps-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.sc-deps-list li {
    padding: 4px 10px;
    border-radius: 999px;
    background: #F4F3EF;
    font-size: 14px;
}

.sc-deps-list b {
    font-weight: 700;
    color: var(--sc-red);
    margin-right: 4px;
}

.sc-deps-list li.is-shared i {
    margin-left: 6px;
    font-size: 11px;
    font-style: normal;
    font-weight: 600;
    letter-spacing: .4px;
    text-transform: uppercase;
    color: var(--sc-muted);
}

.sc-choices {
    margin: 0 -22px;
    padding: 0;
    list-style: none;
    border-top: 1px solid var(--sc-line);
}

.sc-choices .sc-item {
    padding-left: 22px;
    padding-right: 22px;
}

.sc-card-text {
    margin: 0 0 14px;
    font-size: 16px;
    font-weight: 300;
    line-height: 1.5;
}

.sc-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 44px;
    border-radius: 999px;
    background: var(--sc-red);
    color: #fff !important;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: .5px;
    text-decoration: none !important;
    text-transform: uppercase;
    transition: background .15s;
}

.sc-cta:hover {
    background: var(--sc-red-dark);
}

.sc-cta svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sc-card-foot {
    margin: 12px 0 0;
    font-size: 14px;
    color: var(--sc-muted);
}

/* ---------- Tablette et mobile ---------- */

@media (max-width: 900px) {
    .segur-carte {
        grid-template-columns: 1fr;
        grid-template-rows: auto 520px auto auto;
        height: auto;
    }

    .sc-panel {
        display: contents;
    }

    .sc-head {
        grid-row: 1;
        padding: 22px 18px 16px;
    }

    .sc-map {
        grid-row: 2;
        border-top: 1px solid var(--sc-line);
        border-bottom: 1px solid var(--sc-line);
    }

    .sc-head,
    .sc-map,
    .sc-list,
    .sc-empty {
        grid-column: 1;
    }

    .sc-empty {
        grid-row: 4;
    }

    .sc-list {
        grid-row: 3;
    }

    .sc-list {
        max-height: 420px;
    }

    .sc-item {
        padding: 12px 18px;
    }

    .sc-legend {
        left: 12px;
        right: auto;
        top: 12px;
        bottom: auto;
        gap: 10px;
        padding: 6px 10px;
        font-size: 12px;
    }

    .sc-controls {
        right: 12px;
        top: 12px;
        bottom: auto;
    }

    .sc-controls button {
        width: 34px;
        height: 34px;
    }

    .sc-card {
        top: auto;
        left: 10px;
        right: 10px;
        bottom: 10px;
        width: auto;
        max-height: 56%;
        padding: 14px 16px 12px;
    }

    .sc-card-title {
        font-size: 22px;
        margin-bottom: 6px;
    }

    .sc-card-section {
        padding: 10px 0;
    }

    .sc-card-label {
        margin-bottom: 6px;
    }

    .sc-avatar {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }

    .sc-people {
        gap: 6px;
    }

    .sc-deps-list li {
        padding: 3px 8px;
        font-size: 13px;
    }

    .sc-card-text {
        font-size: 15px;
        margin-bottom: 10px;
    }

    .sc-card {
        max-height: 66%;
    }

    .sc-cta {
        height: 40px;
        font-size: 14px;
    }

    .sc-people--contact {
        margin-bottom: 8px;
    }

    .sc-mail + .sc-mail {
        margin-top: 6px;
    }

    .sc-copy {
        height: 30px;
    }

    .sc-drom-box text {
        font-size: 9.5px;
        letter-spacing: 0;
    }

    .sc-marker text {
        display: none;
    }

    .sc-marker.is-active text {
        display: block;
    }
}

@media (max-width: 900px) {
    .sc-choices {
        margin: 0 -16px;
    }

    /* Integree, la liste s'affiche en entier : un seul defilement, celui de la page */
    .is-embed .sc-list {
        max-height: none;
        overflow: visible;
    }
}

/* Tablette : carte plus haute et liste sur deux colonnes */
@media (min-width: 601px) and (max-width: 900px) {
    .segur-carte {
        grid-template-rows: auto 600px auto auto;
    }

    .sc-list {
        display: grid;
        grid-template-columns: 1fr 1fr;
        align-content: start;
        max-height: none;
        overflow: visible;
    }

    .sc-list-sep,
    .sc-more-row {
        grid-column: 1 / -1;
    }

    .sc-marker text {
        display: block;
    }

    .sc-more-row {
        justify-self: center;
        width: min(420px, 100%);
    }
}

/* Petite tablette paysage / fenetre etroite : panneau plus compact */
@media (min-width: 901px) and (max-width: 1100px) {
    .segur-carte {
        grid-template-columns: 290px 1fr;
    }

    .sc-head {
        padding: 22px 20px 16px;
    }

    .sc-item {
        padding: 11px 20px;
    }
}

@media (max-width: 480px) {
    .sc-legend li:last-child {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .segur-carte * {
        animation: none !important;
        transition: none !important;
    }
}
