/* Ai helpdesk - Chat bubble and panel */
/* Use --clientfind-header and --clientfind-accent for custom header color override */

.clientfind-chatbot-widget {
    --clientfind-header: #2563eb;
    --clientfind-accent: #1d4ed8;
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, sans-serif;
    font-size: 16px;
    line-height: 1.4;
}

/* Bubble position overrides (explicit so theme CSS cannot override) */
.clientfind-chatbot-widget--position-bottom-right {
    top: auto !important;
    left: auto !important;
    bottom: 20px !important;
    right: 20px !important;
}
.clientfind-chatbot-widget--position-bottom-right .clientfind-chatbot-panel {
    top: auto !important;
    left: auto !important;
    bottom: 70px !important;
    right: 0 !important;
}

.clientfind-chatbot-widget--position-bottom-left {
    top: auto !important;
    left: 20px !important;
    bottom: 20px !important;
    right: auto !important;
}
.clientfind-chatbot-widget--position-bottom-left .clientfind-chatbot-panel {
    top: auto !important;
    left: 0 !important;
    bottom: 70px !important;
    right: auto !important;
}

.clientfind-chatbot-widget--position-top-left {
    top: 20px !important;
    left: 20px !important;
    bottom: auto !important;
    right: auto !important;
}
.clientfind-chatbot-widget--position-top-left .clientfind-chatbot-panel {
    top: 70px !important;
    left: 0 !important;
    bottom: auto !important;
    right: auto !important;
}

.clientfind-chatbot-widget--position-top-right {
    top: 20px !important;
    left: auto !important;
    bottom: auto !important;
    right: 20px !important;
}
.clientfind-chatbot-widget--position-top-right .clientfind-chatbot-panel {
    top: 70px !important;
    left: auto !important;
    bottom: auto !important;
    right: 0 !important;
}

.clientfind-chatbot-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 18px;
    border: none;
    border-radius: 28px;
    background: linear-gradient(135deg, var(--clientfind-header) 0%, var(--clientfind-accent) 100%);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.clientfind-chatbot-toggle:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.clientfind-chatbot-toggle:focus {
    outline: 2px solid var(--clientfind-header);
    outline-offset: 2px;
}

.clientfind-chatbot-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    background: currentColor;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z'/%3E%3C/svg%3E") center/contain no-repeat;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z'/%3E%3C/svg%3E") center/contain no-repeat;
}
/* Bubble icon variants - higher specificity so they always override */
#clientfind-chatbot-widget .clientfind-chatbot-icon.clientfind-chatbot-icon--comment {
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z'/%3E%3C/svg%3E") center/contain no-repeat !important;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z'/%3E%3C/svg%3E") center/contain no-repeat !important;
}
#clientfind-chatbot-widget .clientfind-chatbot-icon.clientfind-chatbot-icon--support {
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M3 18v-6a9 9 0 0 1 18 0v6'/%3E%3Cpath d='M21 19a2 2 0 0 1-2 2h-1l-3-3a4 4 0 0 0-5-5l-2 2'/%3E%3Cpath d='M7 19a2 2 0 0 0 2 2h2'/%3E%3C/svg%3E") center/contain no-repeat !important;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M3 18v-6a9 9 0 0 1 18 0v6'/%3E%3Cpath d='M21 19a2 2 0 0 1-2 2h-1l-3-3a4 4 0 0 0-5-5l-2 2'/%3E%3Cpath d='M7 19a2 2 0 0 0 2 2h2'/%3E%3C/svg%3E") center/contain no-repeat !important;
}
#clientfind-chatbot-widget .clientfind-chatbot-icon.clientfind-chatbot-icon--message {
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z'/%3E%3Cpolyline points='22,6 12,13 2,6'/%3E%3C/svg%3E") center/contain no-repeat !important;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z'/%3E%3Cpolyline points='22,6 12,13 2,6'/%3E%3C/svg%3E") center/contain no-repeat !important;
}
#clientfind-chatbot-widget .clientfind-chatbot-icon.clientfind-chatbot-icon--chat-dots {
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z'/%3E%3Ccircle cx='9' cy='10' r='1' fill='currentColor'/%3E%3Ccircle cx='12' cy='10' r='1' fill='currentColor'/%3E%3Ccircle cx='15' cy='10' r='1' fill='currentColor'/%3E%3C/svg%3E") center/contain no-repeat !important;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z'/%3E%3Ccircle cx='9' cy='10' r='1' fill='currentColor'/%3E%3Ccircle cx='12' cy='10' r='1' fill='currentColor'/%3E%3Ccircle cx='15' cy='10' r='1' fill='currentColor'/%3E%3C/svg%3E") center/contain no-repeat !important;
}

/* Bubble animations - scoped to widget so they always apply */
#clientfind-chatbot-widget .clientfind-chatbot-toggle--animation-pulse {
    position: relative;
}
#clientfind-chatbot-widget .clientfind-chatbot-toggle--animation-pulse::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 32px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    animation: clientfind-pulse-ring 2s ease-out infinite;
    pointer-events: none;
}
@keyframes clientfind-pulse-ring {
    0% { transform: scale(0.85); opacity: 0.8; }
    100% { transform: scale(1.35); opacity: 0; }
}

#clientfind-chatbot-widget .clientfind-chatbot-toggle--animation-bounce {
    animation: clientfind-bounce 2s ease-in-out infinite !important;
}
@keyframes clientfind-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}
#clientfind-chatbot-widget .clientfind-chatbot-toggle--animation-bounce:hover {
    animation: none !important;
}

#clientfind-chatbot-widget .clientfind-chatbot-toggle--animation-glow {
    animation: clientfind-glow 2s ease-in-out infinite !important;
}
@keyframes clientfind-glow {
    0%, 100% { box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2); }
    50% { box-shadow: 0 4px 24px rgba(255, 255, 255, 0.4); }
}
#clientfind-chatbot-widget .clientfind-chatbot-toggle--animation-glow:hover {
    animation: none !important;
}

#clientfind-chatbot-widget .clientfind-chatbot-toggle--animation-breathe {
    animation: clientfind-breathe 2.5s ease-in-out infinite !important;
}
@keyframes clientfind-breathe {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}
#clientfind-chatbot-widget .clientfind-chatbot-toggle--animation-breathe:hover {
    animation: none !important;
}

.clientfind-chatbot-bubble-label {
    font-weight: 600;
}

.clientfind-chatbot-panel {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 360px;
    max-width: calc(100vw - 40px);
    height: 480px;
    max-height: calc(100vh - 120px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.clientfind-chatbot-panel[hidden] {
    display: none !important;
}

.clientfind-chatbot-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    background: linear-gradient(135deg, var(--clientfind-header) 0%, var(--clientfind-accent) 100%);
    color: #fff;
}

.clientfind-chatbot-panel-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.clientfind-chatbot-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 4px;
    opacity: 0.9;
}

.clientfind-chatbot-close:hover {
    opacity: 1;
}

.clientfind-chatbot-close:focus {
    outline: 2px solid rgba(255,255,255,0.8);
    outline-offset: 2px;
}

.clientfind-chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.clientfind-chatbot-welcome {
    align-self: center;
    text-align: center;
    padding: 20px 16px;
    color: #64748b;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
}

.clientfind-chatbot-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 14px;
    word-wrap: break-word;
}

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

.clientfind-chatbot-msg.assistant {
    align-self: flex-start;
    background: #fff;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
}
.clientfind-chatbot-msg strong {
    font-weight: 700;
    color: inherit;
}
.clientfind-chatbot-msg .clientfind-chatbot-list-num {
    display: inline-block;
    font-weight: 700;
    min-width: 1.6em;
    color: var(--clientfind-header, #2563eb);
}
.clientfind-chatbot-msg ol.clientfind-chatbot-product-list {
    margin: 0.5em 0 0 0;
    padding-left: 1.25em;
    list-style: decimal;
}
.clientfind-chatbot-msg ol.clientfind-chatbot-product-list li {
    margin-bottom: 0.5em;
    line-height: 1.4;
}
.clientfind-chatbot-msg ol.clientfind-chatbot-product-list li:last-child {
    margin-bottom: 0;
}
.clientfind-chatbot-msg a,
.clientfind-chatbot-msg .clientfind-chatbot-link {
    color: #2563eb !important;
    text-decoration: underline !important;
    cursor: pointer !important;
}
.clientfind-chatbot-msg a:hover,
.clientfind-chatbot-msg .clientfind-chatbot-link:hover {
    color: #1d4ed8 !important;
    text-decoration: underline !important;
}

.clientfind-chatbot-msg.error {
    align-self: center;
    background: #fef2f2;
    color: #b91c1c;
    font-size: 0.9rem;
}

.clientfind-chatbot-typing {
    align-self: flex-start;
    padding: 10px 14px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    border-bottom-left-radius: 4px;
}

.clientfind-chatbot-typing span {
    display: inline-block;
    width: 6px;
    height: 6px;
    background: #94a3b8;
    border-radius: 50%;
    margin: 0 2px;
    animation: clientfind-bounce 1.4s ease-in-out infinite both;
}

.clientfind-chatbot-typing span:nth-child(2) { animation-delay: 0.2s; }
.clientfind-chatbot-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes clientfind-bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.6; }
    40% { transform: scale(1); opacity: 1; }
}

.clientfind-chatbot-input-wrap {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    background: #fff;
    border-top: 1px solid #e2e8f0;
}

.clientfind-chatbot-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 22px;
    font-size: 0.95rem;
}

.clientfind-chatbot-input:focus {
    outline: none;
    border-color: var(--clientfind-header);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.clientfind-chatbot-send {
    padding: 10px 18px;
    border: none;
    border-radius: 22px;
    background: var(--clientfind-header);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.clientfind-chatbot-send:hover {
    background: var(--clientfind-accent);
}

.clientfind-chatbot-send:focus {
    outline: 2px solid var(--clientfind-header);
    outline-offset: 2px;
}

/* ---- Theme: WhatsApp ---- */
.clientfind-chatbot-widget--whatsapp {
    --clientfind-header: #075e54;
    --clientfind-accent: #128c7e;
}
.clientfind-chatbot-widget--whatsapp .clientfind-chatbot-messages {
    background: #e5ddd5;
}
.clientfind-chatbot-widget--whatsapp .clientfind-chatbot-msg.assistant,
.clientfind-chatbot-widget--whatsapp .clientfind-chatbot-typing {
    background: #fff;
    border-color: #e0e0e0;
}
.clientfind-chatbot-widget--whatsapp .clientfind-chatbot-input-wrap {
    background: #f0f2f5;
    border-color: #e0e0e0;
}
.clientfind-chatbot-widget--whatsapp .clientfind-chatbot-send {
    background: #25d366;
    color: #fff;
}
.clientfind-chatbot-widget--whatsapp .clientfind-chatbot-send:hover {
    background: #20bd5a;
}

/* ---- Theme: Telegram ---- */
.clientfind-chatbot-widget--telegram {
    --clientfind-header: #0088cc;
    --clientfind-accent: #006699;
}
.clientfind-chatbot-widget--telegram .clientfind-chatbot-panel {
    background: #f4f4f5;
}
.clientfind-chatbot-widget--telegram .clientfind-chatbot-messages {
    background: #e8e8e8;
}
.clientfind-chatbot-widget--telegram .clientfind-chatbot-msg.assistant,
.clientfind-chatbot-widget--telegram .clientfind-chatbot-typing {
    background: #fff;
    border-color: #d4d4d4;
}
.clientfind-chatbot-widget--telegram .clientfind-chatbot-input-wrap {
    background: #fff;
}

/* ---- Theme: Instagram ---- */
.clientfind-chatbot-widget--instagram .clientfind-chatbot-panel-header,
.clientfind-chatbot-widget--instagram .clientfind-chatbot-toggle {
    background: linear-gradient(135deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    border: none;
}
.clientfind-chatbot-widget--instagram {
    --clientfind-header: #e1306c;
    --clientfind-accent: #bc1888;
}
.clientfind-chatbot-widget--instagram .clientfind-chatbot-msg.user {
    background: linear-gradient(135deg, #e1306c 0%, #bc1888 100%);
}
.clientfind-chatbot-widget--instagram .clientfind-chatbot-messages {
    background: #fafafa;
}
.clientfind-chatbot-widget--instagram .clientfind-chatbot-send {
    background: linear-gradient(135deg, #e1306c 0%, #bc1888 100%);
}
.clientfind-chatbot-widget--instagram .clientfind-chatbot-send:hover {
    opacity: 0.95;
}

/* ---- Theme: Messenger ---- */
.clientfind-chatbot-widget--messenger {
    --clientfind-header: #0084ff;
    --clientfind-accent: #0066cc;
}
.clientfind-chatbot-widget--messenger .clientfind-chatbot-messages {
    background: #f0f2f5;
}
.clientfind-chatbot-widget--messenger .clientfind-chatbot-msg.assistant,
.clientfind-chatbot-widget--messenger .clientfind-chatbot-typing {
    background: #fff;
    border-color: #e4e6eb;
}
.clientfind-chatbot-widget--messenger .clientfind-chatbot-input-wrap {
    background: #f0f2f5;
}

/* ---- Theme: Minimal ---- */
.clientfind-chatbot-widget--minimal {
    --clientfind-header: #374151;
    --clientfind-accent: #1f2937;
}
.clientfind-chatbot-widget--minimal .clientfind-chatbot-toggle,
.clientfind-chatbot-widget--minimal .clientfind-chatbot-panel-header {
    background: #374151;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.clientfind-chatbot-widget--minimal .clientfind-chatbot-panel {
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
}
.clientfind-chatbot-widget--minimal .clientfind-chatbot-msg.user {
    background: #374151;
}
.clientfind-chatbot-widget--minimal .clientfind-chatbot-send {
    background: #374151;
}
.clientfind-chatbot-widget--minimal .clientfind-chatbot-send:hover {
    background: #1f2937;
}

/* ---- Theme: Discord ---- */
.clientfind-chatbot-widget--discord {
    --clientfind-header: #5865f2;
    --clientfind-accent: #4752c4;
}
.clientfind-chatbot-widget--discord .clientfind-chatbot-panel {
    background: #36393f;
    border-radius: 12px;
}
.clientfind-chatbot-widget--discord .clientfind-chatbot-panel-header {
    background: #202225;
    border-bottom: 1px solid #2f3136;
}
.clientfind-chatbot-widget--discord .clientfind-chatbot-messages {
    background: #36393f;
}
.clientfind-chatbot-widget--discord .clientfind-chatbot-msg.assistant,
.clientfind-chatbot-widget--discord .clientfind-chatbot-typing {
    background: #2f3136;
    border-color: #202225;
    color: #dcddde;
}
.clientfind-chatbot-widget--discord .clientfind-chatbot-msg a {
    color: #6ea8fe !important;
}
.clientfind-chatbot-widget--discord .clientfind-chatbot-msg.user {
    background: #5865f2;
}
.clientfind-chatbot-widget--discord .clientfind-chatbot-input-wrap {
    background: #40444b;
    border-color: #2f3136;
}
.clientfind-chatbot-widget--discord .clientfind-chatbot-input {
    background: #40444b;
    border-color: #2f3136;
    color: #dcddde;
}
.clientfind-chatbot-widget--discord .clientfind-chatbot-input::placeholder {
    color: #72767d;
}
.clientfind-chatbot-widget--discord .clientfind-chatbot-send {
    background: #5865f2;
}
.clientfind-chatbot-widget--discord .clientfind-chatbot-send:hover {
    background: #4752c4;
}

.clientfind-chatbot-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
