/* ── My Agent WP — Chat Widget ──────────────────────────────────────── */

:root {
    --maw-color: #2563eb; /* sobrescrito via wp_head com a cor configurada */
    --maw-radius: 16px;
    --maw-shadow: 0 8px 32px rgba(0,0,0,.18);
    --maw-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ── Widget container ────────────────────────────────────────────────── */

#maw-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    font-family: var(--maw-font);
    font-size: 15px;
    line-height: 1.5;
}

/* ── Bubble button ───────────────────────────────────────────────────── */

.maw-bubble {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--maw-color);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--maw-shadow);
    outline: none;
    margin-left: auto;
    animation: mawBubbleBreathe 2.4s ease-in-out infinite;
}

.maw-widget.is-open .maw-bubble {
    animation: none;
    transform: scale(1);
}

.maw-bubble:hover {
    animation-play-state: paused;
    transform: scale(1.1);
    box-shadow: 0 12px 36px rgba(0,0,0,.24);
}

@keyframes mawBubbleBreathe {
    0%, 100% { transform: scale(1);    box-shadow: var(--maw-shadow); }
    50%       { transform: scale(1.09); box-shadow: 0 12px 36px rgba(0,0,0,.22); }
}

.maw-bubble:hover {
    transform: scale(1.08);
    box-shadow: 0 12px 36px rgba(0,0,0,.24);
}

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

.maw-bubble-icon {
    width: 26px;
    height: 26px;
    color: #fff;
    flex-shrink: 0;
    transition: opacity .15s, transform .15s;
}

.maw-icon-close { display: none; }

.maw-widget.is-open .maw-icon-open  { display: none; }
.maw-widget.is-open .maw-icon-close { display: block; }

/* ── Chat panel ─────────────────────────────────────────────────────── */

.maw-panel {
    position: absolute;
    bottom: 68px;
    right: 0;
    width: 340px;
    max-height: 520px;
    background: #fff;
    border-radius: var(--maw-radius);
    box-shadow: var(--maw-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    animation: mawPanelIn .2s ease;
}

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

@keyframes mawPanelIn {
    from { opacity: 0; transform: scale(.92) translateY(8px); }
    to   { opacity: 1; transform: scale(1)  translateY(0); }
}

/* ── Header ─────────────────────────────────────────────────────────── */

.maw-panel-header {
    background: var(--maw-color);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.maw-agent-info {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
}

.maw-agent-dot {
    width: 9px;
    height: 9px;
    background: #4ade80;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 0 2px rgba(255,255,255,.4);
}

.maw-agent-name {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
}

.maw-close-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    color: rgba(255,255,255,.85);
    border-radius: 6px;
    transition: background .15s, color .15s;
}

.maw-close-btn:hover { background: rgba(255,255,255,.15); color: #fff; }

.maw-close-btn svg {
    width: 18px;
    height: 18px;
}

/* ── Messages area ───────────────────────────────────────────────────── */

.maw-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
}

.maw-messages::-webkit-scrollbar { width: 4px; }
.maw-messages::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; }

/* ── Message bubbles ─────────────────────────────────────────────────── */

.maw-msg {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
}

.maw-msg--agent {
    background: #f3f4f6;
    color: #111827;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.maw-msg--user {
    background: var(--maw-color);
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

/* ── Typing indicator ────────────────────────────────────────────────── */

.maw-typing {
    display: flex;
    gap: 5px;
    align-items: center;
    padding: 10px 14px;
    background: #f3f4f6;
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    width: fit-content;
}

.maw-typing span {
    width: 7px;
    height: 7px;
    background: #9ca3af;
    border-radius: 50%;
    display: inline-block;
    animation: mawDot 1.2s infinite ease-in-out;
}

.maw-typing span:nth-child(2) { animation-delay: .2s; }
.maw-typing span:nth-child(3) { animation-delay: .4s; }

@keyframes mawDot {
    0%, 80%, 100% { transform: translateY(0); }
    40%           { transform: translateY(-5px); }
}

/* ── Input area ─────────────────────────────────────────────────────── */

.maw-input-area {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px 14px;
    border-top: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.maw-input {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 9px 12px;
    font-family: var(--maw-font);
    font-size: 14px;
    line-height: 1.4;
    resize: none;
    outline: none;
    max-height: 96px;
    overflow-y: auto;
    transition: border-color .15s;
}

.maw-input:focus { border-color: var(--maw-color); }

.maw-send-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--maw-color);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
    transition: opacity .15s, transform .1s;
}

.maw-send-btn:hover   { opacity: .88; }
.maw-send-btn:active  { transform: scale(.94); }
.maw-send-btn:disabled { opacity: .45; cursor: default; }

.maw-send-btn svg {
    width: 18px;
    height: 18px;
}

/* ── Responsive ──────────────────────────────────────────────────────── */

@media (max-width: 420px) {
    #maw-widget {
        bottom: 16px;
        right: 16px;
    }

    .maw-panel {
        width: calc(100vw - 32px);
        right: 0;
    }
}
