.materiales-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    height: calc(100vh - 120px);
}

/* PANEL IZQUIERDO (ÁRBOL) */
.materiales-arbol-panel {
    border-right: 1px solid #ddd;
    background: #fafafa;
    overflow-y: auto;
}

/* LISTA PRINCIPAL */
.materiales-arbol-ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.materiales-arbol-ul > li,
.materiales-arbol-ul li {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* SUBLISTAS — línea vertical alineada bajo la flecha */
.materiales-arbol-ul ul {
    list-style: none;
    margin: 0;
    padding-left: 18px; /* flecha (14) + gap (4) */
    border-left: 1px solid #e0e0e0;
    margin-left: 14px; /* desplaza la línea bajo la flecha */
}

/* Ocultar sublistas vacías */
.materiales-arbol-ul ul:empty {
    display: none;
}

/* NODOS */
.materiales-nodo {
    padding: 0;
    cursor: pointer;
    user-select: none;
}

/* Línea interna del nodo */
.nodo-linea {
    display: flex;
    align-items: center;
    gap: 4px; /* más compacto */
    padding: 6px 10px;
    pointer-events: none;
}

/* Flecha fuera de la sangría */
.nodo-linea .toggle {
    width: 14px; /* más compacto */
    text-align: center;
    cursor: pointer;
    pointer-events: auto;
}

/* Sangría real aplicada solo al texto */
.nodo-linea .nombre {
    display: inline-block;
    padding-left: var(--indent); /* ahora será más pequeña */
    pointer-events: auto;
}

/* Hover */
.nodo-linea:hover {
    background: #f0f0f0;
}

/* Activo */
.materiales-nodo.activo > .nodo-linea {
    background: rgb(0,127,162);
    color: white;
}

/* Borde completo para PRINCIPAL siempre */
.materiales-nodo[data-id="0"] > .nodo-linea {
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    background: white;
}

/* PRINCIPAL activo */
.materiales-nodo[data-id="0"].activo > .nodo-linea {
    background: rgb(0,127,162);
    color: white;
    border: 1px solid #e0e0e0;
}

/* PANEL DERECHO (CONTENIDO) */
.materiales-contenido {
    padding: 20px;
    overflow-y: auto;
    background: white;
    min-height: 100%;
    height: 100%;
    box-sizing: border-box;
}

/* CABECERA DEL PANEL DERECHO */
.materiales-contenido-header {
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* BOTÓN NUEVO ELEMENTO */
.materiales-nuevo {
    position: relative;
}

.materiales-nuevo button {
    cursor: pointer;
}

/* MENÚ DESPLEGABLE */
.materiales-nuevo-menu {
    position: absolute;
    top: 35px;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    z-index: 50;
    width: 180px;
}

.materiales-nuevo-menu div {
    padding: 8px 12px;
    cursor: pointer;
}

.materiales-nuevo-menu div:hover {
    background: #f0f0f0;
}

.oculto {
    display: none;
}

/* MÓVIL */
@media (max-width: 768px) {
    .materiales-layout {
        grid-template-columns: 1fr;
    }

    .materiales-arbol-panel {
        position: fixed;
        left: -260px;
        top: 0;
        width: 260px;
        height: 100%;
        background: white;
        transition: left 0.25s;
        z-index: 20;
    }

    .materiales-arbol-panel.abierto {
        left: 0;
    }
}

/* MODAL PARA SUBIR ARCHIVO, DIAPOSITIVA, ETC */

/* Fondo del modal */
.bazan-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.45);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99999; /* por encima del footer y todo */
}

/* Oculto */
.bazan-modal.oculto {
    display: none;
}

/* Contenedor interno */
.bazan-modal-contenido {
    background: #fff;
    width: 600px;
    max-width: 90%;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

/* Tabs */
.bazan-modal-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.bazan-modal-tabs button {
    padding: 8px 14px;
    border: 1px solid #ccc;
    background: #f5f5f5;
    cursor: pointer;
    border-radius: 4px;
}

.bazan-modal-tabs button.activo {
    background: #0073aa;
    color: white;
    border-color: #0073aa;
}

/* Cuerpo */
.bazan-modal-body .tab {
    display: none;
}

/* Footer del modal */
.bazan-modal-acciones {
    margin-top: 20px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ============================================================
   ITEM DE MATERIAL
============================================================ */

.material-item {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
}

.material-item:hover {
    background: #f7f7f7;
}

.material-item-info {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ============================================================
   BOTÓN DE OPCIONES (⋮)
============================================================ */

.material-item-opciones-btn {
    background: transparent;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 6px;
    line-height: 1;
    color: rgb(0,127,162);
    transition: color 0.15s ease;
}

.material-item-opciones-btn:hover {
    color: rgb(0,100,130);
}

/* ============================================================
   MENÚ DE OPCIONES — BARRA HORIZONTAL
============================================================ */

.material-item-opciones-menu {
    position: absolute;
    top: 50%;
    right: 40px; /* aparece a la izquierda del botón ⋮ */
    transform: translateY(-50%) translateX(20px); /* empieza desplazado a la derecha */
    
    background: #fff;
    border: 1px solid rgba(0,127,162,0.3);
    border-radius: 6px;
    padding: 4px 8px;

    display: flex;
    flex-direction: row; /* HORIZONTAL */
    gap: 6px;

    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    z-index: 999;

    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.material-item-opciones-menu:not(.oculto) {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(-50%) translateX(0); /* se desplaza hacia la izquierda */
}

.material-item-opciones-menu.oculto {
    opacity: 0;
    pointer-events: none;
}

/* Iconos */
.material-item-opciones-menu div {
    padding: 4px;
    cursor: pointer;
    font-size: 18px;
    color: rgb(0,127,162);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, color 0.15s ease;
}

.material-item-opciones-menu div:hover {
    background: rgba(0,127,162,0.1);
    border-radius: 4px;
    color: rgb(0,100,130);
}

/* Tooltip */
.material-item-opciones-menu div::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: -26px;
    background: rgb(0,127,162);
    color: #fff;
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    transform: translateX(-50%);
    left: 50%;
    transition: opacity 0.15s ease;
    pointer-events: none;
}

.material-item-opciones-menu div:hover::after {
    opacity: 1;
}

/* ============================================================
   CIERRE DEL MENÚ AL HACER CLICK FUERA
============================================================ */

body {
    position: relative;
}


/* ============================================================
   BREADCRUMB — Caja superior completa
============================================================ */

.materiales-breadcrumb {
    width: 100%;
    background: #f5f5f5;          /* Color suave para diferenciar */
    padding: 8px 12px;
    border-radius: 4px;
    margin-bottom: 10px;          /* Separación con el título */
    font-size: 14px;
    color: #555;
    box-sizing: border-box;
}

/* Texto del breadcrumb */
.materiales-breadcrumb span {
    cursor: pointer;
    color: #0073aa;
}

.materiales-breadcrumb span:hover {
    text-decoration: underline;
}

.materiales-breadcrumb .sep {
    margin: 0 6px;
    color: #999;
}

/* ============================================================
   TÍTULO — Asegurar que queda a la izquierda
============================================================ */

.materiales-contenido-header h2 {
    margin: 0;
    padding: 0;
    text-align: left !important;
    font-weight: 700;
}

/* ============================================================
   CONTENEDOR DEL HEADER — Mantener botón a la derecha
============================================================ */

.materiales-contenido-header {
    display: flex;
    flex-direction: column;        /* Breadcrumb arriba, título debajo */
    align-items: flex-start;       /* Todo alineado a la izquierda */
    gap: 8px;                      /* Separación vertical */
}

/* El bloque del botón debe alinearse a la derecha */
.materiales-nuevo {
    align-self: flex-end;
}

/* ============================================================
   VISTA TEST ALUMNO — PREGUNTAS Y OPCIONES
============================================================ */

#materiales-lista.modo-test {
    width: 100%;
    max-width: 100%;
}

.test-pregunta {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    font-size: 18px;
    line-height: 1.5;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.test-numero {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 15px;
}

.test-enunciado {
    margin-bottom: 20px;
}

.test-opciones label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    background: #fafafa;
}

.test-opciones input {
    margin-top: 4px;
}

/* ============================================================
   ACCIONES BAJO CADA PREGUNTA (Borrar + Destacar)
============================================================ */

.test-acciones-respuesta {
    margin-top: 20px;
    padding-top: 12px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.destacar-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 15px;
}

/* Navegación del modo pregunta a pregunta */
.test-navegacion {
    margin-top: 30px;
    display: flex;
    gap: 15px;
}

/* ============================================================
   MODO OSCURO — PANEL COMPLETO
============================================================ */

#bazan-test-alumno-contenedor.modo-oscuro {
    background: #121212 !important;   /* fondo general */
    color: #f0f0f0 !important;
}

/* Fondo detrás de las tarjetas (contenedor interno) */
#bazan-test-alumno-contenedor.modo-oscuro #bazan-test-alumno-contenido {
    background: #121212 !important;
}

/* ============================================================
   MODO OSCURO — CABECERA (incluye "Realizando test")
============================================================ */

#bazan-test-alumno-contenedor.modo-oscuro .bazan-test-alumno-header h2 {
    color: #ffffff !important;        /* título claro */
}

#bazan-test-alumno-contenedor.modo-oscuro .bazan-test-alumno-header button {
    color: #f0f0f0 !important;
}

/* ============================================================
   MODO OSCURO — TARJETAS DE PREGUNTA
============================================================ */

#bazan-test-alumno-contenedor.modo-oscuro .test-pregunta {
    background: #1e1e1e !important;
    border-color: #333 !important;
    color: #f0f0f0 !important;
}

/* Número de pregunta */
#bazan-test-alumno-contenedor.modo-oscuro .test-numero {
    color: #e0e0e0 !important;
}

/* Enunciado */
#bazan-test-alumno-contenedor.modo-oscuro .test-enunciado {
    color: #ffffff !important;
}

/* ============================================================
   MODO OSCURO — OPCIONES
============================================================ */

#bazan-test-alumno-contenedor.modo-oscuro .test-opciones label {
    background: #1a1a1a !important;
    border-color: #333 !important;
    color: #e0e0e0 !important;
}

#bazan-test-alumno-contenedor.modo-oscuro .test-opciones label span {
    color: #e0e0e0 !important;
}

/* ============================================================
   MODO OSCURO — ACCIONES BAJO LA PREGUNTA
============================================================ */

#bazan-test-alumno-contenedor.modo-oscuro .test-acciones-respuesta {
    border-color: #333 !important;
}

#bazan-test-alumno-contenedor.modo-oscuro .destacar-label span {
    color: #e0e0e0 !important;
}

/* ============================================================
   MODO OSCURO — BOTONES
============================================================ */

#bazan-test-alumno-contenedor.modo-oscuro button {
    background-color: #2a2a2a !important;
    border-color: #444 !important;
    color: #f0f0f0 !important;
}

#bazan-test-alumno-contenedor.modo-oscuro button:hover {
    background-color: #3a3a3a !important;
}

/* ============================================================
   MODO OSCURO — TODAS LAS PREGUNTAS (tarjetas separadas)
============================================================ */

#bazan-test-alumno-contenedor.modo-oscuro .test-todas .test-pregunta {
    background: #1e1e1e !important;
    border-color: #333 !important;
    box-shadow: 0 1px 3px rgba(255,255,255,0.05);
}


/* ============================================================
   CABECERA DEL PANEL (Título + botones)
============================================================ */

.bazan-test-alumno-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 25px;
}

.bazan-test-alumno-header h2 {
    margin: 0;
    font-size: 26px;
    font-weight: 600;
    color: #1a1a1a;
}

.bazan-test-alumno-header button {
    background: transparent !important;
    border: none !important;
    padding: 6px 10px;
    font-size: 18px;
    cursor: pointer;
    color: inherit;
}

.bazan-test-alumno-header button:hover {
    opacity: 0.7;
}

/* ============================================================
   BOTONES DEL PLUGIN (solo los que usan clases bazan-btn)
   Color corporativo: #007FA2
============================================================ */

.bazan-btn,
.bazan-btn-primario,
.bazan-btn-secundario {
    background-color: #007FA2;
    border: 1px solid #006A87;
    color: #ffffff;
    padding: 5px 10px;
    font-size: 14px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color .15s ease, transform .1s ease;
}

.bazan-btn:hover,
.bazan-btn-primario:hover,
.bazan-btn-secundario:hover {
    background-color: #0095C0;
    transform: translateY(-1px);
}

/* ============================================================
   PANEL COMPLETO DEL TEST DEL ALUMNO (VERSIÓN SEGURA)
============================================================ */

/* Estado por defecto: completamente oculto y sin ocupar espacio */
#bazan-test-alumno-contenedor {
    display: none !important;
    visibility: hidden;
    opacity: 0;
}

/* Estado visible: solo cuando el JS lo active */
#bazan-test-alumno-contenedor.visible {
    display: block !important;
    visibility: visible;
    opacity: 1;

    position: fixed;
    inset: 0;
    background: #f3f3f3; /* Blanco rebajado */
    color: #000000;
    z-index: 99999;
    overflow-y: auto;
    padding: 20px;
    transition: opacity .2s ease;
}

/* Contenido centrado dentro del panel */
#bazan-test-alumno-contenido {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

/* Separación entre preguntas en modo "todas" */
.test-todas .test-pregunta {
    margin-bottom: 20px;        /* espacio entre tarjetas */
    background: #ffffff;        /* aseguro fondo blanco */
    border-radius: 8px;         /* bordes redondeados */
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* Última pregunta sin margen extra */
.test-todas .test-pregunta:last-child {
    margin-bottom: 0;
}


/*Botón activo de las opciones del editor de test: preguntas, opciones, tiempo, etc */

.bazan-test-editor-tabs button.active {
    background-color: transparent !important;
    color: #000 !important; /* o #fff si prefieres */
    border-bottom: 3px solid rgb(0, 127, 162) !important;
}

/* ============================================================
   CONTENEDOR DEL MODAL DEL TEST (panel del alumno)
   Ocupa toda la pantalla y hace scroll interno.
============================================================ */

#bazan-test-alumno-contenedor {
    position: fixed;
    inset: 0;                 /* top:0; right:0; bottom:0; left:0 */
    background: #fff;
    overflow-y: auto;         /* El scroll lo hace el modal */
    display: flex;
    flex-direction: column;
    z-index: 99999;
}


/* ============================================================
   BARRA SUPERIOR FIJA DENTRO DEL MODAL
============================================================ */

.bazan-test-topbar {
    position: sticky;
    top: 0;
    z-index: 10;

    background: #fff;
    border-bottom: 1px solid #ddd;

    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;

    padding: 10px 15px;

    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;

    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

/* Título */
.bazan-test-topbar .left h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

/* Centro (temporizador, estado, etc.) */
.bazan-test-topbar .center {
    text-align: center;
    font-weight: bold;
    font-size: 16px;
}

/* Botones derecha */
.bazan-test-topbar .right {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.bazan-test-topbar .right button {
    padding: 6px 10px;
    font-size: 14px;
}


/* ============================================================
   CONTENIDO DEL TEST (lo que cambia según el modo)
============================================================ */

#bazan-test-alumno-contenido {
    padding: 20px;
}

/* ============================================================
CORTINILLA SUPERIOR PARA OCULTAR CONTENIDO QUE SUBE 
============================================================ */

/* CORTINILLA SUPERIOR FIJA AL NAVEGADOR */
#bazan-test-alumno-cortinilla {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;

    height: 22px; /* altura ajustada para no solaparse con la barra */
    background: #f2f2f2; /* color exacto del fondo */
    z-index: 999999; /* por encima de la barra */

    pointer-events: none; /* no bloquea clics */
}

/* MODO OSCURO */
#bazan-test-alumno-contenedor.modo-oscuro #bazan-test-alumno-cortinilla {
    background: #111111; /* o el gris oscuro que uses */
}

/* ============================================================
   MODO OSCURO PARA LA BARRA SUPERIOR
============================================================ */

#bazan-test-alumno-contenedor.modo-oscuro .bazan-test-topbar {
    background: #1e1e1e;
    border-bottom: 1px solid #444;
    color: #f0f0f0;

    /* Sombra más suave y oscura */
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

/* Título en modo oscuro */
#bazan-test-alumno-contenedor.modo-oscuro .bazan-test-topbar .left h2 {
    color: #f0f0f0;
}

/* Centro (temporizador, etc.) */
#bazan-test-alumno-contenedor.modo-oscuro .bazan-test-topbar .center {
    color: #f0f0f0;
}

/* Botones en modo oscuro */
#bazan-test-alumno-contenedor.modo-oscuro .bazan-test-topbar .right button {
    background: #333;
    color: #fff;
    border: 1px solid #555;
}

#bazan-test-alumno-contenedor.modo-oscuro .bazan-test-topbar .right button:hover {
    background: #444;
}

