/* **************************************** */
/* * Page and map workspace */
/* **************************************** */
.interactive-map-page { max-width: 1680px; margin: 0 auto; padding: 22px 24px 36px; color: #173047; }
.interactive-map-page [hidden], .map-popup [hidden] { display: none !important; }
.map-page-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.map-breadcrumb { margin: 0 0 10px; font-size: 13px; color: #536675; }
.map-page-heading h1 { margin: 0 0 8px; font-size: clamp(25px, 2.5vw, 36px); line-height: 1.2; }
.map-page-heading p:last-child { margin: 0; }
.map-text-link { color: #146594; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.map-workspace { display: grid; grid-template-columns: 310px minmax(0, 1fr); border: 1px solid #d5dfe5; border-radius: 12px; overflow: hidden; background: #fff; box-shadow: 0 8px 24px #14324d0d; }
.map-sidebar { height: min(820px, calc(100dvh - 200px)); min-height: 560px; overflow-y: auto; background: #fff; }
.map-sidebar section { padding: 19px; border-bottom: 1px solid #e3e9ed; }
.map-sidebar h2 { margin: 0 0 9px; font-size: 17px; }
.map-sidebar p { line-height: 1.5; }
.map-sidebar button, .map-sidebar input { font: inherit; }
.map-small { font-size: 12px; color: #546878; margin: 8px 0 12px; }
.map-selected-panel { border-left: 4px solid #d71920; background: #fff9f9; }
#mapSelectedName { font-weight: 700; margin: 0; }
#mapSelectionLink { display: inline-block; font-size: 12px; margin-top: 12px; }
.map-button-row { display: flex; flex-wrap: wrap; gap: 7px; }
.map-button-row button, .map-export-button { padding: 9px 11px; border: 1px solid #bbcbd6; border-radius: 6px; background: #fff; color: #173047; font-size: 12px; font-weight: 600; cursor: pointer; }
.map-sidebar button:disabled { opacity: .45; cursor: default; }
.map-sidebar button:focus-visible, .map-sidebar input:focus-visible, .map-popup a:focus-visible { outline: 3px solid #166b9c; outline-offset: 3px; }
.map-panel { position: relative; min-width: 0; }
#boundaryExplorer { height: 100%; min-height: 560px; background: #dde7e7; }
.map-status { position: absolute; bottom: 30px; left: 50%; transform: translateX(-50%); z-index: 800; max-width: 85%; width: max-content; padding: 8px 12px; margin: 0; border-radius: 5px; background: #fffffff2; color: #173047; box-shadow: 0 2px 8px #0002; font-size: 12px; pointer-events: none; }
.map-route-error { padding: 14px; border: 1px solid #d71920; border-radius: 6px; }

/* **************************************** */
/* * Layer controls and source notes */
/* **************************************** */
#mapLayerList { list-style: none; padding: 0; margin: 12px 0 0; }
.map-layer-row { display: grid; grid-template-columns: 18px minmax(0, 1fr) 27px 22px; align-items: center; gap: 7px; padding: 10px 6px; margin: 6px 0; border: 1px solid #dbe3e9; border-radius: 7px; background: #fff; }
.map-layer-row.ui-sortable-helper { box-shadow: 0 6px 20px #1234; }
.map-layer-handle { cursor: grab; touch-action: none; color: #778996; border: 0; background: none; padding: 0; }
.map-layer-label { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; cursor: pointer; }
.map-layer-toggle { accent-color: #1968b3; margin: 0; width: 15px; height: 15px; }
.map-layer-colour { width: 27px; height: 25px; padding: 1px; border: 1px solid #bbcbd6; border-radius: 4px; cursor: pointer; background: #fff; }
.map-layer-move { display: grid; gap: 1px; }
.map-layer-move button { border: 0; background: #edf2f5; color: #173047; cursor: pointer; padding: 0 4px; line-height: 17px; }
.map-layer-status { grid-column: 2 / -1; color: #607380; font-size: 11px; }
.map-export-button { width: 100%; background: #edf2f5; }
.map-source-notes { padding: 19px; font-size: 12px; color: #546878; }
.map-source-notes summary { cursor: pointer; font-weight: 600; color: #173047; }

/* **************************************** */
/* * Key and boundary popup */
/* **************************************** */
.map-key { background: #fffffff5; padding: 12px 14px; border-radius: 7px; box-shadow: 0 2px 10px #0002; max-width: 225px; color: #173047; font-size: 12px; }
.map-key strong { display: block; margin-bottom: 7px; font-size: 13px; }
.map-key ul { list-style: none; padding: 0; margin: 0; }
.map-key li { display: flex; align-items: center; gap: 9px; margin: 6px 0; line-height: 1.35; }
.map-key-line { display: block; width: 24px; min-width: 24px; border-top: 3px solid; }
.map-key-area { border-top-style: dashed; border-color: #172d3e; }
.map-popup { color: #173047; padding: 2px; }
.map-popup h2 { font-size: 19px; line-height: 1.2; margin: 6px 0 8px; }
.map-popup p { margin: 7px 0; }
.map-popup-type, .map-popup-reference { font-size: 11px; color: #536675; }
.map-popup-status { font-size: 12px; }
.map-popup-actions { display: grid; gap: 7px; margin: 12px 0; }
.map-popup-actions a { display: flex; align-items: center; gap: 7px; border: 1px solid #c5d4df; border-radius: 5px; padding: 10px; color: #125f8c; text-decoration: none; font-weight: 600; }
.map-popup-actions .map-popup-download { background: #173c57; color: #fff; border-color: #173c57; }
.map-popup-link { font-size: 11px; }
.leaflet-draw-tooltip { max-width: 230px; white-space: normal; }

/* **************************************** */
/* * Smaller screens */
/* **************************************** */
@media (max-width: 900px) {
    .interactive-map-page { padding: 15px 12px 25px; }
    .map-page-heading { display: block; }
    .map-page-heading > a { display: inline-block; margin-top: 12px; font-size: 13px; }
    .map-workspace { grid-template-columns: 260px minmax(0, 1fr); }
    .map-sidebar section { padding: 15px; }
}
@media (max-width: 650px) {
    .map-workspace { display: flex; flex-direction: column; }
    .map-panel { order: -1; }
    #boundaryExplorer { height: 62dvh; min-height: 380px; }
    .map-sidebar { height: auto; min-height: 0; overflow: visible; }
    .map-key { max-width: 160px; padding: 9px; font-size: 11px; }
    .map-status { bottom: 36px; font-size: 11px; }
}
