/**
 * Estilos para Tests en Frontend
 * ClaseTube User Panel v1.6.0
 */

/* Contenedor principal del test - Proporción 16:9 como video */
.clasetube-test-container {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    background: #1a1a1a;
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    aspect-ratio: 16 / 9;
    display: flex;
    flex-direction: column;
}

.clasetube-test-error {
    padding: 30px;
    background: #2a2a2a;
    color: #fff;
    text-align: center;
    border-radius: 16px;
    border: 2px solid #FF003C;
}

/* Header compacto del test */
.clasetube-test-header-compact {
    background: rgba(33, 33, 33, 0.95);
    padding: 12px 20px;
    border-bottom: 1px solid rgba(255, 0, 60, 0.3);
    flex-shrink: 0;
}

.test-info-compact {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
    font-size: 13px;
    color: #ccc;
}

.test-info-item-compact {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #ccc;
}

.test-info-item-compact:first-child {
    color: #fff;
    font-weight: 600;
    font-size: 14px;
}

.test-info-item-compact i {
    font-size: 13px;
    color: #FF003C;
}

/* Progress indicator inline */
.test-progress-indicator-inline {
    font-weight: 600;
}

.test-progress-indicator-inline .current-question {
    color: #FF003C;
    font-weight: 700;
}

/* Timer compacto */
.test-timer-compact {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    padding: 4px 12px;
    background: rgba(255, 0, 60, 0.15);
    border-radius: 6px;
    font-weight: 600;
    color: #FF003C;
}

.test-timer-compact i {
    font-size: 13px;
}

.timer-display {
    font-family: 'Courier New', monospace;
    color: #FF003C;
    font-size: 13px;
}

.timer-warning {
    color: #ffd700 !important;
}

.timer-danger {
    color: #ff4444 !important;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Formulario del test */
#clasetube-test-form {
    padding: 0;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.test-preguntas {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.test-pregunta {
    background: rgba(42, 42, 42, 0.6);
    border: 2px solid #333;
    border-radius: 0px;
    padding: 40px;
    width: 100%;
    max-width: none;
    margin: 0 auto;
    transition: all 0.3s ease;
    height: 100%;
}

.pregunta-titulo {
    margin: 0 0 20px 0;
    font-size: 18px;
    color: #fff;
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.pregunta-numero {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    background: #FF003C;
    color: #fff;
    border-radius: 50%;
    font-weight: bold;
    font-size: 16px;
    flex-shrink: 0;
}

.pregunta-puntos {
    display: none;
}

.pregunta-opciones {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.opcion-item {
    position: relative;
    display: flex;
    align-items: center;
    padding: 15px 20px;
    background: #1a1a1a;
    border: 2px solid #333;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.opcion-item:hover {
    background: #252525;
    border-color: #FF003C;
}

.opcion-item input[type="radio"] {
    margin: 0 15px 0 0;
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #FF003C;
}

.opcion-texto {
    color: #fff;
    font-size: 16px;
    line-height: 1.5;
}

.opcion-item:has(input:checked) {
    background: #FF003C;
    border-color: #FF003C;
}

.opcion-item:has(input:checked) .opcion-texto {
    font-weight: 600;
}

/* Botón de envío */
.test-actions {
    padding-top: 20px;
    border-top: 2px solid #333;
    text-align: center;
}

.btn-submit-test {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 15px 40px;
    background: #FF003C;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 0, 60, 0.3);
}

.btn-submit-test:hover {
    background: #d90034;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 0, 60, 0.4);
}

.btn-submit-test:disabled {
    background: #666;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-submit-test i {
    font-size: 20px;
}

/* Resultados */
.test-resultado {
    padding: 30px;
    background: #2a2a2a;
    border-top: 2px solid #333;
}

.test-resultado h3 {
    margin: 0 0 20px 0;
    color: #fff;
    font-size: 24px;
}

.resultado-aprobado {
    background: linear-gradient(135deg, #00c853 0%, #009624 100%);
    color: #fff;
    padding: 30px;
    border-radius: 8px;
    text-align: center;
}

.resultado-reprobado {
    background: linear-gradient(135deg, #ff3d00 0%, #c30000 100%);
    color: #fff;
    padding: 30px;
    border-radius: 8px;
    text-align: center;
}

.resultado-aprobado i,
.resultado-reprobado i {
    font-size: 48px;
    margin-bottom: 15px;
}

.resultado-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-top: 25px;
    padding-top: 25px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.stat-item {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    font-size: 28px;
    font-weight: bold;
}

/* Test aprobado mensaje - Diseño actualizado */
.test-resultado-aprobado {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 30px 40px;
    text-align: center;
    background: linear-gradient(135deg, rgba(26, 26, 26, 0.95) 0%, rgba(42, 42, 42, 0.95) 100%);
    color: #fff;
    border-radius: 0;
    animation: fadeIn 0.5s ease-in-out;
}

.test-resultado-aprobado i {
    font-size: 60px;
    margin-bottom: 15px;
    color: #00ff88;
    text-shadow: 0 0 20px rgba(0, 255, 136, 0.5);
    position: relative;
}

.test-resultado-aprobado i::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: radial-gradient(circle, #00ff88 0%, transparent 70%);
    opacity: 0.2;
    animation: pulse-success 2s ease-in-out infinite;
    z-index: -1;
}

.test-resultado-aprobado h2 {
    margin: 0 0 10px 0;
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
    letter-spacing: -0.5px;
}

.test-resultado-aprobado p {
    font-size: 15px;
    color: #ccc;
    margin: 0 0 20px 0;
    line-height: 1.4;
}

.test-resultado-aprobado .resultado-stats {
    display: flex;
    gap: 25px;
    margin-bottom: 0;
    flex-wrap: wrap;
    justify-content: center;
    padding: 15px 30px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.test-resultado-aprobado .stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-width: 100px;
    position: relative;
}

.test-resultado-aprobado .stat-item::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 2px;
    background: linear-gradient(90deg, transparent, #00ff88, transparent);
}

.test-resultado-aprobado .stat-label {
    font-size: 10px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 600;
}

.test-resultado-aprobado .stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #00ff88;
    text-shadow: 0 0 15px rgba(0, 255, 136, 0.4);
}

/* Ítem del test en índice del curso */
.lesson-item-compact.test-item {
    background: linear-gradient(135deg, #FF003C 0%, #c40030 100%);
    border-left: 4px solid #fff;
}

.lesson-item-compact.test-item:hover {
    background: linear-gradient(135deg, #d90034 0%, #a00028 100%);
}

.lesson-item-compact.test-item.lesson-completed {
    background: linear-gradient(135deg, #00c853 0%, #009624 100%);
    border-left-color: #fff;
}

.lesson-item-compact.test-item .lesson-title-compact {
    font-weight: bold;
}

/* Wrapper para materiales del curso */
.clasetube-materiales-wrapper {
    margin: 0;
}

/* Responsive */
@media screen and (max-width: 768px) {
    .clasetube-test-container {
        margin: 20px;
        border-radius: 8px;
    }
    
    .clasetube-test-header {
        padding: 20px;
    }
    
    .clasetube-test-header h2 {
        font-size: 22px;
    }
    
    #clasetube-test-form {
        padding: 20px;
    }
    
    .test-pregunta {
        padding: 20px;
    }
    
    .pregunta-titulo {
        font-size: 16px;
        flex-wrap: wrap;
    }
    
    .test-info {
        flex-direction: column;
        gap: 10px;
    }
    
    .btn-submit-test {
        width: 100%;
        justify-content: center;
    }
    
    .resultado-stats {
        grid-template-columns: 1fr;
    }
}

/* Dark theme por defecto */
body {
    background-color: #0a0a0a;
    color: #fff;
}

/* Animaciones */
.test-pregunta {
    animation: fadeInUp 0.5s ease-out;
    animation-fill-mode: both;
}

.test-pregunta:nth-child(1) { animation-delay: 0.1s; }
.test-pregunta:nth-child(2) { animation-delay: 0.2s; }
.test-pregunta:nth-child(3) { animation-delay: 0.3s; }
.test-pregunta:nth-child(4) { animation-delay: 0.4s; }
.test-pregunta:nth-child(5) { animation-delay: 0.5s; }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   ESTILOS PARA PAGINACIÓN AUTOMÁTICA v1.6.0
   ============================================ */

/* Indicador de progreso */
.test-progress-indicator {
    background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
    padding: 15px 25px;
    margin: 20px 30px;
    border-radius: 8px;
    text-align: center;
    font-size: 18px;
    font-weight: 500;
    color: #fff;
    border: 2px solid #333;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.test-progress-indicator .current-question {
    color: #FF003C;
    font-size: 24px;
    font-weight: 700;
    display: inline-block;
    min-width: 30px;
}

.test-progress-indicator .total-questions {
    color: #999;
    font-weight: 400;
}

/* Contenedor de preguntas con altura mínima para transiciones suaves */
.test-preguntas {
    min-height: 350px;
    position: relative;
}

/* Preguntas individuales con fade */
.test-pregunta {
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.test-pregunta[style*="display: block"],
.test-pregunta[style*="display:block"] {
    opacity: 1;
}

/* Animación fadeIn para JavaScript */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.test-pregunta.fadeIn {
    animation: fadeIn 0.4s ease-out;
}

/* Feedback visual al seleccionar respuesta */
.opcion-item input[type="radio"]:checked + label {
    background: linear-gradient(135deg, #FF003C 0%, #c40030 100%);
    border-color: #FF003C;
    transform: scale(1.02);
}

.opcion-item input[type="radio"]:checked + label::after {
    content: '';
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    background: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Transición suave para cambio de preguntas */
.test-preguntas .test-pregunta {
    transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
}

/* Scroll personalizado para formulario */
#clasetube-test-form::-webkit-scrollbar {
    width: 6px;
}

#clasetube-test-form::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

#clasetube-test-form::-webkit-scrollbar-thumb {
    background: rgba(255, 0, 60, 0.5);
    border-radius: 10px;
}

#clasetube-test-form::-webkit-scrollbar-thumb:hover {
    background: #FF003C;
}

/* Estilos responsivos para paginación */
@media (max-width: 768px) {
    .clasetube-test-container {
        aspect-ratio: auto;
        min-height: 500px;
    }
    
    .test-info-compact {
        font-size: 11px;
        gap: 10px;
    }
    
    .test-pregunta {
        padding: 20px;
    }
    
    .test-progress-indicator {
        margin: 15px 20px;
        padding: 12px 20px;
        font-size: 16px;
    }
    
    .test-progress-indicator .current-question {
        font-size: 20px;
    }
    
    .test-preguntas {
        min-height: 300px;
    }
}

/* Loading del test */
.test-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #fff;
    font-size: 18px;
}

.test-loading i {
    font-size: 48px;
    color: #FF003C;
    margin-bottom: 20px;
    animation: spin 1s linear infinite;
}

.test-loading p {
    margin: 0;
    color: #999;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Contenedor de resultado */
.test-resultado-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 30px 40px;
    text-align: center;
    animation: fadeIn 0.5s ease-in-out;
    background: linear-gradient(135deg, rgba(26, 26, 26, 0.95) 0%, rgba(42, 42, 42, 0.95) 100%);
    border-radius: 0;
    overflow: hidden;
}

/* Icono del resultado */
.resultado-icon {
    margin-bottom: 15px;
    position: relative;
}

.resultado-icon::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
    border-radius: 50%;
    opacity: 0.2;
}

.resultado-aprobado .resultado-icon::before {
    background: radial-gradient(circle, #00ff88 0%, transparent 70%);
    animation: pulse-success 2s ease-in-out infinite;
}

.resultado-reprobado .resultado-icon::before {
    background: radial-gradient(circle, #ff4444 0%, transparent 70%);
    animation: pulse-error 2s ease-in-out infinite;
}

@keyframes pulse-success {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.2; }
    50% { transform: translate(-50%, -50%) scale(1.1); opacity: 0.3; }
}

@keyframes pulse-error {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.2; }
    50% { transform: translate(-50%, -50%) scale(1.1); opacity: 0.3; }
}

.resultado-icon i {
    font-size: 60px;
    position: relative;
    z-index: 1;
}

.resultado-aprobado .resultado-icon i {
    color: #00ff88;
    text-shadow: 0 0 20px rgba(0, 255, 136, 0.5);
}

.resultado-reprobado .resultado-icon i {
    color: #ff4444;
    text-shadow: 0 0 20px rgba(255, 68, 68, 0.5);
}

/* Título del resultado */
.resultado-titulo {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 10px 0;
    color: #fff;
    line-height: 1.2;
    letter-spacing: -0.5px;
}

/* Mensaje del resultado */
.resultado-mensaje {
    font-size: 15px;
    color: #ccc;
    margin: 0 0 20px 0;
    max-width: 600px;
    line-height: 1.4;
}

/* Stats del resultado */
.resultado-stats {
    display: flex;
    gap: 25px;
    margin-bottom: 25px;
    flex-wrap: wrap;
    justify-content: center;
    padding: 15px 30px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-width: 100px;
    position: relative;
}

.stat-item::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 2px;
    background: linear-gradient(90deg, transparent, #FF003C, transparent);
}

.stat-label {
    font-size: 10px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 600;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #FF003C;
    text-shadow: 0 0 15px rgba(255, 0, 60, 0.4);
}

/* Botón de acción del resultado */
.btn-resultado-action {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 15px 35px;
    font-size: 15px;
    font-weight: 700;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

.btn-resultado-action::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-resultado-action:hover::before {
    width: 300px;
    height: 300px;
}

.btn-certificados {
    background: linear-gradient(135deg, #00ff88 0%, #00cc6a 100%);
    color: #000;
    box-shadow: 0 6px 25px rgba(0, 255, 136, 0.4);
}

.btn-certificados:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(0, 255, 136, 0.5);
}

.btn-reintentar {
    background: linear-gradient(135deg, #FF003C 0%, #C4001D 100%);
    color: #fff;
    box-shadow: 0 6px 25px rgba(255, 0, 60, 0.4);
}

.btn-reintentar:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(255, 0, 60, 0.5);
}

.btn-resultado-action i {
    font-size: 16px;
    position: relative;
    z-index: 1;
}

.btn-resultado-action span {
    position: relative;
    z-index: 1;
}

/* Responsive para resultados */
@media (max-width: 768px) {
    .resultado-icon i {
        font-size: 60px;
    }
    
    .resultado-titulo {
        font-size: 24px;
    }
    
    .resultado-mensaje {
        font-size: 16px;
    }
    
    .stat-value {
        font-size: 24px;
    }
    
    .btn-resultado-action {
        padding: 15px 30px;
        font-size: 14px;
    }
}

