/* =====================================================
   AI Sales Chatbot Pro – Frontend Widget v3.0
   ===================================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

#aicpro-widget {
    position: fixed;
    bottom: 24px;
    z-index: 2147483000;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 15px;
    line-height: 1.5;
}
#aicpro-widget * { box-sizing: border-box; }
#aicpro-widget.aicpro-right { right: 24px; }
#aicpro-widget.aicpro-left  { left: 24px; }

/* ---- Launcher button -------------------------------------------------------- */
#aicpro-launcher {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 6px 24px rgba(0,0,0,0.22);
    transition: transform 0.35s cubic-bezier(0.175,0.885,0.32,1.275), box-shadow 0.3s;
    position: relative;
    z-index: 2;
    outline: none;
}
#aicpro-launcher:hover { transform: scale(1.08); box-shadow: 0 10px 30px rgba(0,0,0,0.28); }

#aicpro-badge {
    position: absolute; top: -4px; right: -4px;
    width: 22px; height: 22px; background: #ef4444; color: white; font-size: 11px; font-weight: 700;
    border-radius: 50%; border: 2px solid white; display: flex; align-items: center; justify-content: center;
    opacity: 0; transform: scale(0); transition: opacity 0.3s, transform 0.3s; animation: none;
}
#aicpro-badge.aicpro-badge-show { opacity: 1; transform: scale(1); animation: aicpro-pulse 2s infinite; }
@keyframes aicpro-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(239,68,68,0.6); }
    70%  { box-shadow: 0 0 0 8px rgba(239,68,68,0); }
    100% { box-shadow: 0 0 0 0 rgba(239,68,68,0); }
}

/* ---- Intro popup ------------------------------------------------------------ */
#aicpro-intro {
    position: absolute; bottom: 74px; background: #fff; border-radius: 12px;
    padding: 12px 28px 12px 14px; box-shadow: 0 8px 32px rgba(0,0,0,0.14); width: 280px;
    font-size: 14px; color: #1f2937; font-weight: 500; border: 1px solid #e5e7eb;
    opacity: 0; transform: scale(0.7) translateY(16px); transition: opacity 0.35s, transform 0.35s; pointer-events: none; z-index: 1;
}
#aicpro-intro.aicpro-intro-show { opacity: 1; transform: scale(1) translateY(0); pointer-events: auto; }
.aicpro-right #aicpro-intro { right: 0; transform-origin: bottom right; }
.aicpro-left  #aicpro-intro { left: 0;  transform-origin: bottom left; }
#aicpro-intro-close { position: absolute; top: 8px; right: 8px; background: none; border: none; cursor: pointer; font-size: 18px; color: #9ca3af; }

/* ---- Chat window ------------------------------------------------------------ */
#aicpro-window {
    position: absolute; bottom: 74px; width: 380px; height: 560px; max-height: 85vh;
    background: #fff; border-radius: 16px; box-shadow: 0 12px 50px rgba(0,0,0,0.18);
    display: flex; flex-direction: column; overflow: hidden; opacity: 0; transform: scale(0.7) translateY(40px);
    transition: opacity 0.35s, transform 0.35s; pointer-events: none; z-index: 3; border: 1px solid rgba(0,0,0,0.06);
}
#aicpro-window.aicpro-open { opacity: 1; transform: scale(1) translateY(0); pointer-events: auto; }
.aicpro-right #aicpro-window { right: 0; transform-origin: bottom right; }
.aicpro-left  #aicpro-window { left: 0;  transform-origin: bottom left; }

#aicpro-header { padding: 14px 16px; display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; }
#aicpro-header-info { display: flex; align-items: center; gap: 10px; }
#aicpro-avatar { width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: white; font-weight: 700; font-size: 16px; flex-shrink: 0; object-fit: cover; }
#aicpro-bot-name { color: white; font-weight: 600; font-size: 15px; }
#aicpro-status { color: rgba(255,255,255,0.8); font-size: 12px; display: flex; align-items: center; gap: 5px; }
.aicpro-dot { width: 7px; height: 7px; background: #4ade80; border-radius: 50%; display: inline-block; animation: aicpro-blink 2s infinite; }
@keyframes aicpro-blink { 0%,100%{opacity:1;} 50%{opacity:0.4;} }
#aicpro-header-actions { display: flex; align-items: center; gap: 8px; }
#aicpro-minimise { background: rgba(255,255,255,0.15); border: none; color: white; width: 28px; height: 28px; border-radius: 50%; font-size: 20px; cursor: pointer; display: flex; align-items: center; justify-content: center; }

#aicpro-body { flex: 1; padding: 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; background: #f8fafc; scroll-behavior: smooth; }
#aicpro-body::-webkit-scrollbar { width: 4px; }
#aicpro-body::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

.aicpro-msg { display: flex; flex-direction: column; max-width: 82%; animation: aicpro-fadein 0.25s ease; }
@keyframes aicpro-fadein { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }
.aicpro-msg.aicpro-user { align-self: flex-end; }
.aicpro-msg.aicpro-bot  { align-self: flex-start; }
.aicpro-bubble { padding: 11px 15px; border-radius: 18px; word-break: break-word; font-size: 14px; line-height: 1.6; }
.aicpro-user .aicpro-bubble { background: #2563eb; color: white; border-bottom-right-radius: 4px; }
.aicpro-bot .aicpro-bubble { background: white; color: #1f2937; border: 1px solid #e5e7eb; border-bottom-left-radius: 4px; box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
.aicpro-bot .aicpro-bubble a { color: #2563eb; font-weight: 500; text-decoration: none; }
.aicpro-time { font-size: 11px; color: #9ca3af; margin-top: 4px; }
.aicpro-user .aicpro-time { text-align: right; }

.aicpro-typing-bubble { min-width: 52px; }
.aicpro-typing-bubble span { display: inline-block; width: 7px; height: 7px; background: #9ca3af; border-radius: 50%; margin: 0 2px; animation: aicpro-bounce 1.3s infinite ease-in-out both; }
.aicpro-typing-bubble span:nth-child(1) { animation-delay: -0.32s; }
.aicpro-typing-bubble span:nth-child(2) { animation-delay: -0.16s; }
@keyframes aicpro-bounce { 0%,80%,100%{ transform:scale(0); } 40%{ transform:scale(1.1); } }

#aicpro-quick-replies { display: flex; gap: 7px; padding: 10px 16px; flex-wrap: wrap; background: #f8fafc; border-top: 1px solid #f1f5f9; flex-shrink: 0; }
.aicpro-quick-btn { padding: 6px 14px; border: 1px solid #d1d5db; border-radius: 20px; background: white; font-size: 13px; cursor: pointer; color: #374151; }
.aicpro-quick-btn:hover { background: #eff6ff; border-color: #2563eb; color: #2563eb; }

#aicpro-footer { display: flex; align-items: center; padding: 12px 14px; gap: 10px; background: white; border-top: 1px solid #f1f5f9; flex-shrink: 0; }
#aicpro-input { flex: 1; border: 1px solid #e2e8f0; border-radius: 22px; padding: 10px 16px; font-size: 14px; font-family: inherit; outline: none; background: #f8fafc; }
#aicpro-input:focus { border-color: #2563eb; background: white; }
#aicpro-send { width: 40px; height: 40px; border: none; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; }

#aicpro-powered { text-align: center; font-size: 11px; color: #cbd5e1; padding: 6px; background: white; }

/* ---- Modals (Lead Capture & Booking) ---- */
.aicpro-overlay-modal {
    position: absolute; top:0; left:0; width:100%; height:100%;
    background: rgba(0,0,0,0.5); z-index: 10; display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(2px);
}
.aicpro-modal-content {
    background: white; width: 85%; padding: 24px; border-radius: 12px; box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    position: relative; animation: aicpro-modal-pop 0.3s cubic-bezier(0.175,0.885,0.32,1.275);
}
@keyframes aicpro-modal-pop { 0%{transform:scale(0.8);opacity:0;} 100%{transform:scale(1);opacity:1;} }
.aicpro-modal-close { position: absolute; top: 12px; right: 12px; background: none; border: none; font-size: 20px; color: #9ca3af; cursor: pointer; }
.aicpro-modal-icon { font-size: 32px; text-align: center; margin-bottom: 10px; }

#aicpro-lead-form input, #aicpro-lead-form select,
#aicpro-book-form input, #aicpro-book-form textarea {
    width: 100%; padding: 10px 12px; margin-bottom: 12px; border: 1px solid #d1d5db; border-radius: 6px; font-family: inherit; font-size: 14px;
}
#aicpro-lead-form textarea { resize: none; }
#aicpro-lead-submit, #aicpro-book-submit {
    width: 100%; padding: 12px; color: white; border: none; border-radius: 6px; font-weight: 600; font-size: 15px; cursor: pointer; transition: opacity 0.2s;
}
#aicpro-lead-submit:hover, #aicpro-book-submit:hover { opacity: 0.9; }
#aicpro-lead-submit:disabled, #aicpro-book-submit:disabled { opacity: 0.6; cursor: not-allowed; }

/* Mobile */
@media (max-width: 480px) {
    #aicpro-widget.aicpro-right { right: 16px; }
    #aicpro-widget.aicpro-left  { left: 16px; }
    #aicpro-window { width: calc(100vw - 32px); height: 75vh; bottom: 76px; }
}
