/**
 * Location Autocomplete — Reusable Geocoder Widget
 *
 * Powered by Nominatim (via /api/geocode/search proxy).
 * Use with public/js/location-autocomplete.js and
 * views/components/location-autocomplete.php.
 */

/* ── Wrapper ─────────────────────────────────────────── */
.lac-wrap {
    position: relative;
}

/* ── Input field ─────────────────────────────────────── */
.lac-wrap .lac-input {
    width: 100%;
    padding: .65rem .9rem;
    padding-right: 2.4rem; /* room for spinner */
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: .95rem;
    background: #fff;
    transition: border-color .2s, box-shadow .2s;
    box-sizing: border-box;
}
.lac-wrap .lac-input:focus {
    outline: none;
    border-color: #E63946;
    box-shadow: 0 0 0 3px rgba(230, 57, 70, .12);
}

/* ── Spinner (SVG inside input) ──────────────────────── */
.lac-spinner {
    display: none;
    position: absolute;
    right: .75rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}
@keyframes lac-spin {
    to { transform: translateY(-50%) rotate(360deg); }
}
.lac-spinner.active {
    display: block;
    animation: lac-spin .7s linear infinite;
}

/* ── Dropdown results ────────────────────────────────── */
.lac-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 200;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .12);
    max-height: 260px;
    overflow-y: auto;
    display: none;
}
.lac-results .lac-item {
    padding: .6rem .85rem;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    font-size: .88rem;
    color: #374151;
    transition: background .15s;
}
.lac-results .lac-item:last-child {
    border-bottom: none;
}
.lac-results .lac-item:hover,
.lac-results .lac-item.lac-active {
    background: #f9fafb;
}
.lac-results .lac-item .lac-city {
    font-weight: 600;
    color: #1e1e2e;
}
.lac-results .lac-item .lac-detail {
    font-size: .78rem;
    color: #9ca3af;
    margin-top: .1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Coordinates readout bar ─────────────────────────── */
.lac-coords {
    display: flex;
    gap: .75rem;
    margin-top: .55rem;
    align-items: center;
    flex-wrap: wrap;
    font-size: .82rem;
    color: #6b7280;
    padding: .45rem .7rem;
    background: #f8fafc;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}
.lac-coords .lac-coord-val {
    font-weight: 600;
    color: #374151;
    font-family: monospace;
}
.lac-coords .lac-clear {
    margin-left: auto;
    color: #E63946;
    cursor: pointer;
    font-weight: 600;
    font-size: .8rem;
    background: none;
    border: none;
    padding: 0;
    font-family: inherit;
}
.lac-coords .lac-clear:hover {
    text-decoration: underline;
}
.lac-coords .lac-label {
    color: #9ca3af;
}
