.bhpm-map {
    position: relative;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    user-select: none;
    -webkit-user-select: none;
    --bhpm-bw: 4px;
    --bhpm-bc: rgba(0, 0, 0, 1);
    --bhpm-bg: rgba(41, 81, 107, 0.45);
    --bhpm-sold-bg: rgba(58, 58, 58, 0.65);
    --bhpm-sold-bc: rgba(0, 0, 0, 1);
    --bhpm-hover-bc: rgba(0, 0, 0, 1);
    --bhpm-hover-bg: rgba(41, 81, 107, 0.7);
    --bhpm-hover-sold-bg: rgba(42, 42, 42, 0.75);
    --bhpm-hover-sold-bc: rgba(0, 0, 0, 1);
}

.bhpm-map-viewport {
    position: relative;
    overflow: hidden;
    line-height: 0;
    cursor: grab;
    touch-action: pan-y;
}

.bhpm-map-viewport.is-panning {
    cursor: grabbing;
}

.bhpm-map-stage {
    position: relative;
    transform-origin: 0 0;
    will-change: transform;
}

.bhpm-map-img {
    display: block;
    width: 100%;
    height: auto;
    -webkit-user-drag: none;
    user-drag: none;
}

.bhpm-map-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.bhpm-poly {
    fill: var(--bhpm-bg);
    stroke: var(--bhpm-bc);
    stroke-width: var(--bhpm-bw);
    vector-effect: non-scaling-stroke;
    cursor: pointer;
    transition: fill 0.18s ease, stroke 0.18s ease;
}

.bhpm-map:not(.is-mobile) .bhpm-poly:hover {
    fill: var(--bhpm-hover-bg);
    stroke: var(--bhpm-hover-bc);
}

.bhpm-poly.is-sold {
    fill: var(--bhpm-sold-bg);
    stroke: var(--bhpm-sold-bc);
    cursor: default;
}

.bhpm-map:not(.is-mobile) .bhpm-poly.is-sold:hover {
    fill: var(--bhpm-hover-sold-bg);
    stroke: var(--bhpm-hover-sold-bc);
}

/* Мобильный режим: отдельный вид областей, без hover, выделение по клику */
.bhpm-map.is-mobile .bhpm-poly {
    fill: var(--bhpm-m-bg);
    stroke: var(--bhpm-m-bc);
    stroke-width: var(--bhpm-m-bw);
}

.bhpm-map.is-mobile .bhpm-poly.is-sold {
    fill: var(--bhpm-m-sold-bg);
    stroke: var(--bhpm-m-sold-bc);
}

.bhpm-map.is-mobile .bhpm-poly.is-active {
    fill: var(--bhpm-m-active-bg);
    stroke: var(--bhpm-m-active-bc);
}

.bhpm-map.is-mobile .bhpm-poly.is-sold.is-active {
    fill: var(--bhpm-m-active-sold-bg);
    stroke: var(--bhpm-m-active-sold-bc);
}

/* Блюр-слой элемента (размытая копия карты, обрезанная по фигуре) */
.bhpm-el-blur {
    pointer-events: none;
}

/* Интерактивные элементы */
.bhpm-el {
    fill: var(--bhpm-el-bg);
    stroke: var(--bhpm-el-bc);
    stroke-width: var(--bhpm-el-bw);
    vector-effect: non-scaling-stroke;
    transition: fill 0.18s ease, stroke 0.18s ease;
}

.bhpm-el.is-link {
    cursor: pointer;
}

.bhpm-el:hover {
    fill: var(--bhpm-el-hbg);
    stroke: var(--bhpm-el-hbc);
}

/* Скрытие интерактивных элементов в мобильной версии (если выключено в настройках) */
.bhpm-map.is-mobile[data-mobile-elements="0"] .bhpm-el,
.bhpm-map.is-mobile[data-mobile-elements="0"] .bhpm-el-text,
.bhpm-map.is-mobile[data-mobile-elements="0"] .bhpm-el-blur {
    display: none;
}

/* Декоративный элемент — не реагирует на наведение/клик */
.bhpm-el.is-decorative {
    pointer-events: none;
}

.bhpm-el.is-decorative:hover {
    fill: var(--bhpm-el-bg);
    stroke: var(--bhpm-el-bc);
}

.bhpm-el-text {
    pointer-events: none;
    user-select: none;
    font-family: inherit;
    font-weight: 600;
}

.bhpm-el-text.is-link {
    pointer-events: auto;
    cursor: pointer;
}

/* Zoom-контролы — поверх карты, горизонтально (прилипание делает JS) */
.bhpm-zoom-controls {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 30;
    display: flex;
    flex-direction: row;
    gap: 6px;
    pointer-events: none;
}

.bhpm-zoom-btn {
    pointer-events: auto;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.92);
    color: #1d2327;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.bhpm-zoom-btn:hover {
    background: #fff;
}

/* Подсказка про Ctrl + колесо */
.bhpm-zoom-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 8;
    padding: 10px 18px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.72);
    color: #fff;
    font-size: 15px;
    text-align: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.bhpm-zoom-hint.is-visible {
    opacity: 1;
}

/* Карточки */
.bhpm-cards {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 5;
}

.bhpm-card {
    position: absolute;
    width: 260px;
    max-width: 80vw;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.bhpm-card.is-active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.bhpm-card-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;
    display: none;
    background: #d63638;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.bhpm-card.is-sold .bhpm-card-badge {
    display: inline-block;
}

.bhpm-card-image {
    line-height: 0;
}

.bhpm-card-image img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
}

.bhpm-card-body {
    padding: 12px 14px 14px;
}

.bhpm-card-title {
    margin: 0 0 8px;
    font-size: 16px;
    line-height: 1.3;
    color: #1d2327;
}

.bhpm-card-specs {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-bottom: 8px;
    font-size: 13px;
    color: #50575e;
}

.bhpm-card-spec strong {
    color: #1d2327;
}

.bhpm-card-price {
    font-size: 15px;
    font-weight: 600;
    color: #0073aa;
}

/* Кнопка-ссылка на объект внутри карточки (видна в мобильном режиме) */
.bhpm-card-link {
    display: none;
    margin-top: 12px;
    padding: 10px 16px;
    border-radius: 8px;
    background: #0073aa;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
}

.bhpm-card-link:hover,
.bhpm-card-link:focus {
    background: #005d8c;
    color: #fff;
}

.bhpm-card.is-sold .bhpm-card-link {
    display: none;
}

/* Кнопка закрытия карточки (видна в мобильном режиме) */
.bhpm-card-close {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 3;
    display: none;
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

/* В мобильном режиме карточка кликабельна, показываем кнопки */
.bhpm-map.is-mobile .bhpm-card.is-active {
    pointer-events: auto;
}

.bhpm-map.is-mobile .bhpm-card .bhpm-card-close {
    display: block;
}

.bhpm-map.is-mobile .bhpm-card:not(.is-sold) .bhpm-card-link {
    display: block;
}
