/* Cuestionarios: parte pública. Todas las clases empiezan por .cq para no chocar con el tema. */

.cq {
    --cq-color: #007bff;
    --cq-color-hover: #0056b3;
    --cq-aviso: #b26b00;
    --cq-urgente: #c0392b;
    --cq-fondo-pregunta: #f8f9fa;
    --cq-texto: #2c3e50;
    --cq-texto-suave: #495057;
    font-family: Arial, sans-serif;
    max-width: 800px;
    margin: 0 auto;
}

.cq *, .cq *::before, .cq *::after { box-sizing: border-box; }

.cq-caja {
    margin: 20px 0;
    padding: 20px;
    background: #fff;
    box-shadow: 0 0 10px rgba(0, 0, 0, .1);
    border-radius: 8px;
}

/* Cuenta atrás: se queda pegada arriba mientras se hace scroll por el formulario */
.cq-timer {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin: -20px -20px 20px;
    padding: 12px 20px;
    background: #fff;
    border-bottom: 1px solid #e3e6ea;
    border-radius: 8px 8px 0 0;
    font-size: 1rem;
    color: var(--cq-texto);
}
.cq-timer[hidden] { display: none; }
.admin-bar .cq-timer { top: 32px; }
@media (max-width: 782px) { .admin-bar .cq-timer { top: 46px; } }

.cq-timer-label { font-weight: 600; }
.cq-timer-valor {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    font-size: 1.25rem;
    padding: 2px 10px;
    border-radius: 4px;
    background: #eef3fb;
    color: var(--cq-color);
}
.cq-timer.is-aviso .cq-timer-valor { background: #fff4e0; color: var(--cq-aviso); }
.cq-timer.is-urgente .cq-timer-valor { background: #fdecea; color: var(--cq-urgente); animation: cq-latido 1s ease-in-out infinite; }
@keyframes cq-latido { 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) { .cq-timer.is-urgente .cq-timer-valor { animation: none; } }

.cq-limite-info { margin: 0 0 20px; color: #6c757d; font-size: .95rem; }

.cq-form.is-bloqueado { opacity: .55; pointer-events: none; }

/* Inicio: botón "Empezar test" */
.cq-inicio { text-align: center; padding: 10px 0; }
.cq-inicio-datos {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px 24px;
    margin: 0 0 12px;
    padding: 0;
    list-style: none;
    color: var(--cq-texto);
    font-size: 1.05rem;
}
.cq-inicio-nota { margin: 0 auto 16px; max-width: 520px; color: #6c757d; font-size: .95rem; }
.cq .cq-empezar {
    display: inline-block;
    min-width: 220px;
    padding: 15px 30px;
    background: var(--cq-color);
    color: #fff;
    border: 0;
    border-radius: 4px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color .3s;
}
.cq .cq-empezar:hover { background: var(--cq-color-hover); }
.cq .cq-empezar:disabled { opacity: .7; cursor: wait; }

.cq-form-inicio { max-width: 520px; margin: 0 auto; text-align: left; }
.cq-form-inicio .cq-empezar { display: block; width: 100%; margin-top: 20px; }
.cq-form-inicio .cq-campo { margin-bottom: 12px; }

.cq-persona { margin: 0 0 20px; color: #6c757d; font-size: .95rem; }
.cq-persona strong { color: var(--cq-texto); }
.cq-persona .cq-limite-info { display: inline-block; margin: 4px 0 0; }
.cq-quedan { color: #6c757d; font-size: .95rem; }

/* Preguntas enseñadas antes de empezar */
.cq-previa { margin-top: 24px; padding-top: 20px; border-top: 1px solid #e3e6ea; }
.cq-previa-aviso { margin: 0 0 16px; text-align: center; color: #6c757d; }
.cq-previa .cq-pregunta { opacity: .6; }
.cq-previa .cq-opcion { cursor: not-allowed; }
.cq-previa .cq-opcion:hover { background: transparent; }

/* Nombre */
.cq-campo { margin-bottom: 20px; }
.cq-campo label { display: block; font-weight: bold; font-size: 1.2rem; color: #333; }
.cq-campo input[type="text"] {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    margin-top: 5px;
}
.cq-campo input[type="text"]:focus { border-color: var(--cq-color); outline: none; }

/* Honeypot */
.cq-hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Preguntas */
.cq-pregunta {
    background: var(--cq-fondo-pregunta);
    padding: 20px;
    margin: 0 0 25px;
    border: 0;
    border-left: 5px solid var(--cq-color);
    border-radius: 4px;
    min-width: 0;
}
.cq-pregunta legend {
    float: left;
    width: 100%;
    padding: 0;
    margin-bottom: 15px;
    font-weight: 600;
    font-size: 1rem;
    color: var(--cq-texto);
    text-wrap: balance;
}
.cq-pregunta legend + * { clear: both; }
.cq-pregunta-num { display: block; font-size: .85em; color: var(--cq-color); margin-bottom: 4px; }

.cq-opcion {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0;
    padding: 10px;
    border-radius: 4px;
    cursor: pointer;
    color: var(--cq-texto-suave);
    transition: background-color .2s;
}
.cq-opcion:hover { background: #e9ecef; }
.cq-opcion:has(input:checked) { background: #e7f1ff; }
.cq-opcion input { flex-shrink: 0; margin: 0; width: 22px; height: 22px; accent-color: var(--cq-color); }

/* Pregunta sin responder al intentar enviar */
.cq-pregunta.is-pendiente { border-left-color: #dc3545; background: #fdf3f4; }
.cq-pregunta.is-pendiente legend::after {
    content: "Falta por responder";
    display: inline-block;
    margin-left: 8px;
    padding: 1px 8px;
    border-radius: 10px;
    background: #f8d7da;
    color: #721c24;
    font-size: .75rem;
    font-weight: 600;
    vertical-align: middle;
}
.cq-pendientes { margin: 20px 0 0; }

/* Privacidad */
.cq-privacidad { display: flex; gap: 10px; align-items: flex-start; margin: 10px 0; cursor: pointer; }
.cq-privacidad input { margin-top: 3px; width: 18px; height: 18px; flex-shrink: 0; accent-color: var(--cq-color); }

/* Botón */
.cq .cq-enviar {
    display: block;
    width: 100%;
    margin-top: 20px;
    padding: 15px 20px;
    background: var(--cq-color);
    color: #fff;
    border: 0;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color .3s;
}
.cq .cq-enviar:hover { background: var(--cq-color-hover); }
.cq .cq-enviar:disabled { opacity: .7; cursor: wait; }

/* Mensajes */
.cq-msg { padding: 15px; margin-bottom: 20px; border-radius: 4px; text-align: center; }
.cq-msg p { margin: 0; }
.cq-msg p + p { margin-top: 8px; }
.cq-msg ul { margin: 0; padding: 0; list-style: none; }
.cq-msg--ok { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.cq-msg--error { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.cq-puntuacion { font-weight: bold; font-size: 1.15em; }

/* Revisión tras enviar */
.cq-revision { margin: 10px 0 20px; }
.cq-rev {
    background: var(--cq-fondo-pregunta);
    padding: 18px 20px;
    margin: 0 0 18px;
    border-left: 5px solid #adb5bd;
    border-radius: 4px;
}
.cq-rev--ok { border-left-color: #28a745; }
.cq-rev--ko { border-left-color: #dc3545; }
.cq-rev--vacia { border-left-color: #fd7e14; }
.cq-rev .cq-pregunta-num { display: flex; align-items: center; gap: 10px; margin: 0 0 4px; }
.cq-badge { font-size: .8rem; font-weight: 600; padding: 2px 8px; border-radius: 10px; }
.cq-badge--ok { background: #d4edda; color: #155724; }
.cq-badge--ko { background: #f8d7da; color: #721c24; }
.cq-badge--vacia { background: #ffe8d1; color: #8a4500; }
.cq-rev-texto { margin: 0 0 12px; font-weight: 600; color: var(--cq-texto); }
.cq-rev-tuya { margin: 0; color: var(--cq-texto-suave); }

.cq-rev-opciones { list-style: none; margin: 0; padding: 0; }
.cq-rev-opcion {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    margin: 4px 0;
    border-radius: 4px;
    color: var(--cq-texto-suave);
}
.cq-rev-icono { width: 18px; flex-shrink: 0; text-align: center; font-weight: 700; }
.cq-rev-op-texto { flex: 1; }
.cq-rev-etiqueta { font-size: .8rem; font-weight: 600; white-space: nowrap; }
.cq-rev-opcion.is-correcta { background: #e6f4ea; color: #155724; }
.cq-rev-opcion.is-elegida:not(.is-correcta) { background: #fbe9eb; color: #721c24; }

.cq-justificacion {
    margin-top: 14px;
    padding: 12px 14px;
    background: #fff;
    border: 1px solid #e3e6ea;
    border-radius: 4px;
    color: var(--cq-texto-suave);
    font-size: .95rem;
}
.cq-justificacion-titulo { margin: 0 0 6px !important; font-weight: 700; color: var(--cq-texto); }
.cq-justificacion p { margin: 0 0 8px; }
.cq-justificacion p:last-child { margin-bottom: 0; }
.cq-repetir { text-align: center; margin: 0; }

@media (min-width: 600px) {
    .cq-caja { margin: 40px 0; }
    .cq-campo label { font-size: 1.4rem; }
    .cq-campo input[type="text"],
    .cq-pregunta legend,
    .cq-opcion,
    .cq .cq-enviar { font-size: 1.1rem; }
    .cq-opcion input { width: 20px; height: 20px; }
}
