/* ============================================
   ENCUESTA DE PERCEPCIÓN (docs/ENCUESTA.md)
   Enlace de «Sobre la tarjeta de reporte» e invitación en dos pasos de las
   tarjetas (includes/encuesta_invitacion.html, static/js/encuesta.js).
   ============================================ */

/* --- Enlace al final de «Sobre la tarjeta de reporte» --- */
.encuesta-cta {
    margin: 1.25rem 0 3rem;
    padding: 0.9rem 1.1rem;
    border-left: 4px solid #3F7C99;
    border-radius: 0.375rem;
    background: rgba(14, 102, 141, 0.06);
    color: #31708f;
    font-size: 1.05rem;
    line-height: 1.5;
}

.encuesta-cta a {
    color: #0e668d;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 0.15em;
}

.encuesta-cta a:hover,
.encuesta-cta a:focus-visible {
    color: #084a67;
}

/* --- Invitación ---
   Fija abajo a la derecha. z-index 1500: debajo de los menús flotantes
   (.tr-cardnav/.tr-secnav, 2000), de los modales de la tarjeta (9999) y del
   de comentarios (100000), que la tapan si se abren. */
.encuesta-invitacion {
    position: fixed;
    right: clamp(0.75rem, 1.6vw, 1.5rem);
    bottom: clamp(0.75rem, 1.6vw, 1.5rem);
    z-index: 1500;
    width: calc(100% - 1.5rem);
    max-width: 360px;
    padding: 1.1rem 1.15rem 1rem;
    border: 1px solid #DAE4F0;
    border-radius: 14px;
    background: #ffffff;
    color: #1f2d37;
    font-family: "Sora", sans-serif;
    box-shadow: 0 12px 36px rgba(8, 30, 45, 0.22);
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.22s ease, transform 0.22s ease, visibility 0s linear 0.22s;
    visibility: hidden;
}

.encuesta-invitacion[hidden] {
    display: none;
}

.encuesta-invitacion.is-visible {
    opacity: 1;
    transform: none;
    visibility: visible;
    transition: opacity 0.22s ease, transform 0.22s ease, visibility 0s;
}

/* Se aparta mientras el botón «Déjanos tus comentarios» del pie está en
   pantalla (el JS pone la clase) y vuelve al subir */
.encuesta-invitacion.is-visible.is-apartada {
    opacity: 0;
    transform: translateY(16px);
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease, visibility 0s linear 0.22s;
}

.encuesta-cerrar {
    position: absolute;
    top: 0.3rem;
    right: 0.3rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #4a5a66;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
}

.encuesta-cerrar:hover {
    background: rgba(14, 102, 141, 0.08);
    color: #0e668d;
}

.encuesta-cerrar:focus-visible,
.encuesta-valor:focus-visible,
.encuesta-boton:focus-visible {
    outline: 3px solid #0e668d;
    outline-offset: 2px;
}

.encuesta-pregunta,
.encuesta-gracias {
    margin: 0 2.5rem 0.75rem 0;     /* deja sitio a la X */
    color: #0e668d;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
}

.encuesta-detalle {
    margin: 0 0 0.9rem;
    color: #3d4f5c;
    font-size: 0.9rem;
    line-height: 1.45;
}

/* Escala de cinco caras: botones redondos de 44 px como mínimo (táctil) */
.encuesta-escala {
    display: flex;
    justify-content: space-between;
    gap: 0.35rem;
}

.encuesta-valor {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 48px;
    height: 48px;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    line-height: 1;
    cursor: pointer;
    transition: transform 0.15s ease, filter 0.15s ease;
}

/* Caritas: pictograma plano (trazo blanco sobre círculo de color) como los
   iconos de los indicadores, con los colores del semáforo: 4 «Muy
   comprensible» (A, verde) a 1 «Nada comprensible» (E, rojo). El SVG toma el
   color del botón (currentColor). */
.encuesta-cara {
    display: block;
    width: 40px;
    height: 40px;
}
.encuesta-valor[data-valor="4"] { color: #4CAF50; }
.encuesta-valor[data-valor="3"] { color: #8BC34A; }
.encuesta-valor[data-valor="2"] { color: #FF9800; }
.encuesta-valor[data-valor="1"] { color: #F44336; }

.encuesta-valor:hover {
    transform: translateY(-2px) scale(1.08);
    filter: brightness(0.92);
}

.encuesta-extremos {
    display: flex;
    justify-content: space-between;
    margin: 0.4rem 0 0;
    color: #5a6b77;
    font-size: 0.75rem;
}

.encuesta-acciones {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.encuesta-boton {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0.55rem 1rem;
    border: 1px solid #3F7C99;
    border-radius: 999px;
    background: #ffffff;
    color: #0e668d;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.encuesta-boton:hover {
    background: #eef5f9;
    color: #0b5677;
}

.encuesta-boton--principal {
    border-color: #0e668d;
    background: #0e668d;
    color: #ffffff;
}

.encuesta-boton--principal:hover,
.encuesta-boton--principal:focus-visible {
    background: #0b5677;
    color: #ffffff;
}

/* Móvil: franja al pie, a todo lo ancho con márgenes de 12 px y compacta */
@media (max-width: 575.98px) {
    .encuesta-invitacion {
        right: 12px;
        left: 12px;
        bottom: 12px;
        bottom: calc(12px + env(safe-area-inset-bottom, 0px));
        width: auto;
        max-width: none;
        padding: 0.8rem 0.85rem 0.75rem;
        border-radius: 12px;
    }

    .encuesta-pregunta,
    .encuesta-gracias {
        margin-bottom: 0.55rem;
        font-size: 0.95rem;
    }

    .encuesta-detalle {
        margin-bottom: 0.65rem;
        font-size: 0.85rem;
    }

    .encuesta-valor {
        width: 44px;
        height: 44px;
    }
    .encuesta-cara {
        width: 36px;
        height: 36px;
    }

    .encuesta-acciones .encuesta-boton {
        flex: 1 1 auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .encuesta-invitacion,
    .encuesta-invitacion.is-visible,
    .encuesta-invitacion.is-visible.is-apartada,
    .encuesta-valor {
        transition: none;
        transform: none;
    }

    .encuesta-valor:hover {
        transform: none;
    }
}
