/* ============================================================
   AI Smart Chatbot — Frontend Styles
   ============================================================ */

:root {
  --aichat-primary:  #1a73e8;
  --aichat-header:   #1a73e8;
  --aichat-radius:   16px;
  --aichat-shadow:   0 8px 40px rgba(0,0,0,.18);
  --aichat-font:     -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ── Launcher bubble ───────────────────────────────────────── */
#aichat-launcher {
  position: fixed;
  bottom: 24px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--aichat-primary);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: var(--aichat-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999998;
  transition: transform .2s, box-shadow .2s;
}
#aichat-launcher:hover { transform: scale(1.08); box-shadow: 0 12px 48px rgba(0,0,0,.22); }
#aichat-launcher svg   { width: 26px; height: 26px; }
#aichat-launcher.right { right: 24px; }
#aichat-launcher.left  { left:  24px; }

/* ── Widget window ─────────────────────────────────────────── */
#aichat-widget {
  position: fixed;
  bottom: 96px;
  width: 360px;
  max-height: 560px;
  background: #fff;
  border-radius: var(--aichat-radius);
  box-shadow: var(--aichat-shadow);
  display: flex;
  flex-direction: column;
  z-index: 999999;
  overflow: hidden;
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}
#aichat-widget.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}
#aichat-widget.right { right: 24px; }
#aichat-widget.left  { left:  24px; }

/* ── Header ────────────────────────────────────────────────── */
.aichat-header {
  background: var(--aichat-header);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
}
.aichat-header-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  background: rgba(255,255,255,.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  overflow: hidden;
}
.aichat-header-avatar img { width: 100%; height: 100%; object-fit: cover; }
.aichat-header-info { flex: 1; }
.aichat-header-name   { font-weight: 700; font-size: 15px; font-family: var(--aichat-font); }
.aichat-header-status { font-size: 12px; opacity: .85; display: flex; align-items: center; gap: 5px; }
.aichat-status-dot    { width: 7px; height: 7px; background: #4cfc98; border-radius: 50%; display: inline-block; }
.aichat-close-btn {
  background: none; border: none; color: #fff; cursor: pointer; opacity: .8; padding: 4px;
  display: flex; align-items: center;
}
.aichat-close-btn:hover { opacity: 1; }

/* ── Messages area ─────────────────────────────────────────── */
.aichat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f5f7fb;
  scroll-behavior: smooth;
}
.aichat-messages::-webkit-scrollbar { width: 4px; }
.aichat-messages::-webkit-scrollbar-thumb { background: #c8d0e0; border-radius: 4px; }

/* ── Bubbles ───────────────────────────────────────────────── */
.aichat-bubble {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.5;
  font-family: var(--aichat-font);
  word-break: break-word;
  animation: aichat-pop .2s ease;
}
@keyframes aichat-pop {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.aichat-bubble.bot {
  background: #fff;
  color: #222;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
  align-self: flex-start;
}
.aichat-bubble.user {
  background: var(--aichat-primary);
  color: #fff;
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}

/* ── Typing indicator ──────────────────────────────────────── */
.aichat-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 10px 14px;
  background: #fff;
  border-radius: 18px;
  border-bottom-left-radius: 4px;
  width: fit-content;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.aichat-typing span {
  width: 7px; height: 7px;
  background: #aab4c8;
  border-radius: 50%;
  animation: aichat-blink 1.2s infinite ease-in-out;
}
.aichat-typing span:nth-child(2) { animation-delay: .2s; }
.aichat-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes aichat-blink {
  0%,80%,100% { transform: scale(.8); opacity:.5; }
  40%         { transform: scale(1.1); opacity:1; }
}

/* ── Quick-reply buttons ───────────────────────────────────── */
.aichat-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 0 14px 10px;
  background: #f5f7fb;
}
.aichat-qbtn {
  background: #fff;
  border: 1.5px solid var(--aichat-primary);
  color: var(--aichat-primary);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: background .15s, color .15s;
  font-family: var(--aichat-font);
}
.aichat-qbtn:hover, .aichat-qbtn.active {
  background: var(--aichat-primary);
  color: #fff;
}

/* ── Input bar ─────────────────────────────────────────────── */
.aichat-input-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid #e8ecf0;
  background: #fff;
}
.aichat-input-bar input {
  flex: 1;
  border: 1.5px solid #dde2ec;
  border-radius: 24px;
  padding: 9px 16px;
  font-size: 14px;
  outline: none;
  font-family: var(--aichat-font);
  transition: border-color .15s;
}
.aichat-input-bar input:focus { border-color: var(--aichat-primary); }
.aichat-send-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--aichat-primary);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform .15s;
}
.aichat-send-btn:hover { transform: scale(1.08); }
.aichat-send-btn svg { width: 18px; height: 18px; fill: #fff; }

/* ── Lead / Contact Form ───────────────────────────────────── */
.aichat-form-wrap {
  background: #fff;
  margin: 4px 14px 10px;
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 1px 6px rgba(0,0,0,.08);
  font-family: var(--aichat-font);
}
.aichat-form-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 10px;
  color: #333;
}
.aichat-form-wrap input {
  width: 100%;
  border: 1.5px solid #dde2ec;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  margin-bottom: 8px;
  outline: none;
  box-sizing: border-box;
  font-family: var(--aichat-font);
  transition: border-color .15s;
}
.aichat-form-wrap input:focus { border-color: var(--aichat-primary); }
.aichat-form-submit {
  width: 100%;
  background: var(--aichat-primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s;
  font-family: var(--aichat-font);
}
.aichat-form-submit:hover { opacity: .88; }
.aichat-form-error { color: #d32f2f; font-size: 12px; margin-bottom: 6px; }
.aichat-powered {
  text-align: center;
  font-size: 11px;
  color: #aab;
  padding: 4px 0 6px;
  font-family: var(--aichat-font);
}

/* ── Mobile ────────────────────────────────────────────────── */
@media (max-width: 420px) {
  #aichat-widget { width: calc(100vw - 20px); left: 10px !important; right: 10px !important; }
}
