/* public/assets/css/test.css */

/* ====== PAGE LAYOUT ====== */
.page-test .test-page {
    padding: 2rem 0 4rem;
}

/* Compatibilidad: .test-layout ya no se usa en wizard pero se mantiene por si acaso */
.test-layout { display: block; }

/* ====== WIZARD ====== */
.config-wizard {
    max-width: 680px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Breadcrumb */
.wizard-breadcrumb {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: 2rem;
    font-size: .82rem;
    font-weight: 600;
}
.wb-step { color: #9196ab; transition: color .2s; }
.wb-step.active { color: #2952cc; }
.wb-step.done { color: #5c5e72; }
.wb-sep { color: #ddd8d0; }

/* Pasos */
.wizard-step { display: none; }
.wizard-step.active {
    display: block;
    animation: wizardIn .28s ease forwards;
}
.wizard-step.active.wizard-back {
    animation: wizardInBack .28s ease forwards;
}
@keyframes wizardIn {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes wizardInBack {
    from { opacity: 0; transform: translateY(-14px); }
    to   { opacity: 1; transform: translateY(0); }
}

.wizard-step__header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.wizard-step__title {
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: #1a1a2a;
    margin: 0;
    line-height: 1.25;
    letter-spacing: -0.02em;
}

/* Botón volver */
.wizard-back-btn {
    flex-shrink: 0;
    background: none;
    border: 1.5px solid #ddd8d0;
    border-radius: .5rem;
    padding: .35rem .75rem;
    font-size: .82rem;
    font-weight: 600;
    color: #5c5e72;
    cursor: pointer;
    transition: border-color .15s, color .15s;
    font-family: 'Inter', system-ui, sans-serif;
}
.wizard-back-btn:hover { border-color: #9196ab; color: #1a1a2a; }

/* Tarjetas de tipo de test */
.wizard-tipo-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .75rem;
}
.wizard-tipo-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: .3rem;
    padding: 1.1rem 1.25rem;
    border-radius: .9rem;
    border: 2px solid #ddd8d0;
    background: #faf8f5;
    cursor: pointer;
    transition: border-color .15s, background .15s, box-shadow .15s;
}
.wizard-tipo-card:hover,
.wizard-tipo-card.radio-pill:hover { background: #fef3e2; border-color: #e8b955; }
.wizard-tipo-card.radio-pill--active {
    background: #f59e0b;
    border-color: #f59e0b;
    box-shadow: 0 2px 10px rgba(245,158,11,.30);
}
.wtc-icon { display: flex; align-items: center; justify-content: center; color: #5c5e72; margin-bottom: .25rem; }
.wizard-tipo-card.radio-pill--active .wtc-icon { color: #1a1a2a; }
.wizard-tipo-card.radio-pill--active .wtc-name { color: #1a1a2a; }
.wizard-tipo-card.radio-pill--active .wtc-desc { color: rgba(26,26,42,.65); }
.wtc-name { font-size: .9rem; font-weight: 700; color: #1a1a2a; }
.wtc-desc { font-size: .78rem; color: #5c5e72; line-height: 1.4; }

/* Tarjeta tipo enlace (p.ej. Modo Estudio → /estudio) */
.wizard-tipo-card.wtc-link {
    text-decoration: none;
    color: inherit;
}

/* Tarjeta Modo Estudio: centrada en fila completa */
.wizard-tipo-card.wtc-estudio {
    grid-column: 1 / -1;
    align-items: center;
    text-align: center;
}

/* Tarjetas de tipo bloqueadas (solo para usuarios no premium) */
.wizard-tipo-card.wtc-locked {
    opacity: 0.6;
    cursor: pointer;
}
.wizard-tipo-card.wtc-locked:hover {
    background: #faf8f5;
    border-color: #ddd8d0;
}

/* Lista de oposiciones: misma estética que las tarjetas de bloque */
#oposicion-options {
    grid-template-columns: 1fr;
}

#oposicion-options .radio-pill {
    border: 2px solid #ddd8d0;
    border-radius: 0.85rem;
    background: #faf8f5;
    padding: 0.85rem 0.75rem;
    min-height: 56px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #1a1a2a;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

#oposicion-options .radio-pill:hover {
    border-color: #e8b955;
    background: #fef3e2;
}

#oposicion-options .radio-pill--active {
    background: #f59e0b;
    border-color: #f59e0b;
    color: #1a1a2a;
    font-weight: 700;
    box-shadow: 0 2px 10px rgba(245,158,11,0.30);
}

/* Resumen wizard */
.wizard-summary {
    background: #faf8f5;
    border: 1px solid #ddd8d0;
    border-radius: .85rem;
    padding: 1.1rem 1.4rem;
    margin-bottom: 1.25rem;
}
.ws-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .35rem 0;
    font-size: .9rem;
    color: #4a4c60;
}
.ws-row:not(:last-child) { border-bottom: 1px solid #edeae5; }
.ws-row strong { color: #1a1a2a; }

/* Botón grande de empezar */
.btn-big { font-size: 1rem; padding: .85rem; border-radius: .75rem; }

/* ── Botones de dificultad ── */
.dificultad-pills {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: .5rem;
    margin-bottom: .25rem;
}
.dificultad-pill {
    padding: .55rem .4rem;
    border: 2px solid #ddd8d0;
    border-radius: .75rem;
    background: #faf8f5;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: .8rem;
    font-weight: 600;
    color: #4a4c60;
    cursor: pointer;
    text-align: center;
    transition: border-color .15s, background .15s, box-shadow .15s;
    user-select: none;
}
.dificultad-pill:hover { background: #fef3e2; border-color: #e8b955; }
.dificultad-pill.active {
    background: #f59e0b;
    border-color: #f59e0b;
    color: #1a1a2a;
    box-shadow: 0 2px 8px rgba(245,158,11,.28);
}

/* ── Contador + slider de número de preguntas ── */
.num-preguntas-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .75rem;
    padding: .5rem 0 .25rem;
}

/* Fila −  número  + */
.num-preguntas-counter {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.np-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #ddd8d0;
    background: #faf8f5;
    font-size: 1.4rem;
    line-height: 1;
    color: #4a4c60;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, border-color .15s, color .15s;
    user-select: none;
    flex-shrink: 0;
}
.np-btn:hover {
    background: #f59e0b;
    border-color: #f59e0b;
    color: #fff;
}
.np-btn:active { transform: scale(.93); }

/* Input numérico central — editable, sin flechas, solo el número grande */
.num-preguntas-display {
    width: 80px;
    border: none;
    border-bottom: 2.5px solid #1a1a2a;
    border-radius: 0;
    background: transparent;
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    font-size: 2rem;
    font-weight: 700;
    color: #1a1a2a;
    text-align: center;
    padding: 0 .25rem .1rem;
    -moz-appearance: textfield;
    outline: none;
}
.num-preguntas-display::-webkit-outer-spin-button,
.num-preguntas-display::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.num-preguntas-display:focus { border-bottom-color: #f59e0b; }

/* Slider */
.num-preguntas-slider {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 999px;
    background: linear-gradient(to right, #f59e0b 0%, #f59e0b var(--pct,26%), #ddd8d0 var(--pct,26%), #ddd8d0 100%);
    outline: none;
    cursor: pointer;
}
.num-preguntas-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #f59e0b;
    border: 3px solid #fff;
    box-shadow: 0 1px 6px rgba(245,158,11,.50);
    cursor: pointer;
}
.num-preguntas-slider::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #f59e0b;
    border: 3px solid #fff;
    box-shadow: 0 1px 6px rgba(245,158,11,.50);
    cursor: pointer;
}
.num-preguntas-labels {
    display: flex;
    justify-content: space-between;
    width: 100%;
    font-size: .72rem;
    color: #9196ab;
    padding: 0 2px;
}

/* Área del test full-width */
.test-area--full { max-width: 100%; }

/* ====== CONFIG PANEL ====== */
.test-config {
    background: #ffffff;
    border-radius: 1.1rem;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(20,20,40,0.09);
    border: 1px solid #edeae5;
    position: sticky;
    top: 1.5rem;
}

.test-config h1 {
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0 0 1.25rem;
    color: #1a1a2a;
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.test-config h1::before {
    content: '⚙';
    font-size: 0.9rem;
}

/* ====== TYPE SELECTOR (radio pills) ====== */
.test-type-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
}

.radio-pill {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.6rem;
    border-radius: 0.6rem;
    border: 1.5px solid #ddd8d0;
    background: #faf8f5;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    text-align: center;
    line-height: 1.3;
}

.radio-pill input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.radio-pill span {
    display: block;
    width: 100%;
}

.radio-pill:hover {
    background: #f5f2ed;
    border-color: #c8c4bc;
}

.radio-pill--active {
    background: #e8eeff;
    border-color: #2952cc;
    color: #1e3ea8;
    font-weight: 600;
    box-shadow: 0 0 0 2px rgba(41,82,204,0.12);
}

.test-type-options.locked .radio-pill {
    opacity: 0.55;
    cursor: not-allowed;
}

.test-type-options.locked .radio-pill--active {
    opacity: 0.85;
}

/* ====== FORM ELEMENTS IN CONFIG ====== */
.form-group {
    margin-bottom: 0.9rem;
}

.form-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
    color: #4a4c60;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.55rem 0.7rem;
    border-radius: 0.5rem;
    border: 1.5px solid #ddd8d0;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.875rem;
    background: #faf8f5;
    color: #1a1a2a;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #2952cc;
    box-shadow: 0 0 0 3px rgba(41,82,204,0.12);
    background: #fff;
}

.test-config input:disabled,
.test-config select:disabled {
    background: #f5f2ed;
    color: #9196ab;
    cursor: not-allowed;
    border-color: #ddd8d0;
}

.form-group select.field-locked {
    background: #f5f2ed;
    color: #9196ab;
    cursor: not-allowed;
}

.field-help {
    margin: 0.3rem 0 0;
    font-size: 0.78rem;
    color: #9196ab;
    line-height: 1.5;
}

.btn-full {
    width: 100%;
    margin-top: 0.25rem;
}

.test-config .btn-primary:disabled {
    background: #9196ab;
    cursor: not-allowed;
    box-shadow: none;
}

.test-config .btn-primary:disabled:hover {
    background: #9196ab;
    transform: none;
}

/* ====== TEST AREA ====== */
.test-area {
    min-height: 300px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* State panel (instructions before test starts) */
.test-state {
    background: linear-gradient(135deg, #e8eeff, #edf0ff);
    border: 1.5px dashed #b8c8f8;
    border-radius: 1rem;
    padding: 2rem 1.5rem;
    text-align: center;
    color: #2c2e3e;
}

.test-state p {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.7;
}

.test-state strong {
    color: #1a2d5a;
}

/* Test container */
.test-container {
    background: #ffffff;
    border-radius: 1.1rem;
    box-shadow: 0 4px 20px rgba(20,20,40,0.09);
    border: 1px solid #edeae5;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Test header */
.test-header {
    margin-bottom: 1.5rem;
}

/* When the test info banner is shown, remove the default loading look */
.test-state--info {
    background: transparent;
    border: none;
    padding: 0;
    text-align: left;
}

.test-state-msg {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: rgba(255,255,255,0.75);
    padding: 0 0.25rem;
}

/* Banner de información del test */
.test-info-banner {
    background: linear-gradient(135deg, #0e1c38 0%, #1e3560 100%);
    border-radius: 0.9rem;
    padding: 1rem 1.4rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 2rem;
    box-shadow: 0 2px 12px rgba(14,28,56,0.18);
}

/* Chip individual */
.tic {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.tic__label {
    font-size: 0.6rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.45);
    text-transform: uppercase;
    letter-spacing: 0.09em;
    white-space: nowrap;
}

.tic__value {
    font-size: 0.82rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 260px;
}

.tic__value--accent {
    color: #f8c869;
}

@media (max-width: 480px) {
    .test-info-banner {
        gap: 0.6rem 1.25rem;
        padding: 0.85rem 1rem;
    }
    .tic__value {
        font-size: 0.78rem;
        max-width: 180px;
    }
}

/* Progress indicator */
.test-progress {
    font-size: 0.8rem;
    color: #9196ab;
    font-weight: 500;
}

/* ====== TABLAS DE ENUNCIADO (preguntas con datos tabulares) ====== */
.test-question-table-wrap {
    margin-bottom: 0.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
    /* Barra de scroll siempre visible y prominente */
    scrollbar-width: auto;
    scrollbar-color: #c8871a #f5ead8;
    border-radius: 0.5rem;
    padding-bottom: 2px;
}

.test-question-table-wrap::-webkit-scrollbar {
    height: 8px;
    display: block;
}
.test-question-table-wrap::-webkit-scrollbar-track {
    background: #f5ead8;
    border-radius: 6px;
}
.test-question-table-wrap::-webkit-scrollbar-thumb {
    background: #c8871a;
    border-radius: 6px;
    min-width: 40px;
}
.test-question-table-wrap::-webkit-scrollbar-thumb:hover {
    background: #a06614;
}

/* Cualquier tabla directa dentro del enunciado también es scrollable */
.test-question-table-wrap table {
    min-width: max-content;
}

/* Indicador de scroll deslizable bajo la tabla */
.table-scroll-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    font-size: 0.72rem;
    color: #c8871a;
    font-weight: 600;
    margin-bottom: 1rem;
    margin-top: 0.2rem;
    letter-spacing: 0.02em;
    opacity: 0.85;
    pointer-events: none;
    user-select: none;
}
.table-scroll-hint svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* Barra de progreso de scroll visible siempre */
.table-scroll-bar-wrap {
    height: 6px;
    background: #f5ead8;
    border-radius: 6px;
    margin: 0.3rem 0 1rem;
    overflow: hidden;
    cursor: pointer;
}
.table-scroll-bar-thumb {
    height: 100%;
    background: #c8871a;
    border-radius: 6px;
    min-width: 32px;
    transition: background 0.15s;
}

.exam-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: auto;
    scrollbar-color: #c8871a #f5ead8;
}
.exam-table-wrap::-webkit-scrollbar { height: 8px; display: block; }
.exam-table-wrap::-webkit-scrollbar-track { background: #f5ead8; border-radius: 6px; }
.exam-table-wrap::-webkit-scrollbar-thumb { background: #c8871a; border-radius: 6px; min-width: 40px; }
.exam-table-wrap::-webkit-scrollbar-thumb:hover { background: #a06614; }

.exam-table-wrap {
    background: #f8f9fc;
    border: 1px solid #dde3f0;
    border-radius: 0.75rem;
    padding: 1rem 1.1rem 0.85rem;
    margin-bottom: 0.5rem;
}

.exam-table-caption {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #2952cc;
    margin: 0 0 0.65rem;
}

.exam-table-note {
    font-size: 0.78rem;
    color: #555;
    margin: 0.65rem 0 0;
    font-style: italic;
}

/* Fila de dos tablas side-by-side (Tablas Flores) */
.exam-tables-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.exam-tables-row .exam-table-scroll {
    flex: 1;
    min-width: 0;
}

/* Scroll horizontal en pantallas pequeñas */
.exam-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.exam-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    white-space: nowrap;
}

.exam-table th {
    background: #2952cc;
    color: #fff;
    font-weight: 600;
    padding: 0.4rem 0.65rem;
    text-align: left;
    font-size: 0.75rem;
}

.exam-table td {
    padding: 0.35rem 0.65rem;
    border-bottom: 1px solid #e5eaf4;
    color: #2c2e3e;
}

.exam-table tbody tr:last-child td {
    border-bottom: none;
}

.exam-table tbody tr:nth-child(even) td {
    background: #eef1f9;
}

/* ====== SECTION HEADERS (PRIMERA PARTE / SUPUESTO I / SUPUESTO II) ====== */
.test-section-header {
    margin: 1.75rem 0 1.25rem;
    padding: 1rem 1.25rem;
    background: #f0f4ff;
    border-left: 4px solid #2952cc;
    border-radius: 0 0.5rem 0.5rem 0;
}

.test-section-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #2952cc;
    margin-bottom: 0;
}

.test-section-header:has(.test-supuesto-text) .test-section-title {
    margin-bottom: 0.75rem;
}

.test-supuesto-text {
    font-size: 0.88rem;
    line-height: 1.7;
    color: #2a2a3a;
    white-space: pre-line;
}

/* ====== QUESTIONS ====== */
.test-question {
    padding: 1.25rem 0;
    border-bottom: 1px solid #f5f2ed;
}

.test-question:first-child {
    padding-top: 0;
}

.test-question:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.test-question-title {
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.6;
    color: #1a1a2a;
    margin-bottom: 0.75rem;
}

.test-options {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.test-options li {
    border-radius: 0.6rem;
    border: 1.5px solid #edeae5;
    transition: background 0.12s, border-color 0.12s;
    overflow: hidden;
}

.test-options li:hover {
    background: #faf8f5;
    border-color: #ddd8d0;
}

.test-options label {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    cursor: pointer;
    padding: 0.6rem 0.75rem;
    width: 100%;
}

.test-options label input[type="radio"] {
    margin-top: 0.1rem;
    flex-shrink: 0;
    accent-color: #2952cc;
    width: 16px;
    height: 16px;
}

.test-options label span {
    font-size: 0.875rem;
    line-height: 1.6;
    color: #2c2e3e;
}

/* Selected option highlight */
.page-test label input[type="radio"]:checked + span {
    font-weight: 600;
    color: #1a1a2a;
}

/* Corrected answer states */
.test-options li.option-correct {
    background: #e8f8ef;
    border-color: #4ade80;
}

.test-options li.option-correct label span {
    color: #145c38;
    font-weight: 600;
}

.test-options li.option-incorrect {
    background: #fef0f0;
    border-color: #f87171;
}

.test-options li.option-incorrect label span {
    color: #8b1e1e;
}

/* Unanswered question highlight */
.test-question.question-unanswered .test-question-title {
    border-left: 3px solid #f59e0b;
    padding-left: 0.65rem;
    margin-left: -0.05rem;
}

.test-question.question-unanswered .test-question-title::after {
    content: ' · Sin responder';
    font-size: 0.78rem;
    color: #92590a;
    font-weight: 500;
}

/* ====== EXPLANATION ====== */
.test-explanation {
    margin-top: 0.75rem;
    padding: 0.85rem 1rem;
    border-radius: 0.75rem;
    background: #faf8f5;
    border: 1px solid #ddd8d0;
    border-left: 3px solid #2952cc;
}

.test-explanation-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #2952cc;
    margin-bottom: 0.4rem;
}

.test-explanation-text {
    font-size: 0.875rem;
    color: #2c2e3e;
    line-height: 1.7;
    white-space: pre-line;
    margin: 0;
}

/* ====== ACTIONS ====== */
.test-actions {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid #edeae5;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.test-actions button {
    min-width: 160px;
}

/* ====== RESULT ====== */
.test-result {
    border-radius: 1rem;
    padding: 1.25rem 1.5rem;
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    box-shadow: 0 4px 18px rgba(0,0,0,0.07);
}

.test-result--ok {
    background: linear-gradient(135deg, #e8f8ef 0%, #d4f5e4 100%);
    border: 1.5px solid #4ade80;
    color: #145c38;
}

.test-result--fail {
    background: linear-gradient(135deg, #fef0f0 0%, #fde4e4 100%);
    border: 1.5px solid #f87171;
    color: #8b1e1e;
}

/* Fila superior: nota grande + puntos/tiempo */
.result-header-row {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.result-nota-block {
    display: flex;
    align-items: baseline;
    gap: 0.2rem;
    flex-shrink: 0;
}

.result-nota-num {
    font-size: 2.6rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -1px;
}

.result-nota-denom {
    font-size: 1rem;
    font-weight: 600;
    opacity: 0.6;
}

.result-meta-block {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    font-size: 0.82rem;
}

.result-puntos { font-weight: 600; }
.result-puntos em { font-style: normal; opacity: 0.65; font-weight: 400; }
.result-tiempo { opacity: 0.7; }

/* Chips: aciertos / fallos / en blanco */
.result-chips-row {
    display: flex;
    gap: 0.6rem;
}

.result-chip {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem 0.25rem;
    border-radius: 0.65rem;
    gap: 0.15rem;
}

.result-chip--ok   { background: rgba(74,222,128,0.18); }
.result-chip--fail { background: rgba(248,113,113,0.18); }
.result-chip--blank { background: rgba(0,0,0,0.06); }

.rchip-n {
    font-size: 1.4rem;
    font-weight: 800;
    line-height: 1;
}

.rchip-l {
    font-size: 0.68rem;
    font-weight: 600;
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Panel flotante de acciones post-test (sin caja blanca) */
.result-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 0.75rem;
}

.result-actions .btn-secondary,
.result-actions .btn-primary {
    flex: 1;
    min-width: 180px;
    justify-content: center;
}

/* ====== MODAL (test change warning) ====== */
.test-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(14,28,56,0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5000;
    backdrop-filter: blur(3px);
}

.test-modal-overlay.hidden {
    display: none;
}

.test-modal {
    background: #ffffff;
    border-radius: 1rem;
    padding: 1.75rem;
    max-width: 380px;
    width: 92%;
    box-shadow: 0 20px 60px rgba(14,28,56,0.25);
    border: 1px solid #edeae5;
}

.test-modal h2 {
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    margin: 0 0 0.5rem;
    font-size: 1.15rem;
    font-weight: 700;
    color: #1a1a2a;
    letter-spacing: -0.01em;
}

.test-modal p {
    margin: 0 0 1.25rem;
    font-size: 0.875rem;
    color: #5c5e72;
    line-height: 1.65;
}

.test-modal-actions {
    display: flex;
    justify-content: flex-end;
}

/* ====== PREMIUM MODAL ====== */
.premium-modal-title {
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    color: #1a1a2a;
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0 0 0.5rem;
    letter-spacing: -0.01em;
}

.premium-modal-body {
    color: #5c5e72;
    line-height: 1.65;
    font-size: 0.875rem;
    margin: 0 0 1.25rem;
}

.premium-modal-actions {
    display: flex;
    gap: 0.6rem;
    justify-content: flex-end;
    align-items: center;
}

.premium-btn-cerrar {
    padding: 0.6rem 1.2rem;
    border-radius: 999px;
    border: 1.5px solid #ddd8d0;
    background: #fff;
    color: #4a4c60;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.premium-btn-cerrar:hover {
    background: #f5f2ed;
    border-color: #9196ab;
}

/* ====== REPORT ERROR BUTTON ====== */
.btn-report-error {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin-top: 0.6rem;
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
    border: 1px solid #ddd8d0;
    background: #faf8f5;
    color: #9196ab;
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    font-family: 'Inter', system-ui, sans-serif;
}

.btn-report-error::before {
    content: '⚑';
    font-size: 0.75rem;
}

.btn-report-error:hover {
    background: #fef0f0;
    border-color: #f5c0c0;
    color: #c42b2b;
}

/* ====== REPORT ERROR MODAL ====== */
.report-error-overlay {
    z-index: 6000;
}

.report-error-modal {
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 1.5rem 1.75rem 1.75rem;
}

.report-error-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.report-error-header h2 {
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.35;
    color: #1a1a2a;
    letter-spacing: -0.01em;
}

.report-error-close {
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    color: #9196ab;
    padding: 0.15rem 0.35rem;
    border-radius: 0.3rem;
    line-height: 1;
    transition: color 0.15s, background 0.15s;
}

.report-error-close:hover {
    color: #1a1a2a;
    background: #f5f2ed;
}

.report-error-section {
    margin-bottom: 1rem;
}

.report-label {
    margin: 0 0 0.25rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #9196ab;
}

.report-value {
    margin: 0;
    font-size: 0.875rem;
    color: #1a1a2a;
    line-height: 1.55;
}

.report-answer {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: #e8f8ef;
    border: 1px solid #b6e8d1;
    border-radius: 0.5rem;
    padding: 0.35rem 0.75rem;
    font-weight: 600;
    color: #145c38;
    font-size: 0.875rem;
}

.report-answer::before {
    content: '✓';
}

.report-error-textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1.5px solid #ddd8d0;
    border-radius: 0.5rem;
    padding: 0.6rem 0.75rem;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.875rem;
    color: #1a1a2a;
    background: #faf8f5;
    resize: vertical;
    transition: border-color 0.15s, box-shadow 0.15s;
    margin-top: 0.35rem;
}

.report-error-textarea:focus {
    outline: none;
    border-color: #2952cc;
    box-shadow: 0 0 0 3px rgba(41,82,204,0.12);
    background: #fff;
}

.report-error-actions {
    text-align: right;
    margin-top: 0.25rem;
}

.btn-report-send {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.4rem;
    border-radius: 999px;
    border: none;
    background: #2952cc;
    color: #fff;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    letter-spacing: 0.01em;
}

.btn-report-send:hover { background: #1e3ea8; }
.btn-report-send:disabled { background: #9196ab; cursor: not-allowed; }

.report-success {
    text-align: center;
    padding: 1rem 0.5rem;
}

.report-success-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: #e8f8ef;
    color: #1a7a4a;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.report-success h2 {
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    margin: 0 0 0.5rem;
    font-size: 1.08rem;
    color: #1a1a2a;
    letter-spacing: -0.01em;
}

.report-success p {
    margin: 0;
    font-size: 0.875rem;
    color: #5c5e72;
    line-height: 1.6;
}

/* ====== BLOQUES PANEL ====== */
/* ══ BLOQUES — diseño en cuadrícula ══ */
.bloques-container {
    background: transparent;
    border: none;
    padding: 0;
    max-height: none;
    overflow-y: visible;
}

/* Grid 3 columnas de tarjetas cuadradas */
.bloques-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.6rem;
    margin-bottom: 0.85rem;
}

/* Tarjeta de bloque */
.bloque-group.bloque-card {
    background: #faf8f5;
    border: 2px solid #ddd8d0;
    border-radius: 0.85rem;
    padding: 0.85rem 0.5rem;
    cursor: pointer;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    min-height: 72px;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
    user-select: none;
    position: relative;
}

.bloque-group.bloque-card:hover {
    border-color: #e8b955;
    background: #fef3e2;
}

.bloque-card--active {
    background: #f59e0b !important;
    border-color: #f59e0b !important;
    color: #1a1a2a !important;
    box-shadow: 0 2px 10px rgba(245,158,11,0.30);
}

.bloque-card__name {
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.35;
    color: inherit;
}

.bloque-card__subtitle {
    font-size: 0.65rem;
    font-weight: 500;
    color: #6b7280;
    line-height: 1.3;
    text-align: center;
    padding: 0 0.25rem;
}

.bloque-card--active .bloque-card__subtitle {
    color: rgba(26,26,42,0.65);
}

.bloque-card__count {
    font-size: 0.68rem;
    color: #9196ab;
    font-weight: 400;
}

.bloque-card--active .bloque-card__count {
    color: rgba(26,26,42,0.6);
}

/* Inputs ocultos (requeridos por la lógica de test.js) */
.bloque-group .bloque-temas-list {
    display: none !important;
}

/* Zona de paneles de temas (debajo del grid) */
.bloques-panels-zone {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

/* Panel de temas */
.bloque-panel {
    background: #faf8f5;
    border: 1.5px solid #ddd8d0;
    border-radius: 0.85rem;
    padding: 0.85rem 1rem;
    animation: wizardIn .2s ease forwards;
}

.bloque-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.6rem;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.bloque-panel__title {
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    color: #1a1a2a;
    letter-spacing: -0.01em;
}

.bloque-panel__actions {
    display: flex;
    gap: 0.35rem;
}

.btn-temas-all, .btn-temas-none {
    border: 1px solid #e8d590;
    background: #fef3e2;
    color: #92590a;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-temas-all:hover, .btn-temas-none:hover { background: #fde9bc; }

/* Lista de temas dentro del panel — 2 columnas */
.bloque-panel-list {
    list-style: none;
    margin: 0;
    padding: 0;
    column-count: 2;
    column-gap: 0.5rem;
    font-size: 0.81rem;
}

.bloque-panel-list li {
    break-inside: avoid;
    background: #fff;
    border-radius: 0.4rem;
    padding: 0.3rem 0.6rem;
    margin-bottom: 0.25rem;
    border: 1.5px solid transparent;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
    overflow: hidden;
}

.bloque-panel-list li:hover {
    background: #fef3e2;
    border-color: #e8d590;
}

/* Fila de tema seleccionado: fondo ámbar de baja opacidad */
.bloque-panel-list li:has(input:checked) {
    background: rgba(245, 158, 11, 0.12);
    border-color: rgba(245, 158, 11, 0.40);
}

/* Checkbox oculto */
.bloque-panel-list input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.bloque-panel-list li span {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.35;
    color: #2c2e3e;
    font-size: 0.8rem;
    user-select: none;
}

.bloque-panel-list li:has(input:checked) span {
    color: #7a4d0a;
    font-weight: 600;
}

/* Lock state */
.bloques-container.bloques-locked { opacity: 0.65; pointer-events: none; }
.bloques-container.bloques-locked input[type="checkbox"] { cursor: not-allowed; }
.bloques-container.bloques-locked button { cursor: not-allowed; opacity: 0.75; }

/* ====== COMPARTIR RESULTADO ====== */

/* Botón "Compartir resultado" en el panel flotante */
.btn-share-float {
    width: 100%;
    padding: 0.65rem 1rem;
    background: #0f172a;
    color: #fff;
    border: none;
    border-radius: 0.6rem;
    font-family: inherit;
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    box-shadow: 0 4px 14px rgba(0,0,0,0.18);
    transition: background 0.15s, opacity 0.15s;
}
.btn-share-float:hover:not(:disabled) { background: #1e293b; }
.btn-share-float:disabled { opacity: 0.45; cursor: not-allowed; }

/* Modal overlay */
#share-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.55);
    backdrop-filter: blur(4px);
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn .2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.share-modal {
    background: #fff;
    border-radius: 1rem;
    padding: 1.75rem 1.5rem;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 8px 40px rgba(15,23,42,.2);
    animation: slideUp .22s ease;
}
@keyframes slideUp { from { opacity:0; transform:translateY(20px); } to { opacity:1; transform:translateY(0); } }

.share-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}
.share-modal-title {
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f172a;
}
.share-modal-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    color: #94a3b8;
    cursor: pointer;
    line-height: 1;
    padding: 0.1rem 0.3rem;
}
.share-modal-close:hover { color: #0f172a; }

/* Input + botón copiar */
.share-modal-url {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}
.share-url-input {
    flex: 1;
    border: 1.5px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.82rem;
    color: #475569;
    background: #f8fafc;
    font-family: inherit;
    outline: none;
    overflow: hidden;
    text-overflow: ellipsis;
}
.share-copy-btn {
    background: #0f172a;
    color: #fff;
    border: none;
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.82rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
}
.share-copy-btn:hover { background: #1e293b; }

/* Grid de redes sociales */
.share-modal-redes {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}
.share-red {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.75rem 0.5rem;
    border-radius: 0.65rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: opacity 0.15s, transform 0.12s;
}
.share-red:hover { opacity: 0.85; transform: translateY(-2px); }
.share-red svg { width: 22px; height: 22px; }

.share-red--wa  { background: #25d366; color: #fff; }
.share-red--tg  { background: #2aabee; color: #fff; }
.share-red--fb  { background: #1877f2; color: #fff; }
.share-red--li  { background: #0a66c2; color: #fff; }
.share-red--x   { background: #000; color: #fff; }
.share-red--dl  { background: #f1f5f9; color: #0f172a; grid-column: 1 / -1; flex-direction: row; gap: 0.5rem; font-size: 0.82rem; }
.share-red--dl svg { width: 17px; height: 17px; }

/* ── Preview de imagen en modal compartir ─────────────────────── */
.share-img-preview-wrap {
    margin: 0 0 1.1rem;
    border-radius: 0.75rem;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
}

.share-img-preview {
    display: block;
    width: 100%;
    height: 340px;
    object-fit: contain;
    background: #0f172a;
}

.share-img-actions {
    display: flex;
    gap: 0.5rem;
    padding: 0.6rem;
    background: #f1f5f9;
    border-top: 1px solid #e2e8f0;
}

.share-img-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.85rem;
    border-radius: 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: opacity 0.15s;
}
.share-img-btn:hover { opacity: 0.8; }
.share-img-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.share-img-btn--view { background: #0f172a; color: #fff; }
.share-img-btn--dl   { background: #2563eb; color: #fff; flex: 1; justify-content: center; }

/* ── Botón compartir nativo (móvil) ──────────────────────────── */
.share-native-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.85rem 1rem;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: #fff;
    border: none;
    border-radius: 0.75rem;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.15s;
}
.share-native-btn:hover { opacity: 0.9; }
.share-native-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* ====== UTILITIES ====== */
.hidden { display: none !important; }

/* ====== RESPONSIVE ====== */
@media (max-width: 959px) {
    .test-config {
        position: static;
    }
}

@media (max-width: 640px) {
    .page-test .test-page {
        padding: 1.5rem 0 3rem;
    }

    .test-config {
        padding: 1.25rem;
    }

    .test-container {
        padding: 1.25rem;
    }

    .radio-pill {
        font-size: 0.78rem;
    }
}

@media (max-width: 480px) {
    .bloques-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .bloque-panel-list {
        column-count: 1;
    }
}

@media (max-width: 480px) {
    .test-type-options {
        grid-template-columns: 1fr;
    }

    .test-actions {
        flex-direction: column;
    }

    .test-actions button {
        width: 100%;
    }
}

/* ================== FAVORITOS — Icono corazón ================== */

.test-question-title-row {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
}

.test-question-title-row .test-question-title {
    flex: 1;
}

.fav-heart {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.15s, transform 0.15s;
    margin-top: 1px;
}

.fav-heart:hover {
    background: #fff0f0;
    transform: scale(1.12);
}

.fav-heart:disabled {
    opacity: 0.5;
    cursor: default;
    transform: none;
}

.fav-heart-svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: #94a3b8;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: fill 0.2s, stroke 0.2s;
}

.fav-heart--active .fav-heart-svg {
    fill: #ef4444;
    stroke: #ef4444;
}

.fav-heart--loading .fav-heart-svg {
    opacity: 0.4;
}

.fav-heart--loading {
    animation: fav-pulse 0.8s ease-in-out infinite;
}

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