/**
 * Oposiciones Fisioterapia Dashboard - Estilos del Frontend
 * Estilos para el tablero de cursos y cuestionarios
 */

/* Contenedor Principal del Tablero */
.ofd-contenedor-tablero {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Título "Mis cursos" reutilizando estilo del nombre de usuario */
.ofd-filtros-dependientes .ofd-iu-nombre {
    color: #0b2a3b;
    font-size: 1.05rem;
    font-weight: 800;
    margin: 0 0 8px 0;
}

/* Visor: tabla y cabecera integrados */
.ofd-tabla-detalles-wrap {
    background: #ffffff;
    border: 1px solid #e6ebef;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

/* Asegurar separaciones coherentes con el visor */
.ofd-visor-encabezado + .ofd-tabla-detalles-wrap { border-top-left-radius: 0; border-top-right-radius: 0; border-top: none; padding: 15px;}
.ofd-tabla-detalles {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    padding: 10px;
}
.ofd-tabla-detalles thead th {
    background: #0b2a3b;
    color: #ffffff;
    text-align: left;
    padding: 14px 16px!important;
    font-weight: 700;
}
.ofd-tabla-detalles thead th:first-child { border-top-left-radius: 0; }
.ofd-tabla-detalles thead th:last-child { border-top-right-radius: 0; }
.ofd-tabla-detalles tbody td {
    padding: 14px 16px;
    border-top: 1px solid #eef3f6;
}
.ofd-tabla-detalles tbody tr:hover { background: #fafcfe; }


.ofd-mis-cursos {
    color: #0b2a3b;
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.2;
}

/* Estado correcta/incorrecta como badges */
.ofd-estado { display: inline-block; padding: 2px 10px; border-radius: 999px; font-weight: 700; font-size: .85rem; }
.ofd-estado.correcta { background: #d4edda; color: #155724; }
.ofd-estado.incorrecta, td .ofd-estado.incorrecta { background: #f8d7da !important; color: #721c24 !important; }

/* Progreso del curso en encabezado */
.ofd-curso-progreso { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.ofd-curso-progreso-barra { flex: 1; height: 8px; background: rgba(255,255,255,0.25); border-radius: 999px; overflow: hidden; }
.ofd-curso-progreso-relleno { height: 100%; background: #f39c12; width: 0%; transition: width .9s cubic-bezier(.2,.8,.2,1); }
.ofd-curso-progreso-texto { font-weight: 700; color: #fff; font-size: .9rem; }

.ofd-contenedor-tablero h3 {
    color: #0b2a3b;
    border-bottom: 2px solid #f39c12;
    padding-bottom: 10px;
    margin-bottom: 30px;
}

/* Estados de Error y Sin Datos */
.ofd-error,
.ofd-sin-datos {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    margin: 20px 0;
}

.ofd-error {
    background: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

.ofd-error .button {
    margin-top: 10px;
}

/* Sección de Información del Usuario */
.ofd-info-usuario {
    background: #ffffff;
    border: 1px solid #e6ebef;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

/* Encabezado visual tipo ficha */
.ofd-iu {
    display: grid;
    grid-template-columns: 64px 1fr auto;
    gap: 16px;
    align-items: center;
}

.ofd-iu-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #0b2a3b;
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 1.1rem;
    overflow: hidden;
}
.ofd-iu-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ofd-iu-avatar span { letter-spacing: 1px; }

.ofd-iu-identidad .ofd-iu-nombre {
    color: #0b2a3b;
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.2;
}
.ofd-iu-identidad .ofd-iu-email {
    color: #6c757d;
    font-size: 0.95rem;
}

.ofd-iu-meta {
    display: grid;
    grid-auto-flow: column;
    gap: 20px;
}
.ofd-iu-item { text-align: right; }
.ofd-iu-label { display: block; color: #6c757d; font-size: 0.8rem; }
.ofd-iu-valor { display: block; color: #0b2a3b; font-weight: 600; }

.ofd-info-usuario p {
    margin: 8px 0;
    color: #555;
}

/* Filtros dependientes - contenedor armonizado */
.ofd-filtros-dependientes {
    background: #ffffff;
    border: 1px solid #e6ebef;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}
.ofd-filtros-dependientes .ofd-filtros-titulo {
    color: #0b2a3b;
    font-weight: 700;
    margin-bottom: 10px;
}
.ofd-filtros-dependientes .ofd-grupo-filtro {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}
.ofd-filtros-dependientes label { color: #6c757d; font-weight: 600; }
.ofd-filtros-dependientes select {
    width: 100%;
    background: #f8fbfd;
    border: 1px solid #d9e2ea;
    border-radius: 8px;
    padding: 10px 12px;
    color: #0b2a3b;
    transition: border-color .2s ease, box-shadow .2s ease;
}
.ofd-filtros-dependientes select:focus {
    border-color: #0b2a3b;
    box-shadow: 0 0 0 3px rgba(11,42,59,0.08);
    outline: none;
}

/* Encabezado azul del visor: curso + badge + fecha */
.ofd-visor-encabezado {
    background: #0b2a3b;
    color: #ffffff;
    border-radius: 8px 8px 0 0;
    padding: 12px 16px;
}
.ofd-visor-titulo { font-weight: 800; letter-spacing: .2px; }
.ofd-visor-sub { color: rgba(255,255,255,.85); font-size: .9rem; margin-top: 4px; }

/* Badge reutilizable para curso */
.ofd-badge-curso {
    display: inline-block;
    background: #f39c12;
    color: #0b2a3b;
    border-radius: 999px;
    padding: 2px 10px;
    font-weight: 800;
    font-size: .85rem;
    vertical-align: middle;
    margin-left: 8px;
}

.ofd-sin-intentos-curso {
    margin: 16px 0;
    color: #6c757d;
}

/* Responsive */
@media (max-width: 720px) {
    .ofd-iu { grid-template-columns: 48px 1fr; }
    .ofd-iu-meta { grid-auto-flow: row; text-align: left; gap: 6px; }
    .ofd-iu-item { text-align: left; }

    .ofd-filtros-dependientes .ofd-grupo-filtro {
        grid-template-columns: 1fr;
    }
}

/* Sección de Filtros */
.ofd-filtros {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
    display: flex;
    gap: 20px;
    align-items: end;
    flex-wrap: wrap;
}

.ofd-grupo-filtro {
    display: flex;
    flex-direction: column;
    min-width: 200px;
}

.ofd-grupo-filtro label {
    font-weight: 600;
    margin-bottom: 5px;
    color: #2c3e50;
}

.ofd-grupo-filtro select {
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background: white;
}

.ofd-boton-actualizar {
    background: #f39c12 !important;
    color: #0b2a3b !important;
    border: none !important;
    padding: 10px 20px !important;
    border-radius: 6px !important;
    cursor: pointer;
    transition: background-color 0.2s ease;
    font-weight: 600;
}

.ofd-boton-actualizar:hover {
    background: #d98c0f !important;
}

/* Sección de Cursos */
.ofd-seccion-cursos h4 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.3em;
}

.ofd-sin-cursos,
.ofd-sin-resultados-filtro {
    text-align: center;
    padding: 40px;
    color: #6c757d;
    font-style: italic;
}

/* Curso Individual */
.ofd-curso {
    background: #ffffff;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
}

.ofd-titulo-curso {
    background: #0b2a3b;
    color: #ffffff;
    padding: 15px 20px;
    margin: 0;
    font-size: 1.1em;
    cursor: pointer;
    transition: background-color 0.2s ease;
    position: relative;
}

.ofd-titulo-curso:hover {
    background: #092232;
}

.ofd-titulo-curso::after {
    content: "▼";
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    transition: transform 0.3s;
}

.ofd-curso.colapsado .ofd-titulo-curso::after {
    transform: translateY(-50%) rotate(-90deg);
}

.ofd-cuestionarios {
    padding: 20px;
}

.ofd-sin-cuestionarios {
    text-align: center;
    color: #6c757d;
    font-style: italic;
    padding: 20px;
}

/* Cuestionario Individual */
.ofd-cuestionario {
    border: 1px solid #e6ebef;
    border-radius: 8px;
    margin-bottom: 15px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.ofd-cabecera-cuestionario {
    background: #f8f9fa;
    padding: 15px;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.ofd-titulo-cuestionario {
    margin: 0;
    color: #0b2a3b;
    font-size: 1em;
    flex: 1;
    min-width: 200px;
    font-weight: 600;
}

.ofd-estadisticas-cuestionario {
    display: flex;
    gap: 15px;
    font-size: 0.9em;
    flex-wrap: wrap;
}

.ofd-mejor-nota {
    color: #27ae60;
    font-weight: 600;
}

.ofd-contador-intentos {
    color: #7f8c8d;
}

.ofd-promedio {
    color: #f39c12;
    font-weight: 600;
}

/* Sección de Intentos */
.ofd-intentos {
    padding: 15px;
}

.ofd-intentos h7 {
    display: block;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 0.95em;
}

/* Intento Individual */
.ofd-intento {
    border: 1px solid #dee2e6;
    border-radius: 6px;
    margin-bottom: 12px;
    overflow: hidden;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    padding: 10px 12px;
    background: #fff;
    transition: box-shadow 0.2s ease, transform 0.06s ease;
}

.ofd-intento.aprobado {
    border-left: 4px solid #27ae60;
}

.ofd-intento.reprobado {
    border-left: 4px solid #e74c3c;
}

.ofd-resumen-intento {
    padding: 12px 15px;
    background: #ffffff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.ofd-numero-intento {
    font-weight: 600;
    color: #2c3e50;
}

.ofd-puntuacion-intento {
    font-weight: 600;
}

.ofd-intento.aprobado .ofd-puntuacion-intento {
    color: #27ae60;
}

.ofd-intento.reprobado .ofd-puntuacion-intento {
    color: #e74c3c;
}

.ofd-fecha-intento {
    color: #6c757d;
    font-size: 0.9em;
}

.ofd-boton-ver-detalles {
    background: #f39c12;
    color: #0b2a3b;
    border: none;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85em;
    transition: background-color 0.2s ease, transform 0.05s ease, box-shadow 0.2s ease;
    font-weight: 600;
}

.ofd-boton-ver-detalles:hover {
    background: #d98c0f;
    box-shadow: 0 2px 8px rgba(243,156,18,0.3);
}

.ofd-boton-ver-detalles:disabled {
    background: #d8dde2;
    color: #8a97a6;
    cursor: not-allowed;
}

/* Alinear el botón a la derecha sin cambiar HTML */
.ofd-intento > .ofd-boton-ver-detalles {
    grid-column: 2 / 3;
    align-self: center;
}
.ofd-intento > span {
    grid-column: 1 / 2;
    align-self: center;
}
.ofd-intento > .ofd-detalles-intento {
    grid-column: 1 / -1;
}

/* Micro animaciones de tarjetas */
.ofd-curso,
.ofd-cuestionario,
.ofd-intento {
    will-change: transform, box-shadow;
}
.ofd-curso:hover,
.ofd-cuestionario:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0,0,0,0.06);
}
.ofd-intento:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

/* Animación suave al mostrar detalles */
.ofd-detalles-intento {
    transition: max-height 0.25s ease, opacity 0.25s ease, padding 0.25s ease;
    overflow: hidden;
}
.ofd-detalles-intento.cargado {
    opacity: 1;
}

/* Accesibilidad: foco visible en botones */
.ofd-boton-ver-detalles:focus {
    outline: 2px solid #f39c12;
    outline-offset: 2px;
}

/* Detalles del Intento */
.ofd-detalles-intento {
    background: #f9fbfc;
    border-top: 1px solid #e6ebef;
    padding: 20px;
}

/* Tabla de detalles del intento */
.ofd-tabla-detalles-wrap {
    width: 100%;
    overflow-x: auto;
}

.ofd-tabla-detalles {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border: 1px solid #e6ebef;
    border-radius: 8px;
    overflow: hidden;
}

.ofd-tabla-detalles thead th {
    background: #0b2a3b;
    color: #ffffff;
    text-align: left;
    padding: 12px 14px;
    font-weight: 700;
}

.ofd-tabla-detalles tbody td,
.ofd-tabla-detalles tfoot td {
    padding: 12px 14px;
    border-top: 1px solid #e6ebef;
    color: #2c3e50;
}

.ofd-tabla-detalles tbody tr:hover {
    background: #f9fbfc;
}

.ofd-tabla-detalles tfoot td {
    background: #f8f9fa;
    font-weight: 600;
}

/* Badges de estado */
.ofd-estado {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.85em;
    font-weight: 700;
}
.ofd-estado.correcta {
    background: #d4edda;
    color: #155724;
}
.ofd-estado.incorrecta {
    background: #f8d7da;
    color: #721c24;
}

.ofd-cargando {
    text-align: center;
    color: #6c757d;
    padding: 20px;
}

.ofd-info-intento h8,
.ofd-resumen-preguntas h8,
.ofd-analisis-areas h8,
.ofd-lista-preguntas h8 {
    display: block;
    font-weight: 700;
    color: #0b2a3b;
    margin-bottom: 15px;
    font-size: 1em;
    border-bottom: 1px solid #e6ebef;
    padding-bottom: 6px;
}

.ofd-meta-intento {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.ofd-meta-intento span {
    color: #555;
    font-size: 0.9em;
}

/* Estadísticas de Resumen */
.ofd-estadisticas-resumen {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.ofd-estadistica {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 15px;
    text-align: center;
    min-width: 100px;
    position: relative;
    overflow: hidden;
}

.ofd-estadistica.correcta {
    border-left: 4px solid #27ae60;
}

.ofd-estadistica.incorrecta {
    border-left: 4px solid #e74c3c;
}

.ofd-estadistica.total {
    border-left: 4px solid #3498db;
}

.ofd-estadistica.porcentaje {
    border-left: 4px solid #9b59b6;
}

.ofd-estadistica .contador {
    display: block;
    font-size: 1.5em;
    font-weight: 700;
    color: #2c3e50;
}

.ofd-estadistica .etiqueta {
    display: block;
    font-size: 0.85em;
    color: #6c757d;
    margin-top: 5px;
}

.ofd-barra-progreso {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: #ecf0f1;
}

.ofd-relleno-progreso {
    height: 100%;
    background: #27ae60;
    transition: width 0.5s ease;
}

/* Análisis por Áreas */
.ofd-analisis-areas {
    margin-bottom: 20px;
}

.ofd-area-estadistica {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 10px;
}

.ofd-area-estadistica h9 {
    display: block;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 0.95em;
}

.ofd-stats-area {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.ofd-stats-area span {
    font-size: 0.85em;
    color: #555;
}

.ofd-area-estadistica .ofd-barra-progreso {
    position: relative;
    height: 6px;
    background: #ecf0f1;
    border-radius: 3px;
    margin-top: 10px;
}

.ofd-area-estadistica .ofd-progreso-relleno {
    height: 100%;
    background: #f39c12;
    border-radius: 3px;
    transition: width 0.5s ease;
}

/* Lista de Preguntas */
.ofd-lista-preguntas {
    margin-top: 20px;
}

.ofd-pregunta {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    margin-bottom: 10px;
    padding: 15px;
}

.ofd-pregunta.correcta {
    border-left: 4px solid #27ae60;
    background: #f8fff9;
}

.ofd-pregunta.incorrecta {
    border-left: 4px solid #e74c3c;
    background: #fff8f8;
}

.ofd-cabecera-pregunta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 10px;
}

.ofd-numero-pregunta {
    font-weight: 600;
    color: #2c3e50;
}

.ofd-puntuacion-pregunta {
    font-weight: 600;
    font-size: 0.9em;
}

.ofd-estado-pregunta {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 600;
    text-transform: uppercase;
}

.ofd-estado-pregunta.correcta {
    background: #d4edda;
    color: #155724;
}

.ofd-estado-pregunta.incorrecta {
    background: #f8d7da;
    color: #721c24;
}

.ofd-texto-pregunta {
    color: #2c3e50;
    line-height: 1.5;
    margin-bottom: 8px;
}

.ofd-tipo-pregunta,
.ofd-porcentaje-pregunta {
    color: #6c757d;
    font-size: 0.85em;
    margin-bottom: 5px;
}

/* Notificaciones */
.ofd-notificacion {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 6px;
    color: white;
    font-weight: 600;
    z-index: 10000;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    max-width: 300px;
}

.ofd-notificacion-success {
    background: #27ae60;
}

.ofd-notificacion-error {
    background: #e74c3c;
}

.ofd-notificacion-info {
    background: #0b2a3b;
}

/* Animaciones */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ofd-detalles-intento.cargado {
    animation: fadeInUp 0.3s ease-out;
}

/* Estados de Carga */
.ofd-cargando::after {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #f39c12;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

/* Avisos y estados vacíos específicos */
.ofd-aviso-sin-intentos,
.ofd-sin-intentos-quiz {
    background: #fff8e8;
    color: #7a4b00;
    border: 1px solid #ffe1b3;
    border-radius: 6px;
    padding: 10px 12px;
    margin: 8px 0 0 0;
    font-size: 0.95em;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Diseño Responsivo */
@media (max-width: 768px) {
    .ofd-contenedor-tablero {
        padding: 10px;
    }
    
    .ofd-filtros {
        flex-direction: column;
        align-items: stretch;
    }
    
    .ofd-grupo-filtro {
        min-width: auto;
    }
    
    .ofd-cabecera-cuestionario,
    .ofd-resumen-intento,
    .ofd-cabecera-pregunta {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .ofd-estadisticas-cuestionario,
    .ofd-meta-intento,
    .ofd-stats-area {
        flex-direction: column;
        gap: 5px;
    }
    
    .ofd-estadisticas-resumen {
        justify-content: center;
    }
    
    .ofd-estadistica {
        flex: 1;
        min-width: 80px;
    }
}

@media (max-width: 480px) {
    .ofd-titulo-curso {
        font-size: 1em;
        padding: 12px 15px;
    }
    
    .ofd-titulo-cuestionario {
        font-size: 0.9em;
    }
    
    .ofd-resumen-intento {
        padding: 10px 12px;
    }
    
    .ofd-estadisticas-resumen {
        flex-direction: column;
    }
    
    .ofd-estadistica {
        min-width: auto;
    }
    
    .ofd-notificacion {
        right: 10px;
        left: 10px;
        max-width: none;
    }
}
