/* ==========================================
   Geo targeting — country mode / radius mode + the map
   Paired with js/geo-targeting.js.
   ========================================== */

.geo-mode {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.geo-mode-option {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 13px 16px;
    border: 1px solid var(--line-2);
    border-radius: 10px;
    background: var(--dark-bg-secondary);
    cursor: pointer;
    transition: var(--transition-smooth, all 0.2s ease);
}

.geo-mode-option:hover {
    border-color: var(--primary-color);
    background: var(--hover-color);
}

/* :has lets the whole card show the selected state without a JS class toggle. */
.geo-mode-option:has(input:checked) {
    border-color: var(--primary-color);
    background: rgba(34, 199, 224, 0.08);
}

.geo-mode-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.geo-mode-title {
    color: var(--text-primary);
    font-size: 0.92rem;
    font-weight: 600;
}

.geo-mode-desc {
    color: var(--text-muted);
    font-size: 0.76rem;
}

/* ── Radius controls ─────────────────────── */

.geo-label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 600;
}

.geo-centre,
.geo-radius {
    margin-bottom: 18px;
}

.geo-radius-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.geo-radius-row input[type="range"] {
    flex: 1 1 200px;
    accent-color: var(--primary-color);
}

.geo-radius-row input[type="number"] {
    flex: 0 0 90px;
}

.geo-unit {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.geo-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.geo-preset {
    padding: 4px 11px;
    border: 1px solid var(--line-2);
    border-radius: 20px;
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.75rem;
    cursor: pointer;
}

.geo-preset:hover {
    border-color: var(--primary-color);
    background: var(--hover-color);
    color: var(--primary-color);
}

/* ── Place search (the only way to set a centre) ── */

.geo-search-group {
    /* .address-search-group carries a divider meant for the top of a long address form. Here
       the search is one control among several, so the rule and its padding come back off. */
    margin-bottom: 10px;
    padding-bottom: 0;
    border-bottom: none;
}

.geo-search-group .address-search-wrapper {
    position: relative;
}

.geo-search-group input[type="text"] {
    /* Room for the magnifier. Two classes so it outranks `.form-group input` in forms.css —
       the same trap that once drew the icon straight through the text. */
    padding-right: 38px;
}

.geo-search-icon {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.85rem;
    pointer-events: none;
}

/* What the search resolved to — read-only on purpose: the centre comes from the search, and a
   second editable copy of the same value is one more thing that can disagree with it. */
.geo-centre-readout {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 14px;
    padding: 9px 13px;
    margin-bottom: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--dark-bg-secondary);
    font-size: 0.8rem;
}

.geo-centre-place {
    color: var(--text-primary);
    font-weight: 600;
}

.geo-centre-coords {
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.74rem;
}

.geo-centre-empty {
    color: var(--text-muted);
    font-style: italic;
}

/* ── The map: OSM tiles + SVG overlay ───── */

.geo-map-wrap {
    margin-top: 6px;
    /* Full form width: the map is the point of the radius pane, and the JS cuts its tile grid
       to whatever width this ends up being. */
    width: 100%;
}

#geo-map {
    width: 100%;
}

.geo-map {
    position: relative;
    max-width: 100%;
    border: 1px solid var(--line-2);
    border-radius: 10px;
    overflow: hidden;
    background: var(--dark-bg);
}

.geo-map-tiles {
    position: absolute;
    inset: 0;
}

.geo-map-tile {
    position: absolute;
    /* The basemap is a light raster in a dark portal. Dimming it slightly keeps the overlay
       readable without inverting the map, which would make the labels unreadable instead. */
    filter: saturate(0.75) brightness(0.82) contrast(1.05);
    user-select: none;
    pointer-events: none;
}

.geo-map-overlay {
    position: absolute;
    inset: 0;
}

.geo-map-radius {
    fill: rgba(34, 199, 224, 0.16);
    stroke: var(--accent-2);
    stroke-width: 2;
    stroke-dasharray: 6 4;
}

.geo-map-centre {
    fill: var(--accent-2);
    stroke: #0A0A0F;
    stroke-width: 2;
}

.geo-map-dot {
    fill: #f8fafc;
    stroke: rgba(10, 10, 15, 0.85);
    stroke-width: 1.5;
    transition: fill 0.15s ease;
}

.geo-map-dot--in {
    fill: var(--success-color);
    stroke: #ffffff;
}

.geo-map-dot:hover {
    fill: var(--accent-2);
}

.geo-map-scale line {
    stroke: #0A0A0F;
    stroke-width: 3;
}

.geo-map-scale text {
    fill: #0A0A0F;
    font-size: 10px;
    font-weight: 700;
    text-anchor: middle;
    font-family: var(--font-mono);
    paint-order: stroke;
    stroke: rgba(255, 255, 255, 0.85);
    stroke-width: 3;
}

/* Attribution is required by the OSM tile usage policy — not decoration, do not remove. */
.geo-map-attribution {
    position: absolute;
    right: 0;
    bottom: 0;
    padding: 2px 7px;
    border-top-left-radius: 6px;
    background: rgba(10, 10, 15, 0.72);
    color: var(--text-secondary);
    font-size: 0.66rem;
}

.geo-map-attribution a {
    color: var(--accent-2);
}

.geo-map-note {
    margin: 8px 0 0;
    color: var(--text-muted);
    font-size: 0.76rem;
    line-height: 1.5;
}

.geo-map-note strong {
    color: var(--text-secondary);
}

.geo-map-empty {
    padding: 34px 18px;
    border: 1px dashed var(--line-2);
    border-radius: 10px;
    color: var(--text-muted);
    font-size: 0.82rem;
    text-align: center;
}

/* No small-screen rule for the map: it is cut to its container's measured width, so it already
   fits. The transform: scale() that used to sit here shrank the labels along with everything
   else and left a gap beside the frame it no longer filled. */
