/* ==========================================================================
   SPEX Frontend Styles - Versión Mejorada
   ========================================================================== */

/* Reset y base */
.spex-supuesto-container * {
    box-sizing: border-box;
}

/* Contenedor principal */
.spex-supuesto-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 30px 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #fff;
}

/* Header del supuesto */
.spex-supuesto-header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 3px solid #0073aa;
}

.spex-supuesto-title {
    font-size: 2em;
    font-weight: 700;
    color: #0073aa;
    margin: 0 0 15px 0;
    line-height: 1.3;
}

.spex-materia {
    font-size: 1.1em;
    color: #666;
    font-weight: 500;
    background: #f8f9fa;
    padding: 8px 16px;
    border-radius: 20px;
    display: inline-block;
}

/* Enunciado */
.spex-enunciado {
    background: #f8f9fa;
    border-left: 4px solid #0073aa;
    padding: 25px;
    margin-bottom: 30px;
    border-radius: 0 8px 8px 0;
}

.spex-enunciado h2 {
    color: #0073aa;
    font-size: 1.4em;
    margin: 0 0 15px 0;
    font-weight: 600;
}

.spex-enunciado-content {
    color: #555;
    font-size: 1.05em;
    line-height: 1.7;
}

/* Intentos anteriores */
.spex-previous-attempts {
    background: #e8f4f8;
    border: 1px solid #b3d9e6;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
}

.spex-previous-attempts h3 {
    color: #0073aa;
    font-size: 1.3em;
    margin: 0 0 15px 0;
    font-weight: 600;
}

.spex-attempts-summary {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.spex-attempts-summary span {
    background: #fff;
    padding: 8px 15px;
    border-radius: 20px;
    font-weight: 500;
    color: #333;
    border: 1px solid #ddd;
    font-size: 0.95em;
}

/* Contenedor de preguntas */
.spex-questions {
    margin-bottom: 40px;
}

/* Cada pregunta individual */
.spex-question {
    background: #fff;
    border: 2px solid #e1e5e9;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
}

.spex-question:hover {
    border-color: #0073aa;
    box-shadow: 0 4px 12px rgba(0,115,170,0.15);
}

/* Header de la pregunta */
.spex-question-header {
    margin-bottom: 15px;
}

.spex-question-header h3 {
    color: #0073aa;
    font-size: 1.3em;
    font-weight: 600;
    margin: 0;
    padding: 8px 15px;
    background: #f0f8ff;
    border-radius: 6px;
    display: inline-block;
}

/* Texto de la pregunta */
.spex-question-text {
    font-size: 1.1em;
    font-weight: 500;
    color: #333;
    margin-bottom: 20px;
    line-height: 1.6;
    padding: 15px 0;
    border-bottom: 1px solid #eee;
}

/* Contenedor de respuestas */
.spex-answers {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Cada opción de respuesta */
.spex-answer-option {
    display: flex;
    align-items: flex-start;
    padding: 15px;
    background: #fafafa;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.05em;
    line-height: 1.5;
}

.spex-answer-option:hover {
    background: #f0f8ff;
    border-color: #0073aa;
}

.spex-answer-option input[type="radio"] {
    margin: 0 12px 0 0;
    transform: scale(1.2);
    accent-color: #0073aa;
    flex-shrink: 0;
    margin-top: 2px;
}

.spex-answer-option input[type="radio"]:checked + .spex-answer-letter {
    background: #0073aa;
    color: white;
}

.spex-answer-option input[type="radio"]:checked ~ .spex-answer-text {
    color: #0073aa;
    font-weight: 600;
}

/* Letra de la respuesta (A, B, C, D) */
.spex-answer-letter {
    background: #666;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9em;
    margin-right: 12px;
    flex-shrink: 0;
    transition: all 0.3s ease;
    margin-top: 1px;
}

/* Texto de la respuesta */
.spex-answer-text {
    flex: 1;
    color: #555;
    line-height: 1.5;
    word-wrap: break-word;
    transition: all 0.3s ease;
}

/* Cuando la opción está seleccionada */
.spex-answer-option input[type="radio"]:checked {
    accent-color: #0073aa;
}

.spex-answer-option:has(input[type="radio"]:checked) {
    background: #f0f8ff;
    border-color: #0073aa;
    box-shadow: 0 2px 8px rgba(0,115,170,0.2);
}

/* Acciones del formulario */
.spex-form-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid #eee;
}

/* Botones */
.spex-btn {
    padding: 12px 30px;
    border: none;
    border-radius: 6px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    min-width: 150px;
}

.spex-btn-primary {
    background: #0073aa;
    color: white;
}

.spex-btn-primary:hover {
    background: #005a87;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,115,170,0.3);
}

.spex-btn-secondary {
    background: #f1f1f1;
    color: #333;
    border: 2px solid #ddd;
}

.spex-btn-secondary:hover {
    background: #e8e8e8;
    border-color: #bbb;
}

.spex-btn-large {
    padding: 15px 40px;
    font-size: 1.2em;
}

/* Resultados */
.spex-result {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 25px;
    margin-top: 30px;
    border-left: 4px solid #28a745;
}

/* Notificaciones */
.spex-notice {
    padding: 15px 20px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-weight: 500;
}

.spex-notice.spex-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.spex-notice.spex-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* Responsive */
@media (max-width: 768px) {
    .spex-supuesto-container {
        padding: 20px 15px;
    }
    
    .spex-supuesto-title {
        font-size: 1.8em;
    }
    
    .spex-question {
        padding: 20px 15px;
    }
    
    .spex-answer-option {
        padding: 12px;
        font-size: 1em;
    }
    
    .spex-attempts-summary {
        flex-direction: column;
        gap: 10px;
    }
    
    .spex-form-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .spex-btn {
        width: 100%;
        max-width: 300px;
    }
}

@media (max-width: 480px) {
    .spex-supuesto-container {
        padding: 15px 10px;
    }
    
    .spex-question {
        padding: 15px 12px;
    }
    
    .spex-answer-option {
        padding: 10px;
        font-size: 0.95em;
    }
    
    .spex-answer-letter {
        width: 24px;
        height: 24px;
        font-size: 0.8em;
    }
}

/* Estados de carga y disabled */
.spex-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.spex-form.loading {
    opacity: 0.7;
    pointer-events: none;
}

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

.spex-question {
    animation: fadeIn 0.5s ease-out;
}

/* Focus states para accesibilidad */
.spex-answer-option input[type="radio"]:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.spex-btn:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}
/* ==========================================================================
   Listado de Supuestos
   ========================================================================== */

.spex-supuestos-list {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.spex-supuesto-item {
    background: #fff;
    border: 2px solid #e1e5e9;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
}

.spex-supuesto-item:hover {
    border-color: #0073aa;
    box-shadow: 0 4px 12px rgba(0,115,170,0.15);
    transform: translateY(-2px);
}

.spex-supuesto-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 12px;
}

.spex-supuesto-title {
    margin: 0;
    flex: 1;
    min-width: 0;
}

.spex-supuesto-title a {
    color: #0073aa;
    text-decoration: none;
    font-size: 0.7em;
    font-weight: 500;
    line-height: 1.3;
    display: block;
}

.spex-supuesto-title a:hover {
    color: #005a87;
    text-decoration: underline;
}

.spex-supuesto-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.spex-materia-badge {
    background: #0073aa;
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
    white-space: nowrap;
}

.spex-date {
    color: #666;
    font-size: 0.9em;
    font-weight: 500;
}

.spex-supuesto-excerpt {
    color: #555;
    line-height: 1.6;
    margin-bottom: 20px;
    padding: 15px 0;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
}

.spex-supuesto-footer {
    text-align: right;
}

.spex-pagination {
    text-align: center;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 2px solid #eee;
}

.spex-pagination .page-numbers {
    display: inline-block;
    padding: 8px 16px;
    margin: 0 4px;
    background: #f1f1f1;
    color: #333;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.spex-pagination .page-numbers:hover,
.spex-pagination .page-numbers.current {
    background: #0073aa;
    color: white;
}

.spex-pagination .page-numbers.prev,
.spex-pagination .page-numbers.next {
    font-weight: 600;
}

/* Notice styles */
.spex-notice {
    background: #f0f6fc;
    border: 1px solid #c3c4c7;
    border-left: 4px solid #72aee6;
    padding: 12px;
    margin: 20px 0;
    border-radius: 4px;
}

/* Responsive para listado */
@media (max-width: 768px) {
    .spex-supuestos-list {
        padding: 15px;
    }
    
    .spex-supuesto-item {
        padding: 20px 15px;
    }
    
    .spex-supuesto-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .spex-supuesto-meta {
        align-items: flex-start;
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .spex-supuesto-footer {
        text-align: center;
    }
    
    .spex-btn {
        width: 100%;
        display: block;
        text-align: center;
    }
}
/* ✅ NUEVO: Estilos para formulario de discrepancias */
.spex-discrepancy-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #e1e1e1;
}

.spex-discrepancy-header {
    text-align: center;
    margin-bottom: 20px;
}

.spex-discrepancy-description {
    color: #666;
    font-size: 0.9em;
    margin: 10px 0;
}

.spex-discrepancy-form-content {
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 25px;
    margin: 20px 0;
}

.spex-discrepancy-form-content h4 {
    color: #2c3e50;
    margin-bottom: 20px;
    text-align: center;
}

.spex-form-group {
    margin-bottom: 20px;
}

.spex-form-group label {
    display: block;
    font-weight: bold;
    margin-bottom: 8px;
    color: #333;
}

.spex-required {
    color: #e74c3c;
}

.spex-form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.spex-form-control:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.1);
}

.spex-help-text {
    display: block;
    color: #666;
    font-size: 0.85em;
    margin-top: 5px;
}

.spex-radio-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.spex-radio-option {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: normal;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.spex-radio-option:hover {
    background-color: #f0f0f0;
}

.spex-radio-option input[type="radio"] {
    margin: 0;
    width: auto;
}

.spex-form-actions {
    text-align: center;
    margin-top: 25px;
}

.spex-submit-discrepancy {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
}

.spex-submit-discrepancy:hover:not(:disabled) {
    background: #c0392b;
}

.spex-submit-discrepancy:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.spex-notice {
    padding: 10px 15px;
    border-radius: 4px;
    margin: 10px 0;
}

.spex-notice.spex-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.spex-notice.spex-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.spex-notice.spex-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Responsive */
@media (max-width: 768px) {
    .spex-discrepancy-form-content {
        padding: 20px 15px;
    }
    
    .spex-radio-group {
        gap: 8px;
    }
    
    .spex-radio-option {
        padding: 6px;
    }
}
.all-options {
    margin: 15px 0;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
}

.option {
    padding: 10px 15px;
    border-bottom: 1px solid #e0e0e0;
    background: #f8f9fa;
}

.option:last-child {
    border-bottom: none;
}

.option.user-selected {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
}

.option.correct-option {
    background: #d4edda;
    border-left: 4px solid #28a745;
    font-weight: 500;
}

.option.user-selected.correct-option {
    background: #d1ecf1;
    border-left: 4px solid #17a2b8;
}

.answers-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin: 15px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
}

@media (max-width: 768px) {
    .answers-summary {
        grid-template-columns: 1fr;
    }
}
/* ==========================================================================
   Modal de Discrepancias - Estilos específicos
   ========================================================================== */

/* Modal overlay */
.spex-modal {
    display: none;
    position: fixed;
    z-index: 99999; /* Muy alto para estar encima de todo */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    overflow-y: auto;
    backdrop-filter: blur(2px);
}

/* Contenido del modal */
.spex-modal-content {
    background-color: #ffffff;
    margin: 3% auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 650px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    position: relative;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Header del modal */
.spex-modal-header {
    padding: 25px 30px 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 2px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 12px 12px 0 0;
    position: sticky;
    top: 0;
    z-index: 10;
}

.spex-modal-header h3 {
    margin: 0;
    color: #495057;
    font-size: 1.4em;
    font-weight: 600;
}

/* Botón cerrar */
.spex-close {
    color: #6c757d;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    padding: 5px;
    background: none;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.spex-close:hover,
.spex-close:focus {
    color: #dc3545;
    background-color: #f8f9fa;
    transform: scale(1.1);
}

/* Formulario dentro del modal */
#discrepancy-form {
    padding: 30px;
}

/* Grupos de formulario específicos del modal */
#discrepancy-form .form-group {
    margin-bottom: 25px;
}

#discrepancy-form .form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #495057;
    font-size: 1.05em;
}

/* Inputs específicos del modal */
#discrepancy-form input[type="text"],
#discrepancy-form select,
#discrepancy-form textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #ced4da;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    box-sizing: border-box;
    transition: all 0.3s ease;
    background-color: #ffffff;
}

#discrepancy-form input[type="text"]:focus,
#discrepancy-form select:focus,
#discrepancy-form textarea:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
    background-color: #f8f9ff;
}

/* Textarea específico */
#discrepancy-form textarea {
    resize: vertical;
    min-height: 100px;
    line-height: 1.5;
}

/* Texto de ayuda en el modal */
#discrepancy-form small {
    display: block;
    margin-top: 6px;
    color: #6c757d;
    font-size: 0.9em;
    font-style: italic;
}

/* Acciones del formulario del modal */
.form-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 35px;
    padding-top: 25px;
    border-top: 2px solid #e9ecef;
}

/* Botones específicos del modal - Sobrescribir estilos existentes */
.form-actions .spex-btn {
    padding: 12px 25px !important;
    border: none !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    text-decoration: none !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 120px !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

.form-actions .spex-btn-secondary {
    background-color: #6c757d !important;
    color: white !important;
}

.form-actions .spex-btn-secondary:hover {
    background-color: #545b62 !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15) !important;
}

.form-actions .spex-btn-warning {
    background-color: #ffc107 !important;
    color: #212529 !important;
}

.form-actions .spex-btn-warning:hover {
    background-color: #e0a800 !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 8px rgba(255, 193, 7, 0.3) !important;
}

.form-actions .spex-btn:disabled {
    opacity: 0.6 !important;
    cursor: not-allowed !important;
    transform: none !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

/* Responsive para el modal */
@media (max-width: 768px) {
    .spex-modal-content {
        margin: 5% auto;
        width: 95%;
        max-height: 85vh;
    }
    
    .spex-modal-header {
        padding: 20px 20px 15px;
    }
    
    .spex-modal-header h3 {
        font-size: 1.2em;
    }
    
    #discrepancy-form {
        padding: 25px 20px;
    }
    
    .form-actions {
        flex-direction: column;
        gap: 12px;
    }
    
    .form-actions .spex-btn {
        width: 100% !important;
        min-width: unset !important;
    }
}

@media (max-width: 480px) {
    .spex-modal-content {
        margin: 2% auto;
        width: 98%;
        border-radius: 8px;
    }
    
    .spex-modal-header {
        padding: 15px;
        border-radius: 8px 8px 0 0;
    }
    
    .spex-modal-header h3 {
        font-size: 1.1em;
    }
    
    .spex-close {
        font-size: 28px;
        width: 35px;
        height: 35px;
    }
    
    #discrepancy-form {
        padding: 20px 15px;
    }
    
    #discrepancy-form .form-group {
        margin-bottom: 20px;
    }
}

/* Asegurar que el modal esté por encima de otros elementos de WordPress */
.spex-modal {
    z-index: 999999 !important;
}

/* Prevenir scroll del body cuando el modal está abierto */
body.spex-modal-open {
    overflow: hidden;
}
/* ==========================================================================
   RESULTADOS DEL EXAMEN - DISEÑO MEJORADO Y COMPACTO
   ========================================================================== */

.spex-results-container {
    max-width: 800px; /* Reducido de 900px */
    margin: 0 auto;
    padding: 15px; /* Reducido de 20px */
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s ease;
}

.spex-results-container.animate-in {
    opacity: 1;
    transform: translateY(0);
}

/* Header principal de resultados - MÁS COMPACTO */
.spex-results-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 15px; /* Reducido de 20px */
    padding: 25px 20px; /* Reducido de 40px 30px */
    text-align: center;
    color: white;
    margin-bottom: 20px; /* Reducido de 30px */
    box-shadow: 0 15px 30px rgba(0,0,0,0.1); /* Reducido */
    position: relative;
    overflow: hidden;
}

.spex-results-header.passed {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.spex-results-header.failed {
    background: linear-gradient(135deg, #fc466b 0%, #3f5efb 100%);
}

.spex-results-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(180deg); }
}

.result-icon {
    width: 50px; /* Reducido de 80px */
    height: 50px; /* Reducido de 80px */
    margin: 0 auto 15px; /* Reducido de 20px */
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: bounce 2s ease-in-out infinite;
}

.result-icon svg {
    width: 25px; /* Reducido de 40px */
    height: 25px; /* Reducido de 40px */
    color: white;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

.result-title {
    font-size: 1.8em; /* Reducido de 2.5em */
    font-weight: 800;
    margin: 0 0 8px 0; /* Reducido */
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.result-subtitle {
    font-size: 1em; /* Reducido de 1.2em */
    opacity: 0.9;
    margin: 0 0 20px 0; /* Reducido de 30px */
    font-weight: 300;
}

.score-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px; /* Reducido de 5px */
}

.score-number {
    font-size: 2.5em; /* Reducido de 4em */
    font-weight: 900;
    text-shadow: 3px 3px 6px rgba(0,0,0,0.3);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.score-label {
    font-size: 0.9em; /* Reducido de 1.1em */
    opacity: 0.8;
    font-weight: 500;
}

/* Grid de estadísticas - MÁS COMPACTO */
.spex-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); /* Reducido de 200px */
    gap: 15px; /* Reducido de 20px */
    margin-bottom: 20px; /* Reducido de 30px */
}

.stat-card {
    background: white;
    border-radius: 12px; /* Reducido de 15px */
    padding: 18px 15px; /* Reducido de 25px 20px */
    text-align: center;
    box-shadow: 0 8px 20px rgba(0,0,0,0.1); /* Reducido */
    border: 3px solid transparent;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px; /* Reducido de 4px */
    background: var(--card-color);
}

.stat-card.correct {
    --card-color: #28a745;
}

.stat-card.wrong {
    --card-color: #dc3545;
}

.stat-card.blank {
    --card-color: #6c757d;
}

.stat-card.total {
    --card-color: #007bff;
}

.stat-card:hover {
    transform: translateY(-3px); /* Reducido de -5px */
    box-shadow: 0 12px 30px rgba(0,0,0,0.15); /* Reducido */
    border-color: var(--card-color);
}

.stat-icon {
    font-size: 1.8em; /* Reducido de 2.5em */
    margin-bottom: 10px; /* Reducido de 15px */
    display: block;
}

.stat-number {
    font-size: 1.8em; /* Reducido de 2.5em */
    font-weight: 800;
    color: var(--card-color);
    display: block;
    margin-bottom: 3px; /* Reducido de 5px */
}

.stat-label {
    font-size: 0.85em; /* Reducido de 1em */
    color: #666;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px; /* Reducido de 1px */
}

/* Sección de progreso - MÁS COMPACTA */
.progress-section {
    background: white;
    border-radius: 12px; /* Reducido de 15px */
    padding: 20px; /* Reducido de 30px */
    margin-bottom: 20px; /* Reducido de 30px */
    box-shadow: 0 8px 20px rgba(0,0,0,0.1); /* Reducido */
}

.progress-section h3 {
    margin: 0 0 15px 0; /* Reducido de 20px */
    color: #333;
    font-size: 1.2em; /* Reducido de 1.4em */
    font-weight: 600;
}

.progress-bar-container {
    margin-bottom: 15px; /* Reducido de 20px */
}

.progress-bar {
    display: flex;
    height: 30px; /* Reducido de 40px */
    border-radius: 15px; /* Reducido de 20px */
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
    position: relative;
}

.progress-segment {
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.8em; /* Reducido de 0.9em */
    position: relative;
    transition: all 0.3s ease;
}

.progress-segment.correct {
    background: linear-gradient(45deg, #28a745, #20c997);
}

.progress-segment.wrong {
    background: linear-gradient(45deg, #dc3545, #fd7e14);
}

.progress-segment.blank {
    background: linear-gradient(45deg, #6c757d, #adb5bd);
}

.progress-label {
    font-size: 0.7em; /* Reducido de 0.8em */
    white-space: nowrap;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.progress-legend {
    display: flex;
    justify-content: center;
    gap: 20px; /* Reducido de 30px */
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px; /* Reducido de 8px */
    font-size: 0.8em; /* Reducido de 0.9em */
    color: #666;
}

.legend-color {
    width: 10px; /* Reducido de 12px */
    height: 10px; /* Reducido de 12px */
    border-radius: 50%;
}

.legend-color.correct { background: #28a745; }
.legend-color.wrong { background: #dc3545; }
.legend-color.blank { background: #6c757d; }

/* Sección motivacional - MÁS COMPACTA */
.motivation-section {
    margin-bottom: 20px; /* Reducido de 30px */
}

.motivation-card {
    background: white;
    border-radius: 12px; /* Reducido de 15px */
    padding: 20px; /* Reducido de 30px */
    display: flex;
    align-items: center;
    gap: 15px; /* Reducido de 20px */
    box-shadow: 0 8px 20px rgba(0,0,0,0.1); /* Reducido */
    border-left: 4px solid var(--motivation-color); /* Reducido de 5px */
}

.motivation-card.success {
    --motivation-color: #28a745;
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
}

.motivation-card.encourage {
    --motivation-color: #007bff;
    background: linear-gradient(135deg, #cce5ff 0%, #b3d9ff 100%);
}

.motivation-icon {
    font-size: 2.2em; /* Reducido de 3em */
    flex-shrink: 0;
}

.motivation-text h4 {
    margin: 0 0 8px 0; /* Reducido de 10px */
    color: #333;
    font-size: 1.1em; /* Reducido de 1.3em */
}

.motivation-text p {
    margin: 0;
    color: #666;
    line-height: 1.4; /* Reducido de 1.5 */
    font-size: 0.9em; /* Añadido para reducir tamaño */
}

/* Grid de acciones - MÁS COMPACTO */
.spex-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); /* Reducido de 250px */
    gap: 15px; /* Reducido de 20px */
    margin-bottom: 20px; /* Reducido de 30px */
}

.action-btn {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 12px; /* Reducido de 15px */
    padding: 15px; /* Reducido de 20px */
    display: flex;
    align-items: center;
    gap: 12px; /* Reducido de 15px */
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    font-family: inherit;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08); /* Reducido */
}

.action-btn:hover {
    transform: translateY(-2px); /* Reducido de -3px */
    box-shadow: 0 8px 20px rgba(0,0,0,0.15); /* Reducido */
    border-color: var(--btn-color);
}

.action-btn.primary {
    --btn-color: #007bff;
}

.action-btn.secondary {
    --btn-color: #6c757d;
}

.action-btn.warning {
    --btn-color: #ffc107;
}

.btn-icon {
    font-size: 1.5em; /* Reducido de 2em */
    flex-shrink: 0;
    width: 40px; /* Reducido de 50px */
    height: 40px; /* Reducido de 50px */
    background: rgba(0,0,0,0.05);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-title {
    font-size: 1em; /* Reducido de 1.1em */
    font-weight: 600;
    color: #333;
    margin-bottom: 2px; /* Reducido de 3px */
}

.btn-subtitle {
    font-size: 0.8em; /* Reducido de 0.9em */
    color: #666;
}

/* Contenedor de detalles - MÁS COMPACTO */
.details-container {
    background: white;
    border-radius: 12px; /* Reducido de 15px */
    padding: 20px; /* Reducido de 30px */
    box-shadow: 0 8px 20px rgba(0,0,0,0.1); /* Reducido */
    margin-top: 20px; /* Reducido de 30px */
}

.details-header {
    text-align: center;
    margin-bottom: 20px; /* Reducido de 30px */
    padding-bottom: 15px; /* Reducido de 20px */
    border-bottom: 2px solid #e9ecef;
}

.details-header h3 {
    margin: 0 0 8px 0; /* Reducido de 10px */
    color: #333;
    font-size: 1.3em; /* Reducido de 1.5em */
}

.details-header p {
    margin: 0;
    color: #666;
    font-size: 0.9em; /* Reducido de 1em */
}

/* Responsive mejorado */
@media (max-width: 768px) {
    .spex-results-container {
        padding: 10px;
    }
    
    .spex-results-header {
        padding: 20px 15px;
    }
    
    .result-title {
        font-size: 1.5em;
    }
    
    .score-number {
        font-size: 2em;
    }
    
    .spex-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .stat-card {
        padding: 15px 12px;
    }
    
    .progress-legend {
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }
    
    .motivation-card {
        flex-direction: column;
        text-align: center;
        padding: 15px;
    }
    
    .spex-actions-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .spex-stats-grid {
        grid-template-columns: 1fr;
    }
    
    .result-title {
        font-size: 1.3em;
    }
    
    .score-number {
        font-size: 1.8em;
    }
    
    .stat-card {
        padding: 12px 10px;
    }
    
    .stat-number {
        font-size: 1.5em;
    }
    
    .stat-icon {
        font-size: 1.5em;
    }
}

/* ==========================================================================
   DETALLES DE PREGUNTAS - DISEÑO MEJORADO Y CORREGIDO
   ========================================================================== */

/* Opciones mejoradas - TAMAÑOS CORREGIDOS */
.all-options {
    display: flex;
    flex-direction: column;
    gap: 8px; /* Reducido de 12px */
}

.option {
    display: flex;
    align-items: flex-start; /* Cambiado de center a flex-start */
    padding: 12px; /* Reducido de 15px */
    border: 2px solid #e9ecef;
    border-radius: 8px; /* Reducido de 10px */
    background: #fff;
    position: relative;
    transition: all 0.3s ease;
    min-height: auto; /* Añadido para evitar altura fija */
}

.option.user-selected {
    background: #fff3cd;
    border-color: #ffc107;
}

.option.correct-option {
    background: #d4edda;
    border-color: #28a745;
}

.option.user-selected.correct-option {
    background: #d1ecf1;
    border-color: #17a2b8;
}

.option-letter {
    background: #6c757d;
    color: white;
    width: 24px; /* Reducido de 30px */
    height: 24px; /* Reducido de 30px */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.8em; /* Reducido */
    margin-right: 12px; /* Reducido de 15px */
    flex-shrink: 0;
    margin-top: 2px; /* Añadido para alineación */
}

.option.correct-option .option-letter {
    background: #28a745;
}

.option.user-selected .option-letter {
    background: #ffc107;
    color: #212529;
}

.option-text {
    flex: 1;
    line-height: 1.4;
    font-size: 0.9em; /* Añadido para reducir tamaño */
    padding-right: 80px; /* Añadido espacio para los indicadores */
}

/* INDICADORES CORREGIDOS - TAMAÑO DE TEXTO AJUSTADO */
.correct-indicator,
.user-indicator {
    position: absolute;
    right: 8px;
    top: 8px;
    font-size: 0.5em; /* Reducido de 0.7em a 0.6em */
    font-weight: 500;
    padding: 2px 4px; /* Reducido de 3px 6px */
    border-radius: 6px; /* Reducido de 8px */
    white-space: nowrap;
    max-width: 60px; /* Reducido de 70px */
    text-align: center;
    line-height: 1.1; /* Reducido de 1.2 */
    min-height: 16px; /* Añadido para altura mínima */
    display: flex;
    align-items: center;
    justify-content: center;
}

.correct-indicator {
    background: #28a745;
    color: white;
}

.user-indicator {
    background: #ffc107;
    color: #212529;
}

/* Alternativa: Indicadores aún más pequeños si es necesario */
@media (max-width: 1200px) {
    .correct-indicator,
    .user-indicator {
        font-size: 0.55em; /* Aún más pequeño en pantallas medianas */
        padding: 1px 3px;
        max-width: 50px;
        min-height: 14px;
    }
}

/* Para pantallas muy pequeñas, cambiar a íconos */
@media (max-width: 768px) {
    .correct-indicator,
    .user-indicator {
        position: static;
        transform: none;
        margin-left: 8px;
        margin-top: 5px;
        align-self: flex-start;
        font-size: 0.5em; /* Muy pequeño */
        padding: 1px 2px;
        max-width: 40px;
        min-height: 12px;
    }
    
    /* Opción alternativa: usar solo íconos en móvil */
    .correct-indicator::before {
        content: "✓";
        font-size: 1.2em;
    }
    
    .user-indicator::before {
        content: "👤";
        font-size: 1em;
    }
    
    /* Ocultar texto en móvil y mostrar solo íconos */
    .correct-indicator,
    .user-indicator {
        text-indent: -9999px;
        width: 20px;
        height: 20px;
        border-radius: 50%;
        padding: 0;
        max-width: 20px;
        min-height: 20px;
    }
    
    .correct-indicator::before,
    .user-indicator::before {
        text-indent: 0;
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
    }
}

/* OPCIÓN ALTERNATIVA: Usar abreviaciones más cortas */
.correct-indicator-short,
.user-indicator-short {
    position: absolute;
    right: 8px;
    top: 8px;
    font-size: 0.65em;
    font-weight: 700;
    padding: 2px 4px;
    border-radius: 6px;
    white-space: nowrap;
    max-width: 45px;
    text-align: center;
    line-height: 1.1;
    min-height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.correct-indicator-short {
    background: #28a745;
    color: white;
}

.correct-indicator-short::after {
    content: "Correcta"; /* Texto más corto */
}

.user-indicator-short {
    background: #ffc107;
    color: #212529;
}

.user-indicator-short::after {
    content: "Tu resp."; /* Texto más corto */
}

/* OPCIÓN 3: Solo íconos con tooltip */
.correct-indicator-icon,
.user-indicator-icon {
    position: absolute;
    right: 8px;
    top: 8px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8em;
    cursor: help;
    transition: all 0.2s ease;
}

.correct-indicator-icon {
    background: #28a745;
    color: white;
}

.correct-indicator-icon::after {
    content: "✓";
}

.user-indicator-icon {
    background: #ffc107;
    color: #212529;
}

.user-indicator-icon::after {
    content: "👤";
}

/* Tooltip para los íconos */
.correct-indicator-icon:hover::before,
.user-indicator-icon:hover::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    right: 0;
    background: #333;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.5em;
    white-space: nowrap;
    z-index: 1000;
    margin-bottom: 5px;
}

.correct-indicator-icon:hover::after {
    content: "";
    position: absolute;
    bottom: 100%;
    right: 8px;
    border: 4px solid transparent;
    border-top-color: #333;
    margin-bottom: 1px;
}

/* Resumen de respuestas - MÁS COMPACTO */
.answers-summary-section {
    margin-bottom: 20px; /* Reducido de 25px */
}

.summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px; /* Reducido de 20px */
}

.summary-item {
    background: #f8f9fa;
    padding: 12px; /* Reducido de 15px */
    border-radius: 6px; /* Reducido de 8px */
    border-left: 3px solid var(--summary-color); /* Reducido de 4px */
}

.summary-item.user-answer { --summary-color: #ffc107; }
.summary-item.correct-answer { --summary-color: #28a745; }

.summary-label {
    font-size: 0.8em; /* Reducido de 0.9em */
    font-weight: 600;
    color: #495057;
    margin-bottom: 4px; /* Reducido de 5px */
}

.summary-value {
    font-weight: 500;
    line-height: 1.3; /* Reducido de 1.4 */
    font-size: 0.9em; /* Añadido para reducir tamaño */
}

.summary-value.correct { color: #28a745; }
.summary-value.wrong { color: #dc3545; }
.summary-value.blank { color: #6c757d; }

/* Tarjetas de preguntas - ALTURA AJUSTADA */
.question-detail-card {
    background: white;
    border-radius: 10px; /* Reducido de 12px */
    margin-bottom: 20px; /* Reducido de 25px */
    box-shadow: 0 3px 12px rgba(0,0,0,0.1); /* Reducido */
    border-left: 4px solid var(--status-color); /* Reducido de 5px */
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s ease;
}

.question-detail-card.animate-in {
    opacity: 1;
    transform: translateY(0);
}

.question-detail-card.correct { --status-color: #28a745; }
.question-detail-card.wrong { --status-color: #dc3545; }
.question-detail-card.blank { --status-color: #6c757d; }

.question-detail-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 15px 20px; /* Reducido de 20px 25px */
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #dee2e6;
}

.question-number {
    display: flex;
    align-items: center;
    gap: 8px; /* Reducido de 10px */
    font-size: 1em; /* Reducido de 1.1em */
    font-weight: 600;
    color: #495057;
}

.question-status {
    font-size: 1.1em; /* Reducido de 1.2em */
}

.result-badge {
    padding: 4px 10px; /* Reducido de 6px 12px */
    border-radius: 15px; /* Reducido de 20px */
    font-size: 0.75em; /* Reducido de 0.85em */
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px; /* Reducido de 0.5px */
}

.result-badge.correct {
    background: #d4edda;
    color: #155724;
}

.result-badge.wrong {
    background: #f8d7da;
    color: #721c24;
}

.result-badge.blank {
    background: #e2e3e5;
    color: #383d41;
}

.question-detail-content {
    padding: 20px; /* Reducido de 25px */
}

.question-text-section,
.options-section,
.answers-summary-section,
.explanation-section {
    margin-bottom: 20px; /* Reducido de 25px */
}

.question-text-section h4,
.options-section h4,
.explanation-section h4 {
    color: #495057;
    font-size: 1em; /* Reducido de 1.1em */
    margin-bottom: 12px; /* Reducido de 15px */
    font-weight: 600;
}

.question-text {
    background: #f8f9fa;
    padding: 12px; /* Reducido de 15px */
    border-radius: 6px; /* Reducido de 8px */
    border-left: 3px solid #007bff; /* Reducido de 4px */
    line-height: 1.5; /* Reducido de 1.6 */
    margin: 0;
    font-size: 0.9em; /* Añadido */
}

/* Explicación - MÁS COMPACTA */
.explanation-content {
    background: #e7f3ff;
    padding: 15px; /* Reducido de 20px */
    border-radius: 6px; /* Reducido de 8px */
    border-left: 3px solid #007bff; /* Reducido de 4px */
}

.explanation-content p {
    margin: 0;
    line-height: 1.5; /* Reducido de 1.6 */
    color: #495057;
    font-size: 0.9em; /* Añadido */
}

/* Responsive mejorado para detalles */
@media (max-width: 768px) {
    .question-detail-header {
        flex-direction: column;
        gap: 10px; /* Reducido de 15px */
        text-align: center;
        padding: 12px 15px; /* Reducido */
    }
    
    .summary-grid {
        grid-template-columns: 1fr;
        gap: 10px; /* Reducido */
    }
    
    .option {
        padding: 10px; /* Reducido de 12px */
    }
    
    .option-text {
        padding-right: 60px; /* Reducido para móvil */
        font-size: 0.85em;
    }
    
    .correct-indicator,
    .user-indicator {
        position: static; /* Cambiar a posición estática en móvil */
        transform: none;
        margin-left: 8px;
        margin-top: 5px;
        align-self: flex-start;
        font-size: 0.65em; /* Más pequeño en móvil */
        padding: 2px 4px;
        max-width: 60px;
    }
    
    .option {
        flex-direction: column; /* Cambiar a columna en móvil */
        align-items: flex-start;
    }
    
    .option-letter {
        margin-bottom: 8px;
        margin-right: 0;
    }
    
    .question-detail-content {
        padding: 15px; /* Reducido para móvil */
    }
}

@media (max-width: 480px) {
    .option-text {
        font-size: 0.8em;
        padding-right: 0; /* Sin padding en móviles pequeños */
    }
    
    .correct-indicator,
    .user-indicator {
        font-size: 0.6em;
        padding: 1px 3px;
        max-width: 50px;
    }
    
    .question-detail-header {
        padding: 10px 12px;
    }
    
    .question-detail-content {
        padding: 12px;
    }
}

/* NUEVA REGLA: Evitar solapamiento de texto */
.option:has(.correct-indicator),
.option:has(.user-indicator) {
    padding-right: 90px; /* Espacio extra para los indicadores */
}

@media (max-width: 768px) {
    .option:has(.correct-indicator),
    .option:has(.user-indicator) {
        padding-right: 12px; /* Reset en móvil ya que cambia a columna */
    }
}
/* Botón de descarga PDF */
.action-btn.success {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
}

.action-btn.success:hover {
    background: linear-gradient(135deg, #218838 0%, #1aa179 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
}

.action-btn.disabled {
    background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
    color: #dee2e6;
    cursor: not-allowed;
    opacity: 0.6;
}

.action-btn.disabled:hover {
    transform: none;
    box-shadow: none;
}
