/* ============ RESET Y ESTILOS GENERALES ============ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f4f4f4;
}

html {
    scroll-behavior: smooth;
}

/* ============ LAYOUT PRINCIPAL ============ */

main {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 20px;
    background: white;
    min-height: 100vh;
}

footer {
    text-align: center;
    padding: 20px;
    background-color: #333;
    color: white;
    margin-top: 40px;
}

/* ============ TIPOGRAFÍA ============ */

h1 {
    font-size: 2rem;
    margin-bottom: 20px;
    color: #2c3e50;
    border-bottom: 3px solid #007bff;
    padding-bottom: 10px;
}

h2 {
    font-size: 1.5rem;
    margin-top: 30px;
    margin-bottom: 15px;
    color: #34495e;
}

p {
    margin-bottom: 15px;
    font-size: 1rem;
}

/* ============ FORMULARIOS ============ */

form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

div > label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2c3e50;
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
    width: 100%;
    padding: 12px;
    border: 1px solid #bdc3c7;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s, box-shadow 0.3s;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

/* ============ BOTONES ============ */

button,
.btn-primary,
.btn-secondary {
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.1s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary,
button[type="submit"] {
    background-color: #007bff;
    color: white;
}

.btn-primary:hover,
button[type="submit"]:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

/* ============ ALERTAS Y MENSAJES ============ */

.errors,
.error-message,
.warning-message,
.success-message,
.warning {
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.errors,
.error-message {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.errors ul,
.error-message ul {
    margin-left: 20px;
}

.success-message {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.warning-message,
.warning {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
}

/* ============ RADIO Y CHECKBOX (OPCIONES) ============ */

.options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 10px;
}

.options label {
    display: flex;
    align-items: center;
    margin: 0;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.options label:hover {
    background-color: #f0f0f0;
}

.options input[type="radio"],
.options input[type="checkbox"] {
    width: auto;
    margin-right: 10px;
    cursor: pointer;
}

/* ============ PREGUNTAS ============ */

.questions-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
    margin: 30px 0;
}

.questions-container img {
    max-width: 100%;
    height: auto;
}

.question-block {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 20px;
    background-color: #fafafa;
}

.question-block legend {
    font-weight: 600;
    color: #2c3e50;
    padding: 0 10px;
    margin-left: -10px;
}

.question-block p {
    margin-top: 15px;
    font-size: 1.1rem;
}

/* ============ QUIZ INFO ============ */

.quiz-info {
    background-color: #e7f3ff;
    border: 1px solid #b3d9ff;
    padding: 20px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.quiz-info p {
    margin-bottom: 10px;
}

/* ============ RESULTADOS ============ */

.results-card {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 30px;
    margin: 20px 0;
}

.result-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #dee2e6;
}

.result-row:last-child {
    border-bottom: none;
}

.result-row.highlight {
    background-color: #e7f3ff;
    padding: 15px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 1.1rem;
    margin: 10px 0;
    border: none;
}

/* ============ CONTENEDOR DE BIENVENIDA ============ */

.welcome-container {
    text-align: center;
}

.welcome-container h1 {
    border-bottom-color: #28a745;
}

.welcome-container .actions {
    margin: 30px 0;
}

.welcome-container .info-section {
    text-align: left;
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 4px;
    margin-top: 30px;
}

.info-section ol,
.info-section ul {
    margin-left: 20px;
    margin-top: 10px;
}

.info-section li {
    margin-bottom: 8px;
}

.info-section.warning {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
}

/* ============ FIELDSET ============ */

fieldset {
    border: none;
    padding: 0;
    margin: 0;
}

/* ============ ANTI-CHEAT ============ */

.anti-cheat-active,
.anti-cheat-active * {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.anti-cheat-active input,
.anti-cheat-active textarea,
.anti-cheat-active select,
.anti-cheat-active button,
.anti-cheat-active input * {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* ============ ACTIONS CONTAINER ============ */

.actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ============ RESPONSIVO ============ */

@media (max-width: 768px) {
    main {
        padding: 20px 15px;
    }

    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.2rem;
    }

    .results-card {
        padding: 20px;
    }

    .result-row {
        flex-direction: column;
        gap: 5px;
    }

    .actions {
        justify-content: stretch;
    }

    .actions a,
    .actions button {
        flex: 1;
    }
}

/* ============ ACCESIBILIDAD ============ */

@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}

/* ============ IMPRESIÓN ============ */

@media print {
    body {
        background: white;
    }

    main {
        max-width: 100%;
        padding: 0;
    }

    button,
    .btn-primary,
    .btn-secondary,
    .actions {
        display: none;
    }
}