/* =============================================
   MAPA DEL SITIO - OAB
   Diseño interactivo con elementos colapsables
   ============================================= */

/* --- Variables de color --- */
:root {
    --mapa-sitio-primary: #2c5aa0;
    --mapa-sitio-secondary: #27ae60;
    --mapa-sitio-dark: #1a3a5c;
    --mapa-sitio-light: #f5f8fa;
    --mapa-sitio-border: #d0d8e0;
    --mapa-sitio-text: #2c3e50;
    --mapa-sitio-link: #1a7a9e;
    --mapa-sitio-link-hover: #27ae60;
}

/* --- Encabezado --- */
.mapa-sitio-header {
    text-align: center;
    margin: 0 0 40px;
    padding: 0;
}

.mapa-sitio-header__img {
    max-width: 100%;
    height: auto;
    border-radius: 140px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

/* --- Contenedor principal --- */
.mapa-sitio-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px 20px;
}

/* --- Items principales (nivel 1) --- */
.mapa-sitio-item {
    margin-bottom: 15px;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    border: 2px solid var(--mapa-sitio-border);
    transition: all 0.3s ease;
}

.mapa-sitio-item:hover {
    border-color: var(--mapa-sitio-secondary);
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.2);
}

.mapa-sitio-item__header {
    display: flex;
    align-items: center;
    padding: 18px 25px;
    cursor: pointer;
    background: linear-gradient(135deg, var(--mapa-sitio-primary) 0%, var(--mapa-sitio-dark) 100%);
    transition: all 0.3s ease;
    position: relative;
}

.mapa-sitio-item__header:hover {
    background: linear-gradient(135deg, #3468b8 0%, #244a6f 100%);
}

.mapa-sitio-item__header--link {
    color: inherit;
    text-decoration: none;
}

.mapa-sitio-item--no-children .mapa-sitio-item__header {
    cursor: default;
}

.mapa-sitio-item--no-children .mapa-sitio-item__header--link {
    cursor: pointer;
}

.mapa-sitio-item__arrow {
    width: 28px;
    height: 28px;
    margin-right: 15px;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.mapa-sitio-item__arrow--hidden {
    opacity: 0;
    pointer-events: none;
}

.mapa-sitio-item.is-open .mapa-sitio-item__arrow {
    transform: none;
}

.mapa-sitio-item__title {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    line-height: 1.3;
}

.mapa-sitio-item__content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
    background: var(--mapa-sitio-light);
}

.mapa-sitio-item.is-open .mapa-sitio-item__content {
    max-height: 5000px;
}

/* --- Listas --- */
.mapa-sitio-list {
    list-style: none;
    padding: 20px 25px 20px 70px;
    margin: 0;
}

.mapa-sitio-list > li {
    margin-bottom: 12px;
}

.mapa-sitio-list > li:last-child {
    margin-bottom: 0;
}

.mapa-sitio-list a {
    display: inline-block;
    color: var(--mapa-sitio-link);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    padding: 8px 15px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid var(--mapa-sitio-border);
    transition: all 0.2s ease;
    width: 100%;
    box-sizing: border-box;
}

.mapa-sitio-list a:hover {
    color: #fff;
    background: var(--mapa-sitio-secondary);
    border-color: var(--mapa-sitio-secondary);
    transform: translateX(5px);
    box-shadow: 0 2px 8px rgba(39, 174, 96, 0.3);
}

/* --- Subitems (nivel 2) --- */
.mapa-sitio-subitem {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    cursor: pointer;
    background: #fff;
    border-radius: 8px;
    border: 1px solid var(--mapa-sitio-border);
    margin-bottom: 10px;
    transition: all 0.2s ease;
}

.mapa-sitio-subitem:hover {
    background: #e8f5e9;
    border-color: var(--mapa-sitio-secondary);
}

.mapa-sitio-subitem__arrow {
    width: 22px;
    height: 22px;
    margin-right: 12px;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.mapa-sitio-subitem.is-open .mapa-sitio-subitem__arrow {
    transform: none;
}

.mapa-sitio-arrow--opening {
    animation: mapa-sitio-arrow-opening 0.35s ease both;
}

.mapa-sitio-arrow--closing {
    animation: mapa-sitio-arrow-closing 0.35s ease both;
}

@keyframes mapa-sitio-arrow-opening {
    from {
        transform: rotate(-90deg);
    }
    to {
        transform: rotate(0deg);
    }
}

@keyframes mapa-sitio-arrow-closing {
    from {
        transform: rotate(90deg);
    }
    to {
        transform: rotate(0deg);
    }
}

.mapa-sitio-subitem__title {
    font-size: 15px;
    font-weight: 600;
    color: var(--mapa-sitio-text);
}

/* --- Sublistas (nivel 2 y 3) --- */
.mapa-sitio-sublist {
    list-style: none;
    padding: 0 0 0 40px;
    margin: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
}

.mapa-sitio-subitem.is-open + .mapa-sitio-sublist {
    max-height: 3000px;
    padding-top: 10px;
    padding-bottom: 10px;
}

.mapa-sitio-sublist > li {
    margin-bottom: 8px;
}

.mapa-sitio-sublist > li:last-child {
    margin-bottom: 0;
}

.mapa-sitio-sublist a {
    font-size: 14px;
    padding: 6px 12px;
}

/* --- Nivel 3 --- */
.mapa-sitio-subitem--level3 {
    background: #f0f4f8;
    border-color: #c5d3e0;
}

.mapa-sitio-subitem--level3:hover {
    background: #d4edda;
}

.mapa-sitio-subitem--level3 .mapa-sitio-subitem__arrow {
    width: 18px;
    height: 18px;
}

.mapa-sitio-subitem--level3 .mapa-sitio-subitem__title {
    font-size: 14px;
}

.mapa-sitio-sublist--level3 {
    padding-left: 35px;
}

.mapa-sitio-sublist--level3 a {
    font-size: 13px;
    padding: 5px 10px;
}

/* --- Leyenda --- */
.mapa-sitio-legend {
    max-width: 900px;
    margin: 10px auto 30px;
    padding: 25px 30px;
    background: #fff;
    border-radius: 12px;
    border: 2px solid var(--mapa-sitio-border);
    display: flex;
    justify-content: center;
    gap: 50px;
    flex-wrap: wrap;
}

.mapa-sitio-legend__item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mapa-sitio-legend__icon {
    width: 28px;
    height: 28px;
}

.mapa-sitio-legend__text {
    font-size: 15px;
    font-weight: 600;
    color: var(--mapa-sitio-text);
}

/* --- Footer con logo --- */
.mapa-sitio-footer {
    text-align: center;
    margin: 40px 0 60px;
}

.mapa-sitio-footer__logo {
    max-width: 200px;
    height: auto;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .mapa-sitio-header__img {
        border-radius: 30px;
    }

    .mapa-sitio-container {
        padding: 0 15px 20px;
    }

    .mapa-sitio-item__header {
        padding: 15px 18px;
    }

    .mapa-sitio-item__arrow {
        width: 24px;
        height: 24px;
        margin-right: 12px;
    }

    .mapa-sitio-item__title {
        font-size: 17px;
    }

    .mapa-sitio-list {
        padding: 15px 18px 15px 50px;
    }

    .mapa-sitio-list a {
        font-size: 14px;
        padding: 7px 12px;
    }

    .mapa-sitio-subitem {
        padding: 8px 12px;
    }

    .mapa-sitio-subitem__arrow {
        width: 20px;
        height: 20px;
        margin-right: 10px;
    }

    .mapa-sitio-subitem__title {
        font-size: 14px;
    }

    .mapa-sitio-sublist {
        padding-left: 30px;
    }

    .mapa-sitio-sublist a {
        font-size: 13px;
    }

    .mapa-sitio-sublist--level3 {
        padding-left: 25px;
    }

    .mapa-sitio-legend {
        padding: 20px;
        gap: 30px;
    }

    .mapa-sitio-legend__icon {
        width: 24px;
        height: 24px;
    }

    .mapa-sitio-legend__text {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .mapa-sitio-item__header {
        padding: 12px 15px;
    }

    .mapa-sitio-item__arrow {
        width: 22px;
        height: 22px;
        margin-right: 10px;
    }

    .mapa-sitio-item__title {
        font-size: 16px;
    }

    .mapa-sitio-list {
        padding: 12px 15px 12px 40px;
    }

    .mapa-sitio-list a {
        font-size: 13px;
        padding: 6px 10px;
    }

    .mapa-sitio-subitem {
        padding: 7px 10px;
    }

    .mapa-sitio-subitem__title {
        font-size: 13px;
    }

    .mapa-sitio-sublist {
        padding-left: 25px;
    }

    .mapa-sitio-sublist a {
        font-size: 12px;
        padding: 5px 8px;
    }

    .mapa-sitio-legend {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .mapa-sitio-footer__logo {
        max-width: 150px;
    }
}

/* --- Animaciones --- */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mapa-sitio-item.is-open .mapa-sitio-item__content {
    animation: fadeIn 0.3s ease;
}

.mapa-sitio-subitem.is-open + .mapa-sitio-sublist {
    animation: fadeIn 0.3s ease;
}
