/* Freddy Chat-Widget (Plugin wh_freddy) */
.wh-freddy {
    --wh-freddy-color: #a51c1e;
    --wh-freddy-bottom: 20px;
    --wh-freddy-side: 20px;
    --wh-freddy-avatar: 150px;
    --wh-freddy-bubble-width: 340px;
    position: fixed;
    bottom: var(--wh-freddy-bottom);
    z-index: 1060;
    width: var(--wh-freddy-avatar);
    font-family: inherit;
    line-height: 1.45;
    color: #212529;
}
.wh-freddy--right { right: var(--wh-freddy-side); }
.wh-freddy--left  { left: var(--wh-freddy-side); }

/* Avatar */
.wh-freddy__avatar {
    display: block;
    width: 100%;
    padding: 0;
    margin: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .22));
    transition: transform .2s ease;
}
.wh-freddy__avatar:hover,
.wh-freddy__avatar:focus-visible { transform: translateY(-3px) scale(1.03); outline: none; }
.wh-freddy__avatar img {
    display: block;
    width: 100%;
    height: auto;
}

/* Kleine "..."-Sprechblase */
.wh-freddy__teaser {
    position: absolute;
    bottom: calc(var(--wh-freddy-avatar) * 0.72);
    display: flex;
    gap: 6px;
    align-items: center;
    padding: 12px 18px;
    background: #fff;
    border: 2px solid var(--wh-freddy-color);
    border-radius: 4px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .15);
    cursor: pointer;
    animation: wh-freddy-pop .35s ease both;
}
.wh-freddy--right .wh-freddy__teaser { right: calc(var(--wh-freddy-avatar) * 0.78); }
.wh-freddy--left  .wh-freddy__teaser { left:  calc(var(--wh-freddy-avatar) * 0.78); }
.wh-freddy__teaser span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--wh-freddy-color);
    animation: wh-freddy-dots 1.4s infinite ease-in-out;
}
.wh-freddy__teaser span:nth-child(2) { animation-delay: .2s; }
.wh-freddy__teaser span:nth-child(3) { animation-delay: .4s; }
.wh-freddy__teaser::after,
.wh-freddy__teaser::before {
    content: "";
    position: absolute;
    top: 50%;
    border: 10px solid transparent;
    transform: translateY(-50%);
}
.wh-freddy--right .wh-freddy__teaser::before { right: -22px; border-left-color: var(--wh-freddy-color); }
.wh-freddy--right .wh-freddy__teaser::after  { right: -18px; border-left-color: #fff; }
.wh-freddy--left  .wh-freddy__teaser::before { left: -22px;  border-right-color: var(--wh-freddy-color); }
.wh-freddy--left  .wh-freddy__teaser::after  { left: -18px;  border-right-color: #fff; }
.wh-freddy__teaser[hidden] { display: none; }

/* Große Sprechblase */
.wh-freddy__bubble {
    position: absolute;
    bottom: calc(var(--wh-freddy-avatar) * 0.45);
    width: var(--wh-freddy-bubble-width);
    max-width: calc(100vw - 32px);
    padding: 26px 22px 22px;
    background: #fff;
    border: 2px solid var(--wh-freddy-color);
    border-radius: 4px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .2);
    animation: wh-freddy-pop .3s ease both;
}
.wh-freddy--right .wh-freddy__bubble { right: calc(var(--wh-freddy-avatar) * 0.85); }
.wh-freddy--left  .wh-freddy__bubble { left:  calc(var(--wh-freddy-avatar) * 0.85); }
.wh-freddy__bubble[hidden] { display: none; }
.wh-freddy__bubble::before,
.wh-freddy__bubble::after {
    content: "";
    position: absolute;
    bottom: 26px;
    border: 12px solid transparent;
}
.wh-freddy--right .wh-freddy__bubble::before { right: -26px; border-left-color: var(--wh-freddy-color); }
.wh-freddy--right .wh-freddy__bubble::after  { right: -21px; border-left-color: #fff; }
.wh-freddy--left  .wh-freddy__bubble::before { left: -26px;  border-right-color: var(--wh-freddy-color); }
.wh-freddy--left  .wh-freddy__bubble::after  { left: -21px;  border-right-color: #fff; }

.wh-freddy__close {
    position: absolute;
    top: 8px;
    right: 10px;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 0;
    background: transparent;
    font-size: 26px;
    line-height: 1;
    color: #333;
    cursor: pointer;
}
.wh-freddy__close:hover { color: var(--wh-freddy-color); }

.wh-freddy__panel[hidden] { display: none; }
.wh-freddy__title {
    margin: 0 0 10px;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.3;
    color: #1f1f1f;
}
.wh-freddy__text {
    margin: 0 0 18px;
    font-size: 15px;
    color: #333;
}
.wh-freddy__about-text {
    max-height: 45vh;
    overflow-y: auto;
    margin: 0 0 16px;
    padding-right: 4px;
    font-size: 14.5px;
    color: #333;
}
.wh-freddy__about-text p { margin: 0 0 10px; }
.wh-freddy__about-text p:last-child { margin-bottom: 0; }

/* Buttons */
.wh-freddy__btn {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin: 0 0 10px;
    padding: 13px 16px;
    border: 2px solid var(--wh-freddy-color);
    border-radius: 3px;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease, opacity .15s ease;
}
.wh-freddy__btn:last-child { margin-bottom: 0; }
.wh-freddy__btn--primary {
    background: var(--wh-freddy-color);
    color: #fff !important;
}
.wh-freddy__btn--primary:hover,
.wh-freddy__btn--primary:focus { opacity: .9; color: #fff; text-decoration: none; }
.wh-freddy__btn--outline {
    background: #fff;
    color: var(--wh-freddy-color);
}
.wh-freddy__btn--outline:hover,
.wh-freddy__btn--outline:focus { background: var(--wh-freddy-color); color: #fff; }
.wh-freddy__btn--link {
    padding: 8px 0 0;
    border: 0;
    background: transparent;
    font-size: 14px;
    font-weight: 600;
    color: var(--wh-freddy-color);
    text-decoration: underline;
}
.wh-freddy__btn--link:hover { text-decoration: none; }
.wh-freddy__back {
    margin: -8px 0 10px;
    padding: 0;
    border: 0;
    background: transparent;
    font-size: 14px;
    font-weight: 600;
    color: var(--wh-freddy-color);
    cursor: pointer;
}

/* Animationen */
@keyframes wh-freddy-pop {
    from { opacity: 0; transform: translateY(8px) scale(.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes wh-freddy-dots {
    0%, 80%, 100% { transform: translateY(0); opacity: .55; }
    40%           { transform: translateY(-4px); opacity: 1; }
}

/* Mobil */
@media (max-width: 575.98px) {
    /* !important, weil die Avatar-Breite als Inline-Style am Element gesetzt wird */
    .wh-freddy { --wh-freddy-avatar: 96px !important; }
    /* Spezifität wie die Desktop-Positionsregeln (.wh-freddy--right .wh-freddy__bubble) */
    .wh-freddy--right .wh-freddy__bubble,
    .wh-freddy--left .wh-freddy__bubble {
        position: fixed;
        left: 16px;
        right: 16px;
        bottom: calc(var(--wh-freddy-bottom) + var(--wh-freddy-avatar) + 12px);
        width: auto;
        max-width: none;
        padding: 22px 18px 18px;
    }
    .wh-freddy--right .wh-freddy__bubble::before,
    .wh-freddy--right .wh-freddy__bubble::after,
    .wh-freddy--left .wh-freddy__bubble::before,
    .wh-freddy--left .wh-freddy__bubble::after { display: none; }
    .wh-freddy__about-text { max-height: 38vh; }
    .wh-freddy__teaser { padding: 9px 14px; }
    .wh-freddy--hide-mobile { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
    .wh-freddy__bubble,
    .wh-freddy__teaser,
    .wh-freddy__teaser span,
    .wh-freddy__avatar { animation: none; transition: none; }
}
