@layer components {
    /* =============================================================
     * Encuesta de satisfacción — página de pedido confirmado
     * (Yeboyebo_Encuestas::success-encuesta.phtml). Panel fijo abajo,
     * port del componente YBEncuestas de la PWA.
     * ============================================================= */
    .elg-encuesta {
        --elg-encuesta-navy: #0f233f;

        position: fixed;
        inset-inline: 0;
        bottom: 0;
        z-index: 60;
        max-height: 100vh;
        overflow-y: auto;
        background: #fff;
        color: var(--elg-encuesta-navy);
        box-shadow: 0 -2px 20px 0 rgb(215 215 215 / 0.67);
    }

    .elg-encuesta-close {
        position: absolute;
        top: 0.75rem;
        right: 1.5rem;
        padding: 0.5rem;
        color: var(--elg-encuesta-navy);
        cursor: pointer;
    }

    .elg-encuesta-inner {
        max-width: 900px;
        margin: 0 auto;
        padding: 1.75rem 1rem 1.5rem;
    }

    .elg-encuesta-field {
        margin: 0 0 1rem;
        padding: 0;
        border: 0;
        text-align: center;
    }

    .elg-encuesta-title {
        display: block;
        width: 100%;
        margin: 0 auto 1.5rem;
        font-size: 1.5rem;
        font-weight: 300;
        line-height: 1.3;
        letter-spacing: 1px;
        color: var(--elg-encuesta-navy);
    }

    /* Valoración 1-10: 10 en fila en desktop, 2 filas de 5 en móvil */
    .elg-encuesta-rating {
        display: grid;
        grid-template-columns: repeat(5, 44px);
        justify-content: center;
        gap: 1rem 1.25rem;
    }

    .elg-encuesta-rate {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        border: 1px solid var(--elg-encuesta-navy);
        border-radius: 6px;
        font-size: 1.125rem;
        font-weight: 300;
        cursor: pointer;
        transition: background 0.2s, color 0.2s;
    }
    .elg-encuesta-rate input {
        position: absolute;
        inset: 0;
        opacity: 0;
        cursor: pointer;
    }
    .elg-encuesta-rate:hover {
        background: rgb(15 35 63 / 0.06);
    }
    .elg-encuesta-rate.is-checked {
        background: var(--elg-encuesta-navy);
        color: #fff;
        font-weight: 500;
    }
    .elg-encuesta-rate:has(input:focus-visible) {
        outline: 2px solid var(--elg-encuesta-navy);
        outline-offset: 2px;
    }

    .elg-encuesta-textarea {
        display: block;
        width: 100%;
        min-height: 115px;
        padding: 0.75rem;
        border: 1px solid #d7d7d7;
        border-radius: 0;
        font-size: 1rem;
        color: var(--elg-encuesta-navy);
        resize: vertical;
    }
    .elg-encuesta-textarea:focus {
        border-color: var(--elg-encuesta-navy);
        outline: none;
        box-shadow: none;
    }

    .elg-encuesta-checks {
        text-align: start;
    }
    .elg-encuesta-check {
        display: inline-flex;
        align-items: center;
        gap: 0.75rem;
        font-size: 0.875rem;
        cursor: pointer;
    }
    .elg-encuesta-check input {
        width: 18px;
        height: 18px;
        border-color: var(--elg-encuesta-navy);
        border-radius: 3px;
        color: var(--elg-encuesta-navy);
        cursor: pointer;
    }
    .elg-encuesta-check a {
        font-weight: 700;
        color: var(--elg-encuesta-navy);
    }

    .elg-encuesta-error {
        margin: -0.5rem 0 0.75rem;
        font-size: 0.8125rem;
        text-align: center;
        color: #b91c1c;
    }
    .elg-encuesta-checks + .elg-encuesta-error {
        text-align: start;
    }
    .elg-encuesta-error--submit {
        margin-top: 0.75rem;
    }

    .elg-encuesta-actions {
        display: flex;
        justify-content: center;
        gap: 1.25rem;
        margin-top: 0.5rem;
    }

    .elg-encuesta-btn {
        min-width: 110px;
        padding: 12px 25px;
        border: 1px solid var(--elg-encuesta-navy);
        border-radius: 6px;
        background: var(--elg-encuesta-navy);
        color: #fff;
        font-size: 1.0625rem;
        font-weight: 300;
        line-height: 1.2;
        text-transform: uppercase;
        cursor: pointer;
        transition: background 0.3s;
    }
    .elg-encuesta-btn:hover {
        background: rgb(15 35 63 / 0.88);
    }
    .elg-encuesta-btn:disabled {
        opacity: 0.6;
        cursor: wait;
    }

    .elg-encuesta-success {
        padding: 1.25rem 2.5rem;
        font-size: 1.25rem;
        text-align: center;
        color: green;
    }

    /* Página de los enlaces de encuesta (valoracion-pedido-web / -tienda): foto de fondo
     * velada, título y todas las preguntas a la vez; la valoración con 5 estrellas */
    /* 100vw incluye la barra de scroll: sin esto aparece scroll horizontal */
    body.valoracion_pedido_web-index-index,
    body.valoracion_pedido_tienda-index-index {
        overflow-x: clip;
    }
    .elg-valoracion {
        position: relative;
        isolation: isolate;
        /* A todo el ancho de la ventana aunque esté dentro del contenedor centrado */
        margin: 0 calc(50% - 50vw) 3rem;
        padding: 4.5rem 1.5rem 4rem;
        background-color: #e9dcd8;
        background-position: center 30%;
        background-size: cover;
        text-align: center;
        color: #0f233f;
    }
    .elg-valoracion::before {
        content: '';
        position: absolute;
        inset: 0;
        z-index: -1;
        background: rgb(255 255 255 / 0.55);
    }
    .elg-valoracion-close {
        position: absolute;
        top: 2rem;
        right: 2rem;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 50px;
        height: 50px;
        border-radius: 9999px;
        background: #0f233f;
        color: #fff;
        transition: background 0.3s;
    }
    .elg-valoracion-close:hover {
        background: rgb(15 35 63 / 0.85);
    }
    .elg-valoracion-inner {
        max-width: 34rem;
        margin: 0 auto;
    }
    .elg-valoracion-title {
        margin: 0 0 1.75rem;
        font-size: 2rem;
        font-weight: 600;
        line-height: 1.15;
        text-transform: uppercase;
        color: #0f233f;
    }
    .elg-valoracion-text {
        margin: 0 0 1.25rem;
        font-size: 1.0625rem;
        font-weight: 500;
        line-height: 1.3;
    }
    .elg-encuesta--page {
        position: static;
        z-index: auto;
        max-height: none;
        overflow: visible;
        background: none;
        box-shadow: none;
    }
    .elg-encuesta--page .elg-encuesta-inner {
        max-width: 26.5rem;
        padding: 0;
    }
    .elg-encuesta--page .elg-encuesta-title {
        margin-bottom: 1.1rem;
        font-size: 1.0625rem;
        font-weight: 500;
        letter-spacing: 0;
    }
    .elg-encuesta--page .elg-encuesta-optional {
        font-weight: 300;
        opacity: 0.7;
    }
    .elg-encuesta--page .elg-encuesta-field {
        margin-bottom: 1.5rem;
    }
    .elg-encuesta-stars {
        display: inline-flex;
        gap: 0.125rem;
    }
    .elg-encuesta-star {
        position: relative;
        display: block;
        width: 44px;
        height: 44px;
        color: #0f233f;
        cursor: pointer;
    }
    .elg-encuesta-star input {
        position: absolute;
        inset: 0;
        opacity: 0;
        cursor: pointer;
    }
    .elg-encuesta-star svg {
        width: 100%;
        height: 100%;
        fill: transparent;
        stroke: currentColor;
        stroke-width: 1.2;
        stroke-linejoin: round;
        transition: fill 0.15s;
    }
    .elg-encuesta-star.is-filled svg {
        fill: currentColor;
    }
    .elg-encuesta-star:has(input:focus-visible) {
        outline: 2px solid #0f233f;
        outline-offset: 2px;
    }
    .elg-encuesta--page .elg-encuesta-textarea {
        min-height: 130px;
        border: 0;
        text-align: center;
    }
    .elg-encuesta--page .elg-encuesta-textarea::placeholder {
        color: #8a8a8a;
        font-weight: 300;
    }
    .elg-encuesta--page .elg-encuesta-checks {
        margin-bottom: 0.75rem;
        text-align: center;
    }
    .elg-encuesta--page .elg-encuesta-check {
        font-size: 0.75rem;
    }
    .elg-encuesta--page .elg-encuesta-checks + .elg-encuesta-error {
        text-align: center;
    }
    .elg-encuesta--page .elg-encuesta-actions {
        margin-top: 0;
    }
    .elg-encuesta--page .elg-encuesta-btn {
        width: 100%;
        padding: 1.05rem 1.5rem;
        border-radius: 0;
        font-size: 0.9375rem;
        font-weight: 400;
    }
    .elg-encuesta--page .elg-encuesta-success {
        padding: 1rem 0;
        font-size: 1.125rem;
        font-weight: 500;
        color: #0f233f;
    }

    @media (max-width: 767px) {
        .elg-encuesta-close {
            top: 0.25rem;
            right: 0.75rem;
        }
        .elg-encuesta-inner {
            padding: 1.75rem 1rem 1rem;
        }
        .elg-encuesta-title {
            margin-bottom: 1rem;
            font-size: 1.125rem;
        }
        .elg-encuesta-rating {
            gap: 0.9rem 1rem;
        }
        .elg-encuesta-rate {
            font-size: 1rem;
        }
        .elg-encuesta-btn {
            padding: 9px 18px;
            font-size: 0.875rem;
        }
    }

    /* 10 en fila solo cuando caben (10×50 + 9×30 ≈ 775px + gutters) */
    @media (min-width: 900px) {
        .elg-encuesta-rating {
            grid-template-columns: repeat(10, 50px);
            gap: 1.9rem;
        }
        .elg-encuesta-rate {
            width: 50px;
            height: 50px;
            font-size: 1.25rem;
        }
    }

    @media (max-width: 767px) {
        .elg-valoracion {
            margin-block: 0 2rem;
            padding: 3.5rem 1rem 2rem;
        }
        .elg-valoracion-close {
            top: 0.75rem;
            right: 0.75rem;
            width: 38px;
            height: 38px;
        }
        .elg-valoracion-title {
            margin-bottom: 1.25rem;
            font-size: 1.375rem;
        }
        .elg-valoracion-text,
        .elg-encuesta--page .elg-encuesta-title {
            font-size: 0.875rem;
        }
        .elg-encuesta-star {
            width: 36px;
            height: 36px;
        }
        .elg-encuesta--page .elg-encuesta-textarea {
            min-height: 110px;
            text-align: start;
        }
    }
}
