/* =====================================================
   ESTILOS UCM — Mapa de Estanterías
   Identidad Corporativa Universidad Complutense de Madrid
   ===================================================== */

/* === Variables CSS — Paleta UCM === */
:root {
    --ucm-rojo: #C41230;
    --ucm-rojo-oscuro: #9E0E27;
    --ucm-oro: #C8A951;
    --color-fondo: #F7F7F8;
    --color-blanco: #FFFFFF;
    --color-texto: #1A1A1A;
    --color-texto-sec: #555;
    --color-borde: #E0E0E0;
    --estante-activo: #C41230;
    --estante-activo-borde: #9E0E27;
    --estante-otro: #D5D5D5;
    --estante-otro-borde: #AAA;
    --font: 'Roboto', 'Segoe UI', Arial, sans-serif;
    --radio: 10px;
    --sombra: 0 2px 8px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
    --sombra-hover: 0 4px 16px rgba(0, 0, 0, 0.10), 0 2px 6px rgba(0, 0, 0, 0.06);
}

/* === Reset y Base === */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font);
    color: var(--color-texto);
    background: var(--color-fondo);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* === Header UCM === */
.ucm-header {
    background: #FFFFFF !important;
    /* Reforzado a blanco puro */
    color: var(--color-texto);
    padding: 0.8rem 1.5rem;
    border-bottom: 1px solid #E0E0E0;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
    position: relative;
    z-index: 10;
}

.ucm-header-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* To allow right side content if added later */
    gap: 1rem;
}

.ucm-logo-img {
    height: 55px;
    width: auto;
    display: block;
}

.ucm-header-icon {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    opacity: 0.95;
}

.ucm-header-text {
    display: flex;
    flex-direction: column;
}

.ucm-header-title {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1.3;
}

.ucm-header-subtitle {
    font-size: 0.78rem;
    font-weight: 400;
    opacity: 0.85;
}

/* === Contenedor Principal === */
.ucm-main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* === Título de Localización === */
#paratitulo,
*.paratitulo {
    position: relative;
    text-align: left;
    margin: 0 0 1.5rem 0;
    border-bottom: none;
}

#paratitulo h2,
*.paratitulo h2 {
    font-family: var(--font);
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--ucm-rojo);
    border-left: 4px solid var(--ucm-oro);
    padding-left: 1rem;
    display: block;
    line-height: 1.4;
}

/* === Layout Desktop: Mapa + Info === */
.plano-container-desktop {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
}

/* === Card wrapper para el mapa === */
.ucm-mapa-card {
    background: var(--color-blanco);
    border-radius: var(--radio);
    box-shadow: var(--sombra);
    padding: 4rem 1.5rem 1.5rem;
    border: 1px solid var(--color-borde);
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    overflow-y: visible;
}

.ucm-mapa-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--color-texto-sec);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.ucm-mapa-label svg {
    width: 15px;
    height: 15px;
    color: var(--ucm-rojo);
}

.ucm-zoom-controls {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0 0 0.9rem;
}

.ucm-zoom-controls button {
    min-width: 34px;
    height: 32px;
    border: 1px solid var(--color-borde);
    border-radius: 6px;
    background: var(--color-blanco);
    color: var(--color-texto);
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.ucm-zoom-controls button:hover {
    border-color: var(--ucm-rojo);
    color: var(--ucm-rojo);
}

.ucm-zoom-value {
    min-width: 48px;
    text-align: center;
    font-size: 0.85rem;
    color: var(--color-texto-sec);
}

/* === Plano del depósito === */
#idplano {
    position: relative;
    background-repeat: no-repeat;
    background-position: top left;
    /* Alineación con el sistema de coordenadas */
    /*background-color: #FAFAFA;*/
    background-color: transparent;
    border: 1px solid var(--color-borde);
    border-radius: 6px;
    overflow: visible;
    max-width: none;
    -webkit-overflow-scrolling: touch;  
}

/* === Leyenda del Mapa === */
.ucm-leyenda {
    display: flex;
    gap: 1.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #EBEBEB;
}

.ucm-leyenda-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.78rem;
    color: var(--color-texto-sec);
}

.ucm-leyenda-dot {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    flex-shrink: 0;
}

.ucm-leyenda-dot--activo {
    background: var(--estante-activo);
    border: 1px solid var(--estante-activo-borde);
}

.ucm-leyenda-dot--otro {
    background: var(--estante-otro);
    border: 1px solid var(--estante-otro-borde);
}

/* === Estanterías en el mapa === */
.mapaestantever {
    position: absolute;
    border-radius: 2px;
    transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
    cursor: pointer;
    border: 1px solid transparent;
}

.mapaestantever:hover {
    opacity: 0.8;
    transform: scale(1.15);
    box-shadow: 0 0 6px rgba(196, 18, 48, 0.4);
    z-index: 5;
}

/* Estantería encontrada */
.estantever {
    background: var(--estante-activo);
    border: 1px solid var(--estante-activo-borde);
}

/* Otras estanterías */
.estante {
    background: var(--estante-otro);
    border: 1px solid var(--estante-otro-borde);
}

.estante:hover {
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.2);
}

/* === Marcador (Flecha) en la estantería === */
.con-flecha {
    position: relative;
    z-index: 1000;
    box-shadow: 0 0 0 3px rgba(196, 18, 48, 0.28), 0 0 14px rgba(196, 18, 48, 0.45);
}

.con-flecha::after {
    content: '';
    position: absolute;
    width: 54px;
    height: 54px;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><path fill="%23C41230" d="M32 60 17 38h9V6h12v32h9z"/></svg>') no-repeat center;
    background-size: contain;
    bottom: 100%;
    left: 50%;
    animation: markerBounceTop 1s infinite alternate cubic-bezier(0.45, 0.05, 0.25, 1);
    z-index: 1002;
    pointer-events: none;
    filter: drop-shadow(0 5px 5px rgba(0, 0, 0, 0.35));
}

.con-flecha.flecha-arriba::after {
    bottom: 100%;
    left: 50%;
    animation-name: markerBounceTop;
}

.con-flecha.flecha-abajo::after {
    top: 100%;
    bottom: auto;
    left: 50%;
    animation-name: markerBounceBottom;
}

.con-flecha.flecha-derecha::after {
    top: 50%;
    bottom: auto;
    left: 100%;
    animation-name: markerBounceRight;
}

.con-flecha.flecha-izquierda::after {
    top: 50%;
    right: 100%;
    bottom: auto;
    left: auto;
    animation-name: markerBounceLeft;
}

.con-flecha::before {
    content: '';
    position: absolute;
    inset: -7px;
    border: 2px solid rgba(196, 18, 48, 0.55);
    border-radius: 5px;
    animation: shelfPulse 1.2s infinite ease-out;
    pointer-events: none;
    z-index: 1001;
}

@keyframes markerBounceTop {
    from {
        transform: translateX(-50%) translateY(-5px);
    }

    to {
        transform: translateX(-50%) translateY(-18px);
    }
}

@keyframes markerBounceBottom {
    from {
        transform: translateX(-50%) translateY(5px) rotate(180deg);
    }

    to {
        transform: translateX(-50%) translateY(18px) rotate(180deg);
    }
}

@keyframes markerBounceRight {
    from {
        transform: translateX(5px) translateY(-50%) rotate(90deg);
    }

    to {
        transform: translateX(18px) translateY(-50%) rotate(90deg);
    }
}

@keyframes markerBounceLeft {
    from {
        transform: translateX(-5px) translateY(-50%) rotate(270deg);
    }

    to {
        transform: translateX(-18px) translateY(-50%) rotate(270deg);
    }
}

@keyframes shelfPulse {
    0% {
        opacity: 0.9;
        transform: scale(1);
    }

    100% {
        opacity: 0;
        transform: scale(1.9);
    }
}

/* === Panel lateral derecho === */
#idplanoderecha {
    width: 300px;
    flex-shrink: 0;
    padding: 0;
}

/* === Panel de información === */
.ucm-info-panel {
    background: var(--color-blanco);
    border-radius: var(--radio);
    box-shadow: var(--sombra);
    border: 1px solid var(--color-borde);
    padding: 0;
    overflow: hidden;
    font-size: 0.95rem;
    line-height: 1.7;
    transition: box-shadow 0.3s ease;
}

.ucm-info-panel + .ucm-info-panel {
    margin-top: 0.75rem;
}

.ucm-info-panel:hover {
    box-shadow: var(--sombra-hover);
}

#idplanoinfo.highlight {
    box-shadow: 0 0 0 3px rgba(196, 18, 48, 0.25), var(--sombra-hover);
}

/* Info data styling inside #idplanoinfo */
.ucm-info-header {
    background: linear-gradient(135deg, var(--ucm-rojo) 0%, var(--ucm-rojo-oscuro) 100%);
    color: #fff;
    padding: 0.75rem 1.25rem;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ucm-info-header svg {
    width: 15px;
    height: 15px;
}

.ucm-info-body {
    padding: 1rem 1.25rem;
}

.ucm-info-row {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid #EBEBEB;
}

.ucm-info-row:last-child {
    border-bottom: none;
}

.ucm-info-icon {
    width: 17px;
    height: 17px;
    flex-shrink: 0;
    color: var(--ucm-rojo);
    margin-top: 2px;
}

.ucm-info-label {
    font-size: 0.7rem;
    color: var(--color-texto-sec);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
    line-height: 1.3;
}

.ucm-info-value {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--color-texto);
    line-height: 1.4;
}

/* Legacy .infomapaest support */
.infomapaest {
    font-weight: 600;
    color: var(--ucm-rojo);
}

/* === Sin resultados === */
.ucm-sin-resultados {
    background: var(--color-blanco);
    border-radius: var(--radio);
    box-shadow: var(--sombra);
    border: 1px solid var(--color-borde);
    padding: 3rem 2rem;
    text-align: center;
}

.ucm-sin-resultados svg {
    width: 48px;
    height: 48px;
    color: var(--ucm-rojo);
    opacity: 0.5;
    margin-bottom: 1rem;
}

.ucm-sin-resultados p {
    font-size: 1rem;
    color: var(--color-texto-sec);
    max-width: 450px;
    margin: 0 auto;
    line-height: 1.6;
}

.ucm-sin-resultados strong {
    color: var(--ucm-rojo);
}

/* === Layout móvil (PHP class) === */
.movil-info {
    background: var(--color-blanco);
    border-radius: var(--radio);
    box-shadow: var(--sombra);
    border: 1px solid var(--color-borde);
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    font-size: 0.95rem;
    line-height: 1.7;
}

.plano-container-movil {
    background: var(--color-blanco);
    border-radius: var(--radio);
    box-shadow: var(--sombra);
    border: 1px solid var(--color-borde);
    padding: 4rem 1rem 1rem;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
}

.plano-container-movil #idplano {
    width: 100%;
}

/* === Footer === */
.ucm-footer {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem;
    text-align: center;
    font-size: 0.75rem;
    color: var(--color-texto-sec);
    border-top: 1px solid var(--color-borde);
}

.ucm-footer a {
    color: var(--ucm-rojo);
    text-decoration: none;
}

.ucm-footer a:hover {
    text-decoration: underline;
}

#limpiar {
    clear: both;
}

/* =====================================================
   RESPONSIVE
   ===================================================== */

@media (max-width: 900px) {
    .plano-container-desktop {
        flex-direction: column;
    }

    #idplanoderecha {
        width: 100%;
    }

    .ucm-main {
        padding: 1.5rem 1rem;
    }

    .paratitulo h2 {
        font-size: 1.2rem;
    }
}

@media (max-width: 600px) {
    .ucm-header {
        padding: 0.6rem 1rem;
    }

    .ucm-header-icon {
        width: 28px;
        height: 28px;
    }

    .ucm-header-title {
        font-size: 1rem;
    }

    .ucm-header-subtitle {
        font-size: 0.7rem;
    }

    .ucm-main {
        padding: 1rem;
    }

    .paratitulo h2 {
        font-size: 1.05rem;
    }

    .ucm-mapa-card {
        padding: 1rem;
    }

    /* #idplano ya no se fuerza al 100% para evitar recortes */

    .ucm-leyenda {
        flex-direction: column;
        gap: 0.4rem;
    }
}

@media (max-width: 400px) {
    html {
        font-size: 14px;
    }

    .ucm-header-icon {
        width: 24px;
        height: 24px;
    }
}

/* =====================================================
   PRINT
   ===================================================== */
@media print {
    .ucm-header {
        background: none;
        color: var(--color-texto);
        box-shadow: none;
        border-bottom: 2px solid var(--ucm-rojo);
    }

    .ucm-mapa-card,
    #idplanoinfo,
    .movil-info {
        box-shadow: none;
        border: 1px solid #ccc;
    }

    .ucm-footer {
        display: none;
    }
}
