.icm-church-map-wrap {
    width: 100%;
    margin: 0 0 1.5rem;
}

.icm-church-map {
    width: 100%;
    min-height: 250px;
    background: #f0f0f0;
}

.icm-map-error {
    padding: 1rem;
    border: 1px solid #d63638;
    background: #fff5f5;
    color: #8a2424;
}

.icm-map-info-window {
    max-width: 280px;
}

.icm-map-info-window h3 {
    margin: 0 0 0.5rem;
    font-size: 1.1rem;
}

.icm-map-info-window p {
    margin: 0 0 0.5rem;
}

.icm-map-info-window hr {
    margin: 0.75rem 0;
}

.icm-church-map-editor-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px dashed #999;
    background: #f6f7f7;
    text-align: center;
    padding: 2rem;
}

.icm-map-filters {
    margin: 0 0 1rem;
    padding: 1rem;
    border: 1px solid #dcdcde;
    background: #fff;
}

.icm-map-filters-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.icm-map-filter label, .icm-population-coverage-controls p {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 600;
}

.icm-map-filter input,
.icm-map-filter select {
    width: 100%;
}

.icm-map-filter-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1rem;
}

.icm-map-private-note {
    font-size: 0.9rem;
    color: #646970;
}

.icm-map-results-count {
    margin: 0.5rem 0 0;
    font-size: 0.95rem;
}

/*.icm-map-filter-private {
    border-left: 3px solid #72aee6;
    padding-left: 0.75rem;
}*/

@media (max-width: 900px) {
    .icm-map-filters-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    .icm-map-filters-grid {
        grid-template-columns: 1fr;
    }
}

.icm-church-marker {
    position: relative;
    width: 2rem;
    height: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    border-radius: 999px;
    background: var(--icm-marker-colour, #2563eb);
    color: var(--icm-marker-text-colour, #ffffff);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
    text-align: center;
}

.icm-church-marker::after {
    content: "";
    position: absolute;
    bottom: -0.35rem;
    left: 50%;
    width: 0.65rem;
    height: 0.65rem;
    background: var(--icm-marker-colour, #2563eb);
    border-right: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: translateX(-50%) rotate(45deg);
}

.icm-church-marker-label {
    position: relative;
    z-index: 1;
    color: var(--icm-marker-text-colour, #ffffff);
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
    text-align: center;
}

.icm-map-legend {
    margin-top: 1rem;
}

.icm-map-legend[hidden] {
    display: none;
}

.icm-map-legend-inner {
    padding: 1rem;
    border: 1px solid #dcdcde;
    border-radius: 0.5rem;
    background: #fff;
}

.icm-map-legend h3 {
    margin: 0 0 0.75rem;
    font-size: 1rem;
}

.icm-map-legend ul {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    gap: 0.5rem 1rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.icm-map-legend li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.icm-map-legend-marker {
    width: 1.75rem;
    height: 1.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    border: 2px solid #fff;
    border-radius: 999px;
    background: var(--icm-marker-colour, #2563eb);
    color: var(--icm-marker-text-colour, #ffffff);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1;
}

.icm-map-legend-label {
    flex: 1 1 auto;
}

.icm-map-legend-count {
    min-width: 1.75rem;
    padding: 0.1rem 0.4rem;
    border-radius: 999px;
    background: #f0f0f1;
    text-align: center;
    font-size: 0.8rem;
}

.icm-origin-marker {
    width: 18px;
    height: 18px;
    border-radius: 999px;
    background: #ffffff;
    border: 3px solid #1a73e8;
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.2);
}

.icm-church-results {
    margin-top: 1.25rem;
}

.icm-church-results-table-wrap {
    overflow-x: auto;
}

.icm-church-results-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.icm-church-results-table th,
.icm-church-results-table td {
    padding: 0.75rem;
    border: 1px solid #dcdcde;
    text-align: left;
    vertical-align: top;
}

.icm-church-results-table th {
    background: #f6f7f7;
}

.icm-sort-button {
    appearance: none;
    border: 0;
    background: transparent;
    padding: 0;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
}

.icm-sort-button:hover,
.icm-sort-button:focus {
    text-decoration: underline;
}

.icm-travel-duration {
    color: #646970;
    font-size: 0.9rem;
}

.icm-church-results-empty {
    margin-top: 1rem;
    padding: 1rem;
    background: #fff;
    border: 1px solid #dcdcde;
}

.icm-population-summary {
    margin-top: 1.25rem;
}

.icm-population-summary-card {
    padding: 1rem;
    border: 1px solid #dcdcde;
    background: #fff;
}

.icm-population-summary-card h3 {
    margin-top: 0;
}

.icm-population-summary-note {
    color: #646970;
    font-size: 0.9rem;
}

.icm-loading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 1rem 0;
    padding: 0.75rem 1rem;
    border: 1px solid #dcdcde;
    background: #fff;
    font-size: 0.95rem;
}

.icm-loading[hidden] {
    display: none;
}

.icm-spinner {
    width: 1rem;
    height: 1rem;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: icm-spin 0.75s linear infinite;
    flex: 0 0 auto;
}

@keyframes icm-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.icm-church-map-wrapper.is-loading .icm-map {
    opacity: 0.65;
}

.icm-population-summary-card.is-loading {
    opacity: 0.8;
}

.icm-church-results {
    margin-top: 1.5rem;
}

.icm-church-results-table {
    width: 100%;
}

.icm-church-results-table th,
.icm-church-results-table td {
    vertical-align: top;
}

.icm-church-results-table th {
    white-space: nowrap;
}

.icm-church-results-table a {
    font-weight: 600;
}

.icm-church-results .dataTables_wrapper,
.icm-church-results .dt-container {
    width: 100%;
}

.icm-church-results .dataTables_length,
.icm-church-results .dataTables_filter,
.icm-church-results .dt-length,
.icm-church-results .dt-search {
    margin-bottom: 1rem;
}

.icm-church-results .dataTables_filter input,
.icm-church-results .dt-search input,
.icm-church-results .dataTables_length select,
.icm-church-results .dt-length select {
    margin-left: 0.5rem;
}

.icm-church-results .dataTables_info,
.icm-church-results .dt-info {
    margin-top: 1rem;
}

.icm-church-results .dataTables_paginate,
.icm-church-results .dt-paging {
    margin-top: 1rem;
}

.icm-church-results table.dataTable thead th {
    cursor: pointer;
}

.icm-church-results table.dataTable thead th.sorting,
.icm-church-results table.dataTable thead th.sorting_asc,
.icm-church-results table.dataTable thead th.sorting_desc,
.icm-church-results table.dataTable thead th.dt-orderable-asc,
.icm-church-results table.dataTable thead th.dt-orderable-desc {
    position: relative;
    padding-right: 1.75rem;
}

.icm-church-results table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control::before,
.icm-church-results table.dataTable.dtr-inline.collapsed > tbody > tr > th.dtr-control::before {
    top: 1.1rem;
}

.icm-church-results ul.dtr-details {
    width: 100%;
    margin: 0;
    padding: 0.75rem 0;
}

.icm-church-results ul.dtr-details li {
    display: flex;
    gap: 0.5rem;
    padding: 0.35rem 0;
    border-bottom: 1px solid #eee;
}

.icm-church-results ul.dtr-details .dtr-title {
    min-width: 8rem;
    font-weight: 700;
}

.icm-church-results-table-wrap {
    width: 100%;
    overflow-x: auto;
}

.icm-church-results-table {
    width: 100% !important;
}

.icm-travel-distance-content,
.icm-travel-distance-miles,
.icm-travel-duration {
    display: block;
}

.icm-travel-duration {
    margin-top: 0.25rem;
    font-size: 0.9rem;
    opacity: 0.8;
}

.icm-church-result-row {
    cursor: pointer;
}

.icm-church-result-row.is-selected,
.icm-church-results table.icm-church-results-table tbody tr.is-selected {
    background: #fff7d6;
    outline: 2px solid #dba617;
    outline-offset: -2px;
}

.icm-view-on-map-button,
.icm-route-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 7rem;
    margin: 0.15rem 0.25rem 0.15rem 0;
    padding: 0.4rem 0.75rem;
    border: 1px solid currentColor;
    border-radius: 0.25rem;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}

.icm-view-on-map-button:hover,
.icm-view-on-map-button:focus,
.icm-route-link:hover,
.icm-route-link:focus {
    text-decoration: none;
    background: rgba(0, 0, 0, 0.05);
}

@media (max-width: 700px) {
    .icm-church-results table.icm-church-results-table tbody td[data-label="Actions"] {
        align-items: start;
    }

    .icm-church-results table.icm-church-results-table tbody td[data-label="Actions"] .icm-view-on-map-button,
    .icm-church-results table.icm-church-results-table tbody td[data-label="Actions"] .icm-route-link {
        width: 100%;
        margin-right: 0;
        margin-bottom: 0.4rem;
    }

    .icm-church-results table.icm-church-results-table tbody td[data-label="Actions"] .icm-route-link:last-child,
    .icm-church-results table.icm-church-results-table tbody td[data-label="Actions"] .icm-view-on-map-button:last-child {
        margin-bottom: 0;
    }
}

@media (max-width: 700px) {
	
	 .icm-church-results table.icm-church-results-table tbody td[data-label="Distance (travel)"] {
        align-items: start;
    }

    .icm-church-results table.icm-church-results-table tbody td[data-label="Distance (travel)"] .icm-travel-distance-content {
        display: block;
        min-width: 0;
    }
	
    .icm-church-results-table-wrap {
        overflow-x: visible;
    }

    .icm-church-results table.icm-church-results-table,
    .icm-church-results table.icm-church-results-table thead,
    .icm-church-results table.icm-church-results-table tbody,
    .icm-church-results table.icm-church-results-table th,
    .icm-church-results table.icm-church-results-table td,
    .icm-church-results table.icm-church-results-table tr {
        display: block;
        width: 100% !important;
        box-sizing: border-box;
    }

    .icm-church-results table.icm-church-results-table thead {
        display: none;
    }

    .icm-church-results table.icm-church-results-table tbody tr {
        margin: 0 0 1rem;
        padding: 1rem;
        border: 1px solid #dcdcde;
        border-radius: 0.5rem;
        background: #fff;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    }

    .icm-church-results table.icm-church-results-table tbody td {
        display: grid;
        grid-template-columns: minmax(7.5rem, 40%) 1fr;
        gap: 0.75rem;
        padding: 0.5rem 0;
        border: 0;
        border-bottom: 1px solid #eee;
        white-space: normal;
        text-align: left;
    }

    .icm-church-results table.icm-church-results-table tbody td:last-child {
        border-bottom: 0;
        padding-bottom: 0;
    }

    .icm-church-results table.icm-church-results-table tbody td::before {
        content: attr(data-label);
        font-weight: 700;
        color: #333;
    }

    .icm-church-results table.icm-church-results-table tbody td:first-child {
        display: block;
        padding-top: 0;
        font-size: 1.05rem;
        font-weight: 700;
    }

    .icm-church-results table.icm-church-results-table tbody td:first-child::before {
        display: none;
    }

    .icm-church-results table.icm-church-results-table tbody td:first-child + td {
        margin-top: 0.5rem;
    }

    .icm-church-results table.icm-church-results-table tbody td[data-label="Route"] a {
        display: inline-block;
        padding: 0.4rem 0.75rem;
        border: 1px solid currentColor;
        border-radius: 0.25rem;
        text-decoration: none;
        font-weight: 700;
    }

    .icm-church-results .icm-travel-duration {
        display: block;
        margin-top: 0.25rem;
        font-size: 0.9rem;
    }

    .icm-church-results .dataTables_wrapper,
    .icm-church-results .dt-container {
        overflow: visible;
    }

    .icm-church-results .dataTables_length,
    .icm-church-results .dataTables_filter,
    .icm-church-results .dt-length,
    .icm-church-results .dt-search {
        width: 100%;
        margin-bottom: 1rem;
        text-align: left;
    }

    .icm-church-results .dataTables_filter label,
    .icm-church-results .dt-search label {
        display: block;
        width: 100%;
    }

    .icm-church-results .dataTables_filter input,
    .icm-church-results .dt-search input {
        display: block;
        width: 100%;
        max-width: 100%;
        margin: 0.5rem 0 0;
        box-sizing: border-box;
    }

    .icm-church-results .dataTables_length select,
    .icm-church-results .dt-length select {
        margin: 0 0.25rem;
    }

    .icm-church-results .dataTables_info,
    .icm-church-results .dt-info,
    .icm-church-results .dataTables_paginate,
    .icm-church-results .dt-paging {
        width: 100%;
        text-align: left;
    }

    .icm-church-results .dataTables_paginate .paginate_button,
    .icm-church-results .dt-paging .dt-paging-button {
        margin-bottom: 0.35rem;
    }
	
	.icm-church-results table.icm-church-results-table tbody td[data-label="Actions"] a.icm-route-link {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 7rem;
        padding: 0.4rem 0.75rem;
        border: 1px solid currentColor;
        border-radius: 0.25rem;
        text-align: center;
        text-decoration: none;
        font-weight: 700;
    }
	
}

.icm-map-message {
    margin: 1rem 0;
    padding: 0.75rem 1rem;
    border-left: 4px solid #2271b1;
    background: #f6f7f7;
}

.icm-map-message-error {
    border-left-color: #d63638;
    background: #fcf0f1;
}