/*! LEARNWISE QUESTION BUTTON
---------------------------------------------*/

#learnwise-button-question {
    width: 60px;
    height: 60px;
    padding: 18px;
    background-color: var(--hoou-extragruen, #88c8b4);
    border: none;
    border-radius: 50%;
    cursor: pointer !important;
    box-sizing: border-box;
    transition: background-color 0.25s ease-out;
}

#learnwise-button-question > svg {
    display: block;
    width: 24px;
    height: 24px;
}

#learnwise-button-question:not(.declined):hover {
    background-color: var(--hoou-extragruen-300, #afdacd);
}

#learnwise-button-question:focus-visible {
    outline: 2px solid var(--hoou-extrablau, #7a91c1);
    outline-offset: 4px;
}

/* order:999 keeps the button visually last while DOM order controls tab sequence. */
#hoou-fixed-buttons #learnwise-button-question,
#hoou-fixed-buttons #lw-floating-button {
    order: 999;
}

#learnwise-button-question.declined,
#hoou-fixed-buttons > #learnwise-button-question.declined {
    background-color: var(--hoou-grau, #c3ccd2);
    cursor: pointer;
}

/*! SKIP-TO-CHATBOT BUTTON
---------------------------------------------*/

/* Visually hidden — mirrors the theme's .screen-reader-text pattern. */
.skip-to-chatbot {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    position: absolute !important;
    width: 1px;
    word-wrap: normal !important;
}

/* On focus: restore all overridden layout properties. overflow and margin must be
   reset explicitly — they are not covered by any hoou-button rule and would
   otherwise suppress the padding area. padding: 13px 16px targets ~50px total
   height (line-height: 24px + 13+13), matching the theme skip-link at ~49.67px. */
.skip-to-chatbot:focus-visible {
    clip: auto !important;
    clip-path: none;
    height: auto;
    margin: 0;
    overflow: visible;
    padding: 13px 16px;
    left: 5px;
    top: 5px;
    width: auto;
    z-index: 100000;
}

/* Declined: show grey background (like #learnwise-button-question.declined) when the
   button becomes visible on focus. ID selector ensures we outspecify .hoou-button.primary. */
#skip-to-chatbot.declined:focus-visible {
    background-color: var(--hoou-grau, #c3ccd2);
    color: var(--hoou-blau, #1e1c39);
}

/*! LEARNWISE-BUTTON
---------------------------------------------*/

#hoou-fixed-buttons > button:focus-visible {
  -webkit-box-shadow: none;
  -moz-box-shadow: none;
  box-shadow: none;
  outline: none;
}

/* Pulsing placeholder while the LearnWise script loads.
   Keeps the same green appearance as the default button.
   Replaced by #lw-floating-button once it appears in the DOM. */
#learnwise-button-question.waiting-for-learnwise-button {
    pointer-events: none;
    animation: learnwise-loading-pulse 1.4s ease-in-out infinite;
}

@keyframes learnwise-loading-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.3; }
}

#lw-floating-button {
    cursor: pointer !important;
    box-shadow: none !important;
    z-index: 9998 !important;
}

#lw-floating-button svg {
    vertical-align: unset;
}

/* When moved into #hoou-fixed-buttons: style to match #learnwise-button-question
   so the swap is visually seamless. The inner img is hidden — the green circle
   is the visual. */
#hoou-fixed-buttons #lw-floating-button {
    position: static !important;
    width: 60px !important;
    height: 60px !important;
    border-radius: 50% !important;
    background-color: var(--hoou-extragruen, #88c8b4) !important;
    border: none !important;
    padding: 18px !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    transition: background-color 0.25s ease-out !important;
}

#hoou-fixed-buttons #lw-floating-button:hover {
    background-color: var(--hoou-extragruen-300, #afdacd) !important;
}

#hoou-fixed-buttons #lw-floating-image {
    display: none !important;
}

/*! CONSENT DIALOG ANIMATIONS
---------------------------------------------*/

@keyframes learnwise-dialog-in {
    from { opacity: 0; transform: translate3d(0, 30px, 0) scale3d(0.95, 0.95, 0.95); }
    to   { opacity: 1; transform: translate3d(0, 0, 0) scale3d(1, 1, 1); }
}

@keyframes learnwise-dialog-out {
    from { opacity: 1; transform: translate3d(0, 0, 0) scale3d(1, 1, 1); }
    to   { opacity: 0; transform: translate3d(0, 30px, 0) scale3d(0.95, 0.95, 0.95); }
}

/*! CONSENT DIALOG
---------------------------------------------*/

/* Consent popup. Position/width/shadow taken from the LearnWise chat wrapper.
   `inset: auto` neutralises the UA default `inset: 0` for <dialog>, which
   would otherwise anchor the popup at top-left. */
#learnwise-consent-dialog {
    position: fixed;
    inset: auto 16px 92px auto;
    z-index: 10001;
    width: 430px;
    max-width: calc(100vw - 32px);
    padding: 16px;
    background: #fff;
    border: none;
    border-radius: 16px;
    box-shadow: 0 0 20px 0 rgba(10, 13, 18, 0.18);
    animation: learnwise-dialog-in 0.25s ease-out;
}

/* Set by JS; after `animationend` JS closes the dialog completely. */
#learnwise-consent-dialog.is-closing {
    animation: learnwise-dialog-out 0.25s ease-out forwards;
}

#learnwise-consent-dialog::backdrop {
    background: transparent;
}

#learnwise-consent-dialog .dialog-inner {
    display: flex;
    flex-direction: column;
    gap: 24px;
    position: relative;
}

#learnwise-consent-dialog .dialog-close {
    position: absolute;
    top: -4px;
    right: -4px;
    padding: 4px;
}

#learnwise-consent-dialog h2 {
    margin: 0;
    padding-right: 32px;
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 16px;
    line-height: 1.3;
    text-align: center;
    color: #000;
}

#learnwise-consent-dialog p {
    margin: 0;
    font-family: 'Poppins', sans-serif;
    font-weight: 400;
    font-size: 16px;
    line-height: 1.5;
    color: #000;
}

#learnwise-consent-dialog .dialog-actions {
    display: flex;
    gap: 16px;
    align-items: center;
}

#learnwise-consent-dialog #learnwise-accept-button,
#learnwise-consent-dialog #learnwise-decline-button {
    white-space: nowrap;
}

@media (max-width: 480px) {
    #learnwise-consent-dialog .dialog-actions {
        flex-direction: column;
        align-items: stretch;
    }

    #learnwise-consent-dialog #learnwise-accept-button,
    #learnwise-consent-dialog #learnwise-decline-button {
        width: 100%;
        white-space: normal;
    }
}
