body {
    margin: 0;
    padding: 0;
    font-family: 'Open Sans', 'Segoe UI', sans-serif;
}

#map {
    height: 100vh;
    width: 100%;
    background-color: #170535;
    position: relative;
}

.split-control {
    margin-top: 6px !important;
}

.layer-select-control {
    display: block;
    margin-top: 6px !important;
}

.resolution-control {
    display: block;
    margin-top: 6px !important;
}

.base-layer-control {
    display: block;
    margin-top: 6px !important;
}

.search-control {
    display: block;
    margin-top: 6px !important;
}

.info-control {
    display: block;
    margin-top: 6px !important;
}

.leaflet-bar a.split-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    position: relative;
    text-align: center;
    font-size: 15px;
    line-height: 1;
    color: #000;
    text-decoration: none;
    background: #fff;
    transition: background 120ms ease, color 120ms ease, box-shadow 120ms ease;
}

@media (hover: hover) {
    .split-btn:hover {
        background: #f4f4f4;
    }
}

.split-btn svg {
    width: 18px;
    height: 18px;
    display: block;
    overflow: visible;
}

.split-btn:not(.home-btn):not(.search-btn):not(.info-btn) svg {
    width: 24px;
    height: 24px;
}

.info-btn svg {
    width: 20px;
    height: 20px;
}

.leaflet-bar a.split-btn-active,
.leaflet-bar a.split-btn-active:hover,
.leaflet-bar a.split-btn-active:focus {
    background: linear-gradient(180deg, #c2deca 0%, #a3ceaf 100%);
    color: #1a3022;
    font-weight: bold;
    box-shadow: inset 0 0 0 1px rgba(55, 130, 85, 0.5);
}

.layer-select-btn {
    display: block;
    width: 30px;
    height: 30px;
    line-height: 30px;
    position: relative;
    text-align: center;
    font-size: 10px;
    font-weight: bold;
    color: #333;
    text-decoration: none;
    background: #fff;
    border-right: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.15);
    transition: background 120ms ease, color 120ms ease, box-shadow 120ms ease;
}

.layer-select-btn:last-child {
    border-bottom: none;
}

@media (hover: hover) {
    .layer-select-btn:hover {
        background: #f4f4f4;
    }
}

.leaflet-bar a.layer-select-btn-active,
.leaflet-bar a.layer-select-btn-active:hover,
.leaflet-bar a.layer-select-btn-active:focus {
    background: linear-gradient(180deg, #c2deca 0%, #a3ceaf 100%);
    color: #1a3022;
    box-shadow: inset 0 0 0 1px rgba(55, 130, 85, 0.5);
}

.layer-select-btn.layer-select-btn-hidden {
    display: none;
}

.wales-lidar-layer {
    filter: grayscale(100%);
}

.search-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 24px 16px;
    background: rgba(16, 21, 18, 0.36);
    backdrop-filter: blur(3px);
}

.search-modal-overlay-hidden {
    display: none;
}

.search-modal {
    width: min(420px, 100%);
    max-height: min(70vh, 560px);
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px;
    border-radius: 12px;
    background: rgba(252, 253, 252, 0.98);
    box-shadow: 0 18px 60px rgba(23, 36, 28, 0.24);
}

.search-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.search-modal-title {
    margin: 0;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.35;
    color: #1b241e;
}

.search-modal-close {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 8px;
    background: #edf2ee;
    color: #445148;
    cursor: pointer;
}

.search-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
}

.search-input,
.search-submit,
.search-result,
.search-modal-close {
    font: inherit;
}

.search-input {
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid rgba(68, 81, 72, 0.2);
    border-radius: 10px;
    background: #fff;
    color: #1b241e;
}

.search-submit {
    padding: 10px 14px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(180deg, #dde9e0 0%, #cfdfd4 100%);
    color: #1f2923;
    font-weight: 600;
    cursor: pointer;
}

.search-submit:disabled {
    opacity: 0.6;
    cursor: default;
}

.search-status {
    min-height: 18px;
    font-size: 12px;
    color: #516057;
}

.search-status.search-status-error {
    color: #8d3f32;
}

.search-results {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
}

.search-result {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid rgba(68, 81, 72, 0.12);
    border-radius: 10px;
    background: #fff;
    color: #1f2923;
    text-align: left;
    cursor: pointer;
}

.search-result:hover {
    background: #f5f8f5;
}

.search-result-title {
    font-size: 13px;
    font-weight: 700;
}

.search-result-meta {
    font-size: 12px;
    line-height: 1.35;
    color: #5f6e64;
}

.info-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 24px 16px;
    background: rgba(16, 21, 18, 0.36);
    backdrop-filter: blur(3px);
}

.info-modal-overlay-hidden {
    display: none;
}

.info-modal {
    width: min(720px, 100%);
    max-height: min(78vh, 760px);
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 18px;
    border-radius: 14px;
    background: rgba(252, 253, 252, 0.98);
    box-shadow: 0 18px 60px rgba(23, 36, 28, 0.24);
}

.info-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.info-modal-title {
    margin: 0;
    font-size: 18px;
    line-height: 1.2;
    color: #1b241e;
}

.info-modal-close {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 8px;
    background: #edf2ee;
    color: #445148;
    cursor: pointer;
    font: inherit;
}

.info-modal-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    padding-right: 4px;
}

.info-section {
    flex: 0 0 auto;
    border: 1px solid rgba(68, 81, 72, 0.12);
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
}

.info-section-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    cursor: pointer;
    list-style: none;
}

.info-section-summary::-webkit-details-marker {
    display: none;
}

.info-section-summary::after {
    content: '+';
    flex: 0 0 auto;
    font-size: 18px;
    line-height: 1;
    color: #5f6e64;
}

.info-section[open] .info-section-summary::after {
    content: '−';
}

.info-section h3 {
    margin: 0;
    font-size: 14px;
    color: #1f2923;
}

.info-section-body {
    padding: 0 14px 12px;
}

.info-section p {
    margin: 0 0 16px;
    font-size: 13px;
    line-height: 1.55;
    color: #4e5c53;
}

.info-section p:last-child {
    margin-bottom: 0;
}

.click-popup-wrapper .leaflet-popup-content-wrapper {
    border-radius: 10px;
    padding: 0;
    box-shadow: 0 6px 24px rgba(23, 36, 28, 0.22);
    font-family: 'Open Sans', 'Segoe UI', sans-serif;
    text-align: left;
}

.click-popup-wrapper .leaflet-popup-content {
    margin: 0;
}

.click-popup {
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.click-popup-row {
    font-size: 13px;
    line-height: 1.5;
    color: #1f2923;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.click-popup-label {
    font-size: 11px;
    font-weight: 600;
    color: #6b7d71;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.click-popup-value-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.click-popup-value {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.click-popup-copy {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    padding: 0;
    margin-left: 2px;
    border: 1px solid rgba(68, 81, 72, 0.2);
    border-radius: 5px;
    background: #f5f8f5;
    color: #445148;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}

.click-popup-copy:hover {
    background: #e8ede9;
}

.click-popup-links {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-top: 6px;
}

.click-popup-links a {
    font-size: 12px;
    color: #2a6e4e;
    text-decoration: underline;
    text-decoration-color: rgba(42, 110, 78, 0.35);
    text-underline-offset: 2px;
    line-height: 1.4;
}

.click-popup-links a:hover {
    color: #1a5a3a;
    text-decoration-color: rgba(42, 110, 78, 0.7);
}

.click-popup-wrapper .leaflet-popup-tip {
    box-shadow: none;
}

@media (max-width: 640px) {
    .search-modal-overlay {
        padding: 12px;
    }

    .search-modal {
        width: 100%;
        max-height: min(78vh, 640px);
    }

    .search-form {
        grid-template-columns: 1fr;
    }

    .info-modal-overlay {
        padding: 12px;
    }

    .info-modal {
        width: 100%;
        max-height: min(82vh, 720px);
        padding: 14px;
    }
}
