/* ── WEXA AI Chat Widget ──────────────────────────────────────────────────── */

:root {
    --wexa-navy:     #05070F;
    --wexa-surface:  #0C0F1E;
    --wexa-surface2: #111827;
    --wexa-border:   #1E2A3A;
    --wexa-cyan:     #00D4FF;
    --wexa-violet:   #7B5EA7;
    --wexa-text:     #B0C4DE;
    --wexa-white:    #FFFFFF;
    --wexa-radius:   16px;
    --wexa-width:    400px;
}

#wxcl-wexa-widget {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 9991;
    font-family: 'Figtree', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ── Floating trigger button ─────────────────────────────────────────────── */
.wxcl-wexa-float {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--wexa-cyan), var(--wexa-violet));
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 24px rgba(0, 212, 255, 0.45);
    transition: transform 0.2s, box-shadow 0.2s;
    padding: 0;
    position: relative;
}
.wxcl-wexa-float:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 32px rgba(0, 212, 255, 0.65);
}
.wxcl-wexa-icon { width: 32px; height: 32px; }

/* Notification badge (unread indicator) */
.wxcl-wexa-float::after {
    content: '';
    position: absolute;
    top: 4px;
    right: 4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #00FF9D;
    border: 2px solid var(--wexa-navy);
    animation: wexa-badge-pulse 2s infinite;
}
@keyframes wexa-badge-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.6; transform: scale(0.85); }
}

/* ── Panel ───────────────────────────────────────────────────────────────── */
.wxcl-wexa-panel {
    position: absolute;
    bottom: 68px;
    left: 0;
    width: var(--wexa-width);
    max-width: calc(100vw - 48px);
    height: 560px;
    max-height: calc(100vh - 100px);
    background: var(--wexa-surface);
    border: 1px solid var(--wexa-border);
    border-radius: var(--wexa-radius);
    box-shadow: 0 32px 80px rgba(0,0,0,0.7), 0 0 0 1px rgba(0,212,255,0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom left;
    transform: scale(0.92) translateY(10px);
    opacity: 0;
    transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1),
                opacity 0.22s ease;
    pointer-events: none;
}
.wxcl-wexa-panel--open {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: all;
}
.wxcl-wexa-panel[hidden] { display: none; }

/* ── Header ──────────────────────────────────────────────────────────────── */
.wxcl-wexa-header {
    background: linear-gradient(135deg, #0D1529 0%, #111827 100%);
    border-bottom: 1px solid var(--wexa-border);
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.wxcl-wexa-header-left { display: flex; align-items: center; gap: 12px; }

.wxcl-wexa-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(0,212,255,0.2), rgba(123,94,167,0.2));
    border: 1px solid var(--wexa-cyan);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.wxcl-wexa-title {
    color: var(--wexa-white);
    font-weight: 800;
    font-size: 0.95rem;
    letter-spacing: 0.03em;
}
.wxcl-wexa-subtitle {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--wexa-cyan);
    font-size: 0.75rem;
    font-weight: 500;
}
.wxcl-wexa-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #00FF9D;
    flex-shrink: 0;
    animation: wexa-blink 2s infinite;
}
@keyframes wexa-blink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.4; }
}

.wxcl-wexa-close {
    background: transparent;
    border: 1px solid var(--wexa-border);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--wexa-text);
    transition: border-color 0.2s, color 0.2s;
    flex-shrink: 0;
}
.wxcl-wexa-close:hover { border-color: var(--wexa-cyan); color: var(--wexa-cyan); }

/* ── Messages area ───────────────────────────────────────────────────────── */
.wxcl-wexa-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}
.wxcl-wexa-messages::-webkit-scrollbar { width: 4px; }
.wxcl-wexa-messages::-webkit-scrollbar-track { background: transparent; }
.wxcl-wexa-messages::-webkit-scrollbar-thumb { background: var(--wexa-border); border-radius: 2px; }

/* Message rows */
.wxcl-wexa-msg {
    display: flex;
    max-width: 88%;
}
.wxcl-wexa-msg--user {
    align-self: flex-end;
    flex-direction: row-reverse;
}
.wxcl-wexa-msg--assistant {
    align-self: flex-start;
}

/* Bubbles */
.wxcl-wexa-bubble {
    padding: 11px 15px;
    border-radius: 14px;
    font-size: 0.875rem;
    line-height: 1.65;
}
.wxcl-wexa-msg--user .wxcl-wexa-bubble {
    background: linear-gradient(135deg, rgba(0,212,255,0.15), rgba(123,94,167,0.15));
    border: 1px solid rgba(0,212,255,0.25);
    color: var(--wexa-white);
    border-bottom-right-radius: 4px;
}
.wxcl-wexa-msg--assistant .wxcl-wexa-bubble {
    background: var(--wexa-surface2);
    border: 1px solid var(--wexa-border);
    color: var(--wexa-text);
    border-bottom-left-radius: 4px;
}
.wxcl-wexa-bubble strong { color: var(--wexa-white); }
.wxcl-wexa-bubble a {
    color: var(--wexa-cyan);
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* Typing indicator */
.wxcl-wexa-typing .wxcl-wexa-bubble {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 14px 16px;
}
.wxcl-wexa-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--wexa-cyan);
    animation: wexa-type 1.4s infinite;
}
.wxcl-wexa-dot:nth-child(2) { animation-delay: 0.2s; }
.wxcl-wexa-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes wexa-type {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
    30%            { transform: translateY(-5px); opacity: 1; }
}

/* CTA rows */
.wxcl-wexa-cta-row { display: flex; padding: 0 4px; }
.wxcl-wexa-cta-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, var(--wexa-cyan), var(--wexa-violet));
    color: #000;
    font-weight: 700;
    font-size: 0.85rem;
    padding: 11px 20px;
    border-radius: 10px;
    text-decoration: none;
    transition: opacity 0.2s;
}
.wxcl-wexa-cta-btn:hover { opacity: 0.9; }
.wxcl-wexa-cta-btn--wa { background: #25D366; color: #fff; }

/* ── Quick chips ─────────────────────────────────────────────────────────── */
.wxcl-wexa-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 16px;
    border-top: 1px solid var(--wexa-border);
    flex-shrink: 0;
}
.wxcl-wexa-chip {
    background: rgba(0,212,255,0.07);
    border: 1px solid rgba(0,212,255,0.25);
    color: var(--wexa-cyan);
    font-size: 0.78rem;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 20px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    font-family: inherit;
}
.wxcl-wexa-chip:hover {
    background: rgba(0,212,255,0.15);
    border-color: var(--wexa-cyan);
}

/* ── Input row ───────────────────────────────────────────────────────────── */
.wxcl-wexa-input-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px 14px;
    border-top: 1px solid var(--wexa-border);
    background: var(--wexa-surface);
    flex-shrink: 0;
}
.wxcl-wexa-textarea {
    flex: 1;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--wexa-border);
    border-radius: 10px;
    padding: 10px 14px;
    color: var(--wexa-white);
    font-size: 0.875rem;
    font-family: inherit;
    resize: none;
    min-height: 40px;
    max-height: 120px;
    line-height: 1.5;
    transition: border-color 0.2s;
}
.wxcl-wexa-textarea::placeholder { color: #4A6180; }
.wxcl-wexa-textarea:focus {
    outline: none;
    border-color: var(--wexa-cyan);
    box-shadow: 0 0 0 3px rgba(0,212,255,0.12);
}

.wxcl-wexa-send {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--wexa-cyan), var(--wexa-violet));
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
    flex-shrink: 0;
    transition: opacity 0.2s, transform 0.15s;
}
.wxcl-wexa-send:hover   { transform: scale(1.05); }
.wxcl-wexa-send:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ── Attribution ─────────────────────────────────────────────────────────── */
.wxcl-wexa-attribution {
    padding: 6px 14px 8px;
    font-size: 0.68rem;
    color: #2D3A4A;
    text-align: center;
    flex-shrink: 0;
    letter-spacing: 0.04em;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
    #wxcl-wexa-widget { bottom: 16px; left: 16px; }
    .wxcl-wexa-panel {
        left: -4px;
        width: calc(100vw - 24px);
        height: 70vh;
        bottom: 64px;
    }
}

/* Ensure WEXA and WhatsApp widgets don't overlap */
#wxcl-wa-widget  { right: 24px; left: auto; }
#wxcl-wexa-widget { left: 24px; right: auto; }
