﻿/* =========================
   Base Layout
   ========================= */

html,
body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;	
}

/* Mobile can scroll normally */
@media (max-width: 768px) {
html,
body {
overflow-y: auto;
overflow-x: hidden;
}
}

/* Header + feedback banner heights */
:root {
    --header-height: 80px;
    --banner-height: 28px;
    --divider-height: 2px;
    --footer-height: 32px;	
    --chrome-height: calc(
        var(--header-height) +
        var(--banner-height) +
        var(--divider-height) +
	var(--footer-height)
    );
}

/* Main map container */
#mapContainer {
    display: flex;
    flex-direction: column;

    height: max(
        300px,
        calc(100vh - var(--chrome-height))
    );

    transition: height 0.5s ease;
}

/* Map */
#map {
    width: 100%;
    height: 100%;
    z-index: 1;

    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.5);

    transition: height 0.5s ease;
}

.nhsuk-phase-banner__content {
    margin-bottom: 0.25rem!important;
}
.phase-banner-divider {
    border-bottom: 2px solid #005eb8;
}

/* Table panel */
#table {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease;
}

/* Table expanded */
#mapContainer.show-table #map {
    height: 50%;
}

#mapContainer.show-table #table {
    max-height: 50%;
    overflow: auto;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    #mapContainer,
    #map,
    #table {
        transition: none;
    }
}

/* Mobile adjustments */
@media (max-width: 768px) {
    :root {
        --header-height: 98px;
        --banner-height: 36px;
    }

    #mapContainer {
        height: max(
            300px,
            calc(100vh - var(--chrome-height))
        );
    }
}

/* =========================
   General Map Styling
   ========================= */

.custom-tooltip {
    opacity: 0.75;
}

.leaflet-popup-content-wrapper {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
    line-height: 21px;
    font-weight: 500;
    background-color: whitesmoke;
    opacity: 0.75;
    color: black;
    text-align: center;
    border-radius: 0;
}

.leaflet-popup-tip {
    background-color: whitesmoke;
    opacity: 0.75;
}

.Legend {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
    line-height: 21px;
    font-weight: 500;
    background-color: grey;
    opacity: 0.75;
    color: black;
    text-align: left;
    border-radius: 0;
    padding: 10px;
    max-width: 240px;
}

.Legend i {
    width: 18px;
    height: 2px;
    float: left;
    margin-top: 8px;
    margin-right: 8px;
    opacity: 1;
    border-radius: 0%;
}

.intersect-alert {
    opacity: 0.75;
}

/* =========================
   Leaflet Geocoder Overrides
   ========================= */
     /* Control.Geocoder.css overrides */
      .leaflet-control-geocoder-error {
        padding-bottom: 5px;
    }
    .leaflet-control-geocoder-alternatives {
        max-height: 300px;
        overflow: hidden;
        overflow-y: auto;
    }
    .leaflet-control-geocoder-alternatives li {
        white-space: normal;
    }

.leaflet-control-zoom-in,
.leaflet-control-zoom-out {
  width: 48px!important;
  height: 48px!important;
  line-height: 48px!important;
  text-align: center;
  font-size: 18px;
  background-color: #fff;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.65);
}
.leaflet-control-zoom-in:focus,
.leaflet-control-zoom-out:focus {
  background: #ffeb3b !important;
  box-shadow: 0 4px 0 #212b32!important;
  color: #212b32!important;
}
.leaflet-control-zoom-in:hover,
.leaflet-control-zoom-out:hover {
  background-color: #f0f0f0;
}

button.leaflet-control-geocoder-icon {
  width: 40px !important;
  height: 40px !important;
  display: flex;
  align-items: center;
  justify-content: center;
}
a
.leaflet-control-geocoder-form input {
  font-size: 1rem;
  line-height: 1.5;
  height: 40px;                 /* NHS default input height */
  padding: 4px 8px;
  border: 1px solid #aeb7bd;    /* NHS grey border */
  border-radius: 4px;
  color: #0b0c0c;
  background: #fff;
  box-sizing: border-box;
  width: auto;
}

.leaflet-control-geocoder .leaflet-control-geocoder-form input {
    font-size: 1rem !important;
}

.leaflet-control-geocoder-form input:focus {
  border: 2px solid #212b32;
  box-shadow: inset 0 0 0 2px;
  outline: 4px solid #ffeb3b;
  outline-offset: 0;

  /* keep layout stable */
  height: 40px;            /* same height as unfocused */
  font-size: 1rem;
  line-height: 1.5;
}

.leaflet-control-layers-selector {
  width: 20px;
  height: 20px;
  cursor: pointer;
  margin: 0 5px 0 0;
  vertical-align: middle;
}
.leaflet-control-layers-selector + span {
  font-size: 1.1875rem;
  line-height: 1.47368;
}

.leaflet-control-layers-selector:checked {
  outline: 2px solid #ffeb3b;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}
.geo-close-icon{
  border-radius: 4px;
  height: 34px;
  width: 34px;
  border: none;
  background-color:rgb(255, 255, 255);
  background-image: url('data:image/svg+xml, <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" focusable="false" height="34" width="34"><path d="M13.41 12l5.3-5.29a1 1 0 1 0-1.42-1.42L12 10.59l-5.29-5.3a1 1 0 0 0-1.42 1.42l5.3 5.29-5.3 5.29a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l5.29-5.3 5.29 5.3a1 1 0 0 0 1.42 0 1 1 0 0 0 0-1.42z"></path></svg>');
  background-repeat: no-repeat;
  background-position: center;
  cursor: pointer;
}
.geo-close-icon:focus {
  background-color: #ffeb3b !important;
  box-shadow: 0 4px 0 #212b32!important;
  color: #212b32!important;
}
.geo-close-icon:hover {
  background-color: #f0f0f0;
}
.leaflet-control-geocoder-alternatives {
  position: absolute !important;
  z-index: 9999;
  background: white;
  border: 1px solid #ccc;
  width: 300px; /* Match the width of leaflet-control-geocoder */
}

/* Hide native clear button in WebKit browsers */
.leaflet-control-geocoder input[type="search"]::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
}

/* We’re driving searches from #postcode, so hide the geocoder’s form UI */
#postcode-group .leaflet-control-geocoder .leaflet-control-geocoder-form {
    display: none;
}

/* If you later decide to show it, these make it look native in the panel */
#postcode-group .leaflet-control-geocoder {
    width: 100%;
    box-shadow: none;
    border: 0;
    background: transparent;
    overscroll-behavior: contain;
}

#postcode-geocoder {
    width: 100%;
    max-width: 300px;
}

/* =========================
   Leaflet Controls
   ========================= */

.leaflet-control-zoom-in,
.leaflet-control-zoom-out {
    width: 48px !important;
    height: 48px !important;
    line-height: 48px !important;
    text-align: center;
    font-size: 18px;
    background-color: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.65);
}

.leaflet-control-zoom-in:focus,
.leaflet-control-zoom-out:focus {
    background: #ffeb3b !important;
    box-shadow: 0 4px 0 #212b32 !important;
    color: #212b32 !important;
}

.leaflet-control-zoom-in:hover,
.leaflet-control-zoom-out:hover {
    background-color: #f0f0f0;
}

.leaflet-control-layers-selector {
    width: 20px;
    height: 20px;
    cursor: pointer;
    margin: 0 5px 0 0;
    vertical-align: middle;
}

.leaflet-control-layers-selector + span {
    font-size: 1.1875rem;
    line-height: 1.47368;
}

.leaflet-control-layers-selector:checked {
    outline: 2px solid #ffeb3b;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}

.leaflet-control-layers label {
    display: flex;
    align-items: center;
    gap: .4em;
    line-height: 1.25;
}

.leaflet-control.info {
    background: rgba(255, 255, 255, 0.75);
    padding: 12px;
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    z-index: 1000;
    max-width: 300px;
}

.leaflet-control-layers-group-label {
    padding: 4px;
    display: block;
    border-bottom: 1px solid #ccc;
}

.leaflet-control-layers-group-name {
    font-size: 1.1875rem;
    line-height: 1.47368;
    font-weight: 600;
}


@media (max-width: 768px) {
    .leaflet-control-layers-expanded {
        max-height: 40vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 768px) {
    #leaflet-slidemenu-panel {
        width: 70vw !important;
        max-width: 280px !important;
    }
}


/* =========================
   Layer Control Slot
   ========================= */

#layers-control-slot {
    max-height: 50vh;
    overflow: auto;
}

#layers-control-slot .leaflet-control-layers {
    width: 100%;
    max-width: none;
    box-shadow: none;
    border: 0;
    background: transparent;
    font: inherit;
    color: inherit;
    padding: 0;
}

#layers-control-slot .leaflet-control-layers-base,
#layers-control-slot .leaflet-control-layers-overlays {
    margin: 0;
    padding: 0;
}

#layers-control-slot .leaflet-control-layers-separator {
    height: 1px;
    margin: 12px 0;
    background: #d8dde0;
    border: 0;
}

#layers-control-slot .leaflet-control-layers-list {
    margin: 0;
    padding: 0;
}

#layers-control-slot .leaflet-control-layers-selector {
    margin-right: 8px;
}

#layers-control-slot .leaflet-control-layers label {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 0;
    margin: 0;
    cursor: pointer;
    border-bottom: 1px solid #f0f4f5;
}

#layers-control-slot .leaflet-control-layers-base label:last-child,
#layers-control-slot .leaflet-control-layers-overlays label:last-child {
    border-bottom: 0;
}

#layers-control-slot .leaflet-control-layers label span {
    font-size: 1rem;
    line-height: 1.5;
}

#layers-control-slot .leaflet-control-layers-expanded {
    padding: 0;
    margin: 0;
    background: transparent;
    box-shadow: none;
    border-radius: 0;
}

#layers-control-slot .leaflet-control-layers label:hover {
    background: #f8f8f8;
}

/* =========================
   Header / Logo
   ========================= */

.nhsuk-header__container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 1rem;
}

.app-header__service-name {
    color: #fff;
    font-size: 1.25rem;
    font-weight: 700;
}

.logo {
    display: inline-flex;
    align-items: center;
    background: #fff;
    padding: 4px 6px;
    border-radius: 4px;
    flex-shrink: 0;
}

.nhsuk-icon {
    vertical-align: middle;
    background-color: #edf4fa;
}

@media (max-width: 768px) {
    .nhsuk-header__container {
        flex-wrap: wrap;
    }

    #postcode-geocoder {
        flex: 1 1 100%;
        margin-top: .5rem;
    }
}

/* =========================
   Icons / Buttons
   ========================= */

.legend-svg {
    width: 1.35em;
    height: 1.35em;
    display: inline-block;
    transform: translateY(1px);
    flex: 0 0 auto;
}

.geo-close-icon {
    border-radius: 4px;
    height: 34px;
    width: 34px;
    border: none;
    background-color: rgb(255, 255, 255);
    background-image: url('data:image/svg+xml, <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" focusable="false" height="34" width="34"><path d="M13.41 12l5.3-5.29a1 1 0 1 0-1.42-1.42L12 10.59l-5.29-5.3a1 1 0 0 0-1.42 1.42l5.3 5.29-5.3 5.29a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l5.29-5.3 5.29 5.3a1 1 0 0 0 1.42 0 1 1 0 0 0 0-1.42z"></path></svg>');
    background-repeat: no-repeat;
    background-position: center;
    cursor: pointer;
}

.geo-close-icon:focus {
    background-color: #ffeb3b !important;
    box-shadow: 0 4px 0 #212b32 !important;
    color: #212b32 !important;
}

.geo-close-icon:hover {
    background-color: #f0f0f0;
}

.postcode-icon {
    background-color: #152F4D;
    border: 1px solid #152F4D;
    z-index: 2001 !important;
}

.nhsuk-map-button {
    height: 48px !important;
    width: 48px !important;
    margin-bottom: 0 !important;
    min-height: 0 !important;

    padding-top: 10px !important;
    padding-bottom: 0 !important;

    display: flex;
    align-items: center;
    justify-content: center;

    box-sizing: border-box;
    line-height: 1 !important;
}

/* =========================
   Spinner / Status
   ========================= */

.nhs-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 60px;
    height: 60px;
    margin-left: -30px;
    margin-top: -30px;
    border: 6px solid #d8dde0;
    border-top-color: #005eb8;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: none;
    z-index: 9999;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid #d8dde0;
    border-top-color: #005eb8;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.status,
#status,
#popinfo {
    position: absolute;
    z-index: 1000;
    background: #ffffff;
    color: #1f2937;
    border: 1px solid rgba(0,0,0,.08);
    box-shadow: 0 2px 10px rgba(0,0,0,.12);
}

.status {
    bottom: 15px;
    left: 15px;

    display: flex;
    align-items: center;
    gap: 8px;

    padding: 8px 12px;

    background: rgba(255,255,255,0.95);
    border: 1px solid #d8dde0;
    border-radius: 4px;

    font-size: 0.9rem;
    font-weight: 600;
    color: #005eb8;
}

#status,
#popinfo {
    left: 60px;
    bottom: 15px;

    padding: 8px 10px;
    border-radius: 6px;

    font: 14px/1.35 system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji";
}

#status.status--pulse {
    animation: statusPulse 0.6s ease;
}

@keyframes statusPulse {
    from {
        transform: scale(0.98);
        opacity: 0.6;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.status--hidden {
    display: none;
}

.popinfo {
    display: none;
}

/* =========================
   Accessibility Utility
   ========================= */

.visually-hidden:not(:focus):not(:active) {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    clip-path: inset(50%) !important;
    border: 0 !important;
    white-space: nowrap !important;
}

/* =========================
   Sidebar / Map Layout
   ========================= */

.map-layout {
    display: flex;
    flex-direction: row;

    height: calc(
        100vh -
        var(--chrome-height)
    );

    overflow: hidden;
}

.side-panel {
    width: clamp(300px, 30vw, 400px);
    flex-shrink: 0;
    background: #fff;
    border-right: 1px solid #d8dde0;

    display: flex;
    flex-direction: column;

    height: 100%;
    min-height: 0;
}

.side-panel__header {
    padding: 16px;
    border-bottom: 1px solid #d8dde0;
    flex-shrink: 0;
}

.side-panel__content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 16px;
}

.map-container {
    flex: 1;
    min-width: 0;
    height: 100%;
}

@media (max-height: 800px) {
    .side-panel {
        overflow-y: auto;
    }

    .side-panel__content {
        flex: none;
        overflow-y: visible;
    }

    .pcn-practices-details {
        font-size: 0.85rem;
    }
}

@media (max-width: 768px) {
    .map-layout {
        display: flex;
        flex-direction: column;
        height: auto;
        overflow: visible;
    }

    .side-panel {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid #d8dde0;
    }

    .side-panel__content {
        overflow: visible;
    }

    .map-container {
        width: 100%;
        flex: none;
    }

    #map {
        width: 100%;
        height: 500px;
        min-height: 500px;
    }

    .slidemenu {
        width: 100% !important;
        max-width: 100% !important;
        left: 0 !important;
        right: 0 !important;
    }
}

/* =========================
   Sidebar Panels / Text
   ========================= */

.panel-inner h5 {
    margin-top: 12px;
    margin-bottom: 6px;
    font-weight: 600;
}

.panel-inner p {
    margin-bottom: 12px;
    font-size: 0.95rem;
}

.pcn-selector {
    width: 100%;
    margin-bottom: 1rem;
}

.pcn-selector .nhsuk-label {
    display: block;
}

#pcnSelect {
    width: 100%;
    max-width: none;
    box-sizing: border-box;
}

.pcn-practices-details {
    font-size: 0.9rem;
}

.gp-map-link i {
    margin-left: 8px;
    font-size: 0.7rem;
}

/* =========================
   Charts / Population Panels
   ========================= */

.chart-wrap-pyramid {
    position: relative;
    height: 320px;
    margin-bottom: 16px;
}

.chart-wrap {
    position: relative;
    height: 260px;
    margin-bottom: 20px;
    background: #fff;
    border: 1px solid #d8dde0;
    padding: 12px;
    border-radius: 6px;
}

.population-headline {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.population-headline .stat {
    padding: 1rem;
    background: #f0f4f5;
    border-left: 4px solid #005eb8;
}

.population-headline .label {
    display: block;
    font-size: 0.75rem;
    color: #4c6272;
    margin-bottom: 0.25rem;
}

.population-headline .value {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    color: #212b32;
}

.monthly-population-container {
    height: 320px;
    position: relative;
}

.monthly-population-container canvas {
    width: 100% !important;
    height: 100% !important;
}

.value.positive {
    color: #007f3b;
}

.value.negative {
    color: #d5281b;
}

.information-title {
    margin-top: 2rem;
}

.popInfo .nhsuk-inset-text {
    margin: 0;
    padding-top: 0;
    padding-bottom: 0;
}

@media (max-width: 768px) {
    .population-headline {
        grid-template-columns: 1fr;
    }

    .monthly-population-container {
        height: 360px;
    }
}

/* =========================
   Legend Content
   ========================= */

.legend-major-title {
    margin: 0.5rem 0 1rem;
    padding-bottom: 0.4rem;

    border-bottom: 3px solid #005eb8;

    color: #005eb8;
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.3;
}

.legend-section-title {
    margin: 1.5rem 0 0.75rem;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid #d8dde0;
    color: #005eb8;
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.3;
}

.legend-subsection-title {
    margin: 1rem 0 0.5rem;
    font-size: 1rem;
    font-weight: 700;
    color: #212b32;
    line-height: 1.3;
}

.legend-description,
.legend-note,
.practiceList-note {
    font-size: 0.875rem;
    line-height: 1.5;
    color: #4c6272;
    margin-bottom: 0.75rem;
}

.legend-list {
    margin-bottom: 1.25rem;
}

.legend-list li {
    font-size: 0.875rem;
    line-height: 1.5;
    margin-bottom: 0.75rem;
}

.legend-symbol {
    flex-shrink: 0;
}

/* Point symbols */
.legend-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    color: #fff;
    font-size: 12px;
}

.legend-icon-main {
    background: #A93226;
}

.legend-icon-branch {
    background: #1d70b8;
}

.gp-nonmember-inside {
    background: #ffb81c;
}

.gp-nonmember-outside {
    background: #007f3b;
}

/* Polygon / boundary symbols */
.legend-box {
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-top: 2px;
}

/* GP boundaries */
.boundary-default {
    background: rgba(255,190,232,0.35);
    border: 2px solid #8400A8;
}

.boundary-selected {
    background: rgba(0,255,255,0.35);
    border: 2px solid #00FFFF;
}

/* PCN layers */
.pcn-dissolved {
    background: rgba(70,130,180,0.3);
    border: 2px solid steelblue;
}

.pcn-footprint {
    background: rgba(0,94,184,0.08);
    border: 3px dashed #005eb8;
}

/* Population settlement scale */
.population-high {
    background: #08519c;
}

.population-low {
    background: #c6dbef;
}

/* Circle symbols */
.legend-circle {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    margin-top: 2px;
}

.population-inside {
    background: #a3c990;
    border: 2px solid #14611d;
}

.population-outside {
    background: #a3bbc3;
    border: 2px solid #0062ac;
}

/* =========================
   Floating Legend
   ========================= */

.legend.legend--br {
    position: absolute;
    right: 10px;
    bottom: 40px;
    z-index: 1200;
    width: 184px;
    max-width: calc(100vw - 20px);
    background: #ffffff;
    color: #1f2937;
    border: 1px solid rgba(0,0,0,.08);
    border-radius: 6px;
    box-shadow: 0 2px 10px rgba(0,0,0,.12);
    padding: 8px 10px;
    font: 13px/1.35 system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans";
}

.legend__toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    padding: 0;
    background: transparent;
    border: 0;
    cursor: pointer;
    color: inherit;
    font: inherit;
}

.legend__title {
    font-weight: 600;
}

.legend__chevron {
    transition: transform .18s ease;
}

.legend__body {
    margin-top: 8px;
    display: grid;
    gap: 6px;
    max-height: 40vh;
    overflow: auto;
    transition: opacity .18s ease;
}

.legend__item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.legend__hex {
    width: 16px;
    height: 10px;
    border: 1px solid rgba(0,0,0,.15);
    border-radius: 2px;
    flex: 0 0 16px;
}

.legend__label {
    font-size: 12px;
    color: #374151;
}

.legend--collapsed .legend__body {
    display: none;
}

.legend--collapsed .legend__chevron {
    transform: rotate(-90deg);
}

.legend--hidden {
    display: none;
}

@media (prefers-color-scheme: dark) {
    .legend.legend--br {
        color: #0a0a0a;
        border-color: rgba(255,255,255,.12);
        box-shadow: 0 2px 10px rgba(0,0,0,.5);
    }

    .legend__label {
        color: #060606;
    }

    .legend__hex {
        border-color: rgba(255,255,255,.2);
    }
}

@media (max-width: 480px) {
    .legend.legend--br {
        right: 8px;
        bottom: 8px;
        width: 200px;
    }

    .legend__body {
        max-height: 32vh;
    }
}

/* =========================
   Tooltips
   ========================= */

.leaflet-fade-anim .leaflet-tooltip {
    transition: opacity 120ms ease, transform 120ms ease;
}

.leaflet-tooltip.donut-tooltip {
    pointer-events: none;
    background: rgba(30, 30, 30, 0.85);
    color: #fff;
    border: 0;
    border-radius: 4px;
    padding: 6px 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,.25);
    opacity: 0;
    transform: translateY(-2px);
}

.leaflet-tooltip.donut-tooltip.is-visible {
    opacity: 0.75;
    transform: translateY(0);
}

.donut-popup__line {
    font-size: 12px;
    line-height: 1.2;
}

.donut-popup__sub {
    font-size: 11px;
    opacity: 0.9;
    margin-top: 2px;
}

.leaflet-tooltip.popup-like-tooltip {
    background: #fff;
    border: 1px solid #d8dde0;
    border-radius: 6px;
    padding: 8px 10px;
    color: #0b0c0c;
    box-shadow: 0 2px 10px rgba(0,0,0,.08);
    max-width: 360px;
}

.leaflet-tooltip-top.popup-like-tooltip::before {
    border-top-color: #d8dde0;
}

.leaflet-tooltip-top.popup-like-tooltip::after {
    border-top-color: #fff;
}

/* =========================
   Info / Route Panels
   ========================= */

.info-panel,
#route-panel {
    position: absolute;
    display: none;
    left: 62px;

    overflow: auto;

    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(2px);
    border: 2px solid rgba(0,0,0,0.2);
    border-radius: 10px;
    padding: 12px;
    background-clip: padding-box;

    z-index: 2000;

    box-shadow:
        0 6px 18px rgba(0, 0, 0, 0.18),
        0 1px 3px rgba(0, 0, 0, 0.08);
}

.info-panel {
    top: 170px;
    max-width: 450px;
    max-height: calc(60% - 40px);
}

#route-panel {
    top: 230px;
    max-width: 380px;
    max-height: calc(60% - 40px);
}

#route-panel .panel-inner {
    padding: 4px 4px 2px 4px;
}

@media (max-width: 640px) {
    #route-panel {
        left: 10px;
        right: 10px;
        bottom: 10px;
        max-width: none;
        max-height: 55vh;
    }
}

/* =========================
   Route Modes
   ========================= */

.route-mode {
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    margin: 10px 0;
    background: #fff;
    overflow: hidden;
}

.route-mode-summary {
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    list-style: none;
    font-size: 1rem;
}

.route-mode-summary::-webkit-details-marker {
    display: none;
}

.route-mode-summary .chevron {
    width: 12px;
    height: 12px;
    background-repeat: no-repeat;
    background-position: center;
    background-size: 12px 12px;
    margin-left: auto;
    transition: transform .2s ease;
    background-image: url("data:image/svg+xml;utf8,<svg fill='%23ADADAD' xmlns='http://www.w3.org/2000/svg' width='20' height='20'><path d='M14.1671 7.64166C14.0109 7.48646 13.7997 7.39934 13.5796 7.39934C13.3594 7.39934 13.1482 7.48646 12.9921 7.64166L10.0004 10.5917L7.0504 7.64166C6.89427 7.48646 6.68306 7.39934 6.4629 7.39934C6.24275 7.39934 6.03154 7.48646 5.8754 7.64166C5.7973 7.71913 5.7353 7.8113 5.693 7.91285C5.65069 8.0144 5.62891 8.12332 5.62891 8.23333C5.62891 8.34334 5.65069 8.45226 5.693 8.55381C5.7353 8.65536 5.7973 8.74753 5.8754 8.825L9.40874 12.3583C9.48621 12.4364 9.57837 12.4984 9.67992 12.5407C9.78147 12.583 9.89039 12.6048 10.0004 12.6048C10.1104 12.6048 10.2193 12.583 10.3209 12.5407C10.4224 12.4984 10.5146 12.4364 10.5921 12.3583L14.1671 8.825Z'/></svg>");
}

.route-mode[open] .chevron {
    transform: rotate(180deg);
}

.route-mode-body {
    border-top: 1px solid #eee;
    padding: 12px 14px 14px;
}

.route-mode-body .nhsuk-list {
    margin-top: 8px;
}

.route-summary-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 120px;
}

.route-summary-right {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.route-badge {
    display: inline-block;
    border-radius: 2px;
    padding: 2px 6px;
    font-size: 12px;
    line-height: 1.2;
    font-weight: 600;
}

.route-badge.badge-walking {
    background: #4CAF50;
    color: #FFFFFF;
}

.route-badge.badge-cycling {
    background: #FF9800;
    color: #1A1A1A;
}

.route-badge.badge-driving {
    background: #1565C0;
    color: #FFFFFF;
}

.route-badge.badge-public_transport {
    background: #8E24AA;
    color: #FFFFFF;
}

.time-row {
    display: flex;
    gap: 16px;
    font-size: 14px;
    margin-bottom: 8px;
}

.micro {
    margin-left: 18px;
    font-size: 0.85rem;
    color: #4C6272;
}

.step {
    cursor: pointer;
}

.step:focus {
    outline: 2px solid #0b0c0c;
    outline-offset: 2px;
}

.nhs-mode-summary.mode-disabled {
    opacity: 0.55;
}

.mode-toggle {
    width: 18px;
    height: 18px;
    accent-color: #005EB8;
}

/* =========================
   NHS Details / Route Summary
   ========================= */

.summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.summary-left {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.summary-right {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.route-title-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.mode-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.summary-stack {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 100%;
}

.summary-line {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.summary-top .route-title {
    font-weight: 700;
    color: #0b0c0c;
}

.summary-sub {
    font-size: 0.95rem;
    color: #4C6272;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 360px) {
    .summary-sub {
        white-space: normal;
        text-overflow: clip;
    }
}

.modes-container {
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    gap: 8px;
    overflow-x: auto;
    padding: 4px 0;
}

.mode-popup-div {
    display: inline-block !important;
    margin: 4px 6px;
    text-align: center;
    vertical-align: top;
}

/* =========================
   Alert Banners
   ========================= */

.alert-banner {
    position: relative;
    width: 100%;
    padding: 8px 12px;
    font-weight: 600;
    font-family: system-ui, Segoe UI, Arial, sans-serif;
    text-align: center;
    border-bottom: 2px solid transparent;
    z-index: 1000;
}

.alert-banner--inside {
    background: #e6f4ea;
    color: #1e7e34;
    border-color: #1e7e34;
}

.alert-banner--outside {
    background: #fdecea;
    color: #a31621;
    border-color: #a31621;
}

.map-has-overlay-banner .alert-banner {
    position: absolute;
    top: 0;
    left: 0;
}

/* =========================
   Phase Banner / Footer
   ========================= */

.nhsuk-phase-banner__text {
    font-size: 0.85rem;
    line-height: 1.4;
}

.nhsuk-phase-banner .nhsuk-tag {
    font-size: 0.75rem;
}

.nhsuk-phase-banner__content {
    margin-bottom: 0.5rem;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    list-style: none;
    margin: 0 0 12px 0;
    padding: 0;
}

.footer-links li:not(:last-child)::after {
    content: "|";
    margin: 0 10px;
    color: #768692;
}

.footer-links a {
    text-decoration: none;
}

.footer-links a:hover {
    text-decoration: underline;
}

.nhsuk-footer__list-item {
    margin-right: 0 !important;
}


.map-legend {
    background: #ffffff;
    padding: 12px;
    border: 2px solid #d8dde0;
    font-size: 0.9rem;
}

.catchment-zero,
.catchment-one {
   display: inline-block;
    width: 16px;
    height: 16px;
    margin-top: 2px;
}

.catchment-zero {
    background-color: rgba(213, 40, 27, 0.45);
    border: 2px solid #d5281b;
}

.catchment-one {
    background-color: rgba(255, 184, 28, 0.45);
    border: 2px solid #ffb81c;
}


.neighbouring-pcn-boundary {
    display: inline-block;
    width: 40px;
    height: 0;
    border-top: 2px solid #00796b;
    vertical-align: middle;
}
