/* MAXWINTER WhatsApp Chat - Frontend */

#mwwc-wrapper {
    --mwwc-green: #25D366;
    --mwwc-green-dark: #1da851;
    --mwwc-red: #ef4444;
    --mwwc-text: #111111;
    --mwwc-text-muted: #6b7280;
    --mwwc-bg: #ffffff;
    --mwwc-border: #e5e7eb;
    --mwwc-shadow: 0 10px 30px rgba(0,0,0,0.18);
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.4;
}

/* Floating Button */
.mwwc-toggle {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--mwwc-green);
    border: none;
    cursor: pointer;
    box-shadow: var(--mwwc-shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, background 0.2s ease;
    padding: 0;
    color: #fff;
}
.mwwc-icon-whatsapp svg {
    width: 30px;
    height: 30px;
    display: block;
}
.mwwc-toggle:hover,
.mwwc-toggle:focus-visible {
    background: var(--mwwc-green-dark);
    transform: scale(1.05);
    outline: none;
}
.mwwc-toggle-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    position: absolute;
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.mwwc-icon-close { opacity: 0; transform: rotate(-90deg); }
#mwwc-wrapper.is-open .mwwc-icon-whatsapp { opacity: 0; transform: rotate(90deg); }
#mwwc-wrapper.is-open .mwwc-icon-close { opacity: 1; transform: rotate(0deg); }
#mwwc-wrapper.is-open .mwwc-badge { display: none; }

.mwwc-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 16px;
    height: 16px;
    padding: 0 3px;
    border-radius: 11px;
    background: var(--mwwc-red);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 2px #fff;
}

/* Chat-Box */
.mwwc-chatbox {
    position: absolute;
    bottom: 76px;
    right: 0;
    width: 340px;
    max-width: calc(100vw - 32px);
    background: var(--mwwc-bg);
    border-radius: 16px;
    box-shadow: var(--mwwc-shadow);
    padding: 20px;
    box-sizing: border-box;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: none;
}
#mwwc-wrapper.is-open .mwwc-chatbox {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.mwwc-chatbox[hidden] { display: none; }

.mwwc-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}
.mwwc-avatar-wrap {
    position: relative;
    flex-shrink: 0;
}
.mwwc-avatar {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    background: #f3f4f6;
}
.mwwc-avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 600;
    color: #fff;
    background: var(--mwwc-green);
    text-transform: uppercase;
}
.mwwc-status-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    background: var(--mwwc-green);
    border: 2px solid #fff;
    border-radius: 50%;
}

.mwwc-identity { min-width: 0; }
.mwwc-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--mwwc-text);
    line-height: 1.2;
}
.mwwc-phone {
    font-size: 14px;
    font-weight: 700;
    color: var(--mwwc-text-muted);
    margin-top: 2px;
}

.mwwc-greeting {
    font-size: 15px;
    color: var(--mwwc-text);
    margin: 0 0 16px;
    word-wrap: break-word;
}
.mwwc-divider {
    height: 1px;
    background: var(--mwwc-border);
    margin: 0 0 14px;
}

.mwwc-form { margin: 0; }
.mwwc-input-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    border: 1px solid var(--mwwc-border);
    border-radius: 10px;
    padding: 6px 8px 6px 14px;
    background: #fff;
    transition: border-color 0.2s ease;
}
.mwwc-input-row:focus-within {
    border-color: var(--mwwc-green);
}
.mwwc-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 15px;
    line-height: 1.4;
    padding: 8px 0;
    color: var(--mwwc-text);
    min-width: 0;
    font-family: inherit;
    resize: none;
    overflow-y: auto;
    /* 4 Zeilen: font-size × line-height × rows + vertikales Padding */
    max-height: calc(15px * 1.4 * 4 + 16px);
}
.mwwc-input::placeholder {
    color: #9ca3af;
    font-weight: 600;
}
.mwwc-send {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--mwwc-text);
    transition: background 0.15s ease, color 0.15s ease;
    flex-shrink: 0;
}
.mwwc-send:hover,
.mwwc-send:focus-visible {
    background: #f3f4f6;
    color: var(--mwwc-green-dark);
    outline: none;
}

.mwwc-privacy {
    font-size: 11px;
    line-height: 1.4;
    color: var(--mwwc-text-muted);
    margin: 10px 2px 0;
}
.mwwc-privacy a { color: inherit; text-decoration: underline; }

/* Screen Reader */
.screen-reader-text {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
    word-wrap: normal !important;
}

/* Mobile */
@media (max-width: 480px) {
    #mwwc-wrapper {
        bottom: 16px;
        right: 16px;
    }
    .mwwc-chatbox {
        width: calc(100vw - 32px);
        right: 0;
        bottom: 76px;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .mwwc-toggle,
    .mwwc-toggle-icon,
    .mwwc-chatbox {
        transition: none;
    }
}
