/* === ZeroCap AI Chatbot Widget — Scoped under #zcai-chatbot === */

#zcai-chatbot .zcai-bubble {
    position: fixed; bottom: 24px; right: 24px; z-index: 9999;
    width: 62px; height: 62px; border-radius: 50%;
    background: linear-gradient(135deg, #f97316, #e11d48);
    border: none; cursor: pointer; box-shadow: 0 4px 20px rgba(249,115,22,0.4);
    display: flex; align-items: center; justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
    animation: zcai-pulse 2.4s ease-in-out infinite;
}
#zcai-chatbot.open .zcai-bubble { animation: none; }
#zcai-chatbot .zcai-bubble:hover { transform: scale(1.08); box-shadow: 0 6px 28px rgba(249,115,22,0.5); animation: none; }
#zcai-chatbot .zcai-bubble svg { width: 28px; height: 28px; fill: #fff; }
#zcai-chatbot .zcai-bubble .zcai-close-icon { display: none; }
#zcai-chatbot.open .zcai-bubble .zcai-chat-icon { display: none; }
#zcai-chatbot.open .zcai-bubble .zcai-close-icon { display: block; }

/* Notification badge */
#zcai-chatbot .zcai-bubble-dot {
    position: absolute; top: -2px; right: -2px;
    min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
    background: #16a34a; color: #fff; font-size: 0.72rem;
    font-weight: 800; line-height: 20px; text-align: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2); border: 2px solid #fff;
    animation: zcai-dot-bounce 1.6s ease-in-out infinite;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}
#zcai-chatbot.open .zcai-bubble-dot { display: none; }

@keyframes zcai-dot-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

@keyframes zcai-pulse {
    0%, 100% { box-shadow: 0 4px 20px rgba(249,115,22,0.4); }
    50% { box-shadow: 0 4px 30px rgba(249,115,22,0.7), 0 0 0 14px rgba(249,115,22,0.08); }
}

/* Teaser preview bubble */
#zcai-chatbot .zcai-teaser {
    position: fixed; bottom: 100px; right: 24px; z-index: 9997;
    max-width: 280px; padding: 12px 14px 12px 12px;
    background: #fff; border-radius: 14px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15), 0 2px 6px rgba(0,0,0,0.06);
    display: none; align-items: flex-start; gap: 10px;
    cursor: pointer; transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid #e2e8f0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}
#zcai-chatbot .zcai-teaser.show {
    display: flex;
    animation: zcai-teaser-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
#zcai-chatbot .zcai-teaser:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 36px rgba(0,0,0,0.18), 0 2px 6px rgba(0,0,0,0.08);
}
#zcai-chatbot .zcai-teaser::after {
    content: ''; position: absolute; bottom: -8px; right: 24px;
    width: 16px; height: 16px; background: #fff; transform: rotate(45deg);
    border-right: 1px solid #e2e8f0; border-bottom: 1px solid #e2e8f0;
}
#zcai-chatbot .zcai-teaser-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: #f0f9ff; display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; padding: 4px;
}
#zcai-chatbot .zcai-teaser-avatar img { width: 100%; height: 100%; object-fit: contain; }
#zcai-chatbot .zcai-teaser-content { flex: 1; min-width: 0; }
#zcai-chatbot .zcai-teaser-name {
    font-size: 0.74rem; font-weight: 700; color: #0077b6;
    margin-bottom: 2px; letter-spacing: 0.2px;
}
#zcai-chatbot .zcai-teaser-msg {
    font-size: 0.85rem; color: #1e293b; line-height: 1.4; font-weight: 500;
}
#zcai-chatbot .zcai-teaser-close {
    position: absolute; top: 4px; right: 6px;
    width: 22px; height: 22px; border-radius: 50%;
    background: transparent; border: none; cursor: pointer;
    color: #94a3b8; font-size: 1.1rem; line-height: 1;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s;
}
#zcai-chatbot .zcai-teaser-close:hover { background: #f1f5f9; color: #1e293b; }
#zcai-chatbot.open .zcai-teaser { display: none !important; }

@keyframes zcai-teaser-pop {
    0%   { opacity: 0; transform: translateY(20px) scale(0.85); }
    60%  { opacity: 1; transform: translateY(-3px) scale(1.02); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* Chat Window */
#zcai-chatbot .zcai-window {
    position: fixed; bottom: 100px; right: 24px; z-index: 9998;
    width: 380px; height: 520px;
    background: #fff; border-radius: 20px;
    box-shadow: 0 12px 48px rgba(0,0,0,0.15);
    display: none; flex-direction: column; overflow: hidden;
    animation: zcai-slide-up 0.3s ease-out;
}
#zcai-chatbot.open .zcai-window { display: flex; }

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

/* Header */
#zcai-chatbot .zcai-header {
    background: linear-gradient(135deg, #0077b6, #00b4d8);
    padding: 16px 20px; display: flex; align-items: center; gap: 12px;
    flex-shrink: 0;
}
#zcai-chatbot .zcai-header-avatar {
    width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,0.2);
    display: flex; align-items: center; justify-content: center; font-size: 1.2rem;
}
#zcai-chatbot .zcai-header-info { flex: 1; }
#zcai-chatbot .zcai-header-name { color: #fff; font-weight: 700; font-size: 0.95rem; }
#zcai-chatbot .zcai-header-status { color: rgba(255,255,255,0.8); font-size: 0.75rem; }
#zcai-chatbot .zcai-header-close {
    background: none; border: none; color: rgba(255,255,255,0.7); font-size: 1.4rem;
    cursor: pointer; padding: 4px; line-height: 1;
}
#zcai-chatbot .zcai-header-close:hover { color: #fff; }

/* Messages */
#zcai-chatbot .zcai-messages {
    flex: 1; overflow-y: auto; padding: 16px; display: flex;
    flex-direction: column; gap: 10px; background: #f8fafc;
}
#zcai-chatbot .zcai-msg {
    max-width: 85%; padding: 10px 16px; border-radius: 14px;
    font-size: 0.88rem; line-height: 1.55; word-wrap: break-word;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}
#zcai-chatbot .zcai-msg p { margin: 0 0 8px 0; }
#zcai-chatbot .zcai-msg p:last-child { margin-bottom: 0; }
#zcai-chatbot .zcai-msg .zcai-list { margin: 4px 0 8px 0; padding-left: 18px; }
#zcai-chatbot .zcai-msg .zcai-list li { margin: 2px 0; }
#zcai-chatbot .zcai-msg strong { font-weight: 700; }
#zcai-chatbot .zcai-msg em { font-style: italic; }
#zcai-chatbot .zcai-msg-bot {
    background: linear-gradient(135deg, #e0f2fe, #f0f9ff);
    color: #1e293b; border: 1px solid #bae6fd;
    border-bottom-left-radius: 4px; align-self: flex-start;
}
#zcai-chatbot .zcai-msg-user {
    background: linear-gradient(135deg, #f97316, #e11d48);
    color: #fff; border-bottom-right-radius: 4px; align-self: flex-end;
}

/* Industry quick-start chips — compact 2-col grid */
#zcai-chatbot .zcai-chips {
    display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
    padding: 0; margin: 4px 0 0; align-self: stretch;
    background: transparent; border: none;
}
#zcai-chatbot .zcai-chip {
    display: flex; align-items: center; gap: 6px;
    padding: 7px 10px; background: #f1f5f9; border: 1px solid #e2e8f0;
    border-radius: 8px; font-size: 0.78rem; font-weight: 600;
    color: #1e293b; cursor: pointer; text-align: left;
    transition: all 0.15s; font-family: inherit;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#zcai-chatbot .zcai-chip:hover {
    background: #e0f2fe; border-color: #0077b6; color: #0077b6;
}
#zcai-chatbot .zcai-chip-emoji { font-size: 0.95rem; flex-shrink: 0; }

/* Typing Indicator */
#zcai-chatbot .zcai-typing {
    display: none; align-self: flex-start; padding: 12px 18px;
    background: linear-gradient(135deg, #e0f2fe, #f0f9ff);
    border: 1px solid #bae6fd; border-radius: 14px;
    border-bottom-left-radius: 4px; gap: 4px;
}
#zcai-chatbot .zcai-typing.visible { display: flex; }
#zcai-chatbot .zcai-dot {
    width: 7px; height: 7px; border-radius: 50%; background: #94a3b8;
    animation: zcai-bounce 1.4s infinite ease-in-out;
}
#zcai-chatbot .zcai-dot:nth-child(2) { animation-delay: 0.2s; }
#zcai-chatbot .zcai-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes zcai-bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* Input */
#zcai-chatbot .zcai-input-area {
    padding: 12px; border-top: 1px solid #e0f2fe; background: #fff;
    display: flex; gap: 8px; flex-shrink: 0;
}
#zcai-chatbot .zcai-input {
    flex: 1; padding: 10px 16px; border: 2px solid #e0f2fe; border-radius: 10px;
    font-size: 0.88rem; outline: none; font-family: inherit; color: #1e293b;
    transition: border-color 0.2s;
}
#zcai-chatbot .zcai-input:focus { border-color: #0077b6; }
#zcai-chatbot .zcai-input::placeholder { color: #94a3b8; }
#zcai-chatbot .zcai-send {
    padding: 10px 16px; border: none; border-radius: 10px;
    background: linear-gradient(135deg, #f97316, #e11d48);
    color: #fff; font-weight: 700; font-size: 0.85rem;
    cursor: pointer; font-family: inherit; transition: opacity 0.2s;
}
#zcai-chatbot .zcai-send:hover { opacity: 0.9; }
#zcai-chatbot .zcai-send:disabled { opacity: 0.5; cursor: not-allowed; }

/* Lead-capture CTA — small two-step preview before the full form */
#zcai-chatbot .zcai-lead-cta {
    align-self: flex-start; max-width: 90%;
    display: flex; flex-direction: column; gap: 6px;
    margin: 4px 0;
    animation: zcai-cta-in 0.25s ease-out;
}
@keyframes zcai-cta-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}
#zcai-chatbot .zcai-lead-cta-btn {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px; border: 2px solid #16a34a;
    border-radius: 12px; cursor: pointer; font-family: inherit;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    color: #166534; transition: all 0.2s; text-align: left; width: 100%;
}
#zcai-chatbot .zcai-lead-cta-btn:hover {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    color: #fff; transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.25);
}
#zcai-chatbot .zcai-lead-cta-icon {
    font-size: 1.4rem; flex-shrink: 0;
}
#zcai-chatbot .zcai-lead-cta-text {
    flex: 1; display: flex; flex-direction: column; gap: 2px;
}
#zcai-chatbot .zcai-lead-cta-title {
    font-size: 0.92rem; font-weight: 700;
}
#zcai-chatbot .zcai-lead-cta-sub {
    font-size: 0.75rem; opacity: 0.85; font-weight: 500;
}
#zcai-chatbot .zcai-lead-cta-arrow {
    font-size: 1.1rem; flex-shrink: 0; transition: transform 0.2s;
}
#zcai-chatbot .zcai-lead-cta-btn:hover .zcai-lead-cta-arrow {
    transform: translateX(3px);
}
#zcai-chatbot .zcai-lead-cta-skip {
    align-self: flex-start; padding: 4px 8px; background: none;
    border: none; color: #64748b; font-size: 0.78rem; cursor: pointer;
    font-family: inherit; text-decoration: underline;
}
#zcai-chatbot .zcai-lead-cta-skip:hover { color: #1e293b; }

/* Lead Form (inline in chat) */
#zcai-chatbot .zcai-lead-form {
    align-self: flex-start; max-width: 90%; background: #f0fdf4;
    border: 2px solid #86efac; border-radius: 14px; padding: 16px;
    display: flex; flex-direction: column; gap: 8px;
}
#zcai-chatbot .zcai-lead-form h4 {
    font-size: 0.82rem; font-weight: 800; text-transform: uppercase;
    color: #166534; margin: 0 0 4px;
}
#zcai-chatbot .zcai-lead-form input {
    padding: 8px 12px; border: 1px solid #bbf7d0; border-radius: 8px;
    font-size: 0.85rem; font-family: inherit; outline: none; color: #1e293b;
}
#zcai-chatbot .zcai-lead-form input:focus { border-color: #16a34a; }
#zcai-chatbot .zcai-lead-form button {
    padding: 10px; border: none; border-radius: 8px;
    background: #16a34a; color: #fff; font-weight: 700;
    font-size: 0.85rem; cursor: pointer; font-family: inherit;
}

/* Mobile */
@media (max-width: 480px) {
    #zcai-chatbot .zcai-bubble { width: 54px; height: 54px; bottom: 16px; right: 16px; }
    #zcai-chatbot .zcai-bubble svg { width: 24px; height: 24px; }
    #zcai-chatbot .zcai-window {
        bottom: 0; right: 0; left: 0; top: 0;
        width: 100%; height: 100%; border-radius: 0;
    }
    #zcai-chatbot .zcai-teaser {
        bottom: 84px; right: 16px; left: 16px; max-width: none;
    }
    #zcai-chatbot .zcai-teaser::after { right: 18px; }
}
