/* IW-2026-10-05 task 34091: floating button + popup quiz. All selectors are prefixed with qp-. */

.qp-float {
    --qp-base: 24px;
    --qp-gap: 12px;
    position: fixed;
    right: max(50px, var(--qp-cover-right, 0px));
    bottom: max(50px, calc(var(--qp-cover, 0px) + var(--qp-gap)));
    z-index: 9990;
    display: flex;
    align-items: center;
    gap: 10px;
    height: 56px;
    padding: 0 26px 0 20px;
    border: 0;
    border-radius: 28px;
    background: #315A8E;
    color: #fff;
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: 0 10px 28px rgba(49, 90, 142, .35);
    overflow: hidden;
    animation: qp-glow 2.4s ease-out infinite;
    transition: bottom .25s ease, right .25s ease, background-color .2s ease, opacity .2s ease, transform .2s ease;
    -webkit-tap-highlight-color: transparent;
}

.qp-float__icon {
    flex: none;
    width: 22px;
    height: 22px;
}

.qp-float__short {
    display: none;
}

.qp-float:hover,
.qp-float:focus-visible {
    background: #26497a;
}

.qp-float:focus-visible {
    outline: 3px solid #9fc0e8;
    outline-offset: 2px;
}

/* Glint across the button, same look as the site's .shine-button. */
.qp-float::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: linear-gradient(45deg, rgba(255, 255, 255, 0) 40%, rgba(255, 255, 255, .55) 50%, rgba(255, 255, 255, 0) 60%);
    background-size: 200% 100%;
    background-repeat: no-repeat;
    animation: qp-shine 3s ease-in-out infinite;
    pointer-events: none;
}

.qp-float > * {
    position: relative;
}

@keyframes qp-shine {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Periodic nudge while nobody has clicked: a hop with a halo. */
@keyframes qp-hop {
    0%, 100% { transform: translateY(0) scale(1); }
    25% { transform: translateY(-8px) scale(1.04); }
    50% { transform: translateY(0) scale(1); }
    70% { transform: translateY(-3px) scale(1.02); }
}

/* Constant halo: a ring spreads out from the button and fades, so it stands out even when still. */
@keyframes qp-glow {
    0% { box-shadow: 0 10px 28px rgba(49, 90, 142, .35), 0 0 0 0 rgba(49, 90, 142, .6); }
    70% { box-shadow: 0 10px 28px rgba(49, 90, 142, .35), 0 0 0 16px rgba(49, 90, 142, 0); }
    100% { box-shadow: 0 10px 28px rgba(49, 90, 142, .35), 0 0 0 16px rgba(49, 90, 142, 0); }
}

/* Reduced motion: the halo glows in place instead of spreading. */
@keyframes qp-glow-soft {
    0%, 100% { box-shadow: 0 10px 28px rgba(49, 90, 142, .35), 0 0 0 4px rgba(49, 90, 142, .12); }
    50% { box-shadow: 0 10px 28px rgba(49, 90, 142, .35), 0 0 0 6px rgba(49, 90, 142, .45); }
}

.qp-float.qp-float_nudge {
    animation: qp-hop 1s ease-in-out, qp-glow 2.4s ease-out infinite;
}

.qp-float-spacer {
    display: none;
}

html.qp-open .qp-float,
html.qp-teaser-on .qp-float {
    opacity: 0;
    pointer-events: none;
    transform: translateY(12px);
}

/* Teaser: the first question slides up on its own; a tap on an answer opens the popup on question 2. */
.qp-teaser {
    --qp-base: 24px;
    --qp-gap: 12px;
    position: fixed;
    right: max(24px, var(--qp-cover-right, 0px));
    bottom: max(var(--qp-base), calc(var(--qp-cover, 0px) + var(--qp-gap)));
    z-index: 10000; /* above the cookie banner (9999) */
    width: clamp(440px, 27vw, 520px);
    padding: 24px 26px 26px;
    box-sizing: border-box;
    border-radius: 16px;
    background: #fff;
    color: #2E3441;
    font-family: inherit;
    box-shadow: 0 18px 48px rgba(46, 52, 65, .22);
    opacity: 0;
    transform: translateY(24px);
    transition: opacity .3s ease, transform .3s ease, bottom .25s ease, right .25s ease;
}

.qp-teaser[hidden] {
    display: none;
}

.qp-teaser.qp-teaser_visible {
    opacity: 1;
    transform: translateY(0);
}

.qp-teaser__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.qp-teaser__label {
    color: #315A8E;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: .03em;
    text-transform: uppercase;
}

.qp-teaser__close {
    flex: none;
    width: 38px;
    height: 38px;
    margin: -6px -6px 0 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #f1f5fa;
    color: #5d6470;
    font-size: 24px;
    line-height: 38px;
    cursor: pointer;
}

.qp-teaser__question {
    margin: 0 0 18px;
    font-size: clamp(22px, 1.4vw, 26px);
    font-weight: 700;
    line-height: 1.3;
}

.qp-teaser__answers {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.qp-teaser__answers .qp-answer {
    padding: 18px 10px;
    font-size: 18px;
    font-weight: 500;
    text-align: center;
}

/* Cookie banner: a compact card in the bottom-left corner instead of a full-width strip.
   Desktop keeps the full text, phones keep the site's short text. Leaves the bottom-right
   corner to the quiz button. Overrides css/style.css via the html prefix. */
html #cookie-consent {
    left: 24px;
    right: auto;
    bottom: 24px;
    width: auto;
    max-width: 720px;
    padding: 14px 16px 14px 20px;
    transform: none;
    flex-direction: row;
    align-items: center;
    gap: 18px;
    border: 1px solid #e3eaf2;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 12px 36px rgba(46, 52, 65, .16);
}

@media (min-width: 1200px) {
    html #cookie-consent {
        max-width: min(720px, calc(100vw - 592px));
    }
}

html #cookie-consent .popup-text-info__text {
    color: #5d6470;
    font-size: 14px;
    line-height: 1.5;
}

html #cookie-consent a {
    color: #315A8E;
    font-weight: 500;
    white-space: normal;
}

html #cookie-consent .popup-text-info__btn {
    flex: none;
}

html #cookie-consent .cookie-btn {
    width: auto;
    padding: 10px 20px;
    border-radius: 8px;
    white-space: nowrap;
}

@media (max-width: 768px) {
    html #cookie-consent {
        left: 8px;
        right: 8px;
        bottom: 8px;
        max-width: none;
        padding: 12px 12px 12px 14px;
        gap: 12px;
        border-radius: 14px;
    }

    html #cookie-consent .cookie-text_mobil {
        color: #5d6470;
        font-size: 13px;
        font-weight: 400;
        line-height: 1.4;
    }

    html #cookie-consent .cookie-btn {
        padding: 10px 14px;
        font-size: 14px;
    }
}

@media (max-width: 767px) {
    .qp-float {
        --qp-base: 16px;
        --qp-gap: 10px;
        right: 16px;
        height: 50px;
        padding: 0 20px 0 16px;
        border-radius: 25px;
        font-size: 15px;
    }

    .qp-float__full {
        display: none;
    }

    .qp-float__short {
        display: inline;
    }

    /* Keeps the end of the page reachable under the button; present from first paint, so no layout shift. */
    .qp-float-spacer {
        display: block;
        height: calc(74px + env(safe-area-inset-bottom, 0px));
    }

    .qp-teaser {
        --qp-base: 0px;
        --qp-gap: 0px;
        bottom: 0; /* the sheet covers the cookie banner instead of stacking on top of it */
        left: 0;
        right: 0;
        width: auto;
        padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
        border-radius: 18px 18px 0 0;
        box-shadow: 0 -8px 30px rgba(46, 52, 65, .18);
        transform: translateY(100%);
    }

    .qp-teaser__question {
        margin-bottom: 12px;
        font-size: 18px;
    }

    .qp-teaser__answers {
        gap: 8px;
    }

    .qp-teaser__answers .qp-answer {
        padding: 12px 8px;
        font-size: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .qp-float::before {
        animation: none;
    }

    .qp-float,
    .qp-float.qp-float_nudge {
        animation: qp-glow-soft 2.4s ease-in-out infinite;
    }

    .qp-teaser {
        transition: none;
    }
}

/* Modal */
html.qp-open,
html.qp-open body {
    overflow: hidden;
}

.qp-modal {
    position: fixed;
    inset: 0;
    z-index: 99000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
    opacity: 0;
    transition: opacity .2s ease;
}

.qp-modal[hidden] {
    display: none;
}

.qp-modal.qp-modal_visible {
    opacity: 1;
}

.qp-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(46, 52, 65, .55);
}

.qp-dialog {
    position: relative;
    width: 100%;
    max-width: 560px;
    max-height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 32px 32px 20px;
    box-sizing: border-box;
    border-radius: 16px;
    background: #fff;
    color: #2E3441;
    font-family: inherit;
    box-shadow: 0 24px 60px rgba(46, 52, 65, .25);
    outline: none;
}

.qp-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #f1f5fa;
    color: #2E3441;
    font-size: 26px;
    line-height: 40px;
    cursor: pointer;
}

.qp-close:hover {
    background: #e2eaf4;
}

.qp-head {
    padding-right: 40px;
    margin-bottom: 22px;
}

.qp-title {
    margin-bottom: 14px;
    color: #315A8E;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.qp-progress__text {
    margin-bottom: 8px;
    color: #8b9199;
    font-size: 14px;
}

.qp-progress__bar {
    height: 6px;
    overflow: hidden;
    border-radius: 3px;
    background: #e8eef5;
}

.qp-progress__bar span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: 3px;
    background: #315A8E;
    transition: width .25s ease;
}

.qp-question {
    margin: 0 0 18px;
    color: #2E3441;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.25;
}

.qp-answers {
    display: grid;
    gap: 10px;
}

.qp-answer {
    display: block;
    width: 100%;
    padding: 15px 18px;
    border: 1.5px solid #d9e3ee;
    border-radius: 10px;
    background: #f7fafd;
    color: #2E3441;
    font-family: inherit;
    font-size: 16px;
    line-height: 1.3;
    text-align: left;
    cursor: pointer;
    transition: border-color .15s ease, background-color .15s ease;
}

.qp-answer:hover,
.qp-answer:focus-visible {
    border-color: #315A8E;
    background: #eef4fb;
    outline: none;
}

.qp-answer[aria-pressed="true"] {
    border-color: #315A8E;
    background: #315A8E;
    color: #fff;
}

.qp-lead {
    margin: 0 0 18px;
    color: #2E3441;
    font-size: 16px;
    line-height: 1.5;
}

.qp-field {
    margin-bottom: 12px;
}

.qp-field input {
    display: block;
    width: 100%;
    height: 52px;
    padding: 0 16px;
    box-sizing: border-box;
    border: 1.5px solid #d9e3ee;
    border-radius: 10px;
    background: #fff;
    color: #2E3441;
    font-family: inherit;
    font-size: 16px;
}

.qp-field input:focus {
    border-color: #315A8E;
    outline: none;
}

.qp-field input.qp-invalid {
    border-color: #c62828;
}

.qp-error {
    display: none;
    margin-top: 6px;
    color: #c62828;
    font-size: 13px;
    line-height: 1.35;
}

.qp-error.qp-error_visible {
    display: block;
}

.qp-consent {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin: 6px 0 4px;
    color: #5d6470;
    font-size: 13px;
    line-height: 1.45;
    cursor: pointer;
}

.qp-consent input {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    margin: 1px 0 0;
    accent-color: #315A8E;
}

.qp-consent a {
    color: #315A8E;
    text-decoration: underline;
}

.qp-submit {
    display: block;
    width: 100%;
    min-height: 54px;
    margin-top: 14px;
    border: 0;
    border-radius: 10px;
    background: #315A8E;
    color: #fff;
    font-family: inherit;
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
}

.qp-submit:hover {
    background: #26497a;
}

.qp-submit:disabled {
    opacity: .6;
    cursor: default;
}

.qp-success {
    text-align: center;
}

.qp-success__icon {
    position: relative;
    width: 64px;
    height: 64px;
    margin: 4px auto 18px;
    border-radius: 50%;
    background: #e8f1fb;
}

.qp-success__icon:before {
    content: "";
    position: absolute;
    left: 22px;
    top: 21px;
    width: 20px;
    height: 11px;
    border-left: 3px solid #315A8E;
    border-bottom: 3px solid #315A8E;
    transform: rotate(-45deg);
}

.qp-foot {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    align-items: center;
    justify-content: space-between;
    margin-top: 20px;
}

.qp-back {
    padding: 6px 0;
    border: 0;
    background: none;
    color: #315A8E;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.qp-back[hidden] {
    display: none;
}

.qp-note {
    margin-left: auto;
    color: #8b9199;
    font-size: 11px;
    line-height: 1.35;
    letter-spacing: .04em;
    text-transform: uppercase;
}

@media (max-width: 767px) {
    .qp-modal {
        align-items: flex-end;
        padding: 0;
    }

    .qp-dialog {
        max-width: none;
        max-height: 92%;
        max-height: 92dvh;
        padding: 24px 16px calc(16px + env(safe-area-inset-bottom, 0px));
        border-radius: 16px 16px 0 0;
    }

    .qp-question {
        font-size: 20px;
    }

    .qp-note {
        margin-left: 0;
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .qp-float,
    .qp-modal,
    .qp-progress__bar span {
        transition: none;
    }
}
