/* Mapa Bernabeu - plugin */

.sp-bernabeu-map {
    position: relative;
    width: 100vw;
    max-width: none;
    box-sizing: border-box;

    /*
     * Elementor suele encerrar el shortcode dentro de un contenedor limitado.
     * Este margen hace que el mapa salga de ese contenedor y vuelva a ocupar
     * el ancho real de la ventana, como en la web original.
     */
    margin-left: calc(50% - 50vw);

    padding: 60px 100px 0;
    overflow: visible;
}

.sp-bernabeu-map .map-container {
    line-height: 0;
    position: relative;
    width: 100%;
    margin-left: 0;
}

.sp-bernabeu-map .map-container > svg {
    width: 100%;
    height: auto;
    display: block;
}

.sp-bernabeu-map .box-house {
    line-height: 0;
}

.sp-bernabeu-map .box-label {
    line-height: .9;
    display: flex;
    width: auto;
    background: var(--box-color, #d8d8d8);
    padding: 1px 2px;
    gap: 1px;
    height: fit-content;
    z-index: 1;
    pointer-events: none;
}

.sp-bernabeu-map .box-house svg {
    width: .48vw;
}

.sp-bernabeu-map .box-number {
    font-size: .72vw;
}

.sp-bernabeu-map .map-box {
    position: absolute;
    background: var(--box-color, #d8d8d8);
    box-sizing: border-box;
    display: flex;
    padding: .3vw;
    cursor: pointer;
    color: #141414;
    text-decoration: none;
    z-index: 2;
}

.sp-bernabeu-map .map-box polygon {
    cursor: pointer;
}

.sp-bernabeu-map .map-box.is-empty {
    pointer-events: none;
}

.sp-bernabeu-map .map-svg-box {
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    position: absolute;
    fill: var(--box-color, #d8d8d8);
    z-index: 0;
}

.sp-bernabeu-map .map-box:has(.map-svg-box) {
    background: transparent !important;
}

.sp-bernabeu-map .map-box:has(.map-svg-box) .box-label {
    position: relative;
    z-index: 1;
}

.sp-bernabeu-map .map-box:hover,
.sp-bernabeu-map .map-box:focus-visible,
.sp-bernabeu-map .map-box:hover .box-label,
.sp-bernabeu-map .map-box:focus-visible .box-label {
    background: #000;
    color: #fff;
}

.sp-bernabeu-map .map-box:hover .map-svg-box,
.sp-bernabeu-map .map-box:focus-visible .map-svg-box {
    fill: #000;
}

.sp-bernabeu-map .map-box .box-label svg,
.sp-bernabeu-map .map-box .box-label polygon {
    fill: currentColor !important;
}

.sp-bernabeu-map .map-box:focus-visible {
    outline: 3px solid #000;
    outline-offset: 3px;
}

/* Tooltip */
.sp-bernabeu-map .box-hover {
    position: fixed;
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transform: translate(20px, 20px);
    background: #fff;
    border: .2vw solid #000;
    display: flex;
    padding: .75vw;
    gap: .5vw;
}

.sp-bernabeu-map .box-hover.active {
    opacity: 1;
}

.sp-bernabeu-map .box-hover .box-number {
    font-size: 1.5vw;
    font-family: 'Doumbar Plate';
    color: #000;
}

.sp-bernabeu-map .box-hover .box-label {
    padding: .4vw .5vw .5vw .6vw;
    gap: .5vw;
    align-items: center;
    background: var(--tooltip-color, #d8d8d8);
}

.sp-bernabeu-map .box-hover .box-house svg {
    width: 1vw;
}

.sp-bernabeu-map .box-hover .box-name {
    font-size: 1.8vw;
    line-height: 1.2;
    white-space: nowrap;
}

/* Posiciones del mapa original */
.sp-bernabeu-map .map-box-1A{width:3.65%;height:18.8%;top:3.5%;left:1.59%}
.sp-bernabeu-map .map-box-2A{width:4.92%;height:9.9%;top:27.25%;left:1.59%}
.sp-bernabeu-map .map-box-3A{width:5.48%;height:9.99%;top:30.4%;left:9.73%}
.sp-bernabeu-map .map-box-5A{width:4.2%;height:13.9%;top:22.8%;left:19.96%}
.sp-bernabeu-map .map-box-6A{width:5.05%;height:9.4%;top:38.5%;left:32.3%}
.sp-bernabeu-map .map-box-7A{width:6.25%;height:7.3%;top:21.2%;left:27.75%}
.sp-bernabeu-map .map-box-1B{width:7.95%;height:7.9%;top:13.3%;left:41.4%}
.sp-bernabeu-map .map-box-2B{width:4.05%;height:12.6%;top:13.3%;left:51.55%}
.sp-bernabeu-map .map-box-3B{width:3.2%;height:10%;top:18.5%;left:57.75%}
.sp-bernabeu-map .map-box-4B{width:4.4%;height:15.2%;top:13.3%;left:62.89%}
.sp-bernabeu-map .map-box-5B{width:3.15%;height:13.2%;top:18.5%;left:69.35%}
.sp-bernabeu-map .map-box-6B{width:3.15%;height:10.5%;top:13.3%;left:74.6%}
.sp-bernabeu-map .map-box-7B{width:6.07%;height:7.8%;top:13.3%;left:80.05%}
.sp-bernabeu-map .map-box-8B{width:3.1%;height:12.6%;top:13.3%;left:89.86%}
.sp-bernabeu-map .map-box-11B{width:3.4%;height:8.26%;top:52.1%;left:75.3%}
.sp-bernabeu-map .map-box-12B{width:7.79%;height:13.5%;top:68.99%;left:65.95%}
.sp-bernabeu-map .map-box-13B{width:6.67%;height:10.3%;top:71.6%;left:56.3%;justify-content:end}
.sp-bernabeu-map .map-box-14B{width:4.58%;height:14.4%;top:31.3%;left:41.46%}
.sp-bernabeu-map .map-box-17B{width:4.89%;height:9.49%;top:52.8%;left:67.97%}
.sp-bernabeu-map .map-box-18B{width:7.05%;height:9.4%;top:54.7%;left:55.23%}

@media only screen and (max-width: 820px) {
    .sp-bernabeu-map {
        width: 100vw;
        margin-left: calc(50% - 50vw);
        padding: 60px 10px 0;
        overflow-x: auto;
    }

    .sp-bernabeu-map .map-container {
        width: 190vw;
        margin-left: 0;
    }

    .sp-bernabeu-map .map-container .box-number {
        font-size: calc(2.2vw * .8);
    }

    .sp-bernabeu-map .map-container .box-house svg {
        width: calc(1.5vw * .8);
    }

    .sp-bernabeu-map .box-hover {
        padding: .6vw 1vw;
        gap: 1vw;
        border: .4vw solid #000;
        align-items: center;
    }

    .sp-bernabeu-map .box-hover .box-house svg {
        width: 2vw;
    }

    .sp-bernabeu-map .box-hover .box-number {
        font-size: 3vw;
    }

    .sp-bernabeu-map .box-hover .box-name {
        font-size: 3.6vw;
    }
}


/* Ajuste de anchura para pantallas intermedias */
@media only screen and (max-width: 1200px) and (min-width: 821px) {
    .sp-bernabeu-map {
        padding-left: 45px;
        padding-right: 45px;
    }
}


/* ==========================================================
   LEYENDA
   ========================================================== */

.sp-bernabeu-map .sp-map-legend-wrap {
    position: absolute;
    right: 100px;
    bottom: 10px;
    z-index: 4;
    display: flex;
    align-items: flex-end;
    gap: 18px;
}

.sp-bernabeu-map #homepage-legend {
    position: static;
    width: 114.6px;
    line-height: 0;
    flex: 0 0 auto;
}

.sp-bernabeu-map #homepage-legend svg {
    width: 100%;
    height: auto;
    display: block;
}

.sp-bernabeu-map .sp-map-legend-locales {
    display: grid;
    grid-template-columns: repeat(2, minmax(150px, 1fr));
    gap: 4px 10px;
    width: min(460px, 38vw);
    line-height: 1;
}

.sp-bernabeu-map .sp-map-legend-local {
    display: flex;
    align-items: center;
    gap: 7px;
    color: #000;
    text-decoration: none;
    font-size: 12px;
    min-width: 0;
}

.sp-bernabeu-map .sp-map-legend-code {
    flex: 0 0 auto;
    min-width: 34px;
    box-sizing: border-box;
    padding: 4px 5px;
    background: var(--legend-color, #d8d8d8);
    font-family: 'Doumbar Plate';
    font-weight: 700;
    text-align: center;
}

.sp-bernabeu-map .sp-map-legend-name {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sp-bernabeu-map .sp-map-legend-local:hover .sp-map-legend-name,
.sp-bernabeu-map .sp-map-legend-local:focus-visible .sp-map-legend-name {
    text-decoration: underline;
}

/* El nombre del tooltip puede partir línea si es largo */
.sp-bernabeu-map .box-hover {
    max-width: min(520px, calc(100vw - 24px));
}

.sp-bernabeu-map .box-hover .box-name {
    white-space: normal;
    overflow-wrap: anywhere;
    max-width: 320px;
}

/* En viewport estrecho, la leyenda de locales pasa debajo */
@media only screen and (max-width: 1100px) and (min-width: 821px) {
    .sp-bernabeu-map .sp-map-legend-wrap {
        right: 45px;
    }

    .sp-bernabeu-map .sp-map-legend-locales {
        grid-template-columns: 1fr;
        width: 210px;
    }
}

@media only screen and (max-width: 820px) {
    .sp-bernabeu-map .sp-map-legend-wrap {
        position: static;
        width: 100vw;
        box-sizing: border-box;
        padding: 16px 10px 0;
        display: grid;
        grid-template-columns: 90px minmax(0, 1fr);
        align-items: start;
        gap: 14px;
    }

    .sp-bernabeu-map #homepage-legend {
        width: 90px;
    }

    .sp-bernabeu-map .sp-map-legend-locales {
        width: auto;
        grid-template-columns: 1fr;
        gap: 5px;
    }

    .sp-bernabeu-map .sp-map-legend-local {
        font-size: 11px;
    }
}


/* ==========================================================
   DIRECTORIO / LEYENDA v1.7
   Inspirado en el directorio impreso: tres columnas de locales
   y una cuarta columna para símbolos.
   ========================================================== */

.sp-bernabeu-map .sp-map-directory {
    width: calc(100% - 200px);
    margin: 24px 100px 0;
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(190px, 1fr);
    gap: 26px;
    align-items: start;
    box-sizing: border-box;
    line-height: 1;
}

.sp-bernabeu-map .sp-map-directory-locales {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.sp-bernabeu-map .sp-map-directory-column,
.sp-bernabeu-map .sp-map-directory-symbols {
    min-width: 0;
}

.sp-bernabeu-map .sp-map-directory-row,
.sp-bernabeu-map .sp-map-symbol-row {
    min-height: 24px;
    display: grid;
    align-items: center;
    border-top: 1px solid #8e8e8e;
    color: #000;
    text-decoration: none;
    box-sizing: border-box;
}

.sp-bernabeu-map .sp-map-directory-row:last-child,
.sp-bernabeu-map .sp-map-symbol-row:last-child {
    border-bottom: 1px solid #8e8e8e;
}

.sp-bernabeu-map .sp-map-directory-row {
    grid-template-columns: 44px minmax(0, 1fr);
}

.sp-bernabeu-map .sp-map-directory-code {
    height: 100%;
    min-height: 23px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--legend-color, #d8d8d8);
    font-family: 'Doumbar Plate';
    font-weight: 700;
    color: #000;
    padding: 0 5px;
    box-sizing: border-box;
}

.sp-bernabeu-map .sp-map-directory-name {
    min-width: 0;
    padding: 3px 7px 2px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sp-bernabeu-map .sp-map-directory-row:hover .sp-map-directory-name,
.sp-bernabeu-map .sp-map-directory-row:focus-visible .sp-map-directory-name {
    text-decoration: underline;
}

.sp-bernabeu-map .sp-map-directory-symbols {
    display: flex;
    flex-direction: column;
}

.sp-bernabeu-map .sp-map-symbol-row {
    grid-template-columns: 34px minmax(0, 1fr);
    font-size: 13px;
    font-weight: 600;
}

.sp-bernabeu-map .sp-map-symbol {
    width: 24px;
    height: 24px;
    margin-right: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    overflow: hidden;
    font-family: 'Doumbar Plate';
    font-size: 10px;
    font-weight: 700;
    color: #000;
}

.sp-bernabeu-map .sp-map-symbol svg {
    width: 100%;
    height: 100%;
    display: block;
}

.sp-bernabeu-map .sp-map-symbol-sector-a {
    border: 1px solid #000;
    background:
        radial-gradient(circle, #000 1px, transparent 1.1px) 0 0 / 5px 5px,
        #fff;
}

.sp-bernabeu-map .sp-map-symbol-sector-b {
    border: 1px solid #000;
    background:
        repeating-linear-gradient(
            135deg,
            #000 0 1px,
            transparent 1px 5px
        ),
        #fff;
}

.sp-bernabeu-map .sp-map-symbol-wc {
    background: #000;
    color: #fff;
    font-family: inherit;
    font-size: 9px;
}

.sp-bernabeu-map .sp-map-symbol-plaza {
    font-size: 17px;
    line-height: 1;
}

/* Tooltip: nunca debe salirse del viewport */
.sp-bernabeu-map .box-hover {
    max-width: min(520px, calc(100vw - 24px));
}

.sp-bernabeu-map .box-hover .box-name {
    white-space: normal;
    overflow-wrap: anywhere;
    max-width: 320px;
}

@media only screen and (max-width: 1200px) and (min-width: 821px) {
    .sp-bernabeu-map .sp-map-directory {
        width: calc(100% - 90px);
        margin-left: 45px;
        margin-right: 45px;
        gap: 18px;
    }

    .sp-bernabeu-map .sp-map-directory-locales {
        gap: 9px;
    }

    .sp-bernabeu-map .sp-map-directory-name,
    .sp-bernabeu-map .sp-map-symbol-row {
        font-size: 11px;
    }
}

@media only screen and (max-width: 820px) {
    .sp-bernabeu-map .sp-map-directory {
        width: 100%;
        margin: 18px 0 0;
        padding: 0 10px;
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .sp-bernabeu-map .sp-map-directory-locales {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .sp-bernabeu-map .sp-map-directory-column + .sp-map-directory-column {
        margin-top: 0;
    }

    .sp-bernabeu-map .sp-map-directory-name,
    .sp-bernabeu-map .sp-map-symbol-row {
        font-size: 12px;
    }

    .sp-bernabeu-map .sp-map-directory-symbols {
        max-width: 320px;
    }
}
