/* Nearby pages: Earners around a job (EmployerJobs/NearbyEarners), talent near me (Nearby/Talent),
   jobs near me (Nearby/Jobs), and the home hero "Near me" button + chooser.
   Theme tokens only — colours come from theme.css / wadai-v2.css. */

.nearby-page {
    --nearby-map-height: 540px;
}

.nearby-back {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
}

.nearby-back:hover {
    color: var(--wadai-red);
}

[dir="rtl"] .nearby-back .bi {
    transform: scaleX(-1);
}

.nearby-heading {
    min-width: 0;
}

.nearby-title {
    font-family: var(--wadai-font-display);
    font-weight: 700;
    color: var(--wadai-ink);
    margin-bottom: 0.25rem;
}

.nearby-subtitle {
    color: var(--text-secondary);
    margin-bottom: 0;
    overflow-wrap: anywhere;
}

.nearby-subtitle .bi {
    color: var(--wadai-red);
}

.nearby-radius {
    min-width: 11rem;
}

/* The site does not load Bootstrap's RTL select rules: keep the chevron clear of the value in Arabic. */
[dir="rtl"] .nearby-page .form-select {
    background-position: left 0.75rem center;
    padding-left: 2.25rem;
    padding-right: 0.75rem;
}

.nearby-radius .form-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

/* Filter chips */
.nearby-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.nearby-chip {
    border: 1px solid var(--border-subtle);
    background: var(--wadai-white);
    color: var(--wadai-ink);
    border-radius: var(--radius-pill);
    padding: 0.4rem 1rem;
    font-weight: 500;
    line-height: 1.3;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.nearby-chip:hover {
    border-color: var(--wadai-red);
}

.nearby-chip[aria-pressed="true"] {
    background: var(--wadai-ink);
    border-color: var(--wadai-ink);
    color: var(--wadai-white);
}

.nearby-chip:focus-visible,
.nearby-item-main:focus-visible {
    outline: 3px solid var(--wadai-red);
    outline-offset: 2px;
}

.nearby-custom {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    width: 100%;
}

.nearby-custom .form-select {
    max-width: 18rem;
}

/* Map */
.nearby-map-card {
    position: relative;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--wadai-paper);
}

.nearby-map {
    height: var(--nearby-map-height);
    width: 100%;
}

.nearby-legend {
    position: absolute;
    inset-inline-start: 0.75rem;
    bottom: 0.75rem;
    display: flex;
    gap: 0.875rem;
    padding: 0.375rem 0.75rem;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-pill);
    font-size: 0.8125rem;
    color: var(--wadai-ink);
    pointer-events: none;
}

.nearby-legend-job {
    color: var(--wadai-red);
}

.nearby-legend-earner {
    display: inline-block;
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 50%;
    background: var(--wadai-ink);
    border: 2px solid var(--wadai-white);
    box-shadow: 0 0 0 1px var(--wadai-ink);
    vertical-align: -0.1em;
}

.nearby-status {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: 0.75rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.nearby-count {
    color: var(--wadai-ink);
    font-weight: 600;
}

.nearby-live::before {
    content: "";
    display: inline-block;
    width: 0.5rem;
    height: 0.5rem;
    margin-inline-end: 0.375rem;
    border-radius: 50%;
    background: var(--wadai-color-success, var(--bs-success));
    vertical-align: 0.05em;
}

.nearby-live.is-paused::before {
    background: var(--text-tertiary);
}

/* Earner list */
.nearby-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: calc(var(--nearby-map-height) + 2.5rem);
    overflow-y: auto;
    margin: 0;
    padding: 0.125rem;
}

.nearby-item {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    background: var(--wadai-white);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.nearby-item.is-selected {
    border-color: var(--wadai-red);
    box-shadow: 0 0 0 1px var(--wadai-red);
}

.nearby-item-main {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    width: 100%;
    padding: 0.875rem 1rem 0.5rem;
    border: 0;
    background: transparent;
    text-align: start;
    color: inherit;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.nearby-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--wadai-paper);
}

.nearby-item-body {
    min-width: 0;
    flex: 1;
}

.nearby-item-top {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    align-items: baseline;
}

.nearby-name {
    font-weight: 600;
    color: var(--wadai-ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Job titles carry more meaning than a name: let them wrap instead of truncating. */
.nearby-name-wrap {
    white-space: normal;
    overflow-wrap: anywhere;
}

.nearby-distance {
    font-weight: 600;
    color: var(--wadai-red);
    white-space: nowrap;
}

.nearby-meta {
    color: var(--text-secondary);
    font-size: 0.875rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nearby-meta .bi-star-fill {
    color: var(--bs-warning);
}

.nearby-item-actions {
    display: flex;
    gap: 0.5rem;
    padding: 0 1rem 0.875rem;
}

.nearby-item-actions .btn {
    flex: 1;
    white-space: nowrap;
    padding-inline: 0.75rem;
}

.nearby-avatar-square {
    border-radius: var(--radius-md);
}

.nearby-job-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--red-10, var(--wadai-paper));
    color: var(--wadai-red);
    font-size: 1.25rem;
}

.nearby-legend-me {
    display: inline-block;
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 50%;
    background: var(--wadai-color-info, var(--bs-primary));
    border: 2px solid var(--wadai-white);
    box-shadow: 0 0 0 1px var(--wadai-color-info, var(--bs-primary));
    vertical-align: -0.1em;
}

.nearby-legend-jobpin {
    display: inline-block;
    width: 0.65rem;
    height: 0.65rem;
    background: var(--wadai-red);
    border: 2px solid var(--wadai-white);
    box-shadow: 0 0 0 1px var(--wadai-red);
    transform: rotate(45deg);
    vertical-align: -0.05em;
}

.nearby-map.is-picking {
    cursor: crosshair;
    outline: 3px dashed var(--wadai-red);
    outline-offset: -3px;
}

.nearby-locate {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.nearby-location-note {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin: 0.5rem 0 0;
}

.nearby-empty {
    border: 1px dashed var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    text-align: center;
    color: var(--text-secondary);
}

.nearby-empty .bi {
    font-size: 1.75rem;
    color: var(--wadai-red);
    display: block;
    margin-bottom: 0.5rem;
}

.nearby-notes {
    color: var(--text-tertiary);
    font-size: 0.8125rem;
}

/* Details page CTA hint */
.nearby-cta-hint {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

@media (max-width: 991.98px) {
    .nearby-page {
        --nearby-map-height: 380px;
    }

    .nearby-list {
        max-height: none;
        overflow: visible;
    }
}

@media (max-width: 575.98px) {
    .nearby-radius {
        min-width: 0;
        width: 100%;
    }
}

/* ---------- Home hero: "Near me" button ---------- */
.hero-nearby-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
    border: 1px solid var(--border-subtle);
    border-radius: 999px;
    background: var(--wadai-white);
    color: var(--wadai-ink);
    padding: 0.625rem 1rem;
    font-family: var(--wadai-font-sans);
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    transition: border-color 0.15s ease, color 0.15s ease;
}

.hero-nearby-btn:hover,
.hero-nearby-btn:focus-visible {
    border-color: var(--wadai-red);
    color: var(--wadai-red);
}

.hero-nearby-btn:focus-visible {
    outline: 3px solid var(--red-10, var(--wadai-red));
    outline-offset: 2px;
}

.hero-nearby-radar {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    background: var(--wadai-red);
    color: var(--wadai-white);
    font-size: 0.875rem;
}

/* Two expanding rings: the "radar" that says "around you". */
.hero-nearby-radar::before,
.hero-nearby-radar::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid var(--wadai-red);
    opacity: 0;
    animation: hero-nearby-ping 2.4s ease-out infinite;
}

.hero-nearby-radar::after {
    animation-delay: 1.2s;
}

@keyframes hero-nearby-ping {
    0% { transform: scale(1); opacity: 0.55; }
    100% { transform: scale(2.1); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .hero-nearby-radar::before,
    .hero-nearby-radar::after {
        animation: none;
    }
}

@media (max-width: 575.98px) {
    .hero-nearby-btn {
        padding: 0.5rem;
    }
}

/* ---------- Chooser shown to signed-out visitors ---------- */
.nearby-chooser .modal-content {
    border: 0;
    border-radius: var(--radius-xl, 1.25rem);
}

.nearby-chooser-title {
    font-family: var(--wadai-font-display);
    font-weight: 700;
    color: var(--wadai-ink);
}

.nearby-choice {
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    background: var(--wadai-white);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.nearby-choice:hover {
    border-color: var(--wadai-red);
    box-shadow: 0 0 0 1px var(--wadai-red);
}

.nearby-choice-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: var(--red-10, var(--wadai-paper));
    color: var(--wadai-red);
    font-size: 1.375rem;
}

.nearby-choice h3 {
    font-family: var(--wadai-font-display);
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--wadai-ink);
    margin: 0.25rem 0 0;
}

.nearby-choice p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 0;
    flex-grow: 1;
}

.nearby-choice-signup {
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-align: center;
}
