/* Webexis AI Chatbot - Frontend Styles
   Developer: سعید رجب زاده | webexis.ir
   Themes: 10 presets + custom | Positions: 6 modes including side panels
*/

#wxc-chat-root {
    --wxc-primary: #6366f1;
    --wxc-user-bg: #6366f1;
    --wxc-user-color: #fff;
    --wxc-ai-bg: #f1f5f9;
    --wxc-ai-color: #1e293b;
    --wxc-agent-bg: #10b981;
    --wxc-agent-color: #fff;
    --wxc-radius: 16px;
    --wxc-font: 'Vazirmatn', Tahoma, sans-serif;
    font-family: var(--wxc-font);
    direction: rtl;
    z-index: 999999;
    position: fixed;
}

/* Positions */
.wxc-pos-bottom-right { bottom: var(--wxc-offset-y, 24px); right: var(--wxc-offset-x, 24px); left: auto; top: auto; }
.wxc-pos-bottom-left { bottom: var(--wxc-offset-y, 24px); left: var(--wxc-offset-x, 24px); right: auto; top: auto; }
.wxc-pos-top-right { top: var(--wxc-offset-y, 24px); right: var(--wxc-offset-x, 24px); left: auto; bottom: auto; }
.wxc-pos-top-left { top: var(--wxc-offset-y, 24px); left: var(--wxc-offset-x, 24px); right: auto; bottom: auto; }

/* Toggle Button */
.wxc-toggle-btn {
    width: var(--wxc-icon-size, 60px);
    height: var(--wxc-icon-size, 60px);
    border-radius: 50%;
    border: none;
    background: var(--wxc-primary);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.wxc-toggle-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.18), 0 6px 12px rgba(0, 0, 0, 0.08);
    filter: none;
    background: var(--wxc-primary); /* keep same color */
    color: #fff;
}

.wxc-toggle-btn:active {
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.14);
}

.wxc-toggle-btn.wxc-icon-square { border-radius: 12px; }
.wxc-toggle-btn.wxc-icon-circle { border-radius: 50%; }

.wxc-icon-svg {
    width: 55%;
    height: 55%;
    max-width: 28px;
    max-height: 28px;
    flex-shrink: 0;
}
.wxc-icon-img, .wxc-icon-video {
    width: 100%;
    height: 100%;
    object-fit: var(--wxc-icon-fit, contain);
    object-position: center;
    display: block;
    border-radius: inherit;
}
.wxc-toggle-btn {
    background: var(--wxc-icon-bg, var(--wxc-primary)) !important;
    padding: var(--wxc-icon-pad, 12px) !important;
    box-sizing: border-box !important;
    border: var(--wxc-icon-border, 0) solid rgba(15,23,42,0.1) !important;
    box-shadow: var(--wxc-icon-shadow, 0 8px 24px rgba(15,23,42,0.22)) !important;
    overflow: hidden;
}
.wxc-toggle-btn.wxc-icon-nobg {
    background: transparent !important;
    box-shadow: none !important;
}
.wxc-toggle-btn.wxc-icon-nobg:hover {
    background: transparent !important;
}

.wxc-badge {
    position: absolute;
    top: -4px;
    left: -4px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Chat Window */
.wxc-chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: var(--wxc-width, 380px);
    max-width: calc(100vw - 32px);
    height: var(--wxc-height, 560px);
    max-height: min(var(--wxc-height, 560px), 90vh);
    background: #fff;
    border-radius: var(--wxc-radius);
    box-shadow: 0 20px 60px rgba(0,0,0,0.15), 0 0 0 1px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: wxc-slide-up 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.wxc-pos-bottom-right .wxc-chat-window { right: 0; bottom: calc(var(--wxc-icon-size, 60px) + 12px); left: auto; top: auto; }
.wxc-pos-bottom-left .wxc-chat-window { left: 0; right: auto; bottom: calc(var(--wxc-icon-size, 60px) + 12px); top: auto; }
.wxc-pos-top-right .wxc-chat-window { right: 0; left: auto; top: calc(var(--wxc-icon-size, 60px) + 12px); bottom: auto; }
.wxc-pos-top-left .wxc-chat-window { left: 0; right: auto; top: calc(var(--wxc-icon-size, 60px) + 12px); bottom: auto; }

@keyframes wxc-slide-up {
    from { opacity: 0; transform: translateY(20px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Header */
.wxc-header {
    background: var(--wxc-primary);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.wxc-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.wxc-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.wxc-avatar svg { width: 22px; height: 22px; }

.wxc-title { font-weight: 700; font-size: 15px; }
.wxc-status { font-size: 12px; opacity: 0.9; }

.wxc-close-btn {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 26px;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
    opacity: 0.9;
}

.wxc-close-btn:hover { opacity: 1; }

/* Messages */
.wxc-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #fafafa;
}

.wxc-msg {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: var(--wxc-radius);
    font-size: 14px;
    line-height: 1.6;
    position: relative;
    animation: wxc-msg-in 0.25s ease;
}

@keyframes wxc-msg-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.wxc-msg-user {
    align-self: flex-start;
    background: var(--wxc-user-bg);
    color: var(--wxc-user-color);
    border-bottom-right-radius: 4px;
}

.wxc-msg-ai {
    align-self: flex-end;
    background: var(--wxc-ai-bg);
    color: var(--wxc-ai-color);
    border-bottom-left-radius: 4px;
}

.wxc-msg-agent {
    align-self: flex-end;
    background: var(--wxc-agent-bg);
    color: var(--wxc-agent-color);
    border-bottom-left-radius: 4px;
}

.wxc-msg-time {
    font-size: 10px;
    opacity: 0.7;
    margin-top: 4px;
    display: block;
}

.wxc-msg-system {
    align-self: center;
    background: #e2e8f0;
    color: #475569;
    font-size: 12px;
    padding: 6px 12px;
    border-radius: 20px;
}

/* Actions */
.wxc-actions {
    padding: 8px 16px;
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    background: #fff;
    border-top: 1px solid #f1f5f9;
}

.wxc-action-btn {
    flex: 1;
    padding: 8px 12px;
    border: none;
    border-radius: 10px;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}

.wxc-escalate {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
}

.wxc-escalate:hover { filter: brightness(1.05); }

.wxc-back {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: #fff;
}

/* Input */
.wxc-input-area {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px 16px;
    background: #fff;
    border-top: 1px solid #f1f5f9;
    flex-shrink: 0;
}

#wxc-input {
    flex: 1;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 10px 14px;
    font-family: inherit;
    font-size: 14px;
    resize: none;
    max-height: 100px;
    outline: none;
    transition: border-color 0.2s;
}

#wxc-input:focus {
    border-color: var(--wxc-primary);
}

#wxc-send-btn {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: none;
    background: var(--wxc-primary);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.2s;
}

#wxc-send-btn:hover { transform: scale(1.05); }
#wxc-send-btn svg { width: 20px; height: 20px; }

.wxc-footer {
    text-align: center;
    font-size: 11px;
    color: #94a3b8;
    padding: 6px;
    background: #fff;
}

.wxc-footer a { color: var(--wxc-primary); text-decoration: none; }

/* Typing indicator */
.wxc-typing {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    align-self: flex-end;
}

.wxc-typing span {
    width: 8px;
    height: 8px;
    background: #94a3b8;
    border-radius: 50%;
    animation: wxc-bounce 1.2s infinite;
}

.wxc-typing span:nth-child(2) { animation-delay: 0.15s; }
.wxc-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes wxc-bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}

/* ========== THEMES ========== */

/* 1. Aurora - Simple colorful */
.wxc-theme-aurora .wxc-chat-window {
    background: #fff;
}
.wxc-theme-aurora .wxc-messages {
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}

/* 2. Midnight - Dark */
.wxc-theme-midnight .wxc-chat-window {
    background: #0f172a;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.wxc-theme-midnight .wxc-messages {
    background: #1e293b;
}
.wxc-theme-midnight .wxc-msg-ai {
    background: #334155 !important;
    color: #e2e8f0 !important;
}
.wxc-theme-midnight .wxc-input-area,
.wxc-theme-midnight .wxc-actions,
.wxc-theme-midnight .wxc-footer {
    background: #0f172a;
    border-color: #334155;
}
.wxc-theme-midnight #wxc-input {
    background: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}
.wxc-theme-midnight .wxc-footer { color: #64748b; }

/* 3. Miniature - Detailed & mini ornaments */
.wxc-theme-miniature .wxc-chat-window {
    border: 2px solid #e2e8f0;
    box-shadow: 0 10px 40px rgba(0,0,0,0.08), inset 0 0 0 1px rgba(255,255,255,0.8);
}
.wxc-theme-miniature .wxc-header {
    background: linear-gradient(135deg, #8b5cf6, #6366f1, #3b82f6);
    position: relative;
}
.wxc-theme-miniature .wxc-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #f472b6, #a78bfa, #60a5fa);
}
.wxc-theme-miniature .wxc-msg {
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border: 1px solid rgba(0,0,0,0.04);
}
.wxc-theme-miniature .wxc-messages {
    background: 
        radial-gradient(circle at 10% 20%, rgba(99,102,241,0.03) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(139,92,246,0.03) 0%, transparent 40%),
        #fafafa;
}

/* 4. Nebula - Modern & beautiful */
.wxc-theme-nebula .wxc-chat-window {
    background: linear-gradient(160deg, #0f0c29, #302b63, #24243e);
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 25px 50px rgba(0,0,0,0.4), 0 0 80px rgba(99,102,241,0.15);
}
.wxc-theme-nebula .wxc-header {
    background: transparent;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.wxc-theme-nebula .wxc-messages {
    background: transparent;
}
.wxc-theme-nebula .wxc-msg-ai {
    background: rgba(255,255,255,0.08) !important;
    color: #e0e7ff !important;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.1);
}
.wxc-theme-nebula .wxc-msg-user {
    background: linear-gradient(135deg, #6366f1, #8b5cf6) !important;
}
.wxc-theme-nebula .wxc-input-area,
.wxc-theme-nebula .wxc-actions,
.wxc-theme-nebula .wxc-footer {
    background: rgba(0,0,0,0.2);
    border-color: rgba(255,255,255,0.08);
}
.wxc-theme-nebula #wxc-input {
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.12);
    color: #e0e7ff;
}
.wxc-theme-nebula .wxc-footer { color: #94a3b8; }
.wxc-theme-nebula .wxc-status { color: #a5b4fc; }

/* Mobile & Tablet */
@media (max-width: 768px) {
    #wxc-chat-root.wxc-pos-bottom-right,
    #wxc-chat-root.wxc-pos-bottom-left {
        bottom: 16px;
        right: 16px;
        left: auto;
    }
    #wxc-chat-root.wxc-pos-bottom-left {
        right: auto;
        left: 16px;
    }
    #wxc-chat-root.wxc-pos-top-right,
    #wxc-chat-root.wxc-pos-top-left {
        top: 16px;
        right: 16px;
        left: auto;
    }
    #wxc-chat-root.wxc-pos-top-left {
        right: auto;
        left: 16px;
    }

    .wxc-toggle-btn {
        width: 56px;
        height: 56px;
        box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
    }

    .wxc-chat-window {
        position: fixed !important;
        top: 0 !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        height: 100% !important;
        max-height: 100% !important;
        border-radius: 0 !important;
        z-index: 999999;
    }

    .wxc-header {
        padding: 12px 14px;
        padding-top: max(12px, env(safe-area-inset-top));
    }

    .wxc-messages {
        padding: 12px;
        -webkit-overflow-scrolling: touch;
    }

    .wxc-msg {
        max-width: 88%;
        font-size: 14px;
    }

    .wxc-input-area {
        padding: 10px 12px;
        padding-bottom: max(10px, env(safe-area-inset-bottom));
    }

    #wxc-input {
        font-size: 16px; /* prevents iOS zoom on focus */
    }

    .wxc-actions {
        padding: 8px 12px;
        flex-wrap: wrap;
    }

    .wxc-action-btn {
        font-size: 12px;
        padding: 8px 10px;
    }

    .wxc-prechat {
        padding: 20px 16px;
        padding-bottom: max(20px, env(safe-area-inset-bottom));
    }

    .wxc-prechat-fields input {
        font-size: 16px;
        padding: 12px 14px;
    }

    .wxc-footer {
        padding-bottom: max(6px, env(safe-area-inset-bottom));
    }
}

@media (max-width: 380px) {
    .wxc-title { font-size: 14px; }
    .wxc-msg { font-size: 13px; padding: 8px 12px; }
}


/* ========== Pre-chat Form ========== */
.wxc-prechat {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: #fafafa;
    min-height: 0;
}

.wxc-prechat-inner {
    width: 100%;
    max-width: 300px;
    text-align: center;
    animation: wxc-msg-in 0.35s ease;
}

.wxc-prechat-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 14px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--wxc-primary), #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 8px 20px rgba(99,102,241,0.3);
}

.wxc-prechat-icon svg { width: 28px; height: 28px; }

.wxc-prechat-inner h3 {
    margin: 0 0 6px;
    font-size: 17px;
    font-weight: 700;
    color: #1e293b;
}

.wxc-prechat-inner p {
    margin: 0 0 18px;
    font-size: 13px;
    color: #64748b;
}

.wxc-prechat-fields {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 14px;
}

.wxc-prechat-fields input {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.wxc-prechat-fields input:focus {
    border-color: var(--wxc-primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}

.wxc-start-btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--wxc-primary), #8b5cf6);
    color: #fff;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(99,102,241,0.35);
    transition: transform 0.2s, box-shadow 0.2s;
}

.wxc-start-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(99,102,241,0.4);
}

.wxc-prechat-error {
    color: #ef4444;
    font-size: 12px;
    margin-top: 10px;
}

.wxc-theme-midnight .wxc-prechat,
.wxc-theme-nebula .wxc-prechat { background: transparent; }
.wxc-theme-midnight .wxc-prechat-inner h3,
.wxc-theme-nebula .wxc-prechat-inner h3 { color: #e2e8f0; }
.wxc-theme-midnight .wxc-prechat-inner p,
.wxc-theme-nebula .wxc-prechat-inner p { color: #94a3b8; }
.wxc-theme-midnight .wxc-prechat-fields input,
.wxc-theme-nebula .wxc-prechat-fields input {
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.12);
    color: #e2e8f0;
}

/* Product link buttons inside chat */
.wxc-product-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 6px 0 2px;
    padding: 8px 14px;
    border-radius: 10px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff !important;
    text-decoration: none !important;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.3;
    max-width: 100%;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    transition: transform 0.15s, box-shadow 0.15s;
    word-break: normal;
    white-space: normal;
    text-align: center;
}

.wxc-product-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
    color: #fff !important;
}

.wxc-msg-ai .wxc-product-btn,
.wxc-msg-agent .wxc-product-btn {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
}

.wxc-theme-nebula .wxc-product-btn,
.wxc-theme-midnight .wxc-product-btn {
    background: linear-gradient(135deg, #818cf8, #a78bfa);
}

.wxc-faq-box {
    padding: 10px 12px 0;
    flex-shrink: 0;
    background: transparent;
}
.wxc-faq-title {
    font-size: 11px;
    color: #94a3b8;
    margin-bottom: 6px;
    font-weight: 600;
}
.wxc-faq-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.wxc-faq-chip {
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #334155;
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
}
.wxc-faq-chip:hover {
    border-color: #818cf8;
    color: #4f46e5;
    background: #eef2ff;
}
.wxc-theme-midnight .wxc-faq-chip,
.wxc-theme-nebula .wxc-faq-chip {
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.12);
    color: #e2e8f0;
}

.wxc-cart-btn {
    display: inline-flex;
    align-items: center;
    margin: 6px 4px 2px 0;
    padding: 8px 14px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}
.wxc-cart-btn:hover { filter: brightness(1.05); }
.wxc-cart-btn:disabled { opacity: 0.7; cursor: default; }

.wxc-rating-box {
    padding: 12px;
    text-align: center;
    border-top: 1px solid #e2e8f0;
    background: #fafafa;
}
.wxc-rating-title {
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 8px;
    color: #334155;
}
.wxc-rating-stars {
    display: flex;
    gap: 6px;
    justify-content: center;
    flex-wrap: wrap;
}
.wxc-star {
    border: 1px solid #e2e8f0;
    background: #fff;
    border-radius: 10px;
    padding: 8px 12px;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
}
.wxc-star:hover {
    border-color: #f59e0b;
    background: #fffbeb;
}


/* Product action row */
.wxc-msg-text .wxc-product-btn,
.wxc-msg-text .wxc-cart-btn {
    display: inline-flex;
    vertical-align: middle;
    margin: 8px 6px 4px 0;
}

.wxc-msg-ai .wxc-msg-text {
    line-height: 1.65;
}

.wxc-msg {
    animation: wxc-msg-in 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes wxc-msg-in {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Modern input */
.wxc-input-area {
    background: #fff;
    border-top: 1px solid rgba(15, 23, 42, 0.06);
    gap: 8px;
}
#wxc-input {
    border-radius: 14px !important;
    background: #f1f5f9 !important;
    border: 1px solid transparent !important;
    padding: 12px 14px !important;
}
#wxc-input:focus {
    background: #fff !important;
    border-color: #c7d2fe !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15) !important;
}
#wxc-send-btn {
    border-radius: 14px !important;
    width: 44px !important;
    height: 44px !important;
}

.wxc-header {
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
}

.wxc-chat-window {
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.18), 0 0 0 1px rgba(15, 23, 42, 0.04) !important;
    overflow: hidden;
}

.wxc-messages {
    background:
        radial-gradient(ellipse at top right, rgba(99, 102, 241, 0.04), transparent 50%),
        #f8fafc;
}

.wxc-msg-user .wxc-msg-text {
    border-bottom-left-radius: 6px;
}
.wxc-msg-ai .wxc-msg-text {
    border-bottom-right-radius: 6px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.wxc-cart-btn {
    background: linear-gradient(135deg, #10b981, #059669) !important;
    border: none !important;
    color: #fff !important;
}

.wxc-product-btn {
    background: linear-gradient(135deg, #6366f1, #8b5cf6) !important;
}

.wxc-attach-btn {
    width: 40px; height: 40px; border-radius: 12px;
    display: none; align-items: center; justify-content: center;
    background: #f1f5f9; cursor: pointer; flex-shrink: 0;
    font-size: 16px;
}
.wxc-attach-btn:hover { background: #e2e8f0; }
.wxc-chat-img {
    max-width: 100%; max-height: 220px; border-radius: 12px;
    display: block; margin: 4px 0;
}


/* ========== Side panel positions (5 & 6) ========== */
.wxc-pos-side-right,
.wxc-pos-side-left {
    top: 0;
    bottom: 0;
    width: 0;
    height: 100%;
    right: auto;
    left: auto;
}
.wxc-pos-side-right { right: 0; }
.wxc-pos-side-left { left: 0; }

.wxc-pos-side-right .wxc-toggle-btn,
.wxc-pos-side-left .wxc-toggle-btn {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: var(--wxc-icon-size, 60px);
    height: calc(var(--wxc-icon-size, 60px) + 4px);
    z-index: 1000000;
    /* protrude: percentage of icon width visible */
}
.wxc-pos-side-right .wxc-toggle-btn {
    right: calc(-1 * var(--wxc-side-hide, 30px));
    border-radius: 14px 0 0 14px !important;
}
.wxc-pos-side-left .wxc-toggle-btn {
    left: calc(-1 * var(--wxc-side-hide, 30px));
    border-radius: 0 14px 14px 0 !important;
}
.wxc-pos-side-right .wxc-toggle-btn:hover {
    transform: translateY(-50%) translateX(-2px);
}
.wxc-pos-side-left .wxc-toggle-btn:hover {
    transform: translateY(-50%) translateX(2px);
}

.wxc-pos-side-right .wxc-chat-window,
.wxc-pos-side-left .wxc-chat-window {
    position: fixed !important;
    top: 0 !important;
    bottom: 0 !important;
    height: 100% !important;
    max-height: 100% !important;
    width: var(--wxc-side-width, 400px) !important;
    max-width: 92vw !important;
    border-radius: 0 !important;
    z-index: 999999;
}
.wxc-pos-side-right .wxc-chat-window {
    right: 0 !important;
    left: auto !important;
    box-shadow: -12px 0 40px rgba(15,23,42,0.12);
}
.wxc-pos-side-left .wxc-chat-window {
    left: 0 !important;
    right: auto !important;
    box-shadow: 12px 0 40px rgba(15,23,42,0.12);
}

/* Base message colors — themes override these; custom uses admin vars */
.wxc-msg-user .wxc-msg-text {
    background: var(--wxc-primary, #6366f1);
    color: #fff;
}
.wxc-msg-ai .wxc-msg-text {
    background: #f1f5f9;
    color: #1e293b;
}
.wxc-msg-agent .wxc-msg-text {
    background: #10b981;
    color: #fff;
}

/* Custom theme ONLY — full admin color control */
.wxc-theme-custom .wxc-chat-window {
    background: var(--wxc-window-bg, #fff) !important;
}
.wxc-theme-custom .wxc-header {
    background: var(--wxc-header-bg, var(--wxc-primary)) !important;
    color: var(--wxc-header-text, #fff) !important;
}
.wxc-theme-custom .wxc-messages {
    background: var(--wxc-messages-bg, #f8fafc) !important;
}
.wxc-theme-custom .wxc-input-area,
.wxc-theme-custom .wxc-actions,
.wxc-theme-custom .wxc-footer {
    background: var(--wxc-input-bg, #fff) !important;
}
.wxc-theme-custom .wxc-msg-user .wxc-msg-text {
    background: var(--wxc-user-bg, var(--wxc-primary)) !important;
    color: var(--wxc-user-color, #fff) !important;
}
.wxc-theme-custom .wxc-msg-ai .wxc-msg-text {
    background: var(--wxc-ai-bg, #f1f5f9) !important;
    color: var(--wxc-ai-color, #1e293b) !important;
}
.wxc-theme-custom .wxc-msg-agent .wxc-msg-text {
    background: var(--wxc-agent-bg, #10b981) !important;
    color: var(--wxc-agent-color, #fff) !important;
}
.wxc-theme-custom .wxc-toggle-btn:not(.wxc-icon-nobg) {
    background: var(--wxc-icon-bg, var(--wxc-primary)) !important;
}

/* ========== Extra themes 5–10 + custom ========== */
.theme-preview.theme-sunset { background: linear-gradient(145deg, #fff7ed, #fdba74 50%, #f97316); }
.theme-preview.theme-ocean { background: linear-gradient(145deg, #ecfeff, #67e8f9 45%, #0284c7); }
.theme-preview.theme-forest { background: linear-gradient(145deg, #f0fdf4, #86efac 45%, #15803d); }
.theme-preview.theme-candy { background: linear-gradient(145deg, #fdf2f8, #f9a8d4 45%, #db2777); }
.theme-preview.theme-graphite { background: linear-gradient(145deg, #f8fafc, #94a3b8 50%, #334155); }
.theme-preview.theme-gold { background: linear-gradient(145deg, #1c1917, #a16207 50%, #fbbf24); }
.theme-preview.theme-custom { background: repeating-linear-gradient(45deg, #e2e8f0, #e2e8f0 8px, #f8fafc 8px, #f8fafc 16px); }

/* Sunset */
.wxc-theme-sunset .wxc-chat-window { background: #fffbf7; border: 1px solid #fed7aa; }
.wxc-theme-sunset .wxc-header { background: linear-gradient(135deg, #f97316, #ea580c) !important; color: #fff; }
.wxc-theme-sunset .wxc-messages { background: #fff7ed; }
.wxc-theme-sunset .wxc-msg-ai .wxc-msg-text { background: #ffedd5 !important; color: #9a3412 !important; }
.wxc-theme-sunset .wxc-msg-user .wxc-msg-text { background: linear-gradient(135deg, #f97316, #fb923c) !important; color: #fff !important; }
.wxc-theme-sunset .wxc-toggle-btn { background: linear-gradient(135deg, #f97316, #ea580c) !important; }
.wxc-theme-sunset .wxc-input-area, .wxc-theme-sunset .wxc-actions, .wxc-theme-sunset .wxc-footer { background: #fffbf7; border-color: #fed7aa; }

/* Ocean */
.wxc-theme-ocean .wxc-chat-window { background: #f0fdfa; border: 1px solid #99f6e4; }
.wxc-theme-ocean .wxc-header { background: linear-gradient(135deg, #0ea5e9, #0284c7) !important; color: #fff; }
.wxc-theme-ocean .wxc-messages { background: #ecfeff; }
.wxc-theme-ocean .wxc-msg-ai .wxc-msg-text { background: #cffafe !important; color: #155e75 !important; }
.wxc-theme-ocean .wxc-msg-user .wxc-msg-text { background: linear-gradient(135deg, #06b6d4, #0284c7) !important; color: #fff !important; }
.wxc-theme-ocean .wxc-toggle-btn { background: linear-gradient(135deg, #0ea5e9, #0284c7) !important; }
.wxc-theme-ocean .wxc-input-area, .wxc-theme-ocean .wxc-actions, .wxc-theme-ocean .wxc-footer { background: #f0fdfa; border-color: #a5f3fc; }

/* Forest */
.wxc-theme-forest .wxc-chat-window { background: #f7fef9; border: 1px solid #bbf7d0; }
.wxc-theme-forest .wxc-header { background: linear-gradient(135deg, #16a34a, #15803d) !important; color: #fff; }
.wxc-theme-forest .wxc-messages { background: #f0fdf4; }
.wxc-theme-forest .wxc-msg-ai .wxc-msg-text { background: #dcfce7 !important; color: #14532d !important; }
.wxc-theme-forest .wxc-msg-user .wxc-msg-text { background: linear-gradient(135deg, #22c55e, #16a34a) !important; color: #fff !important; }
.wxc-theme-forest .wxc-toggle-btn { background: linear-gradient(135deg, #16a34a, #15803d) !important; }
.wxc-theme-forest .wxc-input-area, .wxc-theme-forest .wxc-actions, .wxc-theme-forest .wxc-footer { background: #f7fef9; border-color: #bbf7d0; }

/* Candy */
.wxc-theme-candy .wxc-chat-window { background: #fff5fb; border: 1px solid #fbcfe8; }
.wxc-theme-candy .wxc-header { background: linear-gradient(135deg, #ec4899, #db2777) !important; color: #fff; }
.wxc-theme-candy .wxc-messages { background: #fdf2f8; }
.wxc-theme-candy .wxc-msg-ai .wxc-msg-text { background: #fce7f3 !important; color: #9d174d !important; }
.wxc-theme-candy .wxc-msg-user .wxc-msg-text { background: linear-gradient(135deg, #f472b6, #ec4899) !important; color: #fff !important; }
.wxc-theme-candy .wxc-toggle-btn { background: linear-gradient(135deg, #ec4899, #db2777) !important; }
.wxc-theme-candy .wxc-input-area, .wxc-theme-candy .wxc-actions, .wxc-theme-candy .wxc-footer { background: #fff5fb; border-color: #fbcfe8; }

/* Graphite */
.wxc-theme-graphite .wxc-chat-window { background: #f8fafc; border: 1px solid #e2e8f0; }
.wxc-theme-graphite .wxc-header { background: linear-gradient(135deg, #475569, #1e293b) !important; color: #f8fafc; }
.wxc-theme-graphite .wxc-messages { background: #f1f5f9; }
.wxc-theme-graphite .wxc-msg-ai .wxc-msg-text { background: #e2e8f0 !important; color: #0f172a !important; }
.wxc-theme-graphite .wxc-msg-user .wxc-msg-text { background: #334155 !important; color: #f8fafc !important; }
.wxc-theme-graphite .wxc-toggle-btn { background: #334155 !important; }
.wxc-theme-graphite .wxc-input-area, .wxc-theme-graphite .wxc-actions, .wxc-theme-graphite .wxc-footer { background: #f8fafc; border-color: #e2e8f0; }

/* Gold */
.wxc-theme-gold .wxc-chat-window { background: #1c1917; border: 1px solid #44403c; color: #fef3c7; }
.wxc-theme-gold .wxc-header { background: linear-gradient(135deg, #a16207, #78350f) !important; color: #fef3c7; }
.wxc-theme-gold .wxc-messages { background: #0c0a09; }
.wxc-theme-gold .wxc-msg-ai .wxc-msg-text { background: #292524 !important; color: #fde68a !important; border: 1px solid #44403c; }
.wxc-theme-gold .wxc-msg-user .wxc-msg-text { background: linear-gradient(135deg, #d97706, #b45309) !important; color: #fffbeb !important; }
.wxc-theme-gold .wxc-toggle-btn { background: linear-gradient(135deg, #d97706, #a16207) !important; }
.wxc-theme-gold .wxc-input-area, .wxc-theme-gold .wxc-actions, .wxc-theme-gold .wxc-footer { background: #1c1917; border-color: #44403c; color: #a8a29e; }
.wxc-theme-gold #wxc-input { background: #292524; border-color: #57534e; color: #fef3c7; }
.wxc-theme-gold .wxc-status { color: #fbbf24; }

/* Custom theme uses CSS variables from admin */
.wxc-theme-custom .wxc-chat-window {
    background: var(--wxc-window-bg, #fff);
    border: 1px solid rgba(15,23,42,0.08);
}
.wxc-theme-custom .wxc-header {
    background: var(--wxc-header-bg, var(--wxc-primary)) !important;
    color: var(--wxc-header-text, #fff) !important;
}
.wxc-theme-custom .wxc-messages { background: var(--wxc-messages-bg, #f8fafc); }
.wxc-theme-custom .wxc-input-area,
.wxc-theme-custom .wxc-actions,
.wxc-theme-custom .wxc-footer { background: var(--wxc-input-bg, #fff); }

/* Admin theme grid for more items */
.wxc-themes { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)) !important; }

@media (max-width: 768px) {
    .wxc-pos-side-right .wxc-chat-window,
    .wxc-pos-side-left .wxc-chat-window {
        width: 100% !important;
        max-width: 100% !important;
    }
}


/* ========== Theme contrast & readability fixes ========== */
.wxc-theme-sunset .wxc-header,
.wxc-theme-ocean .wxc-header,
.wxc-theme-forest .wxc-header,
.wxc-theme-candy .wxc-header,
.wxc-theme-graphite .wxc-header,
.wxc-theme-gold .wxc-header,
.wxc-theme-aurora .wxc-header,
.wxc-theme-miniature .wxc-header {
    color: #ffffff !important;
}
.wxc-theme-sunset .wxc-header *,
.wxc-theme-ocean .wxc-header *,
.wxc-theme-forest .wxc-header *,
.wxc-theme-candy .wxc-header *,
.wxc-theme-graphite .wxc-header *,
.wxc-theme-gold .wxc-header *,
.wxc-theme-aurora .wxc-header *,
.wxc-theme-miniature .wxc-header * {
    color: inherit;
}
.wxc-theme-sunset .wxc-status,
.wxc-theme-ocean .wxc-status,
.wxc-theme-forest .wxc-status,
.wxc-theme-candy .wxc-status,
.wxc-theme-graphite .wxc-status,
.wxc-theme-miniature .wxc-status,
.wxc-theme-aurora .wxc-status {
    color: rgba(255,255,255,0.9) !important;
}
.wxc-theme-gold .wxc-status { color: #fde68a !important; }

.wxc-theme-sunset .wxc-faq-chip,
.wxc-theme-ocean .wxc-faq-chip,
.wxc-theme-forest .wxc-faq-chip,
.wxc-theme-candy .wxc-faq-chip {
    background: #fff;
    border-color: rgba(0,0,0,0.08);
    color: #334155;
}
.wxc-theme-midnight .wxc-faq-chip,
.wxc-theme-nebula .wxc-faq-chip,
.wxc-theme-gold .wxc-faq-chip {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.12);
    color: #e2e8f0;
}
.wxc-theme-midnight .wxc-faq-title,
.wxc-theme-nebula .wxc-faq-title,
.wxc-theme-gold .wxc-faq-title {
    color: #94a3b8;
}

.wxc-theme-sunset #wxc-input,
.wxc-theme-ocean #wxc-input,
.wxc-theme-forest #wxc-input,
.wxc-theme-candy #wxc-input,
.wxc-theme-graphite #wxc-input {
    color: #0f172a;
    background: #fff;
}
.wxc-theme-sunset .wxc-footer,
.wxc-theme-ocean .wxc-footer,
.wxc-theme-forest .wxc-footer,
.wxc-theme-candy .wxc-footer,
.wxc-theme-graphite .wxc-footer {
    color: #64748b;
}

.wxc-theme-midnight .wxc-msg-system,
.wxc-theme-nebula .wxc-msg-system,
.wxc-theme-gold .wxc-msg-system {
    background: rgba(251, 191, 36, 0.15);
    color: #fde68a;
}
.wxc-theme-sunset .wxc-msg-system,
.wxc-theme-ocean .wxc-msg-system,
.wxc-theme-forest .wxc-msg-system,
.wxc-theme-candy .wxc-msg-system {
    background: #fef3c7;
    color: #92400e;
}

/* Close button always visible on colored headers */
.wxc-close-btn {
    color: inherit !important;
    opacity: 0.9;
}
.wxc-close-btn:hover { opacity: 1; }

/* Escalate / back buttons readable */
.wxc-theme-sunset #wxc-escalate-btn,
.wxc-theme-ocean #wxc-escalate-btn,
.wxc-theme-forest #wxc-escalate-btn,
.wxc-theme-candy #wxc-escalate-btn {
    color: #fff;
}


/* Preset themes — message bubbles (must win over defaults) */
.wxc-theme-aurora .wxc-msg-user .wxc-msg-text {
    background: linear-gradient(135deg, #6366f1, #8b5cf6) !important;
    color: #fff !important;
}
.wxc-theme-aurora .wxc-msg-ai .wxc-msg-text {
    background: #eef2ff !important;
    color: #312e81 !important;
}
.wxc-theme-aurora .wxc-header {
    background: linear-gradient(135deg, #6366f1, #8b5cf6) !important;
    color: #fff !important;
}
.wxc-theme-aurora .wxc-messages { background: #f8fafc !important; }
.wxc-theme-aurora .wxc-chat-window { background: #fff !important; }

.wxc-theme-midnight .wxc-msg-user .wxc-msg-text {
    background: linear-gradient(135deg, #3b82f6, #6366f1) !important;
    color: #fff !important;
}
.wxc-theme-midnight .wxc-msg-ai .wxc-msg-text {
    background: #1e293b !important;
    color: #e2e8f0 !important;
}
.wxc-theme-midnight .wxc-header {
    background: #0f172a !important;
    color: #f8fafc !important;
}
.wxc-theme-midnight .wxc-messages { background: #0f172a !important; }
.wxc-theme-midnight .wxc-chat-window { background: #1e293b !important; color: #e2e8f0; }
.wxc-theme-midnight .wxc-input-area,
.wxc-theme-midnight .wxc-actions,
.wxc-theme-midnight .wxc-footer { background: #1e293b !important; border-color: #334155; }
.wxc-theme-midnight #wxc-input { background: #0f172a; color: #e2e8f0; border-color: #334155; }

.wxc-theme-miniature .wxc-msg-user .wxc-msg-text {
    background: linear-gradient(135deg, #8b5cf6, #6366f1) !important;
    color: #fff !important;
}
.wxc-theme-miniature .wxc-msg-ai .wxc-msg-text {
    background: #f5f3ff !important;
    color: #4c1d95 !important;
}
.wxc-theme-miniature .wxc-header {
    background: linear-gradient(135deg, #7c3aed, #4f46e5) !important;
    color: #fff !important;
}
.wxc-theme-miniature .wxc-messages { background: #faf5ff !important; }

.wxc-theme-nebula .wxc-msg-user .wxc-msg-text {
    background: linear-gradient(135deg, #6366f1, #a855f7) !important;
    color: #fff !important;
}
.wxc-theme-nebula .wxc-msg-ai .wxc-msg-text {
    background: rgba(255,255,255,0.1) !important;
    color: #e0e7ff !important;
    border: 1px solid rgba(255,255,255,0.12);
}
.wxc-theme-nebula .wxc-header {
    background: transparent !important;
    color: #e0e7ff !important;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.wxc-theme-nebula .wxc-messages { background: transparent !important; }
.wxc-theme-nebula .wxc-chat-window {
    background: linear-gradient(160deg, #0f0c29, #302b63 45%, #24243e) !important;
    color: #e0e7ff;
}
.wxc-theme-nebula .wxc-input-area,
.wxc-theme-nebula .wxc-actions,
.wxc-theme-nebula .wxc-footer {
    background: rgba(0,0,0,0.25) !important;
    border-color: rgba(255,255,255,0.08);
}
.wxc-theme-nebula #wxc-input {
    background: rgba(255,255,255,0.08);
    color: #e0e7ff;
    border-color: rgba(255,255,255,0.12);
}

.wxc-theme-sunset .wxc-msg-user .wxc-msg-text {
    background: linear-gradient(135deg, #f97316, #fb923c) !important;
    color: #fff !important;
}
.wxc-theme-sunset .wxc-msg-ai .wxc-msg-text {
    background: #ffedd5 !important;
    color: #9a3412 !important;
}
.wxc-theme-sunset .wxc-header {
    background: linear-gradient(135deg, #f97316, #ea580c) !important;
    color: #fff !important;
}
.wxc-theme-sunset .wxc-messages { background: #fff7ed !important; }
.wxc-theme-sunset .wxc-chat-window { background: #fffbf7 !important; }
.wxc-theme-sunset .wxc-input-area,
.wxc-theme-sunset .wxc-actions,
.wxc-theme-sunset .wxc-footer { background: #fffbf7 !important; border-color: #fed7aa; }
.wxc-theme-sunset #wxc-input { background: #fff; color: #0f172a; }
.wxc-theme-sunset #wxc-send-btn,
.wxc-theme-sunset #wxc-escalate-btn,
.wxc-theme-sunset #wxc-back-to-ai-btn {
    background: linear-gradient(135deg, #f97316, #ea580c) !important;
    color: #fff !important;
    border: none !important;
}

.wxc-theme-ocean .wxc-msg-user .wxc-msg-text {
    background: linear-gradient(135deg, #06b6d4, #0284c7) !important;
    color: #fff !important;
}
.wxc-theme-ocean .wxc-msg-ai .wxc-msg-text {
    background: #cffafe !important;
    color: #155e75 !important;
}
.wxc-theme-ocean .wxc-header {
    background: linear-gradient(135deg, #0ea5e9, #0284c7) !important;
    color: #fff !important;
}
.wxc-theme-ocean .wxc-messages { background: #ecfeff !important; }
.wxc-theme-ocean .wxc-chat-window { background: #f0fdfa !important; }
.wxc-theme-ocean .wxc-input-area,
.wxc-theme-ocean .wxc-actions,
.wxc-theme-ocean .wxc-footer { background: #f0fdfa !important; border-color: #a5f3fc; }
.wxc-theme-ocean #wxc-send-btn,
.wxc-theme-ocean #wxc-escalate-btn,
.wxc-theme-ocean #wxc-back-to-ai-btn {
    background: linear-gradient(135deg, #0ea5e9, #0284c7) !important;
    color: #fff !important;
    border: none !important;
}

.wxc-theme-forest .wxc-msg-user .wxc-msg-text {
    background: linear-gradient(135deg, #22c55e, #16a34a) !important;
    color: #fff !important;
}
.wxc-theme-forest .wxc-msg-ai .wxc-msg-text {
    background: #dcfce7 !important;
    color: #14532d !important;
}
.wxc-theme-forest .wxc-header {
    background: linear-gradient(135deg, #16a34a, #15803d) !important;
    color: #fff !important;
}
.wxc-theme-forest .wxc-messages { background: #f0fdf4 !important; }
.wxc-theme-forest .wxc-chat-window { background: #f7fef9 !important; }
.wxc-theme-forest .wxc-input-area,
.wxc-theme-forest .wxc-actions,
.wxc-theme-forest .wxc-footer { background: #f7fef9 !important; border-color: #bbf7d0; }
.wxc-theme-forest #wxc-send-btn,
.wxc-theme-forest #wxc-escalate-btn,
.wxc-theme-forest #wxc-back-to-ai-btn {
    background: linear-gradient(135deg, #16a34a, #15803d) !important;
    color: #fff !important;
    border: none !important;
}

.wxc-theme-candy .wxc-msg-user .wxc-msg-text {
    background: linear-gradient(135deg, #f472b6, #ec4899) !important;
    color: #fff !important;
}
.wxc-theme-candy .wxc-msg-ai .wxc-msg-text {
    background: #fce7f3 !important;
    color: #9d174d !important;
}
.wxc-theme-candy .wxc-header {
    background: linear-gradient(135deg, #ec4899, #db2777) !important;
    color: #fff !important;
}
.wxc-theme-candy .wxc-messages { background: #fdf2f8 !important; }
.wxc-theme-candy .wxc-chat-window { background: #fff5fb !important; }
.wxc-theme-candy .wxc-input-area,
.wxc-theme-candy .wxc-actions,
.wxc-theme-candy .wxc-footer { background: #fff5fb !important; border-color: #fbcfe8; }
.wxc-theme-candy #wxc-send-btn,
.wxc-theme-candy #wxc-escalate-btn,
.wxc-theme-candy #wxc-back-to-ai-btn {
    background: linear-gradient(135deg, #ec4899, #db2777) !important;
    color: #fff !important;
    border: none !important;
}
.wxc-theme-candy .wxc-product-btn {
    background: linear-gradient(135deg, #ec4899, #db2777) !important;
}
.wxc-theme-candy .wxc-rating-box { background: #fff5fb; border-color: #fbcfe8; }
.wxc-theme-candy .wxc-rating-title { color: #9d174d; }

.wxc-theme-graphite .wxc-msg-user .wxc-msg-text {
    background: #334155 !important;
    color: #f8fafc !important;
}
.wxc-theme-graphite .wxc-msg-ai .wxc-msg-text {
    background: #e2e8f0 !important;
    color: #0f172a !important;
}
.wxc-theme-graphite .wxc-header {
    background: linear-gradient(135deg, #475569, #1e293b) !important;
    color: #f8fafc !important;
}
.wxc-theme-graphite .wxc-messages { background: #f1f5f9 !important; }
.wxc-theme-graphite .wxc-chat-window { background: #f8fafc !important; }
.wxc-theme-graphite #wxc-send-btn,
.wxc-theme-graphite #wxc-escalate-btn,
.wxc-theme-graphite #wxc-back-to-ai-btn {
    background: #334155 !important;
    color: #fff !important;
    border: none !important;
}

.wxc-theme-gold .wxc-msg-user .wxc-msg-text {
    background: linear-gradient(135deg, #d97706, #b45309) !important;
    color: #fffbeb !important;
}
.wxc-theme-gold .wxc-msg-ai .wxc-msg-text {
    background: #292524 !important;
    color: #fde68a !important;
    border: 1px solid #44403c;
}
.wxc-theme-gold .wxc-header {
    background: linear-gradient(135deg, #a16207, #78350f) !important;
    color: #fef3c7 !important;
}
.wxc-theme-gold .wxc-messages { background: #0c0a09 !important; }
.wxc-theme-gold .wxc-chat-window { background: #1c1917 !important; color: #fef3c7; }
.wxc-theme-gold .wxc-input-area,
.wxc-theme-gold .wxc-actions,
.wxc-theme-gold .wxc-footer { background: #1c1917 !important; border-color: #44403c; color: #a8a29e; }
.wxc-theme-gold #wxc-input { background: #292524; color: #fef3c7; border-color: #57534e; }
.wxc-theme-gold #wxc-send-btn,
.wxc-theme-gold #wxc-escalate-btn,
.wxc-theme-gold #wxc-back-to-ai-btn {
    background: linear-gradient(135deg, #d97706, #a16207) !important;
    color: #fff !important;
    border: none !important;
}

/* Toggle follows theme primary when bg enabled */
.wxc-theme-sunset .wxc-toggle-btn:not(.wxc-icon-nobg) { background: linear-gradient(135deg, #f97316, #ea580c) !important; }
.wxc-theme-ocean .wxc-toggle-btn:not(.wxc-icon-nobg) { background: linear-gradient(135deg, #0ea5e9, #0284c7) !important; }
.wxc-theme-forest .wxc-toggle-btn:not(.wxc-icon-nobg) { background: linear-gradient(135deg, #16a34a, #15803d) !important; }
.wxc-theme-candy .wxc-toggle-btn:not(.wxc-icon-nobg) { background: linear-gradient(135deg, #ec4899, #db2777) !important; }
.wxc-theme-graphite .wxc-toggle-btn:not(.wxc-icon-nobg) { background: #334155 !important; }
.wxc-theme-gold .wxc-toggle-btn:not(.wxc-icon-nobg) { background: linear-gradient(135deg, #d97706, #a16207) !important; }
.wxc-theme-aurora .wxc-toggle-btn:not(.wxc-icon-nobg) { background: linear-gradient(135deg, #6366f1, #8b5cf6) !important; }
.wxc-theme-midnight .wxc-toggle-btn:not(.wxc-icon-nobg) { background: #1e293b !important; }
.wxc-theme-miniature .wxc-toggle-btn:not(.wxc-icon-nobg) { background: linear-gradient(135deg, #7c3aed, #4f46e5) !important; }
.wxc-theme-nebula .wxc-toggle-btn:not(.wxc-icon-nobg) { background: linear-gradient(135deg, #6366f1, #a855f7) !important; }


/* ===== Single-layer message bubbles (no double background) ===== */
.wxc-msg {
    background: transparent !important;
    padding: 0 !important;
    box-shadow: none !important;
}
.wxc-msg .wxc-msg-text {
    display: block;
    padding: 10px 14px;
    border-radius: var(--wxc-radius, 16px);
    line-height: 1.6;
}
.wxc-msg .wxc-msg-time {
    padding: 2px 6px 0;
}
.wxc-msg-user .wxc-msg-text {
    border-bottom-right-radius: 4px;
}
.wxc-msg-ai .wxc-msg-text,
.wxc-msg-agent .wxc-msg-text {
    border-bottom-left-radius: 4px;
}

/* Clear outer bubble colors so only .wxc-msg-text paints */
.wxc-msg-user,
.wxc-msg-ai,
.wxc-msg-agent {
    background: transparent !important;
    color: inherit;
}

/* Toggle hide when chat open */
.wxc-toggle-btn.wxc-toggle-hidden {
    opacity: 0 !important;
    pointer-events: none !important;
    transform: scale(0.6) translateY(12px) !important;
    transition: opacity 0.22s ease, transform 0.22s ease !important;
}
.wxc-toggle-btn {
    transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.22,1,0.36,1), box-shadow 0.25s ease !important;
}

/* Window slide animations */
.wxc-chat-window.wxc-window-anim-in {
    animation: wxc-slide-in 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
.wxc-chat-window.wxc-window-anim-out {
    animation: wxc-slide-out 0.22s ease forwards;
}
@keyframes wxc-slide-in {
    from { opacity: 0; transform: translateY(18px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes wxc-slide-out {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to { opacity: 0; transform: translateY(14px) scale(0.96); }
}
.wxc-pos-side-right .wxc-chat-window.wxc-window-anim-in {
    animation: wxc-side-in-right 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.wxc-pos-side-left .wxc-chat-window.wxc-window-anim-in {
    animation: wxc-side-in-left 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.wxc-pos-side-right .wxc-chat-window.wxc-window-anim-out {
    animation: wxc-side-out-right 0.25s ease forwards;
}
.wxc-pos-side-left .wxc-chat-window.wxc-window-anim-out {
    animation: wxc-side-out-left 0.25s ease forwards;
}
@keyframes wxc-side-in-right {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes wxc-side-in-left {
    from { opacity: 0; transform: translateX(-40px); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes wxc-side-out-right {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(40px); }
}
@keyframes wxc-side-out-left {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(-40px); }
}

/* Dark themes: keep rating + input + footer dark (no white strip) */
.wxc-theme-midnight .wxc-rating-box,
.wxc-theme-nebula .wxc-rating-box,
.wxc-theme-gold .wxc-rating-box {
    background: #1e293b !important;
    border-color: #334155 !important;
}
.wxc-theme-midnight .wxc-rating-title,
.wxc-theme-nebula .wxc-rating-title,
.wxc-theme-gold .wxc-rating-title {
    color: #cbd5e1 !important;
}
.wxc-theme-midnight .wxc-star,
.wxc-theme-nebula .wxc-star,
.wxc-theme-gold .wxc-star {
    background: #0f172a !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}
.wxc-theme-midnight .wxc-input-area,
.wxc-theme-midnight .wxc-actions,
.wxc-theme-midnight .wxc-footer,
.wxc-theme-nebula .wxc-input-area,
.wxc-theme-nebula .wxc-actions,
.wxc-theme-nebula .wxc-footer,
.wxc-theme-gold .wxc-input-area,
.wxc-theme-gold .wxc-actions,
.wxc-theme-gold .wxc-footer {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #94a3b8 !important;
}
.wxc-theme-midnight #wxc-input,
.wxc-theme-nebula #wxc-input,
.wxc-theme-gold #wxc-input {
    background: #0f172a !important;
    color: #e2e8f0 !important;
    border-color: #334155 !important;
}
.wxc-theme-midnight .wxc-faq-chip,
.wxc-theme-nebula .wxc-faq-chip {
    background: #1e293b !important;
    color: #e2e8f0 !important;
    border-color: #334155 !important;
}

.wxc-toggle-btn.wxc-toggle-text {
    width: auto !important;
    height: auto !important;
    min-width: auto !important;
    padding: 12px 18px !important;
    border-radius: 14px !important;
}
.wxc-icon-text {
    color: #fff;
    font-weight: 800;
    font-size: 14px;
    white-space: nowrap;
    line-height: 1.2;
}

/* Hide floating icon when display mode = trigger only */
.wxc-toggle-btn.wxc-toggle-force-hidden {
    display: none !important;
    pointer-events: none !important;
    opacity: 0 !important;
}
