/*
 Description: Multi-messenger floating buttons CSS.
 Author: Maestro del SEO
 Version: 2.0.1
*/

/* ──────────────────────────────────────────────
   WRAPPER (fixed-position container)
   ────────────────────────────────────────────── */
.bwa-wrapper {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    transition: none;
}

/* Left-aligned wrappers */
.bwa-wrapper.bwa-pos-bottom-left,
.bwa-wrapper.bwa-pos-top-left {
    align-items: flex-start;
}

/* ──────────────────────────────────────────────
   FLOATING BUTTON
   ────────────────────────────────────────────── */
.bwa-floating-btn {
    width: 64px;
    height: 64px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .18s ease, box-shadow .18s ease;
    border-radius: 50%;
    box-shadow: 0 6px 18px rgba(0,0,0,.20);
    background: transparent;
    position: relative;
}
.bwa-floating-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 8px 24px rgba(0,0,0,.25);
}
.bwa-floating-btn:active {
    transform: scale(.96);
}

/* Pulse animation for the button */
.bwa-floating-btn::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    opacity: 0;
    animation: bwa-pulse 2.5s ease-out infinite;
    z-index: -1;
}

.bwa-wrapper[data-messenger="whatsapp"] .bwa-floating-btn::before {
    background: rgba(37, 211, 102, 0.25);
}
.bwa-wrapper[data-messenger="telegram"] .bwa-floating-btn::before {
    background: rgba(0, 136, 204, 0.25);
}
.bwa-wrapper[data-messenger="signal"] .bwa-floating-btn::before {
    background: rgba(58, 118, 240, 0.25);
}

@keyframes bwa-pulse {
    0%   { transform: scale(1); opacity: 0.6; }
    70%  { transform: scale(1.35); opacity: 0; }
    100% { transform: scale(1.35); opacity: 0; }
}

/* Icon image */
.bwa-icon-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    border-radius: 0%;
}

/* ──────────────────────────────────────────────
   CHAT WINDOW
   ────────────────────────────────────────────── */
.bwa-chat-window {
    position: absolute;
    width: 340px;
    max-width: calc(100vw - 32px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 18px 40px rgba(0,0,0,.22);
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transition: transform .25s ease, opacity .25s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    margin-bottom: 0;
}

/* Default: bottom positions — chat opens above, slides down into view */
.bwa-pos-bottom-right .bwa-chat-window {
    transform-origin: bottom right;
    transform: translateY(-10px) scale(.97);
}
.bwa-pos-bottom-left .bwa-chat-window {
    transform-origin: bottom left;
    transform: translateY(-10px) scale(.97);
}

/* Top positions — chat opens below, slides up into view */
.bwa-pos-top-right .bwa-chat-window {
    transform-origin: top right;
    transform: translateY(10px) scale(.97);
}
.bwa-pos-top-left .bwa-chat-window {
    transform-origin: top left;
    transform: translateY(10px) scale(.97);
}

.bwa-chat-window.open {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: auto;
}

/* Active chat wrapper gets higher z-index to avoid overlap */
.bwa-wrapper.bwa-chat-active {
    z-index: 10001 !important;
}

/* ──────────────────────────────────────────────
   CHAT HEADER
   ────────────────────────────────────────────── */
.bwa-chat-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
}

.bwa-chat-image {
    width: 44px;
    height: 44px;
    object-fit: cover;
    border-radius: 50%;
    display: block;
    border: 2px solid rgba(0,0,0,.06);
}

.bwa-chat-title {
    font-size: 14.5px;
    color: #111;
    font-weight: 600;
    flex: 1;
    line-height: 1.3;
}

.bwa-close-btn {
    background: transparent;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #888;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s ease, color .15s ease;
}
.bwa-close-btn:hover {
    background: rgba(0,0,0,.06);
    color: #333;
}

/* ──────────────────────────────────────────────
   CHAT BODY
   ────────────────────────────────────────────── */
.bwa-chat-body {
    padding: 14px;
    min-height: 90px;
    max-height: 220px;
    overflow: auto;
    background: #fafafa;
    background-size: cover;
}

.bwa-chat-text {
    padding: 10px 14px;
    border-radius: 12px;
    border-top-right-radius: 2px;
    line-height: 1.45;
    max-width: 88%;
    word-wrap: break-word;
}

/* ──────────────────────────────────────────────
   CHAT FOOTER
   ────────────────────────────────────────────── */
.bwa-chat-footer {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    align-items: center;
    background: #fff;
}

.bwa-input {
    flex: 1;
    padding: 10px 14px;
    border-radius: 22px;
    border: 1px solid #ddd;
    font-size: 14px;
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
    font-family: inherit;
}
.bwa-input:focus {
    border-color: #aaa;
    box-shadow: 0 0 0 3px rgba(0,0,0,.04);
}

/* Per-messenger input focus colors */
.bwa-wrapper[data-messenger="whatsapp"] .bwa-input:focus {
    border-color: #25D366;
    box-shadow: 0 0 0 3px rgba(37,211,102,.12);
}
.bwa-wrapper[data-messenger="telegram"] .bwa-input:focus {
    border-color: #0088cc;
    box-shadow: 0 0 0 3px rgba(0,136,204,.12);
}
.bwa-wrapper[data-messenger="signal"] .bwa-input:focus {
    border-color: #3A76F0;
    box-shadow: 0 0 0 3px rgba(58,118,240,.12);
}

.bwa-send-btn {
    padding: 10px 16px;
    border-radius: 22px;
    border: none;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    font-size: 14px;
    min-width: 80px;
    transition: opacity .15s ease, transform .15s ease;
    font-family: inherit;
}
.bwa-send-btn:hover {
    opacity: .9;
    transform: scale(1.02);
}
.bwa-send-btn:disabled,
.bwa-send-btn.disabled {
    opacity: .5;
    cursor: not-allowed;
    transform: none;
}

/* ──────────────────────────────────────────────
   SHAKE ANIMATION (empty input)
   ────────────────────────────────────────────── */
@keyframes bwa-shake {
    0%   { transform: translateX(0); }
    25%  { transform: translateX(-6px); }
    50%  { transform: translateX(6px); }
    75%  { transform: translateX(-4px); }
    100% { transform: translateX(0); }
}
.bwa-shake {
    animation: bwa-shake .35s ease;
}

/* ──────────────────────────────────────────────
   CLIPBOARD NOTICE (Signal)
   ────────────────────────────────────────────── */
.bwa-clipboard-notice {
    background: #e8f0fe;
    color: #1a56db;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 12px;
    margin-top: 8px;
    text-align: center;
}

/* ──────────────────────────────────────────────
   RESPONSIVE
   ────────────────────────────────────────────── */
@media (max-width: 480px) {
    .bwa-chat-window {
        width: calc(100vw - 24px);
        max-width: calc(100vw - 24px);
    }

    .bwa-floating-btn {
        width: 54px;
        height: 54px;
    }

    /* On mobile, override position to avoid overflow */
    .bwa-wrapper {
        z-index: 9999 !important;
    }
    .bwa-wrapper.bwa-chat-active {
        z-index: 10001 !important;
    }
}

@media (max-width: 360px) {
    .bwa-chat-window {
        width: calc(100vw - 16px);
        max-width: calc(100vw - 16px);
    }
    .bwa-floating-btn {
        width: 48px;
        height: 48px;
    }
}
