﻿/* ===================================================
   AI Hosting Assistant — Chat Widget CSS v3
   =================================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── WIDGET ROOT ── */
.ai-chat-widget {
  position: fixed;
  z-index: 99999;
  font-family: 'Inter', -apple-system, sans-serif;
}
.ai-chat-bottom-right { bottom: 24px; right: 24px; }
.ai-chat-bottom-left  { bottom: 24px; left: 24px; }

/* ── TOGGLE BUTTON ── */
.ai-chat-toggle {
  width: 60px; height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #06b6d4);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 32px rgba(99,102,241,.5);
  position: relative;
  transition: transform .2s, box-shadow .2s;
  user-select: none;
}
.ai-chat-toggle:hover { transform: scale(1.08); box-shadow: 0 12px 40px rgba(99,102,241,.6); }
.ai-chat-icon, .ai-chat-close {
  display: flex; align-items: center; justify-content: center;
  color: #fff; transition: all .2s;
}
.ai-chat-notification {
  position: absolute; top: -4px; right: -4px;
  width: 22px; height: 22px; border-radius: 50%;
  background: #ef4444; color: #fff;
  font-size: .75rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  animation: ai-bounce .6s ease infinite alternate;
}
@keyframes ai-bounce { from { transform: translateY(0); } to { transform: translateY(-4px); } }

/* ── CHAT WINDOW ── */
.ai-chat-window {
  position: absolute; bottom: 76px; right: 0;
  width: 380px;
  background: rgba(20,20,38,.97);
  border: 1px solid rgba(99,102,241,.25);
  border-radius: 20px;
  box-shadow: 0 24px 80px rgba(0,0,0,.6);
  display: flex; flex-direction: column;
  max-height: 600px;
  backdrop-filter: blur(20px);
  overflow: hidden;
  animation: ai-slide-up .25s ease;
}
@keyframes ai-slide-up {
  from { opacity: 0; transform: translateY(20px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── HEADER ── */
.ai-chat-header {
  padding: 14px 16px;
  background: rgba(30,30,55,.9);
  border-bottom: 1px solid rgba(99,102,241,.15);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.ai-chat-header-info { display: flex; align-items: center; gap: 10px; }
.ai-chat-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #06b6d4);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; position: relative; flex-shrink: 0;
}
.ai-chat-status-indicator {
  position: absolute; bottom: 1px; right: 1px;
  width: 10px; height: 10px; border-radius: 50%;
  border: 2px solid rgba(20,20,38,.97);
}
.ai-online  { background: #10b981; }
.ai-agent   { background: #f59e0b; animation: ai-pulse 1.5s ease infinite; }
.ai-offline { background: #6b7280; }
@keyframes ai-pulse { 0%,100%{opacity:1} 50%{opacity:.5} }
.ai-chat-header-text h3 { font-size: .9rem; font-weight: 700; color: #e2e8f0; }
.ai-chat-status { font-size: .72rem; color: #94a3b8; }
.ai-chat-header-actions { display: flex; align-items: center; gap: 4px; }
.ai-chat-icon-btn {
  width: 30px; height: 30px; border-radius: 8px;
  background: transparent; border: 1px solid rgba(99,102,241,.2);
  color: #94a3b8; cursor: pointer; display: flex; align-items: center;
  justify-content: center; transition: all .15s;
}
.ai-chat-icon-btn:hover { background: rgba(99,102,241,.15); color: #e2e8f0; border-color: rgba(99,102,241,.4); }

/* ── WELCOME ── */
.ai-chat-welcome {
  padding: 24px 20px;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 10px; flex: 1;
}
.ai-welcome-icon { font-size: 2rem; }
.ai-chat-welcome h4 { font-size: 1rem; font-weight: 700; color: #e2e8f0; }
.ai-chat-welcome p { font-size: .82rem; color: #94a3b8; line-height: 1.5; }
.ai-quick-btns { display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; margin-top: 4px; }
.ai-quick-btn {
  background: rgba(99,102,241,.12); border: 1px solid rgba(99,102,241,.25);
  color: #a5b4fc; border-radius: 20px; padding: 6px 14px;
  font-size: .78rem; font-weight: 600; cursor: pointer; transition: all .15s;
}
.ai-quick-btn:hover { background: rgba(99,102,241,.25); border-color: rgba(99,102,241,.5); color: #e2e8f0; }

/* ── MESSAGES ── */
.ai-chat-messages {
  flex: 1; overflow-y: auto; padding: 14px 14px 8px;
  display: flex; flex-direction: column; gap: 10px;
  scrollbar-width: thin; scrollbar-color: rgba(99,102,241,.3) transparent;
}
.ai-chat-messages::-webkit-scrollbar { width: 4px; }
.ai-chat-messages::-webkit-scrollbar-thumb { background: rgba(99,102,241,.3); border-radius: 2px; }

.ai-msg { display: flex; gap: 8px; max-width: 88%; animation: ai-msg-in .2s ease; }
@keyframes ai-msg-in { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:none} }
.ai-msg-user { align-self: flex-end; flex-direction: row-reverse; }
.ai-msg-ai, .ai-msg-agent, .ai-msg-error { align-self: flex-start; }

.ai-msg-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(99,102,241,.15); display: flex; align-items: center;
  justify-content: center; font-size: .85rem; flex-shrink: 0; margin-top: 2px;
}
.ai-msg-user .ai-msg-avatar { background: rgba(6,182,212,.15); }
.ai-msg-agent .ai-msg-avatar { background: rgba(16,185,129,.15); }

.ai-msg-bubble {
  background: rgba(30,30,55,.9); border: 1px solid rgba(99,102,241,.15);
  border-radius: 14px 14px 14px 4px; padding: 10px 14px;
  font-size: .84rem; line-height: 1.55; color: #e2e8f0;
}
.ai-msg-user .ai-msg-bubble {
  background: rgba(99,102,241,.2); border-color: rgba(99,102,241,.3);
  border-radius: 14px 14px 4px 14px;
}
.ai-msg-agent .ai-msg-bubble { background: rgba(16,185,129,.1); border-color: rgba(16,185,129,.2); }
.ai-msg-error .ai-msg-bubble { background: rgba(239,68,68,.1); border-color: rgba(239,68,68,.2); color: #fca5a5; }

.ai-msg-meta { font-size: .65rem; color: #475569; margin-top: 3px; padding: 0 4px; }
.ai-msg-user .ai-msg-meta { text-align: right; }

/* ── TYPING ── */
.ai-typing-bubble { padding: 12px 16px !important; }
.ai-typing-bubble span {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: #6366f1; margin: 0 2px;
  animation: ai-dot .8s ease infinite;
}
.ai-typing-bubble span:nth-child(2) { animation-delay: .15s; }
.ai-typing-bubble span:nth-child(3) { animation-delay: .3s; }
@keyframes ai-dot { 0%,80%,100%{transform:translateY(0)} 40%{transform:translateY(-8px)} }

/* ── ACTION BUTTONS ── */
.ai-action-btns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ai-action-btn {
  background: rgba(99,102,241,.15); border: 1px solid rgba(99,102,241,.3);
  color: #a5b4fc; border-radius: 8px; padding: 5px 12px;
  font-size: .75rem; font-weight: 600; cursor: pointer; transition: all .15s;
}
.ai-action-btn:hover { background: rgba(99,102,241,.3); color: #e2e8f0; }
.ai-action-secondary { background: rgba(30,30,55,.8) !important; border-color: rgba(99,102,241,.2) !important; color: #94a3b8 !important; }

/* ── AGENT BANNER ── */
.ai-agent-banner {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 14px;
  background: rgba(245,158,11,.1); border-top: 1px solid rgba(245,158,11,.2);
  color: #f59e0b; font-size: .78rem; font-weight: 600; flex-shrink: 0;
}

/* ── INPUT AREA ── */
.ai-chat-input-area { padding: 10px 14px 6px; border-top: 1px solid rgba(99,102,241,.1); flex-shrink: 0; }
.ai-chat-input-row { display: flex; gap: 8px; align-items: flex-end; }
.ai-chat-input {
  flex: 1; background: rgba(30,30,55,.8); border: 1px solid rgba(99,102,241,.2);
  border-radius: 12px; padding: 10px 14px; color: #e2e8f0;
  font-family: inherit; font-size: .84rem; resize: none;
  outline: none; transition: border .2s; min-height: 40px; max-height: 120px;
  line-height: 1.4;
}
.ai-chat-input:focus { border-color: rgba(99,102,241,.5); }
.ai-chat-input::placeholder { color: #475569; }
.ai-chat-send {
  width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
  background: linear-gradient(135deg, #6366f1, #06b6d4);
  border: none; color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: opacity .2s, transform .15s;
}
.ai-chat-send:disabled { opacity: .4; cursor: not-allowed; }
.ai-chat-send:not(:disabled):hover { transform: scale(1.08); }
.ai-chat-footer-actions {
  display: flex; gap: 6px; margin-top: 7px; justify-content: flex-end;
}
.ai-footer-btn {
  background: transparent; border: 1px solid rgba(99,102,241,.2);
  color: #94a3b8; border-radius: 8px; padding: 4px 10px;
  font-size: .72rem; cursor: pointer; transition: all .15s;
}
.ai-footer-btn:hover { background: rgba(99,102,241,.1); color: #a5b4fc; border-color: rgba(99,102,241,.4); }
.ai-chat-branding {
  text-align: center; font-size: .68rem; color: #2d2d4e;
  padding: 4px 0 8px; flex-shrink: 0;
}

/* ── MODALS ── */
.ai-modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 999999; backdrop-filter: blur(4px);
  animation: ai-fade-in .2s ease;
}
@keyframes ai-fade-in { from{opacity:0} to{opacity:1} }
.ai-modal {
  background: rgba(20,20,38,.98); border: 1px solid rgba(99,102,241,.25);
  border-radius: 18px; padding: 0; width: 340px; max-width: 95vw;
  box-shadow: 0 32px 80px rgba(0,0,0,.7);
  animation: ai-modal-in .2s ease;
}
@keyframes ai-modal-in { from{opacity:0;transform:scale(.95)} to{opacity:1;transform:none} }
.ai-modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 20px 14px; border-bottom: 1px solid rgba(99,102,241,.15);
}
.ai-modal-header h4 { font-size: .95rem; font-weight: 700; color: #e2e8f0; }
.ai-modal-close {
  background: none; border: none; color: #94a3b8; cursor: pointer;
  font-size: 1rem; padding: 2px; transition: color .15s;
}
.ai-modal-close:hover { color: #e2e8f0; }
.ai-modal-body { padding: 18px 20px; }
.ai-modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 14px 20px 18px; border-top: 1px solid rgba(99,102,241,.1);
}
.ai-form-group { margin-bottom: 14px; }
.ai-form-group label { display: block; font-size: .78rem; color: #94a3b8; margin-bottom: 5px; font-weight: 600; }
.ai-input {
  width: 100%; background: rgba(30,30,55,.8); border: 1px solid rgba(99,102,241,.2);
  border-radius: 10px; padding: 9px 12px; color: #e2e8f0;
  font-family: inherit; font-size: .84rem; outline: none; transition: border .2s;
}
.ai-input:focus { border-color: rgba(99,102,241,.5); }
select.ai-input { cursor: pointer; }
.ai-btn-primary {
  background: linear-gradient(135deg, #6366f1, #06b6d4);
  color: #fff; border: none; border-radius: 10px; padding: 9px 20px;
  font-size: .85rem; font-weight: 600; cursor: pointer; transition: opacity .2s;
}
.ai-btn-primary:hover { opacity: .9; }
.ai-btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.ai-btn-secondary {
  background: rgba(30,30,55,.8); border: 1px solid rgba(99,102,241,.2);
  color: #94a3b8; border-radius: 10px; padding: 9px 16px;
  font-size: .85rem; font-weight: 600; cursor: pointer; transition: all .15s;
}
.ai-btn-secondary:hover { border-color: rgba(99,102,241,.4); color: #e2e8f0; }

/* ── RESPONSIVE ── */
@media (max-width: 440px) {
  .ai-chat-window { width: calc(100vw - 24px); right: 0; bottom: 70px; }
  .ai-chat-bottom-right { right: 12px; bottom: 16px; }
}
