/* AI-Free Chatbot by CONVIRZON v2.0 */
:root {
    --aifcb-primary: #4f46e5;
    --aifcb-primary-dark: #3730a3;
    --aifcb-text-on-primary: #ffffff;
    --aifcb-bg: #ffffff;
    --aifcb-bg-secondary: #f8fafc;
    --aifcb-border: #e2e8f0;
    --aifcb-shadow: 0 20px 60px rgba(0,0,0,0.15), 0 8px 25px rgba(0,0,0,0.1);
    --aifcb-radius: 16px;
    --aifcb-bot-bubble: #f1f5f9;
    --aifcb-bot-bubble-text: #1e293b;
    --aifcb-user-bubble: #4f46e5;
    --aifcb-input-bg: #f8fafc;
    --aifcb-header-bg: var(--aifcb-primary);
    --aifcb-footer-text: #94a3b8;
    --aifcb-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --aifcb-z: 999999;
}

/* ===== DARK MODE ===== */
#aifcb-widget.aifcb-dark {
    --aifcb-bg: #1e1e2e;
    --aifcb-bg-secondary: #2a2a3e;
    --aifcb-border: #3a3a55;
    --aifcb-bot-bubble: #2a2a3e;
    --aifcb-bot-bubble-text: #e2e8f0;
    --aifcb-input-bg: #2a2a3e;
    --aifcb-footer-text: #64748b;
}

/* ===== WIDGET CONTAINER ===== */
#aifcb-widget { position: fixed; z-index: var(--aifcb-z); font-family: var(--aifcb-font); }
#aifcb-widget.aifcb-position-bottom-right { bottom: 24px; right: 24px; }
#aifcb-widget.aifcb-position-bottom-left  { bottom: 24px; left: 24px; }
#aifcb-widget * { box-sizing: border-box; }

/* ===== TEASER BUBBLE ===== */
#aifcb-teaser {
    display: none;
    position: absolute;
    bottom: 70px;
    right: 0;
    background: #fff;
    border: 1px solid var(--aifcb-border);
    border-radius: 12px 12px 4px 12px;
    padding: 10px 14px;
    font-size: 13px;
    color: #1e293b;
    white-space: nowrap;
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
    cursor: pointer;
    max-width: 220px;
    white-space: normal;
    font-weight: 500;
}
.aifcb-position-bottom-left #aifcb-teaser { right: auto; left: 0; border-radius: 12px 12px 12px 4px; }
#aifcb-widget.aifcb-dark #aifcb-teaser { background: #2a2a3e; color: #e2e8f0; border-color: #3a3a55; }

/* ===== TOGGLE BUTTON ===== */
.aifcb-toggle-btn {
    width: 60px; height: 60px; border-radius: 50%;
    background: var(--aifcb-primary); border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: var(--aifcb-text-on-primary);
    box-shadow: 0 4px 20px rgba(79,70,229,0.4), 0 2px 8px rgba(0,0,0,0.15);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative; outline: none;
}
.aifcb-toggle-btn:hover { transform: scale(1.08); box-shadow: 0 6px 25px rgba(79,70,229,0.5); }
.aifcb-toggle-btn:active { transform: scale(0.96); }

/* ===== CHAT WINDOW ===== */
.aifcb-window {
    position: absolute; bottom: 72px; right: 0;
    width: 360px; height: 520px;
    background: var(--aifcb-bg);
    border-radius: var(--aifcb-radius);
    box-shadow: var(--aifcb-shadow);
    display: flex; flex-direction: column; overflow: hidden;
    border: 1px solid var(--aifcb-border);
}
.aifcb-position-bottom-left .aifcb-window { right: auto; left: 0; }

/* ===== HEADER ===== */
.aifcb-header {
    background: var(--aifcb-primary); color: var(--aifcb-text-on-primary);
    padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
}
.aifcb-header-info { display: flex; align-items: center; gap: 10px; }
.aifcb-avatar {
    width: 38px; height: 38px; border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0; overflow: hidden;
}
.aifcb-avatar-img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.aifcb-bot-name { font-weight: 700; font-size: 15px; }
.aifcb-status { font-size: 12px; opacity: 0.85; display: flex; align-items: center; gap: 5px; margin-top: 1px; }
.aifcb-status-dot { width: 7px; height: 7px; background: #4ade80; border-radius: 50%; display: inline-block; animation: aifcb-pulse 2s infinite; }
.aifcb-close-btn {
    background: rgba(255,255,255,0.15); border: none; cursor: pointer; color: #fff;
    width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    transition: background 0.15s; padding: 0;
}
.aifcb-close-btn:hover { background: rgba(255,255,255,0.3); }

/* ===== MESSAGES ===== */
.aifcb-messages {
    flex: 1; overflow-y: auto; padding: 14px 12px;
    display: flex; flex-direction: column; gap: 10px;
    background: var(--aifcb-bg-secondary); scroll-behavior: smooth;
}
.aifcb-messages::-webkit-scrollbar { width: 4px; }
.aifcb-messages::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

.aifcb-msg-row { display: flex; gap: 7px; align-items: flex-end; animation: aifcb-msg-in 0.25s ease both; }
.aifcb-msg-row.user-row { flex-direction: row-reverse; }

.aifcb-msg-avatar {
    width: 28px; height: 28px; border-radius: 50%;
    background: var(--aifcb-primary); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700; flex-shrink: 0; overflow: hidden;
}
.aifcb-user-avatar { background: #64748b; }

.aifcb-bubble {
    max-width: 78%; padding: 10px 13px; border-radius: 14px;
    font-size: 14px; line-height: 1.5; word-wrap: break-word;
}
.aifcb-bot-bubble { background: var(--aifcb-bot-bubble); color: var(--aifcb-bot-bubble-text); border-bottom-left-radius: 4px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.aifcb-user-bubble { background: var(--aifcb-user-bubble); color: #fff; border-bottom-right-radius: 4px; box-shadow: 0 2px 8px rgba(79,70,229,0.25); }

/* Typing */
.aifcb-typing {
    display: flex; align-items: center; gap: 4px; padding: 12px 14px;
    background: var(--aifcb-bot-bubble); border-radius: 14px; border-bottom-left-radius: 4px;
}
.aifcb-typing span { width: 7px; height: 7px; background: #94a3b8; border-radius: 50%; animation: aifcb-bounce 1.2s infinite; }
.aifcb-typing span:nth-child(2) { animation-delay: 0.15s; }
.aifcb-typing span:nth-child(3) { animation-delay: 0.30s; }

/* ===== QUICK REPLIES ===== */
.aifcb-quick-replies-row {
    display: flex; flex-wrap: wrap; gap: 7px; padding: 2px 0 2px 35px;
    animation: aifcb-msg-in 0.3s ease both;
}
.aifcb-quick-reply-btn {
    background: #fff; border: 1.5px solid var(--aifcb-primary); color: var(--aifcb-primary);
    border-radius: 20px; padding: 6px 14px; font-size: 13px; font-weight: 600;
    cursor: pointer; transition: all 0.15s; white-space: nowrap;
    font-family: var(--aifcb-font);
}
.aifcb-quick-reply-btn:hover { background: var(--aifcb-primary); color: #fff; }
#aifcb-widget.aifcb-dark .aifcb-quick-reply-btn { background: #2a2a3e; }

/* ===== FALLBACK ACTION BUTTONS ===== */
.aifcb-fallback-actions {
    display: flex; flex-direction: row; gap: 10px;
    justify-content: center; align-items: center; flex-wrap: wrap;
    padding: 6px 10px 2px; animation: aifcb-msg-in 0.35s ease both; animation-delay: 0.15s;
}
.aifcb-action-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 10px 18px; border-radius: 50px; font-size: 13px; font-weight: 700;
    text-decoration: none; cursor: pointer; white-space: nowrap;
    transition: transform 0.18s cubic-bezier(.34,1.56,.64,1), box-shadow 0.18s;
}
.aifcb-action-btn:hover { transform: translateY(-2px) scale(1.03); text-decoration: none; }
.aifcb-action-btn:active { transform: scale(0.97); }
.aifcb-action-call { background: #fff; color: #15803d; border: 2px solid #16a34a; box-shadow: 0 2px 8px rgba(21,128,61,0.12); }
.aifcb-action-call:hover { background: #f0fdf4; color: #15803d; box-shadow: 0 6px 18px rgba(21,128,61,0.2); }
.aifcb-action-appt { background: var(--aifcb-primary); color: var(--aifcb-text-on-primary); border: 2px solid transparent; box-shadow: 0 2px 8px rgba(79,70,229,0.25); }
.aifcb-action-appt:hover { background: var(--aifcb-primary-dark,#3730a3); color: var(--aifcb-text-on-primary); box-shadow: 0 6px 18px rgba(79,70,229,0.35); }

/* ===== INLINE CARD FORMS (Lead / Booking) ===== */
.aifcb-card-form {
    background: var(--aifcb-bg); border: 1.5px solid var(--aifcb-border); border-radius: 14px;
    padding: 14px; margin: 4px 0; animation: aifcb-msg-in 0.3s ease both;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
.aifcb-form-title { font-size: 13px; font-weight: 700; color: var(--aifcb-bot-bubble-text); margin-bottom: 10px; }
.aifcb-form-input {
    width: 100%; border: 1.5px solid var(--aifcb-border); border-radius: 8px;
    padding: 8px 10px; font-size: 13px; font-family: var(--aifcb-font);
    background: var(--aifcb-input-bg); color: var(--aifcb-bot-bubble-text);
    margin-bottom: 7px; outline: none; transition: border-color 0.15s;
}
.aifcb-form-input:focus { border-color: var(--aifcb-primary); }
.aifcb-form-actions { display: flex; gap: 8px; margin-top: 4px; }
.aifcb-form-btn {
    flex: 1; padding: 9px; border-radius: 8px; font-size: 13px; font-weight: 700;
    cursor: pointer; border: none; font-family: var(--aifcb-font); transition: all 0.15s;
}
.aifcb-form-submit { background: var(--aifcb-primary); color: var(--aifcb-text-on-primary); }
.aifcb-form-submit:hover { opacity: 0.9; }
.aifcb-form-skip { background: var(--aifcb-bg-secondary); color: #64748b; border: 1px solid var(--aifcb-border); }
.aifcb-form-skip:hover { background: var(--aifcb-border); }

/* ===== INPUT AREA ===== */
.aifcb-input-area {
    padding: 11px 12px 9px; background: var(--aifcb-bg);
    border-top: 1px solid var(--aifcb-border); flex-shrink: 0;
}
.aifcb-input-wrapper { display: flex; gap: 8px; align-items: center; }
.aifcb-input {
    flex: 1; border: 1.5px solid var(--aifcb-border); border-radius: 24px;
    padding: 10px 16px; font-size: 14px; font-family: var(--aifcb-font);
    outline: none; background: var(--aifcb-input-bg); color: var(--aifcb-bot-bubble-text);
    transition: border-color 0.15s;
}
.aifcb-input:focus { border-color: var(--aifcb-primary); background: var(--aifcb-bg); }
.aifcb-input::placeholder { color: #94a3b8; }
.aifcb-send-btn {
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--aifcb-primary); color: var(--aifcb-text-on-primary);
    border: none; cursor: pointer; display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; transition: background 0.15s, transform 0.1s;
}
.aifcb-send-btn:hover { background: var(--aifcb-primary-dark,#3730a3); }
.aifcb-send-btn:active { transform: scale(0.92); }
.aifcb-footer-text { font-size: 10px; color: var(--aifcb-footer-text); text-align: center; margin-top: 5px; }

/* ===== ANIMATIONS ===== */
@keyframes aifcb-msg-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes aifcb-bounce { 0%,60%,100% { transform: translateY(0); } 30% { transform: translateY(-5px); } }
@keyframes aifcb-pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.2); opacity: 0.7; } }

/* ===== MOBILE ===== */
@media (max-width: 480px) {
    #aifcb-widget.aifcb-position-bottom-right, #aifcb-widget.aifcb-position-bottom-left { bottom: 14px; right: 14px; left: auto; }
    .aifcb-window { width: calc(100vw - 28px); right: -10px; }
}

/* ===== LEAD INTRO FORM (shown first before chat) ===== */
.aifcb-lead-intro-form {
    background: var(--aifcb-bg);
    border: 1.5px solid var(--aifcb-border);
    border-radius: 16px;
    padding: 18px 16px 14px;
    margin: 4px 0;
    animation: aifcb-msg-in 0.3s ease both;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}
.aifcb-lead-intro-header {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 14px;
}
.aifcb-lead-intro-icon {
    font-size: 26px;
    line-height: 1;
    flex-shrink: 0;
}
.aifcb-lead-intro-title {
    font-size: 14px;
    font-weight: 800;
    color: var(--aifcb-bot-bubble-text);
    margin-bottom: 2px;
}
.aifcb-lead-intro-sub {
    font-size: 12px;
    color: #94a3b8;
    line-height: 1.4;
}
.aifcb-lead-field-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    background: var(--aifcb-bg-secondary);
    border: 1.5px solid var(--aifcb-border);
    border-radius: 10px;
    padding: 0 12px;
    transition: border-color 0.15s;
}
.aifcb-lead-field-wrap:focus-within {
    border-color: var(--aifcb-primary);
    background: var(--aifcb-bg);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.08);
}
.aifcb-lead-field-icon {
    font-size: 15px;
    flex-shrink: 0;
    opacity: 0.7;
}
.aifcb-lead-intro-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    padding: 10px 0;
    font-size: 13px;
    font-family: var(--aifcb-font);
    color: var(--aifcb-bot-bubble-text);
    width: 100%;
}
.aifcb-lead-intro-input::placeholder {
    color: #94a3b8;
}
.aifcb-lead-error {
    color: #dc2626;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 2px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.aifcb-lead-intro-btn {
    width: 100%;
    padding: 11px;
    background: var(--aifcb-primary);
    color: var(--aifcb-text-on-primary);
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    font-family: var(--aifcb-font);
    margin-top: 6px;
    transition: opacity 0.15s, transform 0.15s;
    letter-spacing: 0.01em;
}
.aifcb-lead-intro-btn:hover  { opacity: 0.92; transform: translateY(-1px); }
.aifcb-lead-intro-btn:active { transform: translateY(0); opacity: 1; }
.aifcb-lead-intro-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.aifcb-lead-privacy {
    text-align: center;
    font-size: 11px;
    color: #94a3b8;
    margin-top: 8px;
}

/* Input locked state */
.aifcb-input:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    background: var(--aifcb-bg-secondary);
}
