/* Halmo - mapa obiektu. Tokeny --hm-* z fallbackami palety CIEPLE STUDIO. */

.halmo-mapa {
    position: relative;
}

.halmo-mapa__bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.6rem;
}

.halmo-mapa__tab {
    border: 1px solid var(--hm-border, #d5d9de);
    color: var(--hm-text, #1f2530);
    background: transparent;
    border-radius: 999px;
    padding: 0.25rem 0.85rem;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.halmo-mapa__tab:hover {
    border-color: var(--hm-primary, #0C7D8D);
}

.halmo-mapa__tab.is-active {
    background: var(--hm-primary, #0C7D8D);
    border-color: var(--hm-primary, #0C7D8D);
    color: #fff;
}

/* Powrot na teren (poziom 1), gdy wnetrze otwarto z mapy terenu. */
.halmo-mapa__back {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    border: 1px solid var(--hm-primary, #0C7D8D);
    color: var(--hm-primary, #0C7D8D);
    background: transparent;
    border-radius: 999px;
    padding: 0.25rem 0.9rem;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.halmo-mapa__back:hover,
.halmo-mapa__back:focus-visible {
    background: var(--hm-primary, #0C7D8D);
    color: #fff;
}

.halmo-mapa__stage {
    width: 100%;
    border: 1px solid var(--hm-border, #e3e6ea);
    border-radius: var(--hm-radius, 10px);
    background: var(--hm-surface, #FAF6EF);
    overflow: hidden;
}

.halmo-mapa__svg {
    display: block;
    width: 100%;
    height: auto;
    max-height: 72vh;
}

.halmo-mapa__outline {
    fill: var(--hm-plan-bg, #f1ede4);
    stroke: var(--hm-border, #cfd3d8);
    stroke-width: 1;
    vector-effect: non-scaling-stroke;
}

.halmo-mapa__lokal {
    fill: var(--hm-vacant, #e7e3da);
    stroke: #fff;
    stroke-width: 1;
    vector-effect: non-scaling-stroke;
    cursor: default;
    transition: fill-opacity 0.12s ease, filter 0.12s ease;
}

.halmo-mapa__lokal.is-occupied {
    fill: var(--hm-fill, var(--hm-primary, #0C7D8D));
    fill-opacity: 0.85;
    cursor: pointer;
}

.halmo-mapa__lokal--wolny.is-vacant {
    fill: var(--hm-vacant, #e7e3da);
    stroke: var(--hm-border, #cfd3d8);
    stroke-dasharray: 4 3;
}

.halmo-mapa__lokal--zarezerwowany {
    fill: var(--hm-reserved, #F2A03C);
    fill-opacity: 0.45;
}

.halmo-mapa__lokal.is-occupied:hover,
.halmo-mapa__lokal:focus {
    fill-opacity: 1;
    filter: brightness(1.08);
    outline: none;
}

.halmo-mapa__svg a {
    outline: none;
}

.halmo-mapa__legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem 1.1rem;
    margin-top: 0.65rem;
    font-size: 0.82rem;
}

.halmo-mapa__legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.halmo-mapa__swatch {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    background: var(--hm-primary, #0C7D8D);
    flex: 0 0 auto;
}

.halmo-mapa__swatch--vacant {
    background: var(--hm-vacant, #e7e3da);
    border: 1px dashed var(--hm-border, #cfd3d8);
}

.halmo-mapa__swatch--reserved {
    background: var(--hm-reserved, #F2A03C);
    opacity: 0.55;
}

.halmo-mapa__tip {
    position: absolute;
    z-index: 5;
    pointer-events: none;
    background: #1f2530;
    color: #fff;
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    font-size: 0.8rem;
    line-height: 1.35;
    max-width: 240px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.halmo-mapa__tip strong {
    display: block;
}

.halmo-mapa__tip small {
    opacity: 0.82;
}

.halmo-mapa__msg {
    padding: 2.5rem 1rem;
    text-align: center;
    opacity: 0.7;
    margin: 0;
}

/* ====== v0.10.0: interaktywnosc (zoom/pan, filtr, szukajka, wizytowka) ====== */

.halmo-mapa__tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
    margin-bottom: 0.6rem;
}

.halmo-mapa__search {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1 1 240px;
    min-width: 0;
}

.halmo-mapa__input {
    flex: 1 1 auto;
    min-width: 0;
    border: 1px solid var(--hm-border, #d5d9de);
    border-radius: 999px;
    padding: 0.4rem 0.9rem;
    font-size: 0.88rem;
    color: var(--hm-text, #1f2530);
    background: #fff;
}

.halmo-mapa__input:focus-visible {
    outline: 2px solid var(--hm-primary, #0C7D8D);
    outline-offset: 1px;
    border-color: var(--hm-primary, #0C7D8D);
}

.halmo-mapa__hint {
    font-size: 0.78rem;
    color: var(--hm-primary, #0C7D8D);
    white-space: nowrap;
}

.halmo-mapa__hint.is-empty {
    color: var(--hm-muted, #8a9099);
}

.halmo-mapa__zoom {
    display: flex;
    gap: 0.3rem;
    margin-left: auto;
}

.halmo-mapa__zbtn {
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--hm-border, #d5d9de);
    background: #fff;
    color: var(--hm-text, #1f2530);
    border-radius: 8px;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.halmo-mapa__zbtn:hover {
    border-color: var(--hm-primary, #0C7D8D);
    background: var(--hm-surface, #FAF6EF);
}

.halmo-mapa__zbtn:focus-visible {
    outline: 2px solid var(--hm-primary, #0C7D8D);
    outline-offset: 1px;
}

.halmo-mapa__svg {
    touch-action: none;
    cursor: grab;
}

.halmo-mapa__svg.is-grabbing {
    cursor: grabbing;
}

/* Wygaszanie i podswietlenie przy filtrze / szukajce */
.halmo-mapa__lokal.is-dimmed {
    fill-opacity: 0.12;
    filter: grayscale(1);
}

.halmo-mapa__lokal.is-dimmed.is-vacant {
    opacity: 0.3;
}

.halmo-mapa__lokal.is-match.is-occupied {
    fill-opacity: 1;
    stroke: var(--hm-text, #1f2530);
    stroke-width: 2;
}

/* Legenda jako filtr branzy */
.halmo-mapa__filter {
    border: 1px solid transparent;
    background: transparent;
    border-radius: 999px;
    padding: 0.18rem 0.5rem 0.18rem 0.3rem;
    cursor: pointer;
    font: inherit;
    font-size: 0.82rem;
    color: inherit;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.halmo-mapa__filter:hover {
    border-color: var(--hm-border, #cfd3d8);
}

.halmo-mapa__filter.is-active {
    border-color: var(--hm-primary, #0C7D8D);
    background: var(--hm-surface, #FAF6EF);
    font-weight: 600;
}

.halmo-mapa__filter:focus-visible {
    outline: 2px solid var(--hm-primary, #0C7D8D);
    outline-offset: 1px;
}

/* Mini-wizytowka */
.halmo-mapa__card {
    position: absolute;
    z-index: 8;
    width: min(260px, calc(100% - 16px));
    background: #fff;
    color: var(--hm-text, #1f2530);
    border: 1px solid var(--hm-border, #e3e6ea);
    border-radius: var(--hm-radius, 10px);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
    padding: 0.75rem 0.8rem 0.85rem;
}

.halmo-mapa__card-x {
    position: absolute;
    top: 0.25rem;
    right: 0.35rem;
    border: 0;
    background: transparent;
    color: var(--hm-muted, #8a9099);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.15rem 0.3rem;
}

.halmo-mapa__card-x:hover {
    color: var(--hm-text, #1f2530);
}

.halmo-mapa__card-head {
    display: flex;
    gap: 0.6rem;
    align-items: center;
    padding-right: 1rem;
}

.halmo-mapa__card-logo {
    width: 42px;
    height: 42px;
    object-fit: cover;
    border-radius: 8px;
    flex: 0 0 auto;
    background: var(--hm-surface, #FAF6EF);
}

.halmo-mapa__card-id strong {
    display: block;
    font-size: 0.96rem;
    line-height: 1.2;
}

.halmo-mapa__card-meta {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 0.15rem;
    font-size: 0.78rem;
    color: var(--hm-muted, #6b7280);
}

.halmo-mapa__dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    display: inline-block;
}

.halmo-mapa__card-contact {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    margin-top: 0.55rem;
    font-size: 0.82rem;
}

.halmo-mapa__card-contact a {
    color: var(--hm-primary, #0C7D8D);
    text-decoration: none;
}

.halmo-mapa__card-contact a:hover {
    text-decoration: underline;
}

.halmo-mapa__card-link {
    display: inline-block;
    margin-top: 0.65rem;
}

@media (prefers-reduced-motion: reduce) {
    .halmo-mapa__lokal,
    .halmo-mapa__tab,
    .halmo-mapa__zbtn,
    .halmo-mapa__filter {
        transition: none;
    }
}


/* HALMO 0.22.5 - zabezpieczenie przed nadpisywaniem koloru ikon/filtrów przez motyw przy hover. */
.halmo-mapa button.halmo-mapa__zbtn,
.halmo-mapa button.halmo-mapa__zbtn:hover,
.halmo-mapa button.halmo-mapa__zbtn:focus,
.halmo-mapa button.halmo-mapa__zbtn:focus-visible {
    color: var(--hm-text, #1f2530);
    text-shadow: none;
}
.halmo-mapa button.halmo-mapa__filter,
.halmo-mapa button.halmo-mapa__filter:hover,
.halmo-mapa button.halmo-mapa__filter:focus,
.halmo-mapa button.halmo-mapa__filter:focus-visible,
.halmo-mapa button.halmo-mapa__filter.is-active {
    color: var(--hm-text, #1f2530);
    text-shadow: none;
}
.halmo-mapa button.halmo-mapa__filter:hover {
    background: var(--hm-surface, #FAF6EF);
}

/* HALMO 0.22.6 - wyróżnienie lokalu na wizytówce najemcy */
.halmo-mapa__lokal.is-tenant-focus {
    fill-opacity: 1;
    stroke: var(--hm-text, #1f2530);
    stroke-width: 3;
    filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.25));
}

.halmo-mapa--tenant .halmo-mapa__svg {
    max-height: 420px;
}

/* HALMO 0.22.8 - kontekstowe podświetlenie lokalu na bloku wizytówki najemcy */
.halmo-mapa.has-tenant-focus .halmo-mapa__lokal:not(.is-tenant-focus) {
    opacity: 0.34;
}

.halmo-mapa__lokal.is-tenant-focus {
    opacity: 1;
    fill-opacity: 1;
    stroke: var(--hm-text, #1f2530);
    stroke-width: 3.5;
    paint-order: stroke fill;
    filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.3));
    animation: halmoTenantFocusPulse 1.28s ease-in-out 0s 5;
}

.halmo-mapa--tenant-context .halmo-mapa__stage {
    background:
        radial-gradient(circle at 50% 42%, rgba(12, 125, 141, 0.08), transparent 42%),
        var(--hm-surface, #FAF6EF);
}

@keyframes halmoTenantFocusPulse {
    0% { stroke-width: 2.4; filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.18)); }
    50% { stroke-width: 6.2; filter: drop-shadow(0 5px 13px rgba(0, 0, 0, 0.35)); }
    100% { stroke-width: 3.5; filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.3)); }
}

@media (prefers-reduced-motion: reduce) {
    .halmo-mapa__lokal.is-tenant-focus {
        animation: none;
    }
}

/* HALMO 0.22.9 - profesjonalny układ poziomu 2: mapa 70-80% + panel najemców. */
.halmo-mapa--with-side .halmo-mapa__layout {
    display: grid;
    grid-template-columns: minmax(0, 3.25fr) minmax(280px, 0.95fr);
    gap: 1rem;
    align-items: stretch;
}

.halmo-mapa__map {
    position: relative;
    min-width: 0;
}

.halmo-mapa--with-side .halmo-mapa__stage {
    height: clamp(520px, 72vh, 780px);
    min-height: 520px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.halmo-mapa--with-side .halmo-mapa__svg {
    width: 100%;
    height: 100%;
    max-height: none;
}

.halmo-mapa__side {
    min-width: 0;
    max-height: clamp(520px, 72vh, 780px);
    border: 1px solid var(--hm-border, #e3e6ea);
    border-radius: var(--hm-radius, 10px);
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 42, 46, 0.06);
    padding: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.halmo-mapa__side-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
}

.halmo-mapa__side-title {
    margin: 0;
    font-size: 1rem;
    line-height: 1.2;
    color: var(--hm-text, #1f2530);
}

.halmo-mapa__side-count {
    font-size: 0.78rem;
    color: var(--hm-muted, #6b7280);
    white-space: nowrap;
}

.halmo-mapa--with-side .halmo-mapa__tools {
    flex-direction: column;
    align-items: stretch;
    gap: 0.55rem;
    margin-bottom: 0;
}

.halmo-mapa--with-side .halmo-mapa__search {
    flex: 0 0 auto;
    width: 100%;
}

.halmo-mapa--with-side .halmo-mapa__input {
    border-radius: 12px;
    padding: 0.62rem 0.75rem;
    font-size: 0.92rem;
}

.halmo-mapa--with-side .halmo-mapa__hint {
    position: absolute;
    right: 0.6rem;
    top: 50%;
    transform: translateY(-50%);
    background: #fff;
    padding-left: 0.3rem;
}

.halmo-mapa__status-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.halmo-mapa__status {
    border: 1px solid var(--hm-border, #d5d9de);
    background: var(--hm-surface, #f7f9f9);
    color: var(--hm-text, #1f2530);
    border-radius: 999px;
    padding: 0.25rem 0.58rem;
    font-size: 0.78rem;
    line-height: 1.2;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.halmo-mapa__status:hover,
.halmo-mapa__status:focus-visible {
    border-color: var(--hm-primary, #0c7d8d);
}

.halmo-mapa__status.is-active {
    background: var(--hm-primary, #0c7d8d);
    border-color: var(--hm-primary, #0c7d8d);
    color: #fff;
}

.halmo-mapa--with-side .halmo-mapa__zoom {
    margin-left: 0;
    justify-content: flex-start;
}

.halmo-mapa--with-side .halmo-mapa__legend {
    margin-top: 0;
    padding-top: 0.65rem;
    border-top: 1px solid var(--hm-border, #e3e6ea);
    gap: 0.35rem;
}

.halmo-mapa__tenant-list {
    min-height: 0;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 0.38rem;
    padding-right: 0.15rem;
}

.halmo-mapa__tenant-item {
    width: 100%;
    display: grid;
    grid-template-columns: 0.75rem minmax(0, 1fr);
    gap: 0.55rem;
    align-items: center;
    text-align: left;
    border: 1px solid var(--hm-border, #e3e6ea);
    border-radius: 12px;
    background: #fff;
    color: var(--hm-text, #1f2530);
    padding: 0.58rem 0.65rem;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.halmo-mapa__tenant-item:hover,
.halmo-mapa__tenant-item.is-hover,
.halmo-mapa__tenant-item:focus-visible {
    border-color: var(--hm-primary, #0c7d8d);
    background: var(--hm-surface, #f7f9f9);
    box-shadow: 0 5px 16px rgba(12, 125, 141, 0.12);
    transform: translateY(-1px);
    outline: none;
}

.halmo-mapa__tenant-item.is-selected {
    border-color: var(--hm-primary, #0c7d8d);
    box-shadow: inset 3px 0 0 var(--hm-primary, #0c7d8d), 0 5px 16px rgba(12, 125, 141, 0.14);
}

.halmo-mapa__tenant-swatch {
    width: 0.72rem;
    height: 0.72rem;
    border-radius: 50%;
    background: var(--hm-primary, #0c7d8d);
    border: 1px solid rgba(0, 0, 0, 0.12);
}

.halmo-mapa__tenant-item.is-vacant .halmo-mapa__tenant-swatch {
    background: var(--hm-vacant, #e7e3da);
    border-style: dashed;
}

.halmo-mapa__tenant-item.is-reserved .halmo-mapa__tenant-swatch {
    background: var(--hm-reserved, #f2a03c);
}

.halmo-mapa__tenant-body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.08rem;
}

.halmo-mapa__tenant-name {
    display: block;
    font-size: 0.9rem;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.halmo-mapa__tenant-meta {
    display: block;
    font-size: 0.76rem;
    line-height: 1.25;
    color: var(--hm-muted, #6b7280);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.halmo-mapa__tenant-empty {
    margin: 0;
    padding: 0.75rem;
    border: 1px dashed var(--hm-border, #d5d9de);
    border-radius: 12px;
    color: var(--hm-muted, #6b7280);
    text-align: center;
    font-size: 0.86rem;
}

.halmo-mapa__compass {
    position: absolute;
    top: 0.8rem;
    right: 0.8rem;
    z-index: 4;
}

.halmo-mapa__compass-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    border: 1px solid var(--hm-border, #d5d9de);
    background: rgba(255, 255, 255, 0.94);
    color: var(--hm-text, #1f2530);
    border-radius: 999px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    padding: 0.32rem 0.62rem 0.32rem 0.38rem;
    font-size: 0.78rem;
    line-height: 1;
    cursor: pointer;
    backdrop-filter: blur(8px);
}

.halmo-mapa__compass-btn:hover,
.halmo-mapa__compass-btn:focus-visible {
    border-color: var(--hm-primary, #0c7d8d);
    outline: none;
}

.halmo-mapa__compass-arrow {
    width: 1.55rem;
    height: 1.55rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--hm-primary, #0c7d8d);
    color: #fff;
    font-weight: 800;
    transform-origin: 50% 50%;
    transition: transform 0.22s ease;
}

.halmo-mapa__compass-label {
    white-space: nowrap;
}

.halmo-mapa__lokal.is-related-hover,
.halmo-mapa__lokal.is-active-node {
    fill-opacity: 1;
    stroke: var(--hm-text, #1f2530);
    stroke-width: 2.8;
    paint-order: stroke fill;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.24));
}

.halmo-mapa__lokal.is-active-node {
    animation: halmoMapActivePulse 1.1s ease-in-out 0s 2;
}

@keyframes halmoMapActivePulse {
    0% { stroke-width: 2; }
    50% { stroke-width: 5.5; }
    100% { stroke-width: 2.8; }
}

.halmo-mapa--tenant .halmo-mapa__layout,
.halmo-mapa--tenant-context .halmo-mapa__layout {
    grid-template-columns: 1fr;
}

.halmo-mapa--tenant .halmo-mapa__side,
.halmo-mapa--tenant-context .halmo-mapa__side {
    display: none;
}

.halmo-mapa--tenant .halmo-mapa__stage,
.halmo-mapa--tenant-context .halmo-mapa__stage {
    height: clamp(320px, 48vh, 460px);
    min-height: 320px;
}

@media (max-width: 980px) {
    .halmo-mapa--with-side .halmo-mapa__layout {
        grid-template-columns: 1fr;
    }
    .halmo-mapa__side {
        max-height: none;
    }
    .halmo-mapa__tenant-list {
        max-height: 360px;
    }
}

@media (max-width: 640px) {
    .halmo-mapa--with-side .halmo-mapa__stage {
        height: 64vh;
        min-height: 360px;
    }
    .halmo-mapa__compass-label {
        display: none;
    }
    .halmo-mapa__side {
        padding: 0.7rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .halmo-mapa__tenant-item,
    .halmo-mapa__compass-arrow,
    .halmo-mapa__lokal.is-active-node {
        transition: none;
        animation: none;
    }
    .halmo-mapa__tenant-item:hover,
    .halmo-mapa__tenant-item.is-hover,
    .halmo-mapa__tenant-item:focus-visible {
        transform: none;
    }
}
