/* AI Chatbot Widget Styles */
#aichat-root { position: fixed; bottom: 24px; right: 24px; z-index: 99999; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }

/* Bubble */
#aichat-bubble {
  width: 56px; height: 56px; border-radius: 50%;
  background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; box-shadow: 0 4px 16px rgba(37,211,102,0.45);
  transition: transform 0.2s, box-shadow 0.2s; position: relative;
}
#aichat-bubble:hover { transform: scale(1.08); box-shadow: 0 6px 20px rgba(37,211,102,0.55); }
#aichat-badge {
  position: absolute; top: -4px; right: -4px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #e53935; color: #fff; font-size: 10px;
  display: flex; align-items: center; justify-content: center; font-weight: 700;
}

/* Chat Window */
#aichat-window {
  width: 360px; height: 520px; border-radius: 16px;
  background: #fff; box-shadow: 0 8px 40px rgba(0,0,0,0.18);
  display: flex; flex-direction: column; overflow: hidden;
  margin-bottom: 12px; animation: aichatSlideIn 0.25s ease;
}
@keyframes aichatSlideIn { from { opacity: 0; transform: translateY(16px) scale(0.97); } to { opacity: 1; transform: translateY(0) scale(1); } }

/* Header */
#aichat-header {
  background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
  padding: 14px 16px; display: flex; align-items: center; justify-content: space-between;
}
#aichat-header-info { display: flex; align-items: center; gap: 10px; }
#aichat-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255,255,255,0.25); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}
#aichat-title { color: #fff; font-size: 15px; font-weight: 600; }
#aichat-status { color: rgba(255,255,255,0.85); font-size: 11px; margin-top: 1px; }
#aichat-close {
  background: none; border: none; color: rgba(255,255,255,0.85);
  font-size: 16px; cursor: pointer; padding: 4px; border-radius: 4px;
  transition: background 0.15s;
}
#aichat-close:hover { background: rgba(255,255,255,0.15); }

/* Messages */
#aichat-messages {
  flex: 1; overflow-y: auto; padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
  background: #f0f4f3;
}
#aichat-messages::-webkit-scrollbar { width: 4px; }
#aichat-messages::-webkit-scrollbar-thumb { background: #ccc; border-radius: 2px; }

.aichat-msg {
  max-width: 82%; padding: 9px 13px; border-radius: 14px;
  font-size: 14px; line-height: 1.5; word-break: break-word;
  animation: aichatMsgIn 0.2s ease;
}
@keyframes aichatMsgIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.aichat-msg.bot {
  background: #fff; color: #1a1a1a; align-self: flex-start;
  border-bottom-left-radius: 4px; box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.aichat-msg.user {
  background: #25D366; color: #fff; align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.aichat-msg.system {
  background: #fff3cd; color: #856404; align-self: center;
  font-size: 12px; text-align: center; border-radius: 8px;
  border: 1px solid #ffc107; max-width: 90%;
}

/* Typing indicator */
.aichat-typing { display: flex; gap: 4px; padding: 12px 14px; align-items: center; }
.aichat-typing span {
  width: 7px; height: 7px; border-radius: 50%; background: #999;
  animation: aichatBounce 1.2s infinite;
}
.aichat-typing span:nth-child(2) { animation-delay: 0.2s; }
.aichat-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes aichatBounce { 0%,60%,100% { transform: translateY(0); } 30% { transform: translateY(-6px); } }

/* Handoff bar */
#aichat-handoff-bar {
  background: #e8f5e9; border-top: 1px solid #c8e6c9;
  padding: 12px 14px; font-size: 13px;
}
#aichat-handoff-bar p { margin: 0 0 8px; color: #2e7d32; font-weight: 600; }
#aichat-handoff-bar input {
  width: 100%; box-sizing: border-box; padding: 7px 10px;
  border: 1px solid #c8e6c9; border-radius: 8px; font-size: 13px;
  margin-bottom: 6px; outline: none; background: #fff;
}
#aichat-handoff-bar input:focus { border-color: #25D366; }
#aichat-handoff-bar button {
  width: 100%; padding: 8px; border: none; border-radius: 8px;
  background: #25D366; color: #fff; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: background 0.15s;
}
#aichat-handoff-bar button:hover { background: #1da851; }

/* Input row */
#aichat-input-row {
  padding: 10px 12px; border-top: 1px solid #e8e8e8;
  display: flex; gap: 8px; align-items: center; background: #fff;
}
#aichat-input {
  flex: 1; border: 1px solid #ddd; border-radius: 22px;
  padding: 9px 14px; font-size: 14px; outline: none;
  transition: border-color 0.15s; background: #f8f8f8;
}
#aichat-input:focus { border-color: #25D366; background: #fff; }
#aichat-send-btn {
  width: 38px; height: 38px; border-radius: 50%; border: none;
  background: #25D366; color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, transform 0.1s;
}
#aichat-send-btn:hover { background: #1da851; transform: scale(1.05); }
#aichat-send-btn:disabled { background: #ccc; cursor: not-allowed; transform: none; }

/* Mobile */
@media (max-width: 480px) {
  #aichat-root { bottom: 12px; right: 12px; }
  #aichat-window { width: calc(100vw - 24px); height: 70vh; }
}
