

/* Los botones de zoom solo existen en celular */
.zoom-ctrl {
    display: none;
}

@media (max-width: 860px) {

    .directory-page {
        padding: 12px 12px 40px;
    }
    .directory {
        display: flex;
        flex-direction: column;
        height: auto;
        border-radius: 14px;
    }

    /* ---------- Mapa primero ---------- */
    .stage {
        order: 1;
        display: flex;
        flex-direction: column;
        height: auto;
        min-height: 0;
    }

    .floor-switch {
        position: static;
        order: -1;
        flex-direction: row;
        gap: 8px;
        width: 100%;
        padding: 12px;
        background: #fff;
        border-bottom: 1px solid #e5e7eb;
    }
    .floor-btn {
        flex: 1;
        padding: 10px 6px;
        border: 1px solid #e5e7eb;
        background: #fff;
        font-size: 13px;
        white-space: nowrap;
        box-shadow: none;
    }
    .floor-btn[aria-selected="true"] {
        border-color: #1e2a3a;
        background: #1e2a3a;
        color: #fff;
        box-shadow: none;
    }

    .map-view {
        position: relative;
    }

    /* El plano se ve completo (ajustado al ancho) y se amplía con + / − o con dos dedos */
    .stage-scroll {
        position: relative;
        inset: auto;
        width: 100%;
        height: auto;
        aspect-ratio: 2500 / 2140;
        overflow: auto;
        touch-action: pan-x pan-y;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .stage-scroll::-webkit-scrollbar {
        display: none;
    }
    .stage-canvas {
        width: calc(100% * var(--zoom, 1));
        min-width: 0;
        height: auto;
        aspect-ratio: 2500 / 2140;
    }

    .zoom-ctrl {
        position: absolute;
        right: 10px;
        bottom: 10px;
        z-index: 5;
        display: flex;
        flex-direction: column;
        border: 1px solid #d9dde3;
        border-radius: 10px;
        background: #fff;
        overflow: hidden;
        box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
    }
    .zoom-ctrl button {
        width: 44px;
        height: 44px;
        border: 0;
        background: #fff;
        font: 500 24px/1 'Montserrat', sans-serif;
        color: #1e2a3a;
        cursor: pointer;
    }
    .zoom-ctrl button + button {
        border-top: 1px solid #d9dde3;
    }
    .zoom-ctrl button:active {
        background: #eef0f3;
    }

    .legend {
        position: static;
        order: 3;
        width: max-content;
        max-width: calc(100% - 24px);
        margin: 10px auto 12px;
    }
    .stage.has-detail .legend {
        display: none;
    }

    /* Ficha del local sobre la parte baja del plano (deja libres los botones de zoom) */
    .detail-card {
        left: 10px;
        right: 64px;
        bottom: 10px;
        width: auto;
        padding: 16px 16px 14px;
    }
    .dc-title {
        font-size: 21px;
    }

    /* ---------- Buscador y lista debajo del mapa ---------- */
    .sidebar {
        order: 2;
        display: block;
        padding: 14px 14px 0;
        border-right: 0;
        border-top: 1px solid #e5e7eb;
    }
    .search-box {
        height: 46px;
        margin-right: 0;
    }
    /* 16 px evita que el iPhone haga zoom al tocar el buscador */
    .search-box input {
        font-size: 16px;
    }
    .local-list {
        display: block;
        flex: none;
        max-height: 340px;
        margin: 10px 0 0;
        padding: 0 4px 14px 0;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    .no-results {
        margin: 0 0 14px;
        font-size: 14px;
    }
}