/* ========================================
   ExpenseIQ — AI Chat Component Styles
   ======================================== */
#ai-chat-fab {
  position: fixed; bottom: 32px; right: 32px; z-index: 100;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--accent-gradient); color: white;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; box-shadow: var(--shadow-glow-lg);
  transition: var(--transition-spring);
}
#ai-chat-fab:hover { transform: scale(1.12) rotate(6deg); box-shadow: 0 12px 32px var(--accent-primary-glow); }
#ai-chat-fab svg { width: 28px; height: 28px; }

.ai-chat-widget {
  position: fixed; bottom: 100px; right: 32px; z-index: 100;
  width: 360px; height: 480px;
  background: var(--bg-secondary); backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border); border-radius: var(--radius-2xl);
  display: flex; flex-direction: column; box-shadow: var(--shadow-xl);
  transform-origin: bottom right; transition: var(--transition-spring);
}
.ai-chat-widget.hidden { transform: scale(0.85) translateY(20px); opacity: 0; pointer-events: none; }

.ai-chat-header {
  padding: 16px 20px; border-bottom: 1px solid var(--glass-border);
  display: flex; justify-content: space-between; align-items: center;
  font-weight: 600; background: var(--bg-tertiary);
  border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
}
.ai-chat-actions button {
  background: none; border: none; color: var(--text-muted); padding: 4px;
  cursor: pointer; font-size: 12px; transition: color var(--transition-fast);
}
.ai-chat-actions button:hover { color: var(--text-primary); }

.ai-chat-messages {
  flex: 1; padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px;
}

.ai-chat-msg {
  max-width: 85%; padding: 12px 16px; border-radius: 18px;
  font-size: 14px; line-height: 1.5; animation: scaleIn 0.2s ease forwards;
}
.ai-chat-msg.user {
  align-self: flex-end; background: var(--accent-gradient); color: white;
  border-bottom-right-radius: 4px; margin-left: 20%;
}
.ai-chat-msg.assistant {
  align-self: flex-start; background: var(--bg-card); border: 1px solid var(--glass-border);
  color: var(--text-primary); border-bottom-left-radius: 4px; margin-right: 20%;
}

.ai-chat-input-row {
  padding: 16px; border-top: 1px solid var(--glass-border);
  display: flex; gap: 10px; background: var(--bg-secondary);
  border-radius: 0 0 var(--radius-2xl) var(--radius-2xl);
}
.ai-chat-input-row input {
  flex: 1; height: 40px; padding: 0 16px; border-radius: var(--radius-full);
  border: 1px solid var(--glass-border); background: var(--bg-input);
  color: var(--text-primary); outline: none; transition: all var(--transition-fast);
}
.ai-chat-input-row input:focus { border-color: var(--accent-primary); }
.ai-chat-send {
  width: 40px; height: 40px; border-radius: 50%; background: var(--accent-primary);
  color: white; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: var(--transition-spring);
}
.ai-chat-send:hover { transform: scale(1.1); box-shadow: 0 4px 12px var(--accent-primary-glow); }
.ai-chat-send:active { transform: scale(0.95); }
.ai-chat-send svg { width: 18px; height: 18px; }

/* Typing animation */
.typing-indicator span {
  display: inline-block; width: 6px; height: 6px; background: var(--text-muted);
  border-radius: 50%; margin: 0 2px; animation: bounce 1.4s infinite ease-in-out both;
}
.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }
@keyframes bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

@media (max-width: 480px) {
  #ai-chat-fab { bottom: calc(var(--bottom-nav-height) + 16px); right: 16px; }
  .ai-chat-widget {
    bottom: calc(var(--bottom-nav-height) + 80px); right: 16px; left: 16px; width: auto;
  }
}
