.bia-map {
    --bia-navy: #1d252d;
    --bia-red: #da291c;
    --bia-purple: #2e1a47;
    --bia-line: #e3e6e9;
    --bia-muted: #6b7280;
    --bia-surface: #fff;
    --bia-radius: 10px;

    position: relative;
    background: #f6f7f8;
    font-family: inherit;
}

.bia-map *,
.bia-map *::before,
.bia-map *::after {
    box-sizing: border-box;
}

/* ---------- toolbar ---------- */

.bia-map__toolbar {
    position: sticky;
    top: 0;
    z-index: 3;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    padding: 14px 16px 12px;
    background: transparent;
    border-bottom: 1px solid var(--bia-line);
}

.bia-map__floors {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    padding: 0;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
}

.bia-floor {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    min-height: 38px;
    padding: 10px 12px;
    border: 0;
    border-radius: 10px;
    background: #f0f2f4;
    color: var(--bia-navy);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    text-align: left;
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.bia-floor:hover {
    background: #e7eaed;
}

.bia-floor.is-active {
    background: var(--bia-navy);
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.bia-search {
    position: relative;
    width: 100%;
    padding: 0 16px 12px;
}

.bia-search__input {
    width: 100%;
    height: 44px;
    padding: 0 16px;
    border: 1px solid var(--bia-line);
    border-radius: 12px;
    font-size: 15px;
    background: #f9fafb;
    color: var(--bia-navy);
    min-width: 0;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.bia-search__input:focus {
    outline: none;
    border-color: rgba(29, 37, 45, 0.28);
    box-shadow: 0 0 0 3px rgba(29, 37, 45, 0.06);
}

.bia-search__results {
    position: absolute;
    z-index: 20;
    inset-inline: 0;
    top: calc(100% + 4px);
    margin: 0;
    padding: 4px;
    list-style: none;
    background: var(--bia-surface);
    border: 1px solid var(--bia-line);
    border-radius: var(--bia-radius);
    box-shadow: 0 12px 32px rgba(29, 37, 45, 0.16);
    max-height: 320px;
    overflow-y: auto;
}

.bia-search__result {
    display: flex;
    flex-direction: column;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
}

.bia-search__result.is-active,
.bia-search__result:hover {
    background: #f2f4f6;
}

.bia-search__name {
    font-size: 14px;
    font-weight: 600;
    color: var(--bia-navy);
}

.bia-search__meta {
    font-size: 12px;
    color: var(--bia-muted);
}

/* ---------- category chips ---------- */

.bia-map__chips {
    display: flex;
    flex-flow: row wrap;
    align-items: flex-start;
    gap: 6px 8px;
    padding: 0 12px 12px;
    background: var(--bia-surface);
    border-bottom: 1px solid var(--bia-line);
}

.bia-chip {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    max-width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--bia-line);
    border-radius: 10px;
    background: #eef1f3;
    color: var(--bia-navy);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease, transform 0.15s ease;
    box-shadow: none;
    white-space: nowrap;
    text-align: start;
}

.bia-chip__label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bia-chip:hover {
    border-color: rgba(29, 37, 45, 0.2);
}

.bia-chip__icon {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
}

.bia-chip.is-active {
    background: var(--chip-colour, var(--bia-navy));
    border-color: var(--chip-colour, var(--bia-navy));
    color: #fff;
}

.bia-chip.is-active .bia-chip__icon {
    filter: brightness(0) invert(1);
}

/* ---------- layout ---------- */

.bia-map__body {
    display: flex;
    align-items: stretch;
    min-height: 60vh;
}

.bia-map__details {
    position: relative;
    flex: 0 0 0px;
    min-width: 0;
    max-height: 78vh;
    background: var(--bia-surface);
    overflow: hidden;
    opacity: 0;
    transition: flex-basis 0.28s ease, opacity 0.2s ease;
}

.bia-map.has-selection .bia-map__details {
    flex-basis: 380px;
    border-inline-end: 1px solid var(--bia-line);
    opacity: 1;
}

.bia-map__canvas {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    direction: ltr;
    /* floor plans must never mirror in Arabic */
    background: #eceff1;
    overflow: hidden;
    touch-action: none;
}

.bia-map__svg {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 420px;
    cursor: grab;
}

.bia-map__svg:active {
    cursor: grabbing;
}

.bia-map__canvas.is-loading::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.6);
}

.bia-map__zoom {
    position: absolute;
    inset-inline-end: 16px;
    bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 1px;
    z-index: 5;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(29, 37, 45, 0.2);
}

.bia-map__zoom button {
    width: 40px;
    height: 40px;
    border: 0;
    background: var(--bia-surface);
    color: var(--bia-navy);
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
}

.bia-map__zoom button:hover {
    background: #f2f4f6;
}

/* ---------- pins ---------- */

.bia-poi {
    cursor: pointer;
    transition: opacity 0.15s ease;
}

.bia-poi__halo {
    fill: rgba(255, 255, 255, 0.3);
    opacity: 0;
    transition: opacity 0.15s ease;
}

.bia-poi__background {
    fill: var(--poi-colour, #1d252d);
    stroke: #fff;
    stroke-width: 2;
}

.bia-poi__icon {
    filter: brightness(0) invert(1);
    pointer-events: none;
}

.bia-poi__label {
    display: none;
    font-size: 11px;
    font-weight: 600;
    fill: var(--bia-navy);
    text-anchor: middle;
    paint-order: stroke;
    stroke: #fff;
    stroke-width: 3;
    pointer-events: none;
}

.bia-poi.has-label .bia-poi__label {
    display: block;
}

.bia-poi:hover .bia-poi__halo,
.bia-poi:focus-visible .bia-poi__halo {
    opacity: 0.22;
}

.bia-poi.is-selected .bia-poi__halo {
    opacity: 0.35;
}

.bia-poi.is-selected .bia-poi__background {
    stroke: var(--bia-red);
    stroke-width: 3;
}

.bia-poi.is-hidden {
    display: none;
}

/* ---------- sidebar list ---------- */

.bia-map__sidebar {
    position: relative;
    display: flex;
    flex: 0 0 340px;
    flex-direction: column;
    background: #f7f8f9;
    border-inline-end: 1px solid var(--bia-line);
    overflow: hidden;
    max-height: 78vh;
}

.bia-map__sidebar-content {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--bia-surface);
}

.bia-map__filters {
    background: #f8f9fa;
    border-bottom: 1px solid var(--bia-line);
    border-radius: 0;
    overflow: hidden;
    box-shadow: none;
    padding-top: 10px;
}

.bia-map__toolbar,
.bia-search,
.bia-map__chips {
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.bia-map__sidebar [data-role="list"] {
    background: var(--bia-surface);
}

.bia-list__group {
    padding: 10px 12px 8px;
    border-bottom: 1px solid var(--bia-line);
}

.bia-list__heading {
    margin: 0 0 8px;
}

.bia-list__toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--bia-muted);
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-align: start;
    text-transform: uppercase;
}

.bia-list__toggle::after {
    content: "-";
    color: var(--bia-navy);
    font-size: 16px;
    font-weight: 400;
    line-height: 1;
}

.bia-list__group.is-collapsed .bia-list__toggle::after {
    content: "+";
}

.bia-list__toggle:focus-visible {
    outline: 2px solid var(--bia-red);
    outline-offset: 3px;
}

.bia-list__items {
    margin: 0;
    padding: 0;
    list-style: none;
    max-height: 640px;
    opacity: 1;
    overflow: hidden;
    transition: max-height 0.24s ease, opacity 0.18s ease;
}

.bia-list__group.is-collapsed {
    padding-bottom: 10px;
}

.bia-list__group.is-collapsed .bia-list__heading {
    margin-bottom: 0;
}

.bia-list__group.is-collapsed .bia-list__items {
    max-height: 0 !important;
    opacity: 0 !important;
}

.bia-list__item {
    display: block;
    width: 100%;
    padding: 8px 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--bia-navy);
    font-size: 15px;
    text-align: start;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.bia-list__item:hover {
    background: #f2f4f6;
}

.bia-list__item.is-selected {
    background: var(--bia-navy);
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.bia-list__empty {
    padding: 24px 16px;
    color: var(--bia-muted);
    font-size: 14px;
}

/* ---------- detail panel ---------- */

.bia-card {
    position: relative;
    width: 380px;
    /* fixed width stops the content reflowing while the region expands */
    max-width: 100%;
    height: 100%;
    background: var(--bia-surface);
    overflow-y: auto;
    opacity: 0;
    transform: translateX(-12px);
    transition: transform 0.24s ease, opacity 0.2s ease;
}

.bia-map[dir="rtl"] .bia-card {
    transform: translateX(12px);
}

.bia-card.is-open,
.bia-card:not([hidden]):not(.is-closing) {
    transform: none;
    opacity: 1;
}

.bia-card__close {
    position: absolute;
    z-index: 2;
    inset-inline-end: 8px;
    top: 8px;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 50%;
    background: rgba(29, 37, 45, 0.6);
    color: #fff;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

.bia-card__media {
    position: relative;
    height: 140px;
    background: #dfe3e6 center / cover no-repeat;
}

.bia-card__media.is-empty {
    height: 12px;
    background: var(--bia-navy);
}

.bia-card__tag {
    position: absolute;
    inset-inline-start: 12px;
    bottom: 12px;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--bia-purple);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.bia-card__media.is-empty .bia-card__tag {
    display: none;
}

.bia-card__body {
    padding: 18px;
}

.bia-card__title {
    margin: 0 0 4px;
    font-size: 18px;
    font-weight: 700;
    color: var(--bia-navy);
}

.bia-card__meta {
    margin: 0 0 8px;
    font-size: 12px;
    color: var(--bia-muted);
}

.bia-card__desc {
    margin: 0 0 16px;
    font-size: 14px;
    line-height: 1.5;
    color: #414a52;
}

.bia-card__action {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 4px;
    background: var(--bia-red);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}

.bia-card__action:hover {
    background: #b32217;
    color: #fff;
    text-decoration: none;
}

.bia-map__error {
    padding: 48px 16px;
    text-align: center;
    color: var(--bia-muted);
}

/* ---------- mobile ---------- */

@media (max-width: 991px) {
    .bia-map__body {
        flex-direction: column;
    }

    .bia-map__canvas {
        order: 1;
    }

    .bia-map__svg {
        min-height: 58vh;
    }

    .bia-map__sidebar {
        order: 2;
        flex: 1 1 auto;
        max-height: 40vh;
        border-inline-end: 0;
        border-top: 1px solid var(--bia-line);
    }

    /* the expanding region becomes a bottom sheet on narrow viewports */
    .bia-map__details {
        position: fixed;
        z-index: 30;
        inset-inline: 12px;
        bottom: 0;
        flex: none;
        max-height: 72vh;
        background: transparent;
        overflow: visible;
        opacity: 1;
        pointer-events: none;
    }

    .bia-map.has-selection .bia-map__details {
        flex-basis: auto;
        border-inline-end: 0;
    }

    .bia-card {
        width: auto;
        height: auto;
        max-height: 72vh;
        border-radius: var(--bia-radius) var(--bia-radius) 0 0;
        box-shadow: 0 -10px 28px rgba(29, 37, 45, 0.16);
        transform: translateY(102%);
        opacity: 1;
        pointer-events: auto;
    }

    .bia-map[dir="rtl"] .bia-card {
        transform: translateY(102%);
    }

    .bia-card.is-open,
    .bia-card:not([hidden]):not(.is-closing) {
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {

    .bia-poi,
    .bia-poi__halo,
    .bia-map__details,
    .bia-card {
        transition: none;
    }
}