﻿/* =========================================================
   CURSOS LISTA
   ESTRUCTURA GENERAL
========================================================= */


.pagina-titulo {
    margin: 0;
    color: #68091b;
    font-size: 1.55rem;
    font-weight: 700;
}

    .pagina-titulo i {
        color: #e49a20;
    }


/* =========================================================
   UNIDAD DIDÁCTICA ACTIVA
========================================================= */

.unidad-activa-seccion {
    margin-bottom: 26px;
}

.unidad-activa-card {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 134px;
    padding: 22px 28px;
    overflow: hidden;
    border: 1px solid #e7ddd0;
    border-radius: 16px;
    background: linear-gradient(90deg, #ffffff 0%, #fffdf9 55%, #f6e8d3 100%);
    box-shadow: 0 7px 22px rgba(104, 9, 27, 0.07);
}


/* Decoración */

.unidad-activa-decoracion {
    position: absolute;
    right: -60px;
    top: -100px;
    width: 420px;
    height: 300px;
    opacity: 0.45;
    background: linear-gradient( 135deg, transparent 0%, transparent 25%, rgba(228,154,32,0.12) 25%, rgba(228,154,32,0.12) 40%, transparent 40% );
    transform: rotate(-8deg);
}


/* Icono */

.unidad-activa-icono {
    position: relative;
    z-index: 1;
    width: 96px;
    min-width: 96px;
    height: 96px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 24px;
    border-radius: 16px;
    background: linear-gradient( 135deg, #df8c12, #b95b00 );
    color: #ffffff;
    font-size: 2.2rem;
    box-shadow: 0 8px 20px rgba(185,91,0,0.22);
}


/* Información */

.unidad-activa-info {
    position: relative;
    z-index: 1;
    flex: 1;
    min-width: 0;
}

.unidad-activa-label {
    margin-bottom: 6px;
    color: #8a7258;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.unidad-activa-titulo {
    margin: 0 0 6px;
    color: #3e2929;
    font-size: 1.25rem;
    font-weight: 800;
    line-height: 1.3;
}
.unidad-activa-titulo-carrera {
    color: #3e2929;
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.3;
}
.unidad-activa-periodo {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #655b56;
    font-size: 0.82rem;
}

    .unidad-activa-periodo i {
        color: #68091b;
    }


/* Acciones */

.unidad-activa-acciones {
    position: relative;
    z-index: 2;
    margin-left: 25px;
}

.btn-cambiar-unidad {
    display: flex;
    align-items: center;
    gap: 11px;
    border: none;
    border-radius: 28px;
    padding: 14px 21px;
    background: linear-gradient( 135deg, #7b0b23, #550614 );
    color: #ffffff;
    font-size: 0.82rem;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: 0 7px 18px rgba(104,9,27,0.18);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

    .btn-cambiar-unidad:hover {
        transform: translateY(-2px);
        box-shadow: 0 10px 24px rgba(104,9,27,0.25);
    }


/* =========================================================
   SELECTOR DESPLEGABLE DE UNIDAD
========================================================= */

.selector-unidad-dropdown {
    margin-top: 12px;
    border: 1px solid #e7ddd0;
    border-radius: 16px;
    background: #ffffff;
    overflow: hidden;
    box-shadow: 0 12px 30px rgba(104,9,27,0.09);
    animation: desplegarUnidad 0.25s ease;
}


@keyframes desplegarUnidad {

    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}


.selector-unidad-dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 17px 20px;
    border-bottom: 1px solid #eee5da;
    background: #fffdf9;
}

    .selector-unidad-dropdown-header span {
        display: block;
        color: #a07c4d;
        font-size: 0.68rem;
        font-weight: 800;
        letter-spacing: 0.5px;
    }

    .selector-unidad-dropdown-header strong {
        display: block;
        margin-top: 3px;
        color: #4a3434;
        font-size: 0.88rem;
    }


.selector-unidad-contador {
    width: 34px;
    height: 34px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #68091b;
    color: #ffffff !important;
    font-size: 0.78rem !important;
}


.selector-unidad-lista {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 14px;
}


.selector-unidad-opcion {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 13px;
    border: 1px solid #ece2d7;
    border-radius: 12px;
    background: #ffffff;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

    .selector-unidad-opcion:hover {
        border-color: #d59a3d;
        transform: translateY(-1px);
        box-shadow: 0 6px 15px rgba(104,9,27,0.07);
    }

    .selector-unidad-opcion.activo {
        border-color: #68091b;
        background: #fff8f6;
    }


.selector-unidad-opcion-icono {
    width: 42px;
    min-width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    border-radius: 10px;
    background: #f8f0e7;
    color: #68091b;
}


.selector-unidad-opcion-info {
    flex: 1;
    min-width: 0;
}

    .selector-unidad-opcion-info span {
        display: block;
        margin-bottom: 3px;
        color: #a07846;
        font-size: 0.68rem;
        font-weight: 700;
    }

    .selector-unidad-opcion-info strong {
        display: -webkit-box;
        overflow: hidden;
        color: #493333;
        font-size: 0.8rem;
        line-height: 1.35;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }


.selector-unidad-check {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 8px;
    border-radius: 50%;
    background: #e49a20;
    color: #ffffff;
    font-size: 0.7rem;
}


/* =========================================================
   SECCIONES
========================================================= */

.seccion-academica {
    margin-bottom: 32px;
}

.seccion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

    .seccion-header span {
        flex: 1;
        min-width: 20px;
        height: 1px;
        background: #e4dbcf;
    }

.seccion-titulo {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 9px;
    margin: 0;
    color: #68091b;
    font-size: 1.25rem;
    font-weight: 700;
}

    .seccion-titulo span {
        flex: 1;
        height: 1px;
        background: #e4dbcf;
    }

    .seccion-titulo i {
        color: #e49a20;
    }

.seccion-descripcion {
    margin: 5px 0 15px;
    color: #777;
    font-size: 0.84rem;
}


/* =========================================================
   CONTADOR
========================================================= */

.contador-cursos {
    padding: 6px 14px;
    border: 1px solid #eadbc7;
    border-radius: 20px;
    background: #f8f1e6;
    color: #68091b;
    font-size: 0.76rem;
    font-weight: 700;
    white-space: nowrap;
}


/* =========================================================
   CARRUSEL DE CURSOS
   ---------------------------------------------------------
   El ancho de la tarjeta es fijo (--ancho-curso) y el
   JavaScript calcula cuántas caben en el viewport.
   En móvil la tarjeta pasa a 100% y solo se ve una.
========================================================= */

.selector-cursos {
    --ancho-curso: 330px;
    display: flex;
    align-items: center;
    width: 100%;
    gap: 14px;
}


.selector-viewport {
    flex: 1;
    min-width: 0;
    /* Recorta las tarjetas sobrantes mientras el JS
       todavía no ha medido la pantalla. */
    overflow: visible;
}


.selector-track {
    display: flex;
    gap: 16px;
    width: 100%;
}


.selector-item {
    flex: 0 0 auto;
    width: var(--ancho-curso);
    min-width: var(--ancho-curso);
}


/* =========================================================
   CONTROLES
========================================================= */

.selector-controles {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-shrink: 0;
}


/* =========================================================
   FLECHAS
========================================================= */

.selector-flecha {
    width: 42px;
    min-width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #ded5c8;
    border-radius: 50%;
    background: #fffdf9;
    color: #68091b;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

    .selector-flecha:hover:not(:disabled) {
        background: #68091b;
        color: #ffffff;
        border-color: #68091b;
        transform: scale(1.05);
        box-shadow: 0 4px 12px rgba(104, 9, 27, 0.18);
    }

    .selector-flecha:focus-visible {
        outline: 2px solid #e49a20;
        outline-offset: 2px;
    }

    .selector-flecha:disabled {
        opacity: 0.3;
        cursor: not-allowed;
    }


/* =========================================================
   SEPARADOR
========================================================= */

.selector-separador {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 22px 0 32px;
}

    .selector-separador span {
        flex: 1;
        height: 1px;
        background: #e4dbcf;
    }


/* =========================================================
   BOTÓN VER TODOS
========================================================= */

.btn-ver-todos {
    border: none;
    background: transparent;
    color: #68091b;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 5px 10px;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.2s ease, transform 0.2s ease;
}

    .btn-ver-todos:hover {
        color: #e49a20;
        transform: translateY(-1px);
    }


/* =========================================================
   DETALLE DEL CURSO
========================================================= */

.seccion-detalle {
    margin-top: 5px;
}

.curso-detalle {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 150px;
    padding: 25px 28px 25px 35px;
    overflow: hidden;
    background: linear-gradient( 135deg, #69091d 0%, #860d27 100% );
    border-radius: 16px;
    box-shadow: 0 7px 20px rgba(104, 9, 27, 0.15);
}

.detalle-indicador {
    position: absolute;
    left: 0;
    top: 0;
    width: 8px;
    height: 100%;
    background: #e49a20;
}

.detalle-icono {
    width: 62px;
    min-width: 62px;
    height: 62px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 22px;
    border-radius: 50%;
    background: rgba(255,255,255,0.12);
    color: #ffffff;
    font-size: 1.6rem;
}

.detalle-contenido {
    min-width: 0;
    flex: 1;
}

.detalle-codigo {
    margin-bottom: 5px;
    color: #e8ad47;
    font-size: 0.78rem;
    font-weight: 600;
}

.detalle-titulo {
    margin: 0 0 16px;
    color: #ffffff;
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.35;
}

.detalle-datos {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
}

.detalle-dato {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #ffffff;
}

.detalle-label {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #e8ad47;
    font-size: 0.76rem;
}

.detalle-dato strong {
    color: #ffffff;
    font-size: 0.8rem;
}

.detalle-estado {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-left: 25px;
    padding: 7px 13px;
    border-radius: 20px;
    background: rgba(255,255,255,0.12);
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
}

    .detalle-estado i {
        color: #e4a027;
    }


/* =========================================================
   SIN SELECCIÓN
========================================================= */

.sin-seleccion {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 100px;
    padding: 20px;
    border: 1px dashed #d8cbbb;
    border-radius: 14px;
    background: #fffdf9;
    color: #777;
    font-size: 0.85rem;
}

    .sin-seleccion i {
        color: #e49a20;
    }


/* =========================================================
   SIN CURSOS
========================================================= */

.sin-cursos {
    display: flex;
    align-items: center;
    flex-direction: column;
    padding: 55px 20px;
    text-align: center;
    border: 1px dashed #d8cbbb;
    border-radius: 16px;
    background: #fffdf9;
}

.sin-cursos-icono {
    width: 65px;
    height: 65px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
    border-radius: 50%;
    background: #f8f1e6;
    color: #68091b;
    font-size: 1.5rem;
}

.sin-cursos h4 {
    color: #68091b;
    font-size: 1.05rem;
}

.sin-cursos p {
    margin: 0;
    color: #777;
    font-size: 0.84rem;
}


/* =========================================================
   LOADING
========================================================= */

.loading-container {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    min-height: 250px;
    color: #777;
}


/* =========================================================
   TODOS LOS CURSOS
========================================================= */

.todos-cursos-panel {
    padding: 20px;
    border: 1px solid #e7ddd0;
    border-radius: 18px;
    background: #fffdf9;
    animation: mostrarTodosCursos 0.25s ease;
}


@keyframes mostrarTodosCursos {

    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}


.todos-cursos-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}


.todos-cursos-label {
    display: block;
    margin-bottom: 4px;
    color: #a07846;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.6px;
}

.todos-cursos-header h4 {
    margin: 0;
    color: #493333;
    font-size: 1rem;
    font-weight: 700;
}


.btn-volver-horizontal {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 15px;
    border: 1px solid #e0d5c8;
    border-radius: 20px;
    background: #ffffff;
    color: #68091b;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

    .btn-volver-horizontal:hover {
        background: #68091b;
        border-color: #68091b;
        color: #ffffff;
    }


.todos-cursos-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}


.todos-cursos-item {
    min-width: 0;
}


/* =========================================================
   LAPTOP / TABLET GRANDE
   El carrusel NO se toca aquí: el JS reduce solo la
   cantidad de tarjetas al achicarse el viewport.
========================================================= */

@media (max-width: 1370px) {

    .todos-cursos-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .unidad-activa-titulo {
        font-size: 1.1rem;
    }
}


/* =========================================================
   TABLET
   Las flechas pasan debajo del carrusel, alineadas a la
   derecha. La tarjeta sigue midiendo 330px, así que
   normalmente caben 2.
========================================================= */

@media (max-width: 1050px) {

    .unidad-activa-card {
        align-items: flex-start;
        flex-wrap: wrap;
        padding: 20px;
    }

    .unidad-activa-icono {
        width: 72px;
        min-width: 72px;
        height: 72px;
        margin-right: 16px;
        font-size: 1.7rem;
    }

    .unidad-activa-info {
        min-width: calc(100% - 90px);
    }

    .unidad-activa-acciones {
        width: 100%;
        margin-top: 18px;
        margin-left: 0;
    }

    .btn-cambiar-unidad {
        width: 100%;
        justify-content: center;
    }


    /* En columna, align-items debe ser stretch o el viewport
       se encoge al ancho de su contenido y se desborda. */

    .selector-cursos {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .selector-viewport {
        width: 100%;
    }

    .selector-controles {
        width: 100%;
        justify-content: flex-end;
    }


    .selector-unidad-lista {
        grid-template-columns: 1fr;
    }

    .todos-cursos-grid {
        grid-template-columns: 1fr;
    }

    .todos-cursos-header {
        align-items: flex-start;
        gap: 15px;
        flex-direction: column;
    }

    .btn-volver-horizontal {
        width: 100%;
        justify-content: center;
    }
}


/* =========================================================
   MÓVIL
   Una sola tarjeta a todo el ancho. Como la tarjeta mide
   lo mismo que el viewport, el cálculo del JS da 1 y el
   carrusel avanza de uno en uno con las flechas.
========================================================= */

@media (max-width: 768px) {

    .selector-cursos {
        --ancho-curso: 100%;
    }
}


/* =========================================================
   MÓVIL PEQUEÑO
========================================================= */

@media (max-width: 480px) {

    .unidad-activa-card {
        padding: 16px;
    }

    .unidad-activa-icono {
        width: 60px;
        min-width: 60px;
        height: 60px;
        margin-right: 13px;
        border-radius: 13px;
        font-size: 1.4rem;
    }

    .unidad-activa-label {
        font-size: 0.62rem;
    }

    .unidad-activa-titulo {
        font-size: 0.92rem;
    }

    .unidad-activa-periodo {
        font-size: 0.75rem;
    }

    .selector-flecha {
        width: 38px;
        min-width: 38px;
        height: 38px;
    }

    .todos-cursos-panel {
        padding: 14px;
    }
}


/* =========================================================
   MOVIMIENTO REDUCIDO
========================================================= */

@media (prefers-reduced-motion: reduce) {

    .selector-unidad-dropdown,
    .todos-cursos-panel {
        animation: none;
    }

    .btn-cambiar-unidad,
    .selector-flecha,
    .selector-unidad-opcion,
    .btn-ver-todos,
    .btn-volver-horizontal {
        transition: none;
    }
}
