/* Location picker, area chips and coverage map. Used by the directory listing form, the public
   company profile and the admin tools, so colours fall back to the site palette when a page's own
   variables are not defined. */

.loc-picker,
.loc-chips,
.loc-chip,
.cov-map {
    --loc-green: var(--serden-evergreen, #153a2b);
    --loc-green-mid: #2d4e41;
    --loc-sage: var(--serden-sage, #e8eee8);
    --loc-ink: #10231b;
    --loc-muted: var(--serden-text-secondary, #526159);
    --loc-line: var(--serden-stone, #dddcd3);
    --loc-line-strong: #c7d5ce;
    --loc-warning: #8a5300;
    --loc-warning-soft: #fdf3dc;
    --loc-danger: #b3261e;
}

/* ------------------------------------------------------------------ picker */

.loc-picker {
    position: relative;
}

.loc-picker-field {
    position: relative;
}

.loc-picker-field > .fas {
    position: absolute;
    top: 50%;
    left: 16px;
    font-size: 14px;
    color: var(--loc-muted);
    transform: translateY(-50%);
    pointer-events: none;
}

.loc-picker .loc-picker-field input {
    padding-left: 42px;
    padding-right: 42px;
}

.loc-picker-spinner {
    position: absolute;
    top: 50%;
    right: 16px;
    width: 16px;
    height: 16px;
    margin-top: -8px;
    border-width: 2px;
    color: var(--loc-green);
}

.loc-picker-list {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    left: 0;
    z-index: 40;
    max-height: 340px;
    margin: 0;
    padding: 6px;
    overflow-y: auto;
    border: 1px solid var(--loc-line-strong);
    border-radius: 14px;
    background-color: #fff;
    box-shadow: 0 18px 44px rgba(14, 42, 31, .18);
    list-style: none;
    overscroll-behavior: contain;
}

.loc-picker-list[hidden] {
    display: none;
}

.loc-option {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--loc-ink);
    cursor: pointer;
}

.loc-option.is-active {
    background-color: var(--loc-sage);
    box-shadow: inset 3px 0 0 var(--loc-green);
}

.loc-option.is-taken {
    cursor: not-allowed;
    opacity: .6;
}

.loc-option-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.loc-option-label {
    min-width: 0;
    font-size: 15px;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.loc-option-context {
    font-size: 13px;
    color: var(--loc-muted);
}

.loc-option-context .fas {
    margin-right: 4px;
    font-size: 11px;
    color: var(--loc-green);
}

.loc-picker-message {
    margin: 6px 0 0;
    font-size: 13px;
    line-height: 1.5;
    color: var(--loc-muted);
}

.loc-picker-message:empty {
    display: none;
}

.loc-picker-message.is-error {
    color: var(--loc-danger);
    font-weight: 500;
}

/* Location type, after the name: "Vancouver, WA  City". */
.loc-type {
    flex: none;
    padding: 2px 9px;
    border-radius: 999px;
    background-color: var(--loc-sage);
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .03em;
    line-height: 1.6;
    color: var(--loc-green);
    white-space: nowrap;
}

.loc-type--state {
    background-color: #153a2b;
    color: #fff;
}

.loc-type--county {
    background-color: #dfeadf;
    color: #1d4a35;
}

.loc-type--zip {
    background-color: #eef0ea;
    color: #45524b;
}

/* ------------------------------------------------------------------- chips */

.loc-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 14px 0 0;
    padding: 0;
    list-style: none;
}

.loc-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 100%;
    padding: 5px 6px 5px 12px;
    border: 1px solid var(--loc-line-strong);
    border-radius: 999px;
    background-color: #fff;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.3;
    color: var(--loc-ink);
}

.loc-chip-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.loc-chip .loc-type {
    padding: 1px 8px;
    font-size: 11px;
}

.loc-chip-remove {
    display: inline-flex;
    flex: 0 0 26px;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background-color: var(--loc-sage);
    font-size: 11px;
    color: var(--loc-green);
    cursor: pointer;
}

.loc-chip-remove:hover {
    background-color: #d5e6dc;
}

.loc-chip-remove:focus-visible {
    outline: 3px solid var(--loc-green);
    outline-offset: 1px;
}

/* An entry from before the location list that couldn't be matched. */
.loc-chip--flag {
    border-color: #e9c46a;
    background-color: var(--loc-warning-soft);
    color: var(--loc-warning);
}

.loc-chip--flag .fas {
    font-size: 12px;
}

.loc-chips-note {
    margin: 10px 0 0;
    font-size: 13px;
    line-height: 1.5;
    color: var(--loc-warning);
}

/* --------------------------------------------------------------------- map */

.cov-map {
    position: relative;
    /* In a column flex container, such as the admin drawers, overflow: hidden would let it shrink to nothing. */
    flex: none;
    /* Leaflet's panes go up to z-index 1000; this keeps them from covering the location suggestions above the map. */
    isolation: isolate;
    margin-top: 16px;
    border: 1px solid var(--loc-line);
    border-radius: 16px;
    overflow: hidden;
    background-color: #eef2ef;
}

.cov-map-canvas {
    height: 320px;
    width: 100%;
    background-color: #eef2ef;
}

.cov-map-canvas:focus-visible {
    outline: 3px solid var(--loc-green);
    outline-offset: -3px;
}

.cov-map-status {
    position: absolute;
    top: 12px;
    left: 50%;
    z-index: 500;
    max-width: calc(100% - 24px);
    margin: 0;
    padding: 6px 12px;
    border-radius: 999px;
    background-color: rgba(255, 255, 255, .94);
    box-shadow: 0 4px 14px rgba(14, 42, 31, .14);
    font-size: 13px;
    font-weight: 500;
    color: var(--loc-ink);
    transform: translateX(-50%);
    pointer-events: none;
}

.cov-map-status[hidden] {
    display: none;
}

.cov-map-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    margin: 0;
    padding: 8px 14px;
    border-top: 1px solid var(--loc-line);
    background-color: #fff;
    font-size: 12.5px;
    color: var(--loc-muted);
}

.cov-map-legend > span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.cov-swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid #153a2b;
    border-radius: 3px;
    background-color: rgba(63, 125, 95, .3);
}

.cov-swatch--approx {
    border-style: dashed;
    border-radius: 50%;
    background-color: rgba(63, 125, 95, .15);
}

.cov-map.is-unavailable .cov-map-canvas::after {
    content: "The map couldn't be loaded. The list of areas shows where this company works.";
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 20px;
    font-size: 14px;
    text-align: center;
    color: var(--loc-muted);
}

.cov-map .leaflet-container {
    font-family: inherit;
}

.cov-map .leaflet-tooltip {
    font-size: 13px;
    font-weight: 600;
    color: var(--loc-ink);
}

@media (max-width: 575.98px) {
    .cov-map-canvas {
        height: 260px;
    }

    .loc-option-main {
        flex-wrap: wrap;
        gap: 4px 10px;
    }
}
