/* Estilos personalizados para el Quiz */

/* Variables CSS */
:root {
    --primary-color: #007bff;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --border-radius: 0.5rem;
    --box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    --transition: all 0.3s ease-in-out;
}

/* Estilos generales */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #FFFFFF 0%, #aaebff 100%);
    min-height: 100vh;
    margin: 0;
    padding: 0;
    font-size: 14px; /* Reducido aún más */
    line-height: 1.4;
}

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

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

/* Clases de animación */
.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

.slide-in-left {
    animation: slideInLeft 0.6s ease-out;
}

.slide-in-right {
    animation: slideInRight 0.6s ease-out;
}

.pulse {
    animation: pulse 2s infinite;
}

/* Header */
header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #0056b3 100%) !important;
    box-shadow: var(--box-shadow);
    border-radius: 18px;
    padding: 1.5rem 0 !important; /* Reducido de 2rem */
}

header .display-4 {
    font-size: 2.25rem; /* Reducido de 2.75rem */
    margin-bottom: 0.25rem; /* Reducido de 0.5rem */
}

header .lead {
    font-size: 1rem; /* Reducido de 1.125rem */
    margin-bottom: 0;
}

/* Cards */
.card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    transition: var(--transition);
    max-width: 100%;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 0.75rem 1.5rem rgba(0, 0, 0, 0.15);
}

/* Card headers con gradiente */
.card-header.bg-gradient {
    background: linear-gradient(135deg, var(--primary-color) 0%, #0056b3 100%) !important;
    padding: 1rem 1.5rem; /* Reducido el padding vertical */
}

.card-header h3 {
    font-size: 1.25rem; /* Más pequeño */
    margin-bottom: 0;
}

/* Badges de capítulo y pregunta */
#question-chapter {
    background: linear-gradient(135deg, var(--primary-color) 0%, #0056b3 100%) !important;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#question-id {
    background: linear-gradient(135deg, var(--dark-color) 0%, #495057 100%) !important;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.4rem 0.6rem;
    border-radius: 0.375rem;
}

/* Feature boxes para la pantalla de inicio */
.feature-box {
    padding: 1rem;
    margin-bottom: 1rem;
}

.feature-box i {
    transition: transform 0.3s ease;
}

.feature-box:hover i {
    transform: scale(1.1);
}

/* Botones */
.btn {
    border-radius: var(--border-radius);
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    transition: var(--transition);
    border: none;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.2);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, #0056b3 100%);
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color) 0%, #1e7e34 100%);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color) 0%, #bd2130 100%);
}

/* Barra de progreso */
.progress {
    border-radius: var(--border-radius);
    background-color: #e9ecef;
}

.progress-bar {
    transition: width 0.6s ease;
    border-radius: var(--border-radius);
}

/* Opciones de respuesta */
.answer-option {
    background: #fff;
    border: 2px solid #e9ecef;
    border-radius: var(--border-radius);
    padding: 0.875rem 1rem;
    margin-bottom: 0.6rem;
    transition: var(--transition);
    cursor: pointer;
    position: relative;
}

.answer-option:hover {
    border-color: var(--primary-color);
    background: #f8f9ff;
    transform: translateX(5px);
}

.answer-option.selected {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, #f8f9ff 0%, #e6f3ff 100%);
    box-shadow: 0 0.25rem 0.5rem rgba(0, 123, 255, 0.2);
}

.answer-option.correct {
    border-color: var(--success-color);
    background: linear-gradient(135deg, #f8fff9 0%, #e6ffe6 100%);
}

.answer-option.incorrect {
    border-color: var(--danger-color);
    background: linear-gradient(135deg, #fff8f8 0%, #ffe6e6 100%);
}

.answer-option.correct-answer {
    border-color: var(--success-color);
    background: linear-gradient(135deg, #f8fff9 0%, #e6ffe6 100%);
    animation: correctAnswerPulse 1s ease-in-out;
}

@keyframes correctAnswerPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0.25rem 0.5rem rgba(40, 167, 69, 0.2);
    }
    50% {
        transform: scale(1.02);
        box-shadow: 0 0.5rem 1rem rgba(40, 167, 69, 0.4);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0.25rem 0.5rem rgba(40, 167, 69, 0.2);
    }
}

/* Radio buttons y checkboxes personalizados */
.form-check-input {
    width: 1rem; /* Reducido de 1.125rem */
    height: 1rem;
    margin-top: 0.125rem;
    border: 2px solid #dee2e6;
    transition: var(--transition);
}

.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.form-check-input:focus {
    box-shadow: 0 0 0 0.25rem rgba(0, 123, 255, 0.25);
}

/* Labels */
.form-check-label {
    font-weight: 500;
    cursor: pointer;
    margin-left: 0.5rem;
    flex: 1;
}

/* Círculo de puntuación */
.score-circle {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
    color: white;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
}

.score-excellent {
    background: linear-gradient(135deg, var(--success-color) 0%, #20c997 100%);
}

.score-good {
    background: linear-gradient(135deg, var(--info-color) 0%, #138496 100%);
}

.score-average {
    background: linear-gradient(135deg, var(--warning-color) 0%, #e0a800 100%);
}

.score-poor {
    background: linear-gradient(135deg, var(--danger-color) 0%, #bd2130 100%);
}

/* Resumen de respuestas */
.answer-summary-item {
    background: #fff;
    border-left: 4px solid #e9ecef;
    padding: 0.75rem; /* Reducido de 1rem */
    margin-bottom: 0.5rem; /* Reducido de 0.75rem */
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
    transition: var(--transition);
}

.answer-summary-item.correct {
    border-left-color: var(--success-color);
    background: linear-gradient(90deg, #f8fff9 0%, #fff 100%);
}

.answer-summary-item.incorrect {
    border-left-color: var(--danger-color);
    background: linear-gradient(90deg, #fff8f8 0%, #fff 100%);
}

/* Iconos de estado */
.status-icon {
    width: 22px; /* Reducido de 26px */
    height: 22px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem; /* Reducido de 0.875rem */
    font-weight: bold;
    color: white;
    margin-right: 0.5rem;
    flex-shrink: 0; /* Evita que se deforme */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.status-icon.correct {
    background-color: var(--success-color);
}

.status-icon.incorrect {
    background-color: var(--danger-color);
}

/* Ajuste específico para iconos Font Awesome */
.status-icon i {
    font-size: 0.75rem;
    line-height: 1;
}

/* Mejoras específicas para cada tipo de icono */
.status-icon.correct i {
    font-size: 0.8rem;
}

.status-icon.incorrect i {
    font-size: 0.7rem;
    font-weight: 900; /* Extra bold para la X */
}

/* Efectos de hover para elementos interactivos */
.clickable {
    cursor: pointer;
    transition: var(--transition);
}

.clickable:hover {
    opacity: 0.8;
}

/* Mensajes de validación */
.validation-message {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
    padding: 0.75rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    display: none;
}

.validation-message.show {
    display: block;
    animation: fadeInUp 0.3s ease-out;
}

/* Responsive design */
@media (max-width: 1400px) {
    /* Ajustes para resoluciones como 1366x768 */
    .container {
        max-width: 1200px;
    }
    
    .display-4 {
        font-size: 2rem; /* Reducido de 2.5rem */
    }
    
    .lead {
        font-size: 0.95rem; /* Reducido de 1.1rem */
    }
    
    .card-body {
        padding: 1.75rem 1.5rem !important; /* Reducido de 2.5rem 2rem */
    }
    
    #question-text {
        font-size: 1.2rem; /* Reducido de 1.4rem */
        line-height: 1.3;
    }
    
    #question-description {
        font-size: 0.9rem; /* Reducido de 1rem */
    }
    
    .answer-option {
        padding: 0.75rem 0.875rem; /* Reducido */
        margin-bottom: 0.5rem; /* Reducido de 0.6rem */
    }
    
    .form-check-label {
        font-size: 0.875rem; /* Reducido de 0.95rem */
        line-height: 1.3;
    }
    
    .btn {
        padding: 0.5rem 1rem; /* Reducido */
        font-size: 0.875rem; /* Reducido de 0.95rem */
    }
    
    .btn-lg {
        padding: 0.625rem 1.25rem; /* Reducido */
        font-size: 1rem; /* Reducido de 1.1rem */
    }
    
    .alert {
        padding: 0.625rem 0.875rem; /* Reducido */
        font-size: 0.825rem; /* Reducido de 0.9rem */
    }
    
    .alert h5 {
        font-size: 1rem; /* Reducido de 1.1rem */
    }
    
    .score-circle {
        width: 120px; /* Reducido de 140px */
        height: 120px;
        font-size: 1.6rem; /* Reducido de 1.8rem */
    }
    
    .answer-summary-item {
        padding: 0.75rem; /* Reducido de 0.875rem */
        margin-bottom: 0.5rem; /* Reducido de 0.6rem */
    }
    
    .answer-summary-item h6 {
        font-size: 0.9rem; /* Reducido de 1rem */
    }
    
    .answer-summary-item .fw-medium {
        font-size: 0.825rem; /* Reducido de 0.9rem */
    }
    
    .answer-summary-item small {
        font-size: 0.75rem; /* Reducido de 0.8rem */
    }
    
    .progress {
        height: 6px; /* Reducido de 8px */
    }
    
    #progress-text {
        font-size: 0.825rem; /* Reducido de 0.9rem */
    }
}

@media (max-width: 768px) {
    .container-fluid {
        padding: 0.5rem;
    }
    
    .card-body {
        padding: 2rem 1.5rem !important;
    }
    
    .display-4 {
        font-size: 2rem;
    }
    
    .btn-lg {
        padding: 0.75rem 1.25rem;
        font-size: 1rem;
    }
    
    .answer-option {
        padding: 0.75rem;
    }
    
    .score-circle {
        width: 120px;
        height: 120px;
        font-size: 1.5rem;
    }
}

@media (max-width: 576px) {
    .d-flex.justify-content-between {
        flex-direction: column;
        gap: 1rem;
    }
    
    .d-flex.justify-content-between .btn {
        width: 100%;
    }
    
/* Ajustes específicos para contenedores del quiz */
#quiz-container .container {
    max-width: 1140px;
}

#quiz-container .card-body {
    padding: 1.5rem 2rem; /* Reducido de 2rem 2.5rem */
}

#start-screen .card-body,
#results-screen .card-body {
    padding: 2rem 1.75rem; /* Reducido de 2.5rem 2rem */
}

/* Spacing optimizado */
.mb-4 {
    margin-bottom: 1rem !important; /* Reducido de 1.25rem */
}

.mb-3 {
    margin-bottom: 0.75rem !important; /* Reducido de 1rem */
}

.mb-2 {
    margin-bottom: 0.5rem !important;
}

@media (max-width: 768px) {
    .container-fluid {
        padding: 0.5rem;
    }
    
    .card-body {
        padding: 2rem 1.5rem !important;
    }
    
    .display-4 {
        font-size: 2rem;
    }
    
    .btn-lg {
        padding: 0.75rem 1.25rem;
        font-size: 1rem;
    }
    
    .answer-option {
        padding: 0.75rem;
    }
    
    .score-circle {
        width: 120px;
        height: 120px;
        font-size: 1.5rem;
    }
}

@media (max-width: 576px) {
    .d-flex.justify-content-between {
        flex-direction: column;
        gap: 1rem;
    }
    
    .d-flex.justify-content-between .btn {
        width: 100%;
    }
    
    .progress-text {
        text-align: center;
        margin-bottom: 0.5rem;
    }
}

/* Efectos especiales */
.sparkle {
    position: relative;
    overflow: hidden;
}

.sparkle::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transform: rotate(45deg);
    animation: sparkle 2s infinite;
}

@keyframes sparkle {
    0% {
        transform: translateX(-100%) translateY(-100%) rotate(45deg);
    }
    100% {
        transform: translateX(100%) translateY(100%) rotate(45deg);
    }
}

/* Estilos responsivos para badges y texto largo */
#question-chapter {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    vertical-align: top;
}

/* Estilos para contadores de progreso */
#correct-count, #incorrect-count {
    font-size: 1.5rem;
    font-weight: 700;
    transition: all 0.3s ease;
}

#correct-count {
    color: var(--success-color) !important;
}

#incorrect-count {
    color: var(--danger-color) !important;
}

/* Animación para cambios en contadores */
.counter-update {
    animation: counterPulse 0.6s ease-in-out;
}

@keyframes counterPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

/* Media queries para dispositivos móviles */
@media (max-width: 768px) {
    #question-chapter {
        max-width: calc(100vw - 120px) !important; /* Dejar espacio para el badge del ID */
        font-size: 0.8rem !important;
    }
    
    #question-id {
        font-size: 0.8rem !important;
    }
    
    /* Asegurar que los badges no se desborden en contenedores pequeños */
    .mb-3 {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.25rem;
    }
    
    /* Ajustes para la nueva estructura de una sola card */
    .card .row .col-md-4 {
        margin-bottom: 15px;
    }
    
    .card .row .col-3, .card .row .col-6 {
        margin-bottom: 10px;
    }
    
    /* Contadores de progreso más pequeños en móviles */
    #correct-count, #incorrect-count {
        font-size: 1rem !important;
    }
    
    /* Selector de preguntas más pequeño en móviles */
    #question-selector {
        font-size: 0.7rem !important;
        padding: 0.25rem 0.4rem !important;
    }
    
    /* Botones más pequeños en móviles */
    #summary-btn, #restart-quiz-btn {
        font-size: 0.7rem;
        padding: 0.25rem 0.4rem;
    }
}

@media (max-width: 576px) {
    #question-chapter {
        max-width: calc(100vw - 100px) !important;
        font-size: 0.75rem !important;
    }
    
    #question-id {
        font-size: 0.75rem !important;
    }
    
    /* En pantallas muy pequeñas, poner los badges en líneas separadas si es necesario */
    .mb-3 {
        flex-direction: column;
        align-items: flex-start;
    }
    
    #question-chapter,
    #question-id {
        max-width: 100% !important;
        margin-bottom: 0.25rem;
    }
    
    /* Mayor gap entre cards en móviles pequeños */
    #quiz-container .row.mb-4 > .col-md-6,
    #quiz-container .row.mb-4 > .col-md-2 {
        margin-bottom: 15px;
    }
    
    /* Asegurar que la última columna no tenga margen extra */
    #quiz-container .row.mb-4 > .col-md-2:last-child {
        margin-bottom: 0;
    }
    
    /* Contadores aún más pequeños en móviles pequeños */
    #correct-count, #incorrect-count {
        font-size: 1rem !important;
    }
    
    /* Reducir padding en cards de contadores */
    #quiz-container .card-body {
        padding: 0.75rem !important;
    }
}

/* Estilos específicos para el selector de preguntas */
#question-selector {
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    transition: var(--transition);
}

#question-selector:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

#question-selector option {
    padding: 0.5rem;
}

/* Estilos para las opciones con estados */
#question-selector option.text-success {
    background-color: #d4edda;
    color: #155724;
}

#question-selector option.text-danger {
    background-color: #f8d7da;
    color: #721c24;
}

#question-selector option.text-warning {
    background-color: #fff3cd;
    color: #856404;
}

/* Estilos para el modal de resumen */
#summaryModal .modal-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #0056b3 100%) !important;
}

#summaryModal .table th {
    font-size: 0.875rem;
    font-weight: 600;
}

#summaryModal .table td {
    font-size: 0.825rem;
    vertical-align: middle;
}

#summaryModal .table-warning {
    background-color: rgba(255, 193, 7, 0.1) !important;
}

#summaryModal .text-truncate {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Responsive para el modal */
@media (max-width: 768px) {
    #summaryModal .modal-dialog {
        margin: 0.5rem;
    }
    
    #summaryModal .table {
        font-size: 0.75rem;
    }
    
    #summaryModal .table th,
    #summaryModal .table td {
        padding: 0.375rem 0.25rem;
    }
    
    #summaryModal .text-truncate {
        max-width: 120px;
    }
    
    #summaryModal .btn-sm {
        padding: 0.125rem 0.25rem;
        font-size: 0.7rem;
    }
}
