/* =============================================
   WA ChatBot — Frontend Widget Styles
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --wac-accent: #25D366; /* overridden inline per user config */
    --wac-accent-dark: #128C7E;
    --wac-white: #ffffff;
    --wac-chat-bg: #f0f2f5;
    --wac-bubble-bg: #ffffff;
    --wac-text: #111827;
    --wac-muted: #6b7280;
    --wac-radius-lg: 20px;
    --wac-shadow: 0 4px 24px rgba(0,0,0,.18);
    --wac-shadow-btn: 0 6px 24px rgba(0,0,0,.22);
}

/* ---- Widget container ---- */
#wac-widget {
    position: fixed;
    bottom: 24px;
    z-index: 99999;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

#wac-widget.wac-widget--right { right: 24px; }
#wac-widget.wac-widget--left  { left: 24px; }

/* ---- Launcher Button ---- */
.wac-launcher {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 20px 0 0;
    height: 58px;
    background: var(--wac-accent);
    color: var(--wac-white);
    border: none;
    border-radius: 999px;
    cursor: pointer;
    box-shadow: var(--wac-shadow-btn);
    transition: transform .25s cubic-bezier(.34,1.56,.64,1), box-shadow .25s;
    overflow: hidden;
    outline: none;
    font-family: inherit;
}

.wac-launcher:hover {
    transform: scale(1.05) translateY(-2px);
    box-shadow: 0 10px 32px rgba(0,0,0,.28);
}

.wac-launcher:active { transform: scale(.97); }

.wac-launcher__icon {
    width: 58px;
    height: 58px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity .2s, transform .3s cubic-bezier(.34,1.56,.64,1);
}

.wac-launcher__icon--open  { opacity: 1; transform: rotate(0deg) scale(1); }
.wac-launcher__icon--close { opacity: 0; transform: rotate(-90deg) scale(.6); position: absolute; left: 0; }

.wac-launcher.is-open .wac-launcher__icon--open  { opacity: 0; transform: rotate(90deg) scale(.6); }
.wac-launcher.is-open .wac-launcher__icon--close { opacity: 1; transform: rotate(0deg) scale(1); }

.wac-launcher__label {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: .2px;
    white-space: nowrap;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Pulse animation */
.wac-launcher__pulse {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translate(-50%, -50%);
    width: 58px;
    height: 58px;
    background: var(--wac-accent);
    border-radius: 50%;
    opacity: .35;
    animation: wac-pulse 2.4s ease-out infinite;
    pointer-events: none;
}

@keyframes wac-pulse {
    0%   { transform: translate(-50%, -50%) scale(1); opacity: .35; }
    70%  { transform: translate(-50%, -50%) scale(1.6); opacity: 0; }
    100% { transform: translate(-50%, -50%) scale(1.6); opacity: 0; }
}

.wac-launcher.is-open .wac-launcher__pulse { animation: none; opacity: 0; }

/* ---- Popup ---- */
.wac-popup {
    position: absolute;
    bottom: 74px;
    width: 340px;
    background: var(--wac-white);
    border-radius: var(--wac-radius-lg);
    box-shadow: var(--wac-shadow);
    overflow: hidden;
    border: 1px solid rgba(0,0,0,.07);
    transform-origin: bottom center;
    transform: scale(.92) translateY(12px);
    opacity: 0;
    transition: transform .3s cubic-bezier(.34,1.4,.64,1), opacity .25s ease;
    pointer-events: none;
}

.wac-widget--right .wac-popup { right: 0; }
.wac-widget--left  .wac-popup { left: 0; }

.wac-popup.is-visible {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: all;
}

/* Popup Header */
.wac-popup__header {
    background: var(--wac-accent);
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.wac-popup__agent {
    display: flex;
    align-items: center;
    gap: 12px;
}

.wac-popup__avatar {
    width: 46px;
    height: 46px;
    background: rgba(255,255,255,.22);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
}

.wac-popup__status-dot {
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2.5px solid var(--wac-accent);
}

.wac-popup__status-dot--online  { background: #22c55e; }
.wac-popup__status-dot--away    { background: #eab308; }
.wac-popup__status-dot--offline { background: #ef4444; }

.wac-popup__agent-info strong {
    display: block;
    color: white;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
}

.wac-popup__agent-info span {
    display: block;
    color: rgba(255,255,255,.8);
    font-size: 12px;
    margin-top: 2px;
}

.wac-popup__close {
    background: rgba(255,255,255,.18);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .15s;
    flex-shrink: 0;
    outline: none;
}

.wac-popup__close:hover { background: rgba(255,255,255,.3); }

/* Chat Body */
.wac-popup__body {
    background: var(--wac-chat-bg);
    padding: 18px 16px;
    min-height: 100px;
    /* WhatsApp chat bg pattern */
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23d1d5db' fill-opacity='0.25'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

/* Chat Bubble */
.wac-chat-bubble {
    animation: wac-bubble-in .4s cubic-bezier(.34,1.56,.64,1) both;
    animation-delay: .1s;
    opacity: 0;
}

@keyframes wac-bubble-in {
    from { opacity: 0; transform: translateX(-12px) scale(.9); }
    to   { opacity: 1; transform: translateX(0) scale(1); }
}

.wac-chat-bubble__inner {
    background: var(--wac-bubble-bg);
    border-radius: 0 16px 16px 16px;
    padding: 12px 14px 10px;
    max-width: 88%;
    box-shadow: 0 1px 3px rgba(0,0,0,.1);
    position: relative;
}

.wac-chat-bubble__inner::before {
    content: '';
    position: absolute;
    top: 0;
    left: -8px;
    width: 0;
    height: 0;
    border-top: 0 solid transparent;
    border-right: 8px solid var(--wac-bubble-bg);
    border-bottom: 10px solid transparent;
}

.wac-chat-bubble__title {
    font-size: 14px;
    font-weight: 700;
    color: var(--wac-text);
    margin: 0 0 5px;
}

.wac-chat-bubble__text {
    font-size: 13.5px;
    color: #374151;
    line-height: 1.55;
    margin: 0 0 6px;
}

.wac-chat-bubble__time {
    font-size: 11px;
    color: var(--wac-muted);
    float: right;
}

/* Footer */
.wac-popup__footer {
    padding: 14px 16px 16px;
    background: white;
    border-top: 1px solid #f3f4f6;
}

.wac-cta-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 13px;
    background: var(--wac-accent);
    color: white;
    text-decoration: none;
    border-radius: 13px;
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    transition: all .2s;
    letter-spacing: .1px;
    box-shadow: 0 4px 14px rgba(37,211,102,.35);
}

.wac-cta-btn:hover {
    background: #1dbc5c;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(37,211,102,.45);
    color: white;
    text-decoration: none;
}

.wac-powered {
    text-align: center;
    font-size: 11px;
    color: var(--wac-muted);
    margin: 10px 0 0;
}

/* ---- Responsive ---- */
@media (max-width: 480px) {
    #wac-widget.wac-widget--right { right: 16px; }
    #wac-widget.wac-widget--left  { left: 16px; }
    #wac-widget { bottom: 16px; }

    .wac-launcher { padding-right: 14px; height: 54px; }
    .wac-launcher__icon { width: 54px; height: 54px; }
    .wac-launcher__label { max-width: 120px; font-size: 13px; }

    .wac-popup { width: calc(100vw - 32px); max-width: 340px; }
}
