.section--map-page {
    padding-top: 24px;
}

.site-header--top {
    position: sticky;
    top: 0;
    z-index: 5000;
}

.section__header--map {
    align-items: center;
}

.section__header--map h1 {
    margin: 0 0 10px;
    font-size: 2.2rem;
    line-height: 1.05;
    letter-spacing: -0.03em;
}

.section__header--map p {
    max-width: 980px;
    margin: 0;
    color: var(--text-soft);
}

.map-page__count {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 92px;
    min-height: 58px;
    padding: 0 18px;
    border-radius: 999px;
    border: 1px solid rgba(195, 211, 233, 0.95);
    background: rgba(255, 255, 255, 0.94);
    box-shadow: var(--shadow);
    font-size: 1.25rem;
    font-weight: 800;
}

.map-filters {
    display: grid;
    grid-template-columns: minmax(260px, 1.6fr) repeat(2, minmax(170px, 0.7fr)) auto auto;
    gap: 14px;
    align-items: end;
    margin-bottom: 22px;
}

.map-filters__field,
.map-filters__checkbox,
.map-filters__actions {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.map-filters__field span,
.map-filters__checkbox span {
    font-weight: 700;
}

.map-filters__field input,
.map-filters__field select {
    width: 100%;
    min-height: 52px;
    padding: 0 14px;
    border: 1px solid rgba(195, 211, 233, 1);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.98);
    color: var(--text);
}

.map-filters__checkbox {
    flex-direction: row;
    align-items: center;
    gap: 10px;
    min-height: 52px;
    padding-bottom: 2px;
}

.map-filters__checkbox input {
    width: 18px;
    height: 18px;
}

.map-filters__actions {
    flex-direction: row;
    align-items: center;
    gap: 10px;
}

.map-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.8fr) minmax(320px, 0.9fr);
    gap: 18px;
    align-items: start;
}

.card-surface,
.map-canvas-wrap {
    position: relative;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(195, 211, 233, 0.95);
    border-radius: 26px;
    box-shadow: var(--shadow);
}

.map-canvas-wrap {
    padding: 18px;
    overflow: hidden;
}

.map-canvas {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 680px !important;
    min-height: 680px;
    border-radius: 20px;
    overflow: hidden;
    background: linear-gradient(180deg, #ddeafc 0%, #cfe0fb 100%);
}


.leaflet-container,
.leaflet-pane,
.leaflet-top,
.leaflet-bottom,
.leaflet-control,
.leaflet-pane > * {
    z-index: 1;
}

.leaflet-top,
.leaflet-bottom {
    pointer-events: none;
}

.leaflet-top .leaflet-control,
.leaflet-bottom .leaflet-control {
    pointer-events: auto;
}

.leaflet-control-attribution {
    display: none !important;
}

.map-sidebar {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.map-legend,
.map-results {
    padding: 22px;
}

.map-legend h2,
.map-results h2 {
    margin: 0 0 18px;
    font-size: 1.7rem;
    line-height: 1.05;
    letter-spacing: -0.03em;
}

.map-legend ul {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.map-legend li {
    display: flex;
    align-items: center;
    gap: 10px;
}

.map-legend__dot,
.map-result-card__dot {
    position: relative;
    width: 16px;
    height: 16px;
    border-radius: 999px;
    display: inline-block;
    flex: 0 0 16px;
}

.map-result-card__dot::before,
.map-result-card__dot::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 22px;
    height: 22px;
    border-radius: 999px;
    border: 2px solid currentColor;
    opacity: 0;
    transform: translate(-50%, -50%) scale(.8);
}

.map-legend__dot--online,
.map-result-card__dot--online {
    background: #16a34a;
    color: #16a34a;
}

.map-legend__dot--offline,
.map-result-card__dot--offline {
    background: #dc2626;
    color: #dc2626;
}

.map-result-card__dot--online::before,
.map-result-card__dot--online::after,
.map-result-card__dot--offline::before,
.map-result-card__dot--offline::after {
    animation: map-status-wave 1.8s ease-out infinite;
}

.map-result-card__dot--online::after,
.map-result-card__dot--offline::after {
    animation-delay: .6s;
}

@keyframes map-status-wave {
    0% { opacity: .62; transform: translate(-50%, -50%) scale(.8); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(1.95); }
}

.map-results__list {
    max-height: 920px;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding-right: 6px;
}

.map-result-card {
    position: relative;
    padding: 18px 18px 16px;
    border-radius: 18px;
    border: 1px solid rgba(195, 211, 233, 0.96);
    background: linear-gradient(180deg, rgba(255,255,255,.98) 0%, rgba(248,251,255,.98) 100%);
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.map-result-card:hover {
    transform: translateY(-2px);
    border-color: rgba(105, 146, 231, 0.96);
    box-shadow: 0 12px 30px rgba(37, 99, 235, 0.10);
}

.map-result-card h3 {
    margin: 0 0 10px;
    font-size: 1.12rem;
    line-height: 1.25;
    letter-spacing: -0.02em;
    padding-right: 82px;
}

.map-result-card h3 a {
    color: var(--text);
}

.map-result-card__mode {
    position: absolute;
    top: 18px;
    right: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    background: #eef4ff;
    color: #2f64f2;
    font-weight: 800;
    font-size: 0.9rem;
}

.map-result-card p {
    margin: 8px 0 0;
    color: var(--text-soft);
}

.map-result-card__status-line {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 20px;
}

.map-result-card__location {
    color: var(--text-soft);
}

.map-popup {
    min-width: 210px;
    font-size: 14px;
    line-height: 1.45;
}

.map-popup strong {
    display: inline-block;
    margin-bottom: 6px;
    color: var(--text);
}

.map-popup a {
    display: inline-flex;
    margin-top: 8px;
    font-weight: 800;
}

@media (max-width: 1200px) {
    .map-layout {
        grid-template-columns: 1fr;
    }

    .map-results__list {
        max-height: none;
    }
}

@media (max-width: 920px) {
    .map-filters {
        grid-template-columns: 1fr 1fr;
    }

    .map-filters__field--search,
    .map-filters__actions {
        grid-column: 1 / -1;
    }
}

@media (max-width: 700px) {
    .map-filters {
        grid-template-columns: 1fr;
    }

    .map-filters__actions {
        flex-direction: column;
        align-items: stretch;
    }

    .map-canvas {
        height: 480px !important;
        min-height: 480px;
    }

    .map-note {
        right: 18px;
        bottom: 18px;
    }
}


/* RFM213: Yandex map markers like preview-card status */
.ym-map-marker {
    position: relative;
    width: 28px;
    height: 28px;
}

.ym-map-marker__button {
    position: relative;
    display: block;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.ym-map-marker__button::before,
.ym-map-marker__button::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 24px;
    height: 24px;
    border-radius: 999px;
    border: 2px solid currentColor;
    opacity: 0;
    transform: translate(-50%, -50%) scale(.82);
    pointer-events: none;
}

.ym-map-marker__core {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 12px;
    height: 12px;
    display: block;
    border-radius: 999px;
    background: currentColor;
    border: 3px solid #ffffff;
    box-shadow: 0 0 0 5px rgba(255,255,255,.34);
    transform: translate(-50%, -50%);
}

.ym-map-marker--active { color: #16a34a; }
.ym-map-marker--inactive { color: #dc2626; }
.ym-map-marker--unknown { color: #64748b; }

.ym-map-marker--active .ym-map-marker__button::before,
.ym-map-marker--active .ym-map-marker__button::after,
.ym-map-marker--inactive .ym-map-marker__button::before,
.ym-map-marker--inactive .ym-map-marker__button::after {
    animation: map-status-wave 1.8s ease-out infinite;
}

.ym-map-marker--active .ym-map-marker__button::after,
.ym-map-marker--inactive .ym-map-marker__button::after {
    animation-delay: .6s;
}

.ym-map-marker--focus .ym-map-marker__core {
    box-shadow: 0 0 0 7px rgba(255,255,255,.40);
}

.ym-map-marker__popup {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 12px);
    transform: translateX(-50%);
    min-width: 230px;
    max-width: 280px;
    display: none;
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(255,255,255,.98);
    border: 1px solid rgba(195, 211, 233, .98);
    box-shadow: 0 18px 34px rgba(15,23,42,.16);
    color: #1e293b;
    font-size: 13px;
    line-height: 1.45;
}

.ym-map-marker__popup::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 100%;
    width: 12px;
    height: 12px;
    background: rgba(255,255,255,.98);
    border-right: 1px solid rgba(195, 211, 233, .98);
    border-bottom: 1px solid rgba(195, 211, 233, .98);
    transform: translate(-50%, -7px) rotate(45deg);
}

.ym-map-marker.is-open .ym-map-marker__popup {
    display: block;
}

.ym-map-popup-card__title {
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.3;
}

.ym-map-popup-card__link {
    display: inline-flex;
    margin-top: 8px;
    color: var(--primary);
    font-weight: 700;
    text-decoration: none;
}

.ym-map-popup-card__link:hover {
    color: var(--primary-dark);
}

.ymaps3x0--map-copyrights,
.ymaps3x0--scale-in-copyrights {
    font-size: 11px;
}
