/* ========================================
   AI FLOATING ASSISTANT
   ======================================== */
.ai-assistant-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9990;
  display: none !important;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms cubic-bezier(0.4, 0, 0.2, 1);
}
body.loaded .ai-assistant-container.loaded {
  display: flex !important;
  opacity: 1;
  pointer-events: auto;
}
.ai-trigger {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  position: relative;
}
.ai-avatar-wrapper {
  position: relative;
  width: 60px;
  height: 60px;
  flex-shrink: 0;
  cursor: pointer;
}
.ai-avatar-wrapper::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid #22C55E;
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.25);
  z-index: 3;
  pointer-events: none;
}
.ai-avatar-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  position: relative;
  z-index: 2;
  transition: transform 0.3s ease;
}
.ai-trigger:hover .ai-avatar-img {
  transform: scale(1.08);
}
.ai-avatar-glow {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid rgba(34, 197, 94, 0.4);
  animation: aiGlowPulse 2s ease-in-out infinite;
  pointer-events: none;
}
@keyframes aiGlowPulse {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.05); }
}
.ai-float-anim {
  animation: aiFloat 3s ease-in-out infinite;
}
@keyframes aiFloat {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-6px); }
}
.ai-label {
  background: white;
  border: 1px solid #e5e7eb;
  padding: 6px 14px;
  border-radius: 20px;
  font-family: 'Poppins', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: #111;
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
  opacity: 0;
  transition: opacity 0.6s ease;
  pointer-events: none;
}
.ai-label.visible {
  opacity: 1;
}
.ai-chat-window {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 380px;
  max-height: 600px;
  height: 600px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 22px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  transform: translateY(20px) scale(0.96);
  opacity: 0;
  pointer-events: none;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 9998;
}
.ai-chat-window.open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: all;
}
.ai-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #f3f4f6;
  flex-shrink: 0;
}
.ai-chat-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ai-chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid #22C55E;
}
.ai-chat-title {
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: #111;
  line-height: 1.2;
}
.ai-chat-status {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: 'Poppins', sans-serif;
  font-size: 11px;
  color: #6b7280;
}
.ai-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22C55E;
  display: inline-block;
  animation: aiStatusPulse 1.5s ease-in-out infinite;
}
@keyframes aiStatusPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.ai-chat-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: #e5e7eb;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 180ms cubic-bezier(0.16, 1, 0.3, 1);
  color: #111;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  font-family: 'Poppins', sans-serif;
  outline: none;
}
.ai-chat-close:hover {
  background: #d1d5db;
  transform: scale(1.05);
}
.ai-chat-close:active {
  transform: scale(0.95);
}
.ai-chat-close:focus-visible {
  outline: 2px solid #22C55E;
  outline-offset: 2px;
}
.ai-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ai-chat-body::-webkit-scrollbar {
  width: 4px;
}
.ai-chat-body::-webkit-scrollbar-track {
  background: transparent;
}
.ai-chat-body::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 4px;
}
.ai-message {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 16px;
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
  line-height: 1.6;
  animation: aiMsgIn 0.3s ease;
  white-space: pre-line;
}
@keyframes aiMsgIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.ai-bot-message {
  background: #f3f4f6;
  color: #1f2937;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.ai-user-message {
  background: #111;
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.ai-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
  padding-bottom: 8px;
}
.ai-chip {
  background: white;
  border: 1px solid #e5e7eb;
  padding: 6px 14px;
  border-radius: 16px;
  font-family: 'Poppins', sans-serif;
  font-size: 11px;
  font-weight: 500;
  color: #374151;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.ai-chip:hover {
  border-color: #22C55E;
  color: #059669;
  background: #f0fdf4;
}
.ai-input-validation {
  font-family: 'Poppins', sans-serif;
  font-size: 11px;
  font-weight: 500;
  color: #dc2626;
  background: #fef2f2;
  border: 1px solid #fecaca;
  padding: 6px 12px;
  border-radius: 8px;
  margin: 0 16px 8px 16px;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: none;
  display: none;
}
.ai-input-validation.visible {
  display: block;
  opacity: 1;
  transform: translateY(0);
}
.ai-chat-input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid #f3f4f6;
  flex-shrink: 0;
}
.ai-chat-input {
  flex: 1;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 10px 14px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: #111;
  outline: none;
  transition: border-color 0.2s;
  background: #f9fafb;
}
.ai-chat-input:focus {
  border-color: #22C55E;
  background: white;
}
.ai-chat-input::placeholder {
  color: #9ca3af;
}
.ai-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: none;
  background: #e5e7eb;
  color: #111;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
}
.ai-send-btn:hover {
  background: #d1d5db;
}
.ai-send-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ai-overlay {
  display: none !important;
  pointer-events: none !important;
}
.ai-overlay.active {
  display: none !important;
  pointer-events: none !important;
}
/* Typing indicator */
.ai-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 14px 20px;
}
.typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9ca3af;
  animation: typingBounce 1.4s ease-in-out infinite;
}
.typing-dot:nth-child(1) { animation-delay: 0s; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

@media (max-width: 640px) {
  .ai-chat-window {
    bottom: 0; right: 0; left: 0;
    width: 100%;
    height: 85vh;
    max-height: 85vh;
    border-radius: 22px 22px 0 0;
  }
  .ai-assistant-container {
    bottom: 16px; right: 16px;
  }
  .ai-avatar-wrapper {
    width: 52px; height: 52px;
  }
}

/* Parsed Markdown Typography Styles */
.ai-bot-message h2.ai-heading-1,
.ai-bot-message h3.ai-heading-2,
.ai-bot-message h4.ai-heading-3 {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  color: #111827;
  margin-top: 10px;
  margin-bottom: 4px;
}
.ai-bot-message h2.ai-heading-1 { font-size: 15px; }
.ai-bot-message h3.ai-heading-2 { font-size: 14px; }
.ai-bot-message h4.ai-heading-3 { font-size: 13px; }

.ai-bot-message p.ai-paragraph {
  margin-bottom: 6px;
  line-height: 1.55;
}
.ai-bot-message p.ai-paragraph:last-child {
  margin-bottom: 0;
}

.ai-bot-message ul.ai-bullet-list,
.ai-bot-message ol.ai-num-list {
  margin-top: 4px;
  margin-bottom: 8px;
  padding-left: 20px;
}
.ai-bot-message ul.ai-bullet-list { list-style-type: disc; }
.ai-bot-message ol.ai-num-list { list-style-type: decimal; }

.ai-bot-message li {
  margin-bottom: 4px;
  line-height: 1.5;
}

.ai-bot-message hr.ai-divider {
  border: 0;
  height: 1px;
  background: #e5e7eb;
  margin: 10px 0;
}

.ai-bot-message strong {
  font-weight: 600;
  color: #111827;
}

.ai-bot-message code.ai-inline-code {
  background: #e5e7eb;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 11px;
}
