/* Tai Chat Widget — powered by h-conductor */
/* Light theme default (vibeasite branding), dark mode via prefers-color-scheme */

.tai-bubble{position:fixed;bottom:24px;right:24px;width:56px;height:56px;border-radius:50%;background:var(--tai-accent,#6366f1);color:#fff;border:none;cursor:pointer;box-shadow:0 4px 16px rgba(99,102,241,.4);z-index:9990;display:flex;align-items:center;justify-content:center;transition:transform .2s,box-shadow .2s}
.tai-bubble:hover{transform:scale(1.08);box-shadow:0 6px 24px rgba(99,102,241,.5)}
.tai-bubble svg{width:28px;height:28px;fill:currentColor}
.tai-bubble .tai-close{display:none}
.tai-bubble.open .tai-chat-icon{display:none}
.tai-bubble.open .tai-close{display:block}

.tai-panel{position:fixed;bottom:92px;right:24px;width:400px;max-width:calc(100vw - 32px);height:540px;max-height:calc(100vh - 120px);border-radius:16px;background:#fff;border:1px solid #e5e7eb;box-shadow:0 12px 40px rgba(0,0,0,.15);z-index:9989;display:none;flex-direction:column;overflow:hidden;font-family:'Inter',-apple-system,sans-serif;transition:all .3s ease;color:#1f2937}
.tai-panel.open{display:flex}

/* Maximize mode */
.tai-panel.maximized{width:580px;height:80vh;max-height:calc(100vh - 48px);bottom:50%;right:50%;transform:translate(50%,50%);border-radius:16px;box-shadow:0 20px 60px rgba(0,0,0,.25)}

/* Backdrop */
.tai-backdrop{position:fixed;inset:0;background:rgba(0,0,0,.4);backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px);z-index:9988;opacity:0;pointer-events:none;transition:opacity .3s ease}
.tai-backdrop.show{opacity:1;pointer-events:auto}

.tai-header{padding:16px 20px;background:linear-gradient(135deg,#6366f1,#8b5cf6);color:#fff;font-weight:600;font-size:15px;display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.tai-header .tai-dot{width:8px;height:8px;border-radius:50%;background:#4ade80;flex-shrink:0}
.tai-maximize{background:none;border:none;color:#fff;cursor:pointer;margin-left:auto;padding:4px;opacity:.8;transition:opacity .15s}
.tai-maximize:hover{opacity:1}
.tai-maximize svg{width:16px;height:16px;fill:currentColor}

/* Progress bar (onboarding) */
.tai-progress{width:100%;height:4px;background:rgba(255,255,255,.2);border-radius:2px;margin-top:8px;overflow:hidden;flex-basis:100%}
.tai-progress-fill{height:100%;background:#4ade80;border-radius:2px;transition:width .4s ease}

.tai-messages{flex:1;overflow-y:auto;padding:16px;display:flex;flex-direction:column;gap:12px}
.tai-msg{max-width:85%;padding:10px 14px;border-radius:12px;font-size:14px;line-height:1.6;word-wrap:break-word}
.tai-msg.user{align-self:flex-end;background:#6366f1;color:#fff;border-bottom-right-radius:4px}
.tai-msg.assistant{align-self:flex-start;background:#f3f4f6;color:#1f2937;border-bottom-left-radius:4px}
.tai-msg.assistant strong{color:#6366f1}
.tai-msg.assistant code{background:rgba(99,102,241,.1);padding:1px 4px;border-radius:3px;font-size:13px}
.tai-msg.system{align-self:center;font-size:12px;color:#9ca3af;padding:4px 12px}

.tai-typing{align-self:flex-start;padding:10px 14px;background:#f3f4f6;border-radius:12px;border-bottom-left-radius:4px;display:none}
.tai-typing.show{display:flex;gap:4px;align-items:center}
.tai-typing span{width:6px;height:6px;border-radius:50%;background:#9ca3af;animation:tai-bounce .6s infinite alternate}
.tai-typing span:nth-child(2){animation-delay:.15s}
.tai-typing span:nth-child(3){animation-delay:.3s}
@keyframes tai-bounce{to{opacity:.3;transform:translateY(-4px)}}

/* Quick-reply buttons */
.tai-quick-replies{display:flex;flex-wrap:wrap;gap:6px;padding:4px 0}
.tai-quick-btn{background:transparent;border:1px solid #6366f1;color:#6366f1;border-radius:20px;padding:6px 14px;font-size:13px;cursor:pointer;transition:all .15s;font-family:inherit}
.tai-quick-btn:hover{background:#6366f1;color:#fff}

.tai-input-area{padding:12px 16px;border-top:1px solid #e5e7eb;display:flex;gap:8px;background:#fff}
.tai-input{flex:1;border:1px solid #e5e7eb;border-radius:24px;padding:10px 16px;font-size:14px;outline:none;background:#fafafa;color:#1f2937;font-family:inherit;resize:none;max-height:80px}
.tai-input::placeholder{color:#9ca3af}
.tai-input:focus{border-color:#6366f1;box-shadow:0 0 0 2px rgba(99,102,241,.15)}
.tai-send{width:40px;height:40px;border-radius:50%;background:#6366f1;color:#fff;border:none;cursor:pointer;display:flex;align-items:center;justify-content:center;flex-shrink:0;transition:opacity .15s}
.tai-send:disabled{opacity:.4;cursor:default}
.tai-send svg{width:18px;height:18px;fill:currentColor}

/* Dark mode */
@media(prefers-color-scheme:dark){
  .tai-panel{background:#1a1a2e;border-color:#2d2d44;color:#e5e7eb}
  .tai-msg.assistant{background:#2d2d44;color:#e5e7eb}
  .tai-input-area{background:#1a1a2e;border-color:#2d2d44}
  .tai-input{background:#16162a;border-color:#2d2d44;color:#e5e7eb}
}

/* Mobile */
@media(max-width:480px){
  .tai-panel,.tai-panel.maximized{bottom:0;right:0;width:100%;max-width:100%;height:100vh;max-height:100vh;border-radius:0;transform:none}
  .tai-bubble{bottom:16px;right:16px}
}
