/* =========================
   mapper.location.css
   ========================= */
/* ---------- Selection chips ---------- */
.location-chips {
    padding: 0.5rem;
    border: 1px dashed var(--bs-border-color);
    border-radius: 0.5rem;
    background: var(--bs-body-bg);
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    max-width: 100%;
}

.mapper-chip {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 2.5rem;
    gap: 0.5rem;
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
    font-size: 0.925rem;
    line-height: 1.2;
    max-width: 100%;
}

.mapper-chip .chip-name {
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.mapper-chip .chip-id {
    align-self: center;
    flex: 0 1 auto;
    min-width: 0;
    max-width: 45%;
    font-size: 0.75rem;
    color: var(--bs-secondary-color);
    border-left: 1px solid var(--bs-border-color);
    padding-left: 0.5rem;
    margin-left: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mapper-chip .btn-close {
    flex: 0 0 auto;
    width: 0.9rem;
    height: 0.9rem;
    margin-left: auto;
    align-self: center;
}

@media (max-width: 1400px) {
    .location-map-panel-right .row.g-2.row-cols-2 .btn {
        font-size: 0.9rem;
    }
}


/* ---------- Map ---------- */
#location-map-card {
    position: relative;
}

.location-map-stage {
    position: relative;
}

#location-map {
    height: clamp(400px, 70vh, 800px);
    border-radius: 0.5rem;
    border: 1px solid var(--bs-border-color);
    overflow: hidden;
}

/* Map loading mask */
.location-map-mask {
    position: absolute;
    inset: 0;
    z-index: 60;

    display: none; /* changed from flex */
    align-items: center;
    justify-content: center;

    background: rgba(255, 255, 255, 0.9);
}

.location-map-mask .inner {
    text-align: center;
    padding: 0.75rem 1rem;
    background: #fff;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.75rem;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

/* ---------- Map overlays ---------- */
.location-map-legend {
    position: absolute;
    left: 0.75rem;
    bottom: 0.75rem;
    z-index: 10;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    padding: 0.5rem 0.75rem;
    min-width: 200px;
}

.location-map-legend .swatch {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    border: 1px solid var(--bs-border-color);
    display: inline-block;
    vertical-align: middle;
    margin-right: 0.5rem;
    background: rgba(51, 153, 255, 0.3);
}

.location-map-legend .legend-title {
    font-weight: 600;
}

/* ---------- Dockable map panels ---------- */
.location-map-panel {
    position: absolute;
    z-index: 40;
    max-width: min(300px, 18vw);
    min-width: 290px;
}

.location-map-panel .section-card {
    border-radius: 0.75rem;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.12);
}

.location-map-panel-right {
    right: 0.25rem;
    top: 0.25rem;
}

/* Mobile: panels become normal blocks below the map */
@media (max-width: 991.98px) {
    .location-map-panel {
        position: static;
        z-index: auto;
        max-width: none;
        margin: 0.75rem;
    }

    .location-map-panel-right {
        left: auto;
        right: auto;
        top: auto;
    }
}



/* ---------- Identify Tool - Location ---------- */
.location-identify-panel {
    position: absolute;
    z-index: 75;
    min-width: 260px;
    max-width: 360px;
    width: min(360px, calc(100% - 1.5rem));
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.75rem;
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.18);
    padding: 0.75rem 0.75rem;
}

.location-identify-cursor {
    position: absolute;
    z-index: 70;
    width: 22px;
    height: 22px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 0, 0, 0.35);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.10);
    font-weight: 700;
    font-size: 0.85rem;
    pointer-events: none;
    user-select: none;
}

.location-identify-panel table {
    border-collapse: collapse;
    width: 100%;
}

.location-identify-panel th,
.location-identify-panel td {
    border: 1px solid #d0d0d0;
    vertical-align: middle;
}

.location-identify-panel tbody th,
.location-identify-panel tbody td {
    background: #fff;
    font-size: 0.9rem;
}

.location-identify-panel tbody th {
    font-weight: 600;
}

.location-identify-panel tbody td,
.location-identify-panel tbody td.text-end {
    text-align: center;
}

.location-identify-panel tbody tr:nth-child(even) > th,
.location-identify-panel tbody tr:nth-child(even) > td {
    background-color: #f5f5f5;
}

.location-selection-footer {
    background: #fff;
    border-top: 1px solid var(--bs-border-color);
    padding-top: 1rem;
    padding-bottom: 1rem;
}

/* selection panel header + controls */
#location-pane #card-selection > .card-header {
    font-family: "Oswald", Arial, Helvetica, sans-serif;
}

#location-pane .area-type-label {
    text-decoration: underline;
    text-underline-offset: 0.12em;
    text-decoration-thickness: 1.5px;
}

#location-pane #area-type-select {
    background-color: #fff;
    border-color: rgba(55, 55, 55, 0.24);
    color: #1f1f1f;
}

#location-pane #area-type-select:hover,
#location-pane #area-type-select:focus,
#location-pane #area-type-select:focus-visible {
    background-color: #eceff1;
    border-color: #c8ccd1;
    color: #111;
    box-shadow: none;
}

#location-pane #area-type-select option {
    background-color: #fff;
    color: #111;
}

#location-pane #area-type-select option:hover,
#location-pane #area-type-select option:focus,
#location-pane #area-type-select option:checked {
    background: linear-gradient(0deg, #eceff1, #eceff1);
    color: #111;
}

#location-pane #btn-identify,
#location-pane #btn-box-select,
#location-pane #btn-clear-all {
    background-color: #fff;
    border-color: rgba(55, 55, 55, 0.46);
    color: rgba(31, 31, 31, 0.68);
    outline: 1px solid rgba(31, 31, 31, 0.18);
}

#location-pane #btn-identify:hover,
#location-pane #btn-identify:focus-visible,
#location-pane #btn-box-select:hover,
#location-pane #btn-box-select:focus-visible,
#location-pane #btn-clear-all:hover,
#location-pane #btn-clear-all:focus-visible {
    background-color: #154a19;
    border-color: #154a19;
    color: #fff;
    outline-color: rgba(255, 255, 255, 0.75);
}

#location-pane #btn-identify:focus:not(:focus-visible),
#location-pane #btn-box-select:focus:not(:focus-visible),
#location-pane #btn-clear-all:focus:not(:focus-visible) {
    background-color: #fff;
    border-color: rgba(55, 55, 55, 0.46);
    color: rgba(31, 31, 31, 0.68);
    outline-color: rgba(31, 31, 31, 0.18);
}

#location-pane #btn-identify.active,
#location-pane #btn-identify.active:hover,
#location-pane #btn-identify.active:focus,
#location-pane #btn-box-select.active,
#location-pane #btn-box-select.active:hover,
#location-pane #btn-box-select.active:focus {
    background-color: #1b5e20;
    border-color: #1b5e20;
    color: #ffea00;
    outline-color: rgba(255, 234, 0, 0.85);
}




.area-type-label {
    font-weight: 600;
}

.mapper-location-import-line {
    margin-top: 0.35rem;
    font-size: 0.9rem;
}

.mapper-page .location-chips {
    max-height: none;
    overflow: visible;
}

.mapper-page #card-selection {
    max-height: clamp(320px, 65vh, 700px);
    display: flex;
    flex-direction: column;
}

.mapper-page #selection-body {
    overflow-y: auto;
    overflow-x: hidden;
}

/* Smaller text for mapper control buttons */
#btn-continue,
#btn-clear-all,
#btn-identify,
#btn-box-select {
    font-size: 0.95rem;
}

