/* ─── WA ChatBot Front-end Widget ─── */
:root {
    --wa-btn-color:  #25D366;
    --wa-btn-shadow: rgba(37, 211, 102, 0.5);
    --wa-dark:       #128C7E;
    --wa-radius:     18px;
}

/* ── FLOATING BUTTON ── */
#wa-chatbot-btn {
    position: fixed;
    width: var(--wa-size, 60px);
    height: var(--wa-size, 60px);
    border-radius: 50%;
    background: var(--wa-btn-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 99999;
    box-shadow: 0 6px 20px var(--wa-btn-shadow);
    transition: transform .25s cubic-bezier(.34,1.56,.64,1), box-shadow .25s;
    text-decoration: none;
}
#wa-chatbot-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 10px 28px var(--wa-btn-shadow);
}
#wa-chatbot-btn.pulse::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--wa-btn-color);
    opacity: 0.6;
    animation: wa-pulse 2s ease-out infinite;
    z-index: -1;
}
@keyframes wa-pulse {
    0%   { transform: scale(1); opacity: 0.6; }
    70%  { transform: scale(1.55); opacity: 0; }
    100% { transform: scale(1.55); opacity: 0; }
}

#wa-chatbot-btn svg {
    width: 56%;
    height: 56%;
    fill: #fff;
    transition: transform .3s;
}
#wa-chatbot-btn.open svg.wa-icon-wa  { transform: scale(0) rotate(-90deg); display: none; }
#wa-chatbot-btn.open svg.wa-icon-close { display: block !important; }
#wa-chatbot-btn svg.wa-icon-close { display: none; }

/* Positions */
#wa-chatbot-btn.bottom-right { bottom: 24px; right: 24px; }
#wa-chatbot-btn.bottom-left  { bottom: 24px; left: 24px; }
#wa-chatbot-btn.top-right    { top: 24px;    right: 24px; }
#wa-chatbot-btn.top-left     { top: 24px;    left: 24px; }

/* Badge */
.wa-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    width: 20px;
    height: 20px;
    background: #e53e3e;
    border-radius: 50%;
    border: 2px solid #fff;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: sans-serif;
    animation: wa-badge-bounce .5s .8s ease-out both;
}
@keyframes wa-badge-bounce {
    0%   { transform: scale(0); }
    70%  { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* Tooltip */
.wa-tooltip {
    position: absolute;
    background: #1a202c;
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    padding: 7px 13px;
    border-radius: 8px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity .2s, transform .2s;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    transform: translateX(6px);
}
.wa-tooltip::after {
    content: '';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    border: 5px solid transparent;
}
.bottom-right .wa-tooltip,
.top-right    .wa-tooltip { right: calc(100% + 10px); }
.bottom-right .wa-tooltip::after,
.top-right    .wa-tooltip::after { right: -10px; border-left-color: #1a202c; }
.bottom-left  .wa-tooltip,
.top-left     .wa-tooltip { left: calc(100% + 10px); }
.bottom-left  .wa-tooltip::after,
.top-left     .wa-tooltip::after { left: -10px; border-right-color: #1a202c; }

#wa-chatbot-btn:hover .wa-tooltip {
    opacity: 1;
    transform: translateX(0);
}

/* ── POPUP WINDOW ── */
#wa-chatbot-popup {
    position: fixed;
    z-index: 99998;
    width: 320px;
    border-radius: var(--wa-radius);
    box-shadow: 0 16px 48px rgba(0,0,0,0.18);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transform: scale(0.85) translateY(16px);
    transition: opacity .28s cubic-bezier(.34,1.56,.64,1), transform .28s cubic-bezier(.34,1.56,.64,1);
    transform-origin: bottom right;
}
#wa-chatbot-popup.open {
    opacity: 1;
    pointer-events: all;
    transform: scale(1) translateY(0);
}

/* Popup positions */
#wa-chatbot-popup.bottom-right { bottom: 96px; right: 24px; transform-origin: bottom right; }
#wa-chatbot-popup.bottom-left  { bottom: 96px; left: 24px;  transform-origin: bottom left; }
#wa-chatbot-popup.top-right    { top: 96px;    right: 24px; transform-origin: top right; }
#wa-chatbot-popup.top-left     { top: 96px;    left: 24px;  transform-origin: top left; }

/* Popup Header */
.wa-popup-header {
    background: linear-gradient(135deg, #25D366, #128C7E);
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.wa-popup-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: rgba(255,255,255,0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}
.wa-popup-avatar svg { width: 28px; height: 28px; fill: #fff; }
.wa-popup-info { flex: 1; }
.wa-popup-name { font-size: 15px; font-weight: 700; color: #fff; line-height: 1.2; }
.wa-popup-role { font-size: 12px; color: rgba(255,255,255,0.8); margin-top: 2px; }
.wa-online-dot {
    width: 8px; height: 8px;
    background: #b5ffd9;
    border-radius: 50%;
    display: inline-block;
    margin-right: 5px;
    animation: wa-blink 1.5s infinite;
}
@keyframes wa-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: .3; }
}
.wa-offline-badge {
    font-size: 11px;
    color: rgba(255,255,255,0.7);
    background: rgba(0,0,0,.2);
    padding: 2px 8px;
    border-radius: 20px;
    display: inline-block;
    margin-top: 4px;
}

/* Popup Body */
.wa-popup-body {
    background: #ece5dd;
    padding: 16px 14px;
    min-height: 80px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Crect width='300' height='300' fill='%23ece5dd'/%3E%3C/svg%3E");
}
.wa-chat-bubble {
    background: #fff;
    border-radius: 0 10px 10px 10px;
    padding: 10px 13px;
    font-size: 14px;
    color: #1a1a1a;
    line-height: 1.5;
    box-shadow: 0 1px 2px rgba(0,0,0,0.12);
    max-width: 88%;
    position: relative;
    animation: wa-bubble-in .3s .1s ease-out both;
}
@keyframes wa-bubble-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: none; }
}
.wa-chat-bubble::before {
    content: '';
    position: absolute;
    top: 0; left: -8px;
    border: 8px solid transparent;
    border-right-color: #fff;
    border-top-color: #fff;
}
.wa-bubble-time {
    font-size: 11px;
    color: #999;
    text-align: right;
    margin-top: 4px;
}

/* Popup Footer */
.wa-popup-footer {
    background: #f0f0f0;
    padding: 12px 14px;
}
.wa-popup-input-wrap {
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 24px;
    padding: 5px 5px 5px 14px;
    gap: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.wa-popup-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 14px;
    background: transparent;
    color: #1a1a1a;
    font-family: inherit;
    resize: none;
    line-height: 1.4;
}
.wa-popup-send {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--wa-btn-color);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .2s, transform .15s;
}
.wa-popup-send:hover { background: var(--wa-dark); transform: scale(1.05); }
.wa-popup-send svg { width: 18px; height: 18px; fill: #fff; }

.wa-popup-offline {
    background: #fff3cd;
    border-radius: 8px;
    padding: 10px 13px;
    font-size: 13px;
    color: #856404;
    line-height: 1.4;
    text-align: center;
}

/* ── RESPONSIVE ── */
@media (max-width: 480px) {
    #wa-chatbot-popup { width: calc(100vw - 32px); }
    #wa-chatbot-btn.bottom-right { bottom: 16px; right: 16px; }
    #wa-chatbot-btn.bottom-left  { bottom: 16px; left: 16px; }
    #wa-chatbot-popup.bottom-right { right: 16px; bottom: 90px; }
    #wa-chatbot-popup.bottom-left  { left: 16px;  bottom: 90px; }
    .wa-tooltip { display: none; }
}

/* ── HIDDEN ── */
.wa-btn-hidden { opacity: 0 !important; pointer-events: none !important; transform: scale(0) !important; }
