/* ============================================================
   AI CHAT WIDGET — styles extracted from ai_chat_widget.php
============================================================ */

/* ── Floating trigger button ── */
#ai-chat-fab {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #2e6da4;
  color: #fff;
  border: none;
  font-size: 22px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.28);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.2s;
}
#ai-chat-fab:hover { background: #245a8a; transform: scale(1.08); }

/* Pulse ring animation */
#ai-chat-fab::after {
  content: '';
  position: absolute;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 2px solid #2e6da4;
  animation: ai-pulse 2s ease-out infinite;
}
@keyframes ai-pulse {
  0%   { transform: scale(1);   opacity: 0.7; }
  100% { transform: scale(1.7); opacity: 0; }
}

/* ── Modal overlay ── */
#ai-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: ai-fade-in 0.2s ease;
}
#ai-modal-overlay.open { display: flex; }
@keyframes ai-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── Modal box ── */
#ai-modal {
  background: #fff;
  border-radius: 14px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  animation: ai-slide-up 0.25s ease;
  font-family: 'Nunito Sans', 'Lato', sans-serif;
}
@keyframes ai-slide-up {
  from { transform: translateY(30px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ── Modal header ── */
#ai-modal-header {
  background: linear-gradient(135deg, #2e6da4 0%, #1a4f80 100%);
  color: #fff;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
#ai-modal-header .ai-title {
  display: flex;
  align-items: center;
  gap: 10px;
}
#ai-modal-header .ai-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
}
#ai-modal-header .ai-name  { font-weight: 700; font-size: 15px; }
#ai-modal-header .ai-status {
  font-size: 11px;
  opacity: 0.85;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}
#ai-modal-header .ai-status::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4cff91;
  display: inline-block;
}
#ai-modal-close {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background 0.2s;
  flex-shrink: 0;
}
#ai-modal-close:hover { background: rgba(255, 255, 255, 0.3); }

/* ── Messages area ── */
#ai-modal-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f4f7fb;
  min-height: 280px;
  max-height: 380px;
}
.ai-bubble, .user-bubble {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 13.5px;
  line-height: 1.55;
  word-wrap: break-word;
  white-space: pre-wrap;
}
.ai-bubble {
  background: #fff;
  color: #222;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}
.user-bubble {
  background: #2e6da4;
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  box-shadow: 0 1px 4px rgba(46, 109, 164, 0.3);
}

/* Typing dots animation */
.ai-typing-bubble {
  background: #fff;
  color: #888;
  align-self: flex-start;
  border-radius: 18px;
  border-bottom-left-radius: 4px;
  padding: 12px 16px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  display: flex;
  gap: 5px;
  align-items: center;
}
.ai-typing-bubble span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #aab;
  display: inline-block;
  animation: ai-dot-bounce 1.2s infinite ease-in-out;
}
.ai-typing-bubble span:nth-child(2) { animation-delay: 0.2s; }
.ai-typing-bubble span:nth-child(3) { animation-delay: 0.4s; }
@keyframes ai-dot-bounce {
  0%, 80%, 100% { transform: translateY(0);   }
  40%           { transform: translateY(-6px); }
}

/* ── Input area ── */
#ai-modal-input-area {
  display: flex;
  align-items: center;
  padding: 12px 14px;
  border-top: 1px solid #e5e9f0;
  gap: 10px;
  background: #fff;
  flex-shrink: 0;
}
#ai-modal-input {
  flex: 1;
  border: 1.5px solid #dce3ec;
  border-radius: 24px;
  padding: 10px 16px;
  font-size: 13.5px;
  outline: none;
  font-family: 'Nunito Sans', 'Lato', sans-serif;
  transition: border-color 0.2s;
  color: #333;
}
#ai-modal-input:focus          { border-color: #2e6da4; }
#ai-modal-input::placeholder   { color: #aab; }

#ai-modal-send {
  background: #2e6da4;
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  cursor: pointer;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.15s;
}
#ai-modal-send:hover:not(:disabled) { background: #245a8a; transform: scale(1.05); }
#ai-modal-send:disabled             { background: #b0bec5; cursor: not-allowed; }

/* ── Footer hint ── */
#ai-modal-hint {
  text-align: center;
  font-size: 11px;
  color: #aab;
  padding: 6px 0 10px;
  background: #fff;
  flex-shrink: 0;
}
