/**
 * Locator module frontend styles (spec §5.1).
 * Standalone, theme-agnostic: everything is .loc- prefixed and the accent
 * color is themeable via CSS custom properties.
 */
:root {
    --loc-accent: #0c65e3;
    --loc-accent-dark: #0a52b8;
    --loc-ink: #0f172a;
    --loc-muted: #64748b;
    --loc-line: #e2e8f0;
    --loc-bg: #f8fafc;
}

.loc-container {
    max-width: 80rem;
    margin-inline: auto;
    padding-inline: 1rem;
}

@media (min-width: 1024px) {
    .loc-container {
        padding-inline: 2rem;
    }
}

.loc-visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* ---------- Hero ---------- */

.loc-hero {
    background: linear-gradient(135deg, var(--loc-accent) 0%, #06b6d4 100%);
    color: #fff;
    /* Top offset clears the (fixed) site header; themes can retune it. */
    padding: calc(var(--loc-header-offset, 5rem) + 2.5rem) 0 2.5rem;
}

.loc-hero h1 {
    font-size: clamp(1.6rem, 4vw, 2.4rem);
    font-weight: 800;
    margin: 0 0 0.5rem;
}

.loc-hero p {
    max-width: 46rem;
    opacity: 0.92;
    margin: 0;
}

.loc-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    margin: 1.75rem 0 0;
}

.loc-stats div {
    display: flex;
    flex-direction: column-reverse;
}

.loc-stats dd {
    font-size: 1.9rem;
    font-weight: 800;
    margin: 0;
    line-height: 1.1;
}

.loc-stats dt {
    font-size: 0.85rem;
    opacity: 0.85;
}

.loc-stats-inline {
    margin: 0;
    gap: 1.25rem;
}

.loc-stats-inline dd {
    font-size: 1.4rem;
}

/* ---------- Layout: two columns desktop, stacked mobile ---------- */

.loc-main {
    background: var(--loc-bg);
    padding: 1.5rem 0 3rem;
}

.loc-columns {
    display: flex;
    flex-direction: column-reverse; /* mobile: map above list (spec §5.1) */
    gap: 1.25rem;
}

.loc-map {
    height: 45vh;
    min-height: 300px;
}

@media (min-width: 1024px) {
    .loc-columns {
        display: grid;
        grid-template-columns: minmax(24rem, 2fr) 3fr;
        align-items: start;
        gap: 1.5rem;
    }

    .loc-map-col {
        position: sticky;
        top: 6rem;
    }

    .loc-map {
        height: calc(100vh - 9rem);
        min-height: 480px;
    }
}

.loc-map-shell {
    position: relative;
    border-radius: 1rem;
    overflow: hidden;
    border: 1px solid var(--loc-line);
    background: #dbe4ee;
}

/* ---------- Legend ---------- */

.loc-legend {
    position: absolute;
    left: 0.75rem;
    bottom: 0.75rem;
    z-index: 800;
    background: rgba(255, 255, 255, 0.94);
    border-radius: 0.6rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    color: var(--loc-ink);
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.8rem;
    align-items: center;
    box-shadow: 0 1px 6px rgba(15, 23, 42, 0.15);
}

.loc-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.loc-legend-dot {
    width: 0.65rem;
    height: 0.65rem;
    border-radius: 9999px;
    display: inline-block;
}

/* ---------- Filters ---------- */

.loc-filters {
    background: #fff;
    border: 1px solid var(--loc-line);
    border-radius: 1rem;
    padding: 1rem;
    display: grid;
    gap: 0.85rem;
}

.loc-search input {
    width: 100%;
    border: 1px solid var(--loc-line);
    border-radius: 0.6rem;
    padding: 0.6rem 0.9rem;
    font-size: 0.95rem;
}

.loc-filter-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
    gap: 0.6rem;
}

.loc-filter-row label span,
.loc-amenities-filter legend {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--loc-muted);
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.loc-filter-row select {
    width: 100%;
    border: 1px solid var(--loc-line);
    border-radius: 0.6rem;
    padding: 0.5rem 0.6rem;
    font-size: 0.9rem;
    background: #fff;
}

.loc-amenities-filter {
    border: 0;
    padding: 0;
    margin: 0;
}

.loc-amenities-filter > div {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.9rem;
}

.loc-amenities-filter label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.85rem;
    color: var(--loc-ink);
}

.loc-filter-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.loc-near-denied {
    font-size: 0.8rem;
    color: #b45309;
    margin: 0;
}

/* ---------- Buttons ---------- */

.loc-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border: 1px solid transparent;
    border-radius: 0.6rem;
    padding: 0.55rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    background: transparent;
    color: var(--loc-accent);
}

.loc-btn-primary {
    background: var(--loc-accent);
    color: #fff;
}

.loc-btn-primary:hover {
    background: var(--loc-accent-dark);
    color: #fff;
}

.loc-btn-ghost {
    border-color: var(--loc-line);
    color: var(--loc-ink);
    background: #fff;
}

.loc-btn-ghost:hover {
    border-color: var(--loc-accent);
    color: var(--loc-accent);
}

.loc-btn-mini {
    padding: 0.3rem 0.6rem;
    font-size: 0.78rem;
    border-radius: 0.45rem;
    background: var(--loc-accent);
    color: #fff;
}

.loc-btn-mini.loc-btn-ghost {
    background: #fff;
    color: var(--loc-ink);
}

.loc-btn-block {
    display: flex;
    justify-content: center;
    width: 100%;
}

/* ---------- Result count / list / cards ---------- */

.loc-count {
    font-size: 0.9rem;
    color: var(--loc-muted);
    margin: 0.9rem 0 0.6rem;
}

.loc-cards {
    display: grid;
    gap: 0.75rem;
}

@media (min-width: 1024px) {
    .loc-list-col .loc-cards {
        max-height: calc(100vh - 22rem);
        overflow-y: auto;
        padding-right: 0.25rem;
    }
}

.loc-cards-row {
    grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
    max-height: none !important;
}

.loc-card {
    display: flex;
    gap: 0.8rem;
    background: #fff;
    border: 1px solid var(--loc-line);
    border-radius: 0.9rem;
    padding: 0.8rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.loc-card:hover,
.loc-card.is-active {
    border-color: var(--loc-accent);
    box-shadow: 0 2px 12px rgba(12, 101, 227, 0.12);
}

.loc-card-img {
    width: 7.5rem;
    height: 5.6rem;
    object-fit: cover;
    border-radius: 0.6rem;
    flex-shrink: 0;
}

.loc-card-body {
    min-width: 0;
    flex: 1;
}

.loc-card-title {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 0.15rem;
    color: var(--loc-ink);
}

.loc-card-title a {
    color: inherit;
    text-decoration: none;
}

.loc-card-title a:hover {
    color: var(--loc-accent);
}

.loc-card-address {
    font-size: 0.82rem;
    color: var(--loc-muted);
    margin: 0 0 0.35rem;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.loc-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem 0.7rem;
    font-size: 0.8rem;
    color: var(--loc-ink);
    margin: 0 0 0.35rem;
    align-items: center;
}

.loc-badge {
    display: inline-block;
    border-radius: 0.4rem;
    padding: 0.1rem 0.45rem;
    font-size: 0.72rem;
    font-weight: 700;
}

.loc-badge-subtype {
    background: rgba(12, 101, 227, 0.1);
    color: var(--loc-accent);
}

.loc-card-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.8rem;
    margin: 0 0 0.45rem;
}

.loc-status {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-weight: 600;
}

.loc-status-dot {
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 9999px;
    background: currentColor;
}

.loc-status-operating { color: #16a34a; }
.loc-status-construction { color: #f59e0b; }
.loc-status-planned { color: #64748b; }
.loc-status-maintenance { color: #dc2626; }

.loc-distance {
    color: var(--loc-muted);
    font-weight: 600;
}

.loc-card-actions {
    display: flex;
    gap: 0.4rem;
    margin: 0;
}

.loc-empty {
    background: #fff;
    border: 1px dashed var(--loc-line);
    border-radius: 0.9rem;
    text-align: center;
    color: var(--loc-muted);
    padding: 2rem 1rem;
}

.loc-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
    border-radius: 0.9rem;
    text-align: center;
    padding: 1.2rem 1rem;
}

.loc-load-more {
    margin-top: 1rem;
    text-align: center;
}

/* Loading skeleton */

.loc-skeleton {
    border-radius: 0.9rem;
    height: 7rem;
    background: linear-gradient(90deg, #eef2f7 25%, #f8fafc 50%, #eef2f7 75%);
    background-size: 200% 100%;
    animation: loc-shimmer 1.1s infinite;
}

@keyframes loc-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ---------- Mobile floating toggle + bottom sheet ---------- */

.loc-view-toggle {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: 1.25rem;
    z-index: 900;
    background: var(--loc-ink);
    color: #fff;
    border: 0;
    border-radius: 9999px;
    padding: 0.65rem 1.4rem;
    font-size: 0.9rem;
    font-weight: 700;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.35);
    cursor: pointer;
}

@media (min-width: 1024px) {
    .loc-view-toggle {
        display: none !important;
    }
}

/* Mobile "map" mode: map becomes full-screen-ish, list hidden */
@media (max-width: 1023px) {
    .loc-main[data-view="map"] .loc-list-col {
        display: none;
    }

    .loc-main[data-view="map"] .loc-map {
        height: calc(100vh - 12rem);
    }
}

.loc-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 950;
    background: #fff;
    border-radius: 1rem 1rem 0 0;
    box-shadow: 0 -6px 24px rgba(15, 23, 42, 0.25);
    padding: 0.75rem 1rem 1.25rem;
    transform: translateY(105%);
    transition: transform 0.25s ease;
    max-height: 55vh;
    overflow-y: auto;
}

.loc-sheet.is-open {
    transform: translateY(0);
}

.loc-sheet-close {
    position: absolute;
    top: 0.5rem;
    right: 0.75rem;
    border: 0;
    background: transparent;
    font-size: 1.4rem;
    color: var(--loc-muted);
    cursor: pointer;
    line-height: 1;
}

@media (min-width: 1024px) {
    .loc-sheet {
        display: none;
    }
}

/* ---------- Markers ---------- */

.loc-marker {
    background: transparent;
    border: 0;
}

.loc-marker svg {
    filter: drop-shadow(0 2px 3px rgba(15, 23, 42, 0.35));
    transition: transform 0.12s ease;
    transform-origin: bottom center;
}

.loc-marker.is-highlighted svg {
    transform: scale(1.25);
}

/* ---------- Detail page ---------- */

.loc-detail {
    padding: calc(var(--loc-header-offset, 5rem) + 1.5rem) 0 2.5rem;
    background: #fff;
}

.loc-breadcrumb {
    font-size: 0.85rem;
    color: var(--loc-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.loc-breadcrumb a {
    color: var(--loc-muted);
    text-decoration: none;
}

.loc-breadcrumb a:hover {
    color: var(--loc-accent);
}

.loc-detail-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.loc-detail-header h1 {
    font-size: clamp(1.4rem, 3.5vw, 2rem);
    font-weight: 800;
    color: var(--loc-ink);
    margin: 0;
}

.loc-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
    gap: 0.6rem;
    margin-bottom: 1.5rem;
}

.loc-gallery-item img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 0.7rem;
    display: block;
}

.loc-detail-cover {
    width: 100%;
    max-height: 24rem;
    object-fit: cover;
    border-radius: 1rem;
    margin-bottom: 1.5rem;
}

.loc-detail-grid {
    display: grid;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

@media (min-width: 900px) {
    .loc-detail-grid {
        grid-template-columns: 1fr 1fr;
        align-items: start;
    }
}

.loc-specs {
    display: grid;
    gap: 0.8rem;
    margin: 0;
    background: var(--loc-bg);
    border: 1px solid var(--loc-line);
    border-radius: 1rem;
    padding: 1.1rem;
}

.loc-specs dt {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--loc-muted);
    margin-bottom: 0.15rem;
}

.loc-specs dd {
    margin: 0;
    color: var(--loc-ink);
    font-size: 0.95rem;
}

.loc-units,
.loc-amenity-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.3rem;
}

.loc-amenity-list {
    grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
}

.loc-amenity-list i {
    color: var(--loc-accent);
    margin-right: 0.25rem;
}

.loc-detail-map-shell {
    display: grid;
    gap: 0.75rem;
}

.loc-detail-map {
    height: 20rem;
    border-radius: 1rem;
    border: 1px solid var(--loc-line);
    background: #dbe4ee;
}

.loc-description {
    max-width: 52rem;
    color: var(--loc-ink);
    line-height: 1.7;
    margin-bottom: 1.75rem;
}

.loc-nearby h2 {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--loc-ink);
    margin: 0 0 0.8rem;
}

/* ---------- CTA ---------- */

.loc-cta {
    background: linear-gradient(135deg, var(--loc-accent) 0%, #06b6d4 100%);
    color: #fff;
    text-align: center;
    padding: 2.5rem 0;
}

.loc-cta h2 {
    font-size: clamp(1.3rem, 3vw, 1.8rem);
    font-weight: 800;
    margin: 0 0 0.5rem;
}

.loc-cta p {
    opacity: 0.92;
    margin: 0 0 1rem;
}

.loc-cta .loc-btn-primary {
    background: #fff;
    color: var(--loc-accent);
}

/* ---------- Home widget ---------- */

.loc-widget {
    padding: 3rem 0;
    background: var(--loc-bg);
}

.loc-widget-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.loc-widget-head h2 {
    font-size: clamp(1.3rem, 3vw, 1.9rem);
    font-weight: 800;
    color: var(--loc-ink);
    margin: 0;
}

.loc-widget-map {
    height: 22rem;
    border-radius: 1rem;
    border: 1px solid var(--loc-line);
    background: #dbe4ee;
}

.loc-widget-cta {
    margin-top: 1.25rem;
    text-align: center;
}
