/* MS WhatsApp Widget - vollständig gekapseltes Stylesheet */

.msww-widget {
    --msww-button-color: #25d366;
    --msww-button-hover-color: #1ead52;
    --msww-button-text-color: #ffffff;
    --msww-panel-background: #ffffff;
    --msww-panel-text-color: #1f2937;
    --msww-button-size: 60px;
    --msww-side-offset: 24px;
    --msww-bottom-offset: 24px;
    --msww-z-index: 1040;
    --msww-panel-width: 320px;
    --msww-panel-radius: 14px;
    --msww-panel-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
    --msww-panel-title-color: #1f2937;

    position: fixed;
    bottom: calc(var(--msww-bottom-offset) + env(safe-area-inset-bottom));
    z-index: var(--msww-z-index);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.35;
    box-sizing: border-box;
    max-width: calc(100vw - 32px);
}

.msww-widget *,
.msww-widget *::before,
.msww-widget *::after {
    box-sizing: border-box;
}

.msww-widget--right {
    right: max(var(--msww-side-offset), env(safe-area-inset-right));
}

.msww-widget--left {
    left: max(var(--msww-side-offset), env(safe-area-inset-left));
}

.msww-widget--center {
    left: 50%;
    transform: translateX(-50%);
}

.msww-widget--scroll-reveal:not(.is-revealed) {
    opacity: 0;
    pointer-events: none;
}

.msww-widget--scroll-reveal {
    transition: opacity 300ms ease;
}

.msww-widget--scroll-reveal.is-revealed {
    opacity: 1;
    pointer-events: auto;
}

.msww-widget--hidden-desktop .msww-button {
    display: none;
}

@media (min-width: 768px) {
    .msww-widget--hidden-mobile .msww-button {
        display: none;
    }
}

.msww-widget--hidden-mobile.msww-widget--hidden-desktop .msww-button {
    display: none;
}

/* Button */
.msww-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: var(--msww-button-size);
    height: var(--msww-button-size);
    border: 0;
    border-radius: 50%;
    background-color: var(--msww-button-color);
    color: var(--msww-button-text-color);
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.22);
    transition: background-color 160ms ease, transform 160ms ease;
}

.msww-button:focus-visible {
    outline: 3px solid var(--msww-button-color);
    outline-offset: 3px;
}

@media (hover: hover) {
    .msww-button:hover {
        background-color: var(--msww-button-hover-color);
        transform: translateY(-2px);
    }
}

.msww-button:hover,
.msww-button:focus,
.msww-button:active {
    color: var(--msww-button-text-color);
}

.msww-button__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56%;
    height: 56%;
}

.msww-button__icon svg {
    display: block;
    width: 100%;
    height: 100%;
}

.msww-button__label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.msww-widget--text .msww-button {
    width: auto;
    min-width: var(--msww-button-size);
    height: var(--msww-button-size);
    border-radius: calc(var(--msww-button-size) / 2);
    padding: 0 20px 0 16px;
}

.msww-widget--text .msww-button__label {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip-path: none;
    white-space: nowrap;
    font-size: 15px;
    font-weight: 600;
}

.msww-widget--pill .msww-button {
    border-radius: 999px;
}

.msww-widget--pill .msww-button:focus-visible {
    outline-offset: 3px;
}

.msww-button__img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Animationen (bei prefers-reduced-motion deaktiviert) */
@keyframes msww-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.45);
    }
    70% {
        box-shadow: 0 0 0 14px rgba(37, 211, 102, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0);
    }
}

.msww-button--subtle {
    animation: none;
}

.msww-button--pulse {
    animation: msww-pulse 2.4s ease-out infinite;
}

/* Panel (Begrüßungsbox) */
.msww-panel {
    position: absolute;
    bottom: calc(var(--msww-button-size) + 12px);
    right: 0;
    width: var(--msww-panel-width);
    max-width: calc(100vw - 32px);
    padding: 16px;
    background-color: var(--msww-panel-background);
    color: var(--msww-panel-text-color);
    border-radius: var(--msww-panel-radius);
    box-shadow: var(--msww-panel-shadow);
    word-break: break-word;
    overflow-wrap: anywhere;
    overflow: hidden;
}

.msww-widget--left .msww-panel {
    right: auto;
    left: 0;
}

.msww-widget--center .msww-panel {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
}

.msww-panel[hidden] {
    display: none;
}

.msww-panel__close {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.msww-panel__close:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.msww-panel__title {
    display: block;
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 6px;
    padding-right: 24px;
    color: var(--msww-panel-title-color);
}

.msww-panel__header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: -16px -16px 12px;
    padding: 12px 16px;
    background-color: var(--msww-button-color);
    color: var(--msww-button-text-color);
}

.msww-panel__header + .msww-panel__title {
    padding-right: 24px;
}

.msww-panel__head {
    display: block;
    font-size: 15px;
    font-weight: 700;
    color: var(--msww-button-text-color);
    min-width: 0;
    overflow-wrap: anywhere;
}

.msww-panel__avatar {
    flex: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    background-color: rgba(255, 255, 255, 0.25);
}

.msww-panel__text {
    margin: 0;
    font-size: 14px;
}

/* Abwesenheits-Hinweis (außerhalb der Geschäftszeiten) */
.msww-note {
    position: absolute;
    bottom: calc(var(--msww-button-size) + 12px);
    right: 0;
    width: 280px;
    max-width: calc(100vw - 32px);
    padding: 12px 14px;
    background-color: var(--msww-panel-background);
    color: var(--msww-panel-text-color);
    border-left: 4px solid var(--msww-button-color);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.14);
    font-size: 13px;
    word-break: break-word;
    overflow-wrap: anywhere;
    text-align: left;
}

.msww-widget--left .msww-note {
    right: auto;
    left: 0;
    border-left: 0;
    border-right: 4px solid var(--msww-button-color);
    text-align: left;
}

.msww-widget--center .msww-note {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
}

.msww-note__title {
    display: block;
    font-weight: 700;
    margin-bottom: 4px;
}

.msww-note__text {
    margin: 0;
}

@media (max-width: 320px) {
    .msww-panel {
        width: calc(100vw - 32px);
    }
    .msww-note {
        width: calc(100vw - 32px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .msww-button--pulse {
        animation: none;
    }
    .msww-button,
    .msww-button:hover {
        transition: none;
        transform: none;
    }
    .msww-widget--scroll-reveal {
        transition: none;
        opacity: 1;
        pointer-events: auto;
    }
}

@media print {
    .msww-widget {
        display: none !important;
    }
}