/* ==========================================================
   VIRTUAL UTTEC
   Personalización de la portada y footer institucional
   Moodle 5.0 + Boost Union + Bootstrap
   ========================================================== */


/* ==========================================================
   1. PORTADA PRINCIPAL
   ========================================================== */

/* Oculta únicamente el título grande de la portada */
body#page-site-index #page-header {
    display: none !important;
}

/* Reduce el espacio superior antes del banner */
body#page-site-index #page-content {
    margin-top: 0 !important;
}


/* ==========================================================
   2. VARIABLES Y ESTRUCTURA GENERAL DEL FOOTER
   ========================================================== */

.uttec-footer {
    --uttec-cafe: #622e3b;
    --uttec-cafe-claro: #c49463;
    --uttec-rojo: #9d3446;
    --uttec-cafe-oscuro: #421d27;
    --uttec-blanco: #ffffff;

    position: relative;
    display: block;

    width: 100%;
    max-width: 100%;
    min-width: 0;

    margin: 0;
    padding: 0;

    color: var(--uttec-blanco);
    background-color: var(--uttec-cafe);

    /*
     * Extiende solamente el fondo hasta los bordes de la
     * ventana, sin modificar físicamente el ancho del footer
     * y sin generar desplazamiento horizontal.
     */
    box-shadow: 0 0 0 100vmax var(--uttec-cafe);
    clip-path: inset(0 -100vmax);

    font-family: Arial, Helvetica, sans-serif;
    box-sizing: border-box;
}

/* Modelo de caja uniforme dentro del footer */
.uttec-footer,
.uttec-footer *,
.uttec-footer *::before,
.uttec-footer *::after {
    box-sizing: border-box;
}

/* Evita que imágenes y elementos SVG excedan su columna */
.uttec-footer img,
.uttec-footer svg {
    max-width: 100%;
}

/* Protege el texto blanco frente a estilos heredados de Moodle */
.uttec-footer,
.uttec-footer p,
.uttec-footer address,
.uttec-footer li,
.uttec-footer strong {
    color: var(--uttec-blanco);
}


/* ==========================================================
   3. CONTENEDOR Y COLUMNAS
   ========================================================== */

.uttec-footer__container {
    width: 100%;
    max-width: 1600px;

    margin-right: auto;
    margin-left: auto;

    /* Dimensiones compactas finales */
    padding: 32px 36px 34px;
}

/*
 * Bootstrap administra el gutter mediante .row.
 * min-width: 0 permite que las columnas se contraigan
 * cuando existen correos o direcciones largas.
 */
.uttec-footer .row {
    max-width: 100%;
}

.uttec-footer .row > [class*="col-"] {
    min-width: 0;
}

.uttec-footer__section {
    position: relative;
    min-width: 0;
}


/* ==========================================================
   4. IDENTIDAD INSTITUCIONAL
   ========================================================== */

.uttec-footer__logo-link {
    display: inline-block;

    width: auto;
    max-width: 100%;

    margin: 0 0 18px;
    padding: 0;

    color: inherit;
    border-radius: 4px;
    text-decoration: none;
}

.uttec-footer__logo {
    display: block;

    width: 180px;
    max-width: 100%;
    height: auto;
    max-height: 90px;

    margin: 0;

    object-fit: contain;
    object-position: left center;
}

.uttec-footer__logo-link:focus-visible {
    outline: 3px solid var(--uttec-cafe-claro);
    outline-offset: 6px;
}

.uttec-footer__description {
    width: 100%;
    max-width: 320px;

    margin: 0;

    color: var(--uttec-blanco);

    font-size: 15px;
    font-weight: 400;
    line-height: 1.45;

    overflow-wrap: break-word;
}


/* ==========================================================
   5. TÍTULOS DE LAS SECCIONES
   ========================================================== */

.uttec-footer__title {
    margin: 0 0 17px;

    color: var(--uttec-cafe-claro) !important;

    font-size: 29px;
    font-weight: 700;
    line-height: 1.1;

    overflow-wrap: break-word;
}

/* Línea roja decorativa debajo de cada título */
.uttec-footer__title::after {
    display: block;

    width: 46px;
    height: 3px;

    margin-top: 8px;

    background-color: var(--uttec-rojo);
    border-radius: 999px;

    content: "";
}


/* ==========================================================
   6. SITIOS DE INTERÉS
   ========================================================== */

.uttec-footer__links {
    display: flex;
    flex-direction: column;
    align-items: flex-start;

    width: 100%;
    max-width: 100%;

    gap: 8px;
}

.uttec-footer__links a {
    display: inline-block;

    max-width: 100%;

    color: var(--uttec-blanco) !important;

    font-size: 15px;
    font-weight: 500;
    line-height: 1.25;

    overflow-wrap: anywhere;

    text-decoration: underline;
    text-decoration-color: var(--uttec-cafe-claro);
    text-decoration-thickness: 1px;
    text-underline-offset: 4px;

    transition:
        color 160ms ease,
        transform 160ms ease;
}

.uttec-footer__links a:hover {
    color: var(--uttec-cafe-claro) !important;
    transform: translateX(4px);
}

.uttec-footer__links a:focus-visible {
    color: var(--uttec-blanco) !important;

    outline: 3px solid var(--uttec-cafe-claro);
    outline-offset: 4px;

    border-radius: 3px;
}


/* ==========================================================
   7. UBICACIÓN
   ========================================================== */

.uttec-footer__address {
    width: 100%;
    max-width: 100%;

    margin: 0 0 15px;

    color: var(--uttec-blanco);

    font-size: 15px;
    font-style: normal;
    font-weight: 400;
    line-height: 1.45;

    overflow-wrap: break-word;
}


/* ==========================================================
   8. INFORMACIÓN DE CONTACTO
   ========================================================== */

.uttec-footer__contact {
    display: flex;
    flex-direction: column;

    width: 100%;
    max-width: 100%;

    margin: 0;
    padding: 0;

    gap: 10px;

    list-style: none;
}

.uttec-footer__contact li {
    display: flex;
    align-items: flex-start;

    min-width: 0;
    max-width: 100%;

    gap: 10px;

    color: var(--uttec-blanco);

    font-size: 15px;
    line-height: 1.4;
}

.uttec-footer__contact-icon {
    display: inline-flex;
    flex: 0 0 20px;
    align-items: center;
    justify-content: center;

    width: 20px;
    min-width: 20px;

    margin-top: 2px;

    color: var(--uttec-cafe-claro);
}

.uttec-footer__contact-icon i {
    color: var(--uttec-cafe-claro);
}

.uttec-footer__contact-content {
    flex: 1 1 auto;

    min-width: 0;
    max-width: 100%;

    color: var(--uttec-blanco);

    overflow-wrap: anywhere;
}

.uttec-footer__contact a {
    color: var(--uttec-blanco) !important;

    overflow-wrap: anywhere;
    word-break: normal;

    text-decoration: underline;
    text-decoration-color: var(--uttec-cafe-claro);
    text-underline-offset: 4px;

    transition: color 160ms ease;
}

.uttec-footer__contact a:hover {
    color: var(--uttec-cafe-claro) !important;
}

.uttec-footer__contact a:focus-visible {
    color: var(--uttec-blanco) !important;

    outline: 3px solid var(--uttec-cafe-claro);
    outline-offset: 3px;

    border-radius: 3px;
}


/* ==========================================================
   9. REDES SOCIALES
   ========================================================== */

.uttec-footer__social {
    display: flex;
    flex-wrap: wrap;
    align-items: center;

    width: 100%;
    max-width: 100%;

    gap: 12px;
}

.uttec-footer__social-link {
    display: inline-flex;
    flex: 0 0 50px;
    align-items: center;
    justify-content: center;

    width: 50px;
    height: 50px;

    margin: 0;
    padding: 0;

    color: var(--uttec-blanco) !important;

    border: 2px solid rgba(255, 255, 255, 0.18);
    border-radius: 7px;

    font-size: 21px;
    font-weight: 700;
    line-height: 1;

    text-decoration: none;

    transition:
        color 160ms ease,
        background-color 160ms ease,
        border-color 160ms ease,
        box-shadow 160ms ease,
        transform 160ms ease;
}

.uttec-footer__social-link i,
.uttec-footer__social-link span {
    display: block;
    line-height: 1;
}

/* Colores institucionales de los botones sociales */
.uttec-footer__social-link--facebook {
    background-color: var(--uttec-rojo);
}

.uttec-footer__social-link--x {
    background-color: var(--uttec-cafe-oscuro);
}

.uttec-footer__social-link--instagram {
    background-color: #7d2f41;
}

.uttec-footer__social-link--youtube {
    background-color: var(--uttec-rojo);
    border-color: var(--uttec-cafe-claro);
}

.uttec-footer__social-link:hover {
    color: var(--uttec-cafe) !important;
    background-color: var(--uttec-cafe-claro);
    border-color: var(--uttec-blanco);

    box-shadow: 0 8px 18px rgba(31, 12, 17, 0.34);

    text-decoration: none;
    transform: translateY(-4px);
}

.uttec-footer__social-link:focus-visible {
    color: var(--uttec-cafe) !important;
    background-color: var(--uttec-cafe-claro);

    outline: 3px solid var(--uttec-blanco);
    outline-offset: 4px;
}

.uttec-footer__social-link:active {
    transform: translateY(-1px);
}


/* ==========================================================
   10. SEPARADORES VERTICALES EN ESCRITORIO
   ========================================================== */

@media (min-width: 1200px) {
    /*
     * Cada sección tiene 34 px entre el separador y
     * el contenido, evitando que el texto quede pegado.
     */
    .uttec-footer__section {
        padding-right: 34px !important;
        padding-left: 34px !important;
    }

    .uttec-footer__section:first-child {
        padding-left: 0 !important;
    }

    .uttec-footer__section:last-child {
        padding-right: 0 !important;
    }

    /*
     * La línea marca el inicio de cada sección,
     * excepto la primera.
     */
    .uttec-footer__section:not(:first-child)::before {
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;

        display: block;
        width: 1px;

        background-color: rgba(196, 148, 99, 0.32);

        content: "";
    }
}


/* ==========================================================
   11. BARRA DE COPYRIGHT COMPACTA
   ========================================================== */

.uttec-footer__copyright {
    position: relative;

    width: 100%;
    max-width: 100%;

    /*
     * El margen negativo cubre el pequeño espacio inferior
     * que Moodle deja después del fragmento.
     */
    margin: 0 0 -16px;
    padding: 8px 20px 20px;

    color: rgba(255, 255, 255, 0.82) !important;
    background-color: var(--uttec-cafe-oscuro);
    border-top: 3px solid var(--uttec-rojo);

    /*
     * Extiende el fondo hasta los laterales sin modificar
     * físicamente el ancho del elemento.
     */
    box-shadow: 0 0 0 100vmax var(--uttec-cafe-oscuro);
    clip-path: inset(0 -100vmax);

    text-align: center;
}

.uttec-footer__copyright .container {
    max-width: 1600px;
}

.uttec-footer__copyright p {
    margin: 0 !important;

    color: rgba(255, 255, 255, 0.82) !important;

    font-size: 13px;
    font-weight: 400;
    line-height: 1.25;

    overflow-wrap: break-word;
}


/* ==========================================================
   12. TABLETAS Y PORTÁTILES PEQUEÑOS
   De 768 px a 1199.98 px
   ========================================================== */

@media (min-width: 768px) and (max-width: 1199.98px) {
    .uttec-footer__container {
        padding: 30px 28px;
    }

    /*
     * En tabletas se eliminan los separadores verticales.
     * Bootstrap acomoda dos columnas por fila.
     */
    .uttec-footer__section::before,
    .uttec-footer__section::after {
        display: none !important;
        content: none !important;
    }

    .uttec-footer__section {
        padding: 4px 24px 24px;

        border-bottom: 1px solid rgba(196, 148, 99, 0.22);
    }

    .uttec-footer__description {
        max-width: 420px;
    }
}


/* ==========================================================
   13. MÓVILES
   Menos de 768 px
   ========================================================== */

@media (max-width: 767.98px) {
    .uttec-footer__container {
        padding: 30px 20px;
    }

    /* Elimina cualquier separador vertical */
    .uttec-footer__section::before,
    .uttec-footer__section::after {
        display: none !important;
        content: none !important;
    }

    /*
     * Cada bloque se muestra en una fila.
     * La línea horizontal marca el final de la sección.
     */
    .uttec-footer__section {
        width: 100%;
        max-width: 100%;

        margin-bottom: 25px;
        padding: 0 0 25px;

        border-bottom: 1px solid rgba(196, 148, 99, 0.28);
    }

    .uttec-footer__section:last-child {
        margin-bottom: 0;
        padding-bottom: 0;
        border-bottom: 0;
    }

    .uttec-footer__logo {
        width: 165px;
        max-height: 82px;
    }

    .uttec-footer__description {
        max-width: 500px;
    }

    .uttec-footer__title {
        margin-bottom: 16px;
        font-size: 25px;
    }

    .uttec-footer__social-link {
        flex-basis: 48px;

        width: 48px;
        height: 48px;

        font-size: 20px;
    }

    /*
     * Moodle deja alrededor de 20 px debajo del último
     * fragmento en móvil.
     
    body#page-site-index .uttec-footer__copyright {
    margin-bottom: -20px;
    padding: 8px 16px 24px;
    }
    */
}


/* ==========================================================
   14. MÓVILES PEQUEÑOS
   Menos de 400 px
   ========================================================== */

@media (max-width: 399.98px) {
    .uttec-footer__container {
        padding: 26px 16px;
    }

    .uttec-footer__section {
        margin-bottom: 22px;
        padding-bottom: 22px;
    }

    .uttec-footer__title {
        font-size: 23px;
    }

    .uttec-footer__description,
    .uttec-footer__address,
    .uttec-footer__contact li,
    .uttec-footer__links a {
        font-size: 14px;
    }

    .uttec-footer__social {
        gap: 10px;
    }
}


/* ==========================================================
   15. ELIMINAR ESPACIO INFERIOR DE MOODLE
   Solamente en la portada que contiene el footer
   ========================================================== */

/*
 * Limpia el contenedor inmediato de la actividad o fragmento.
 */
body#page-site-index .activity:has(.uttec-footer),
body#page-site-index .activity-item:has(.uttec-footer),
body#page-site-index .section-item:has(.uttec-footer),
body#page-site-index .contentwithoutlink:has(.uttec-footer),
body#page-site-index .activity-altcontent:has(.uttec-footer),
body#page-site-index .no-overflow:has(.uttec-footer) {
    max-width: none !important;

    margin-bottom: 0 !important;
    padding-bottom: 0 !important;

    overflow: visible !important;

    border: 0 !important;
    border-radius: 0 !important;
}

/* Limpia los contenedores hijos alrededor del fragmento */
body#page-site-index .activity:has(.uttec-footer) > div,
body#page-site-index .activity-item:has(.uttec-footer) > div,
body#page-site-index .contentwithoutlink:has(.uttec-footer) > div {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

/* Elimina el espaciado de la última sección de la portada */
body#page-site-index .course-content,
body#page-site-index .course-content > ul,
body#page-site-index .course-content > ul > li:last-child,
body#page-site-index .course-content .section:last-child,
body#page-site-index .activity:last-child,
body#page-site-index .section-item:last-child {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

/* Elimina el espaciado inferior del área principal */
body#page-site-index #page,
body#page-site-index #page-content,
body#page-site-index #region-main,
body#page-site-index .main-inner {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

/* El propio footer no debe dejar separación adicional */
body#page-site-index .uttec-footer {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}


/* ==========================================================
   16. ACCESIBILIDAD: MOVIMIENTO REDUCIDO
   ========================================================== */

@media (prefers-reduced-motion: reduce) {
    .uttec-footer a {
        transition: none;
    }

    .uttec-footer__links a:hover,
    .uttec-footer__social-link:hover,
    .uttec-footer__social-link:active {
        transform: none;
    }
}