/* AI Chatbot HUB Client v4.2.0 — base layout only, visual styles via JS */

/* ─── Floating button ─── */
#aicbc-btn {
    position: relative;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    /* No background — shows avatar image or SVG only, glow effect added by JS */
    filter: drop-shadow(0 6px 20px rgba(0,0,0,.30));
    transition: transform .18s ease, filter .18s ease;
}
#aicbc-btn:hover { transform: scale(1.08); filter: drop-shadow(0 8px 28px rgba(0,0,0,.38)); }

/* Avatar image — no circle background */
#aicbc-avatar-img-wrap {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    overflow: hidden;
    position: absolute;
    inset: 0;
}
#aicbc-avatar-img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }

/* SVG icon shown when no custom image */
#aicbc-avatar-svg {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    inset: 0;
}

/* Notification badge */
#aicbc-badge {
    position: absolute;
    top: -5px;
    right: -8px;
    min-width: 26px;
    height: 18px;
    border-radius: 9px;
    background: #ef4444;
    color: #fff;
    font: 700 10px/18px -apple-system,sans-serif;
    text-align: center;
    padding: 0 5px;
    border: 2px solid #fff;
    z-index: 10;
    animation: aicbc-pop .3s ease;
    pointer-events: none;
    letter-spacing: .5px;
}
@keyframes aicbc-pop { 0%{transform:scale(0)} 70%{transform:scale(1.2)} 100%{transform:scale(1)} }

/* ─── Chat window ─── */
#aicbc-win {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 360px;
    max-height: 580px;
    background: #fff;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,.18), 0 2px 12px rgba(0,0,0,.10);
    display: flex;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    animation: aicbc-slide .22s ease;
}
@keyframes aicbc-slide { from{opacity:0;transform:translateY(10px)} to{opacity:1;transform:translateY(0)} }
#aicbc-root.aicbc-left #aicbc-win { right: auto; left: 0; }

/* Header */
#aicbc-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 15px;
    flex-shrink: 0;
}
#aicbc-header-av {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,.2);
    border: 1.5px solid rgba(255,255,255,.35);
}
#aicbc-header-info { flex: 1; min-width: 0; }
#aicbc-bot-name {
    display: block;
    font: 700 14px/1 inherit;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
#aicbc-status {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: rgba(255,255,255,.75);
    margin-top: 3px;
}
#aicbc-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #4ade80;
    box-shadow: 0 0 0 2px rgba(74,222,128,.3);
    flex-shrink: 0;
}
#aicbc-close {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    background: rgba(255,255,255,.18);
    border: 1px solid rgba(255,255,255,.25);
    color: #fff;
    font-size: 14px;
    line-height: 28px;
    text-align: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background .15s;
    user-select: none;
}
#aicbc-close:hover { background: rgba(255,255,255,.32); }

/* Messages */
#aicbc-msgs {
    flex: 1;
    overflow-y: auto;
    padding: 14px 13px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #f6f8fb;
    scroll-behavior: smooth;
}
#aicbc-msgs::-webkit-scrollbar { width: 4px; }
#aicbc-msgs::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; }

.aicbc-msg { display: flex; flex-direction: column; max-width: 86%; }
.aicbc-msg.bot  { align-self: flex-start; }
.aicbc-msg.user { align-self: flex-end; }

.aicbc-bubble {
    padding: 9px 13px;
    border-radius: 16px;
    font-size: 13.5px;
    line-height: 1.5;
    word-break: break-word;
}
.aicbc-msg.bot  .aicbc-bubble {
    background: #fff;
    color: #1e293b;
    border-radius: 3px 16px 16px 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,.07);
    border: .5px solid #e5e9f0;
}
.aicbc-msg.user .aicbc-bubble {
    color: #fff;
    border-radius: 16px 3px 16px 16px;
}
.aicbc-ts { font-size: 10px; color: #94a3b8; margin-top: 3px; padding: 0 2px; }
.aicbc-msg.user .aicbc-ts { text-align: right; }

/* Typing indicator */
.aicbc-typing { padding: 10px 14px !important; }
.aicbc-dots { display: flex; gap: 4px; align-items: center; }
.aicbc-dots span {
    width: 6px; height: 6px; border-radius: 50%; background: #94a3b8;
    animation: aicbc-bounce 1.2s ease-in-out infinite;
}
.aicbc-dots span:nth-child(2) { animation-delay: .18s; }
.aicbc-dots span:nth-child(3) { animation-delay: .36s; }
@keyframes aicbc-bounce { 0%,80%,100%{transform:translateY(0)} 40%{transform:translateY(-5px)} }

/* Message entry animation */
.aicbc-msg { animation: aicbc-in .2s ease; }
@keyframes aicbc-in { from{opacity:0;transform:translateY(5px)} to{opacity:1;transform:translateY(0)} }

/* Lead form */
#aicbc-lead-form {
    border-top: 1px solid #e8ecf2;
    padding: 13px;
    background: #fafbff;
    flex-shrink: 0;
}
#aicbc-lead-title {
    font: 600 13px/1 inherit;
    color: #1e293b;
    margin-bottom: 10px;
}
#aicbc-lead-form input {
    display: block;
    width: 100%;
    padding: 8px 11px;
    border: 1.5px solid #e2e8f0;
    border-radius: 9px;
    font-size: 13px;
    font-family: inherit;
    color: #1e293b;
    background: #fff;
    outline: none;
    margin-bottom: 7px;
    box-sizing: border-box;
    transition: border-color .2s;
}
#aicbc-lead-form input:focus { border-color: #6366f1; }
#aicbc-l-send, #aicbc-l-skip {
    display: block;
    width: 100%;
    border: none;
    cursor: pointer;
    font-family: inherit;
    box-sizing: border-box;
}
#aicbc-l-send {
    padding: 9px;
    border-radius: 9px;
    font: 600 13px/1 inherit;
    color: #fff;
    margin-bottom: 5px;
}
#aicbc-l-skip {
    padding: 4px;
    background: transparent;
    font-size: 12px;
    color: #94a3b8;
    text-align: center;
}

/* Inline lead button */
.aicbc-lead-btn {
    align-self: flex-start;
    border: none;
    cursor: pointer;
    border-radius: 11px;
    padding: 9px 16px;
    font: 600 13px/1 -apple-system,sans-serif;
    color: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
    transition: opacity .2s;
    margin: 3px 0;
    display: inline-block;
}
.aicbc-lead-btn:hover { opacity: .85; }

/* Contact prompt */
.aicbc-prompt {
    align-self: flex-start;
    background: #fffbf0;
    border: 1px solid #fed7aa;
    border-radius: 13px;
    padding: 11px 13px;
    font-size: 13px;
    max-width: 95%;
}
.aicbc-prompt strong { display: block; color: #1e293b; margin-bottom: 4px; }
.aicbc-prompt span { display: block; color: #64748b; margin-bottom: 8px; font-size: 12px; }
.aicbc-prompt-btn {
    border: none;
    cursor: pointer;
    border-radius: 7px;
    padding: 7px 13px;
    font: 600 12.5px/1 inherit;
    color: #fff;
}

/* Footer / input */
#aicbc-footer { border-top: 1px solid #e8ecf2; padding: 9px 11px 9px; background: #fff; flex-shrink: 0; }
#aicbc-input-wrap {
    display: flex;
    align-items: flex-end;
    gap: 7px;
    background: #f1f5f9;
    border: 1.5px solid #e2e8f0;
    border-radius: 13px;
    padding: 7px 7px 7px 13px;
    transition: border-color .2s;
}
#aicbc-input-wrap:focus-within { border-color: #6366f1; }
#aicbc-input {
    flex: 1;
    border: none;
    background: transparent;
    resize: none;
    font: 13.5px/1.45 -apple-system,BlinkMacSystemFont,sans-serif;
    color: #1e293b;
    max-height: 96px;
    outline: none;
    padding: 2px 0;
    min-width: 0;
    display: block;
    box-sizing: border-box;
}
#aicbc-input::placeholder { color: #94a3b8; }
#aicbc-send {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    color: #fff;
    transition: opacity .2s;
}
#aicbc-send:disabled { opacity: .35; cursor: default; }
#aicbc-meta {
    display: flex;
    justify-content: space-between;
    font-size: 10.5px;
    color: #94a3b8;
    margin-top: 5px;
    padding: 0 2px;
}

/* Product cards */
.aicbc-card {
    background: #fff;
    border: 1px solid #e5e9f0;
    border-radius: 13px;
    overflow: hidden;
    align-self: flex-start;
    max-width: 92%;
    box-shadow: 0 2px 8px rgba(0,0,0,.07);
    margin: 2px 0;
}
.aicbc-card-img { width: 100%; max-height: 140px; object-fit: cover; display: block; }
.aicbc-card-body { padding: 9px 12px; }
.aicbc-card-name  { font: 700 13px/1.3 inherit; color: #1e293b; display: block; margin-bottom: 3px; }
.aicbc-card-price { font: 700 15px/1 inherit; color: #1e3a5f; display: block; margin-bottom: 2px; }
.aicbc-card-stock { font-size: 12px; display: block; margin-bottom: 8px; }
.aicbc-card-stock.in  { color: #059669; }
.aicbc-card-stock.out { color: #dc2626; }
.aicbc-card-link {
    display: inline-block;
    color: #fff;
    text-decoration: none;
    font: 600 12px/1 inherit;
    padding: 6px 13px;
    border-radius: 7px;
}

/* ── WhatsApp contact buttons ── */
.aicbc-contact-panel {
    background: #f0fdf4;
    border-top: 1px solid #bbf7d0;
    padding: 12px 13px;
    flex-shrink: 0;
}
.aicbc-contact-panel-title {
    font: 600 12px/1 -apple-system, sans-serif;
    color: #15803d;
    margin-bottom: 9px;
    display: flex;
    align-items: center;
    gap: 5px;
}
.aicbc-wa-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    background: #25d366;
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 9px 13px;
    font: 600 13px/1 -apple-system, sans-serif;
    cursor: pointer;
    margin-bottom: 6px;
    text-decoration: none;
    transition: background .15s, transform .1s;
    box-sizing: border-box;
}
.aicbc-wa-btn:last-child { margin-bottom: 0; }
.aicbc-wa-btn:hover { background: #1ebe5d; transform: translateY(-1px); }
.aicbc-wa-btn svg { flex-shrink: 0; }
.aicbc-wa-btn span { flex: 1; text-align: left; }

/* Inline contact trigger button in messages area */
.aicbc-contact-trigger {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: none;
    cursor: pointer;
    border-radius: 11px;
    padding: 9px 16px;
    font: 600 13px/1 -apple-system, sans-serif;
    color: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,.12);
    transition: opacity .2s;
    margin: 3px 0;
}
.aicbc-contact-trigger:hover { opacity: .88; }

/* ── WhatsApp footer icons (discrete) ── */
#aicbc-wa-icons {
    display: flex;
    align-items: center;
    gap: 5px;
    flex: 1;
    justify-content: center;
}
.aicbc-wa-icon-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #25d366;
    text-decoration: none;
    font-size: 10.5px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 5px;
    border: 1px solid #bbf7d0;
    background: #f0fdf4;
    transition: background .15s;
    white-space: nowrap;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.aicbc-wa-icon-link:hover { background: #dcfce7; }
