/* Communications map overlay: electricity, gas and surface-specific roads. */
.leaflet-pane.zf-communication-roads-pane { z-index: 510; }
.leaflet-pane.zf-communication-gas-pane { z-index: 515; }
.leaflet-pane.zf-communication-electricity-pane { z-index: 520; }
.leaflet-pane.zf-communication-drawing-pane { z-index: 540; }

.zf-electrical-pole-marker {
    box-sizing: border-box;
    border: 0;
    border-radius: 50%;
    background: #111111;
    cursor: grab;
}
.zf-electrical-pole-marker:active { cursor: grabbing; }
.zf-electrical-vertex-marker {
    box-sizing: border-box;
    border: 2px solid #161616;
    border-radius: 3px;
    background: #ffffff;
    box-shadow: 0 0 0 1px #ffffff;
    cursor: move;
}
.land-leaflet-map.is-electrical-drawing,
.land-leaflet-map.is-electrical-drawing .leaflet-interactive { cursor: crosshair; }

.map-basemap-overlay-options {
    display: grid;
    gap: 3px;
    margin-top: 6px;
    padding: 9px 5px 3px;
    border-top: 1px solid #dce3da;
}
.map-basemap-overlay-options > strong {
    margin: 0 5px 5px;
    font-size: 12px;
    color: #526055;
}
.map-basemap-overlay-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 5px;
    border-radius: 7px;
    color: #18261d;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}
.map-basemap-overlay-option:hover { background: rgba(169,186,143,.17); }
.map-basemap-overlay-option input { width: 16px; height: 16px; margin: 0; accent-color: #638e36; }
.map-basemap-overlay-option:has(input:disabled) { opacity: .5; cursor: not-allowed; }
.map-basemap-overlay-option:has(input:disabled):hover { background: transparent; }

.map-legend .map-legend-communication[hidden] { display: none; }
.map-legend .map-legend-communication i {
    position: relative;
    flex: 0 0 30px;
    width: 30px;
    height: 14px;
    border: 0;
    border-radius: 0;
}
.map-legend .map-legend-electricity { background: linear-gradient(#111,#111) center/30px 1px no-repeat; }
.map-legend .map-legend-electricity::after {
    content: "";
    position: absolute;
    left: 13px;
    top: 5px;
    width: 3px;
    height: 3px;
    background: #111111;
    border-radius: 50%;
}
.map-legend .map-legend-gas { background: linear-gradient(#e1bf00,#e1bf00) center/30px 2px no-repeat; }
.map-legend .map-legend-asphalt { background: linear-gradient(#555b61,#555b61) center/30px 8px no-repeat; }
.map-legend .map-legend-gravel { background: linear-gradient(#b8bdc2,#b8bdc2) center/30px 8px no-repeat; }
.map-legend .map-legend-dirt { background: linear-gradient(#946946,#946946) center/30px 8px no-repeat; }

.map-electrical-edit-toggle {
    position: absolute;
    z-index: 760;
    top: 133px;
    left: 16px;
    max-width: calc(100% - 32px);
    padding: 10px 13px;
    border: 1px solid #d4e2d4;
    border-radius: 8px;
    background: rgba(255,255,255,.97);
    color: #28522c;
    font-size: 13px;
    font-weight: 650;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,.12);
}
.map-electrical-edit-toggle:hover { background: #f2f8ed; }
.map-electrical-panel {
    position: absolute;
    z-index: 1020;
    top: 133px;
    left: 16px;
    display: grid;
    gap: 12px;
    width: min(340px, calc(100% - 32px));
    max-height: calc(100dvh - 148px);
    overflow-y: auto;
    padding: 14px;
    border: 1px solid #d6e4d4;
    border-radius: 10px;
    background: rgba(255,255,255,.98);
    color: #263629;
    box-shadow: 0 8px 28px rgba(0,0,0,.18);
}
.map-electrical-panel[hidden] { display: none; }
.map-electrical-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.map-electrical-panel-head strong { font-size: 15px; }
.map-electrical-panel-head button {
    border: 0;
    background: transparent;
    font-size: 23px;
    line-height: 1;
    cursor: pointer;
}
.map-electrical-panel p,
.map-electrical-panel small { margin: 0; color: #536154; font-size: 12px; line-height: 1.45; }
.map-electrical-modes,
.map-electrical-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.map-electrical-modes button,
.map-electrical-actions button {
    min-height: 34px;
    padding: 6px 10px;
    border: 1px solid #cbd6cb;
    border-radius: 7px;
    background: #fff;
    color: #283b2c;
    font-size: 12px;
    cursor: pointer;
}
.map-electrical-modes button[aria-pressed="true"],
.map-electrical-actions button.is-primary {
    border-color: #5f8c31;
    background: #5f8c31;
    color: #fff;
}
.map-electrical-actions button:disabled { opacity: .45; cursor: not-allowed; }


/* Generic communication nodes scale with the map zoom and can use individual colors. */
.zf-communication-station-icon {
    box-sizing: border-box;
    border: 0;
    border-radius: 0;
    background: #808080;
    cursor: pointer;
}
.zf-communication-node-fill {
    display: block;
    width: 100%;
    height: 100%;
}
.zf-communication-station-icon:focus-visible { outline: 2px solid #5f8c31; outline-offset: 3px; }
@media (pointer: coarse) {
    /* Keep the requested visual size but make small map objects easier to tap. */
    .zf-communication-station-icon::after {
        content: "";
        position: absolute;
        left: 50%;
        top: 50%;
        width: 28px;
        height: 28px;
        transform: translate(-50%, -50%);
        background: rgba(0, 0, 0, .001);
    }
}
.zf-communication-station-icon.is-selected {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px #5f8c31;
}
.map-legend .map-legend-node::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 10px;
    width: 10px;
    height: 10px;
    background: #808080;
}

.map-communication-station-settings {
    display: grid;
    gap: 10px;
    padding: 12px;
    border: 1px solid #d6e4d4;
    border-radius: 8px;
    background: #f8faf7;
}
.map-communication-station-settings[hidden] { display: none; }
.map-communication-station-settings > strong { font-size: 13px; }
.map-communication-station-settings label {
    display: grid;
    gap: 4px;
    min-width: 0;
    font-size: 12px;
    font-weight: 600;
}
.map-communication-station-dimensions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}
.map-communication-station-settings input[type="number"],
.map-communication-station-settings input[type="color"],
.map-communication-station-settings textarea,
.map-communication-station-settings input[type="file"] {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    min-height: 34px;
    padding: 7px 8px;
    border: 1px solid #cbd6cb;
    border-radius: 6px;
    background: #ffffff;
    color: #263629;
    font: inherit;
}
.map-communication-station-settings input[type="color"] {
    padding: 3px;
    cursor: pointer;
}
.map-communication-station-settings textarea {
    min-height: 68px;
    resize: vertical;
    font-weight: 400;
}
.map-communication-station-settings input[type="file"] { font-size: 11px; }
.map-communication-station-photo {
    display: grid;
    gap: 7px;
    justify-items: start;
}
.map-communication-station-photo[hidden] { display: none; }
.map-communication-station-photo img {
    max-width: 100%;
    max-height: 160px;
    border-radius: 6px;
    object-fit: contain;
}
.map-communication-station-photo button {
    padding: 6px 9px;
    border: 1px solid #cbd6cb;
    border-radius: 6px;
    background: #fff;
    color: #344235;
    cursor: pointer;
}
.map-hover-card.map-communication-popup {
    z-index: 980;
    width: min(300px, calc(100% - 24px));
    max-width: calc(100% - 16px);
    max-height: calc(100% - 16px);
    overflow-y: auto;
    overscroll-behavior: contain;
    gap: 8px;
    pointer-events: auto;
}
.map-hover-card.map-communication-popup[hidden] { display: none; }
.map-communication-popup-description {
    margin: 0;
    color: #344236;
    font-size: 12px;
    line-height: 1.5;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.map-communication-popup-photo {
    display: block;
    max-width: 100%;
    max-height: 240px;
    border-radius: 8px;
    object-fit: contain;
}
.map-communication-popup.is-mobile-interactive {
    padding-right: 42px;
}
.map-communication-popup.is-mobile-interactive .map-communication-popup-photo {
    max-height: 200px;
}

/* Read-only NSPD preview and explicit import into editable communication lines. */
.map-communication-import {
    border: 1px solid #d6e4d4;
    border-radius: 8px;
    background: #f8faf7;
}
.map-communication-import > summary {
    padding: 11px 12px;
    color: #263629;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}
.map-communication-import-body {
    display: grid;
    gap: 10px;
    padding: 1px 12px 12px;
}
.map-communication-import-body > label {
    display: grid;
    gap: 5px;
    font-size: 12px;
    font-weight: 650;
}
.map-communication-import input[type="text"],
.map-communication-import select {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    min-height: 35px;
    padding: 7px 9px;
    border: 1px solid #cbd6cb;
    border-radius: 7px;
    background: #ffffff;
    color: #263629;
    font: inherit;
}
.map-communication-import-body > button {
    min-height: 35px;
    padding: 8px 11px;
    border: 1px solid #5f8c31;
    border-radius: 7px;
    background: #5f8c31;
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}
.map-communication-import button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.map-communication-import-result {
    display: grid;
    gap: 8px;
    padding: 10px;
    border: 1px solid #d6e4d4;
    border-radius: 7px;
    background: #ffffff;
}
.map-communication-import-result[hidden],
.map-communication-import-warning[hidden],
.map-communication-source[hidden] { display: none; }
.map-communication-import-result > strong {
    color: #273a2b;
    font-size: 12px;
    overflow-wrap: anywhere;
}
.map-communication-import-result > p {
    margin: 0;
    font-size: 12px;
    line-height: 1.5;
}
.map-communication-import-warning {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 9px;
    border: 1px solid #d5b36e;
    border-radius: 7px;
    background: #fff8e5;
    color: #60451b;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
}
.map-communication-import-warning input {
    flex: 0 0 auto;
    margin: 2px 0 0;
}
.map-communication-source {
    display: block;
    padding: 8px 9px;
    border-radius: 6px;
    background: #edf4e7;
    color: #314d2c;
    font-size: 11px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

@media (max-width: 640px) {
    .map-electrical-edit-toggle { left: 12px; top: 142px; font-size: 12px; }
    .map-electrical-panel {
        left: 12px;
        top: 142px;
        width: min(340px, calc(100% - 24px));
        max-height: calc(100dvh - 154px);
    }
}
