/* AI Live Chat Widget Styles */
#ailc-chat-widget {
    position: fixed;
    bottom: 24px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
#ailc-chat-widget.ailc-widget-right { right: 24px; }
#ailc-chat-widget.ailc-widget-left  { left: 24px; }

/* Toggle Button */
#ailc-toggle-btn {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: var(--ailc-primary, #6366f1);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 24px;
    box-shadow: 0 4px 20px rgba(99,102,241,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
}
#ailc-toggle-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(99,102,241,0.55);
}

/* Chat Window */
#ailc-chat-window {
    position: absolute;
    bottom: 72px;
    width: 360px;
    height: 520px;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 12px 48px rgba(0,0,0,0.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: ailcSlideUp 0.25s ease;
}
.ailc-widget-right #ailc-chat-window { right: 0; }
.ailc-widget-left  #ailc-chat-window { left: 0; }

@keyframes ailcSlideUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Header */
#ailc-chat-header {
    background: var(--ailc-primary, #6366f1);
    color: #fff;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.ailc-header-info { display: flex; align-items: center; gap: 10px; }
.ailc-avatar {
    width: 38px; height: 38px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    overflow: hidden;
    flex-shrink: 0;
}
.ailc-avatar-img {
    width: 100%; height: 100%;
    object-fit: cover;
    border-radius: 50%;
}
#ailc-chat-title { font-weight: 700; font-size: 15px; }
.ailc-status { font-size: 11px; opacity: 0.85; display: flex; align-items: center; gap: 5px; }
.ailc-dot {
    width: 7px; height: 7px;
    background: #4ade80; border-radius: 50%;
    display: inline-block; animation: ailcPulse 2s infinite;
}
@keyframes ailcPulse { 0%,100%{opacity:1} 50%{opacity:0.4} }
#ailc-close-btn {
    background: none; border: none; color: #fff;
    font-size: 18px; cursor: pointer; opacity: 0.75;
    padding: 4px; line-height: 1;
}
#ailc-close-btn:hover { opacity: 1; }

/* Messages */
#ailc-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f8f9ff;
}
.ailc-bubble {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
    animation: ailcFadeIn 0.2s ease;
}
@keyframes ailcFadeIn { from{opacity:0;transform:translateY(4px)} to{opacity:1;transform:none} }
.ailc-bubble-user {
    background: var(--ailc-primary, #6366f1);
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 6px;
}
.ailc-bubble-ai {
    background: #fff;
    color: #1e1e2e;
    align-self: flex-start;
    border-bottom-left-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}
.ailc-typing {
    display: flex; gap: 5px; align-items: center;
    padding: 12px 16px;
}
.ailc-typing span {
    width: 7px; height: 7px;
    background: #9ca3af; border-radius: 50%;
    animation: ailcBounce 1.4s infinite;
}
.ailc-typing span:nth-child(2) { animation-delay: 0.2s; }
.ailc-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes ailcBounce { 0%,80%,100%{transform:scale(1)} 40%{transform:scale(1.4)} }

/* Lead Capture Form */
#ailc-lead-form {
    padding: 14px 16px;
    background: #fff;
    border-top: 1px solid #e5e7eb;
    flex-shrink: 0;
    overflow-y: auto;
}
.ailc-lead-intro {
    font-size: 13px; color: #4b5563;
    margin-bottom: 10px; line-height: 1.5;
}
.ailc-lead-input {
    width: 100%; box-sizing: border-box;
    border: 1px solid #d1d5db; border-radius: 8px;
    padding: 8px 12px; font-size: 13px;
    margin-bottom: 8px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}
.ailc-lead-input:focus { border-color: var(--ailc-primary, #6366f1); }
.ailc-lead-actions { display: flex; gap: 8px; margin-top: 4px; }
.ailc-send-btn {
    flex: 1; padding: 9px;
    background: var(--ailc-primary, #6366f1); color: #fff;
    border: none; border-radius: 8px;
    font-size: 13px; font-weight: 600; cursor: pointer;
    transition: opacity 0.2s;
}
.ailc-send-btn:hover { opacity: 0.88; }
.ailc-cancel-btn {
    padding: 9px 14px;
    background: #f3f4f6; color: #374151;
    border: none; border-radius: 8px;
    font-size: 13px; cursor: pointer;
}

/* Input Area */
#ailc-input-area {
    display: flex; align-items: center;
    padding: 12px 14px; gap: 10px;
    background: #fff;
    border-top: 1px solid #e5e7eb;
    flex-shrink: 0;
}
#ailc-message-input {
    flex: 1; border: 1px solid #d1d5db;
    border-radius: 24px; padding: 9px 16px;
    font-size: 14px; outline: none;
    font-family: inherit;
    transition: border-color 0.2s;
}
#ailc-message-input:focus { border-color: var(--ailc-primary, #6366f1); }
#ailc-send-btn {
    width: 38px; height: 38px;
    background: var(--ailc-primary, #6366f1); color: #fff;
    border: none; border-radius: 50%; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: opacity 0.2s;
}
#ailc-send-btn:hover { opacity: 0.85; }

/* Footer */
#ailc-footer {
    text-align: center; font-size: 10px;
    color: #9ca3af; padding: 4px 0 8px;
    background: #fff; flex-shrink: 0;
}

@media (max-width: 400px) {
    #ailc-chat-window { width: calc(100vw - 32px); }
}
