/* ==========================================================================
   CHAT WIDGET STYLES
   AI chat assistant component
   ========================================================================== */

/* ==========================================================================
   Chat Widget Container
   ========================================================================== */
.chat-widget {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: var(--z-modal);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

/* ==========================================================================
   Welcome Bubble
   ========================================================================== */
.chat-welcome-bubble {
  margin-bottom: var(--space-4);
  width: 12rem;
  background: var(--color-white);
  color: var(--color-brand-secondary);
  padding: var(--space-3);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  font-size: var(--text-xs);
  font-weight: 500;
  border: 1px solid var(--color-slate-200);
  position: relative;
  margin-right: var(--space-2);
  transform-origin: bottom right;
}

.chat-welcome-bubble.hidden {
  display: none;
}

/* Arrow pointing to toggle button */
.chat-welcome-bubble::after {
  content: '';
  position: absolute;
  bottom: -0.375rem;
  right: 1.5rem;
  width: 0.75rem;
  height: 0.75rem;
  background: var(--color-white);
  transform: rotate(45deg);
  border-right: 1px solid var(--color-slate-200);
  border-bottom: 1px solid var(--color-slate-200);
}

.chat-welcome-typing {
  display: flex;
  gap: var(--space-1);
  justify-content: center;
}

/* ==========================================================================
   Chat Toggle Button
   ========================================================================== */
.chat-toggle-btn {
  width: 4rem;
  height: 4rem;
  background: var(--color-white);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-2xl);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 4px solid var(--color-brand-main);
  cursor: pointer;
  overflow: hidden;
  transition: transform var(--transition-base);
}

.chat-toggle-btn:hover {
  transform: scale(1.05);
}

.chat-toggle-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ==========================================================================
   Chat Window
   ========================================================================== */
.chat-window {
  position: fixed;
  bottom: 6rem;
  right: var(--space-6);
  width: 22rem;
  height: 32rem;
  background: var(--color-white);
  border-radius: var(--radius-3xl);
  box-shadow: var(--shadow-2xl);
  display: flex;
  flex-direction: column;
  z-index: var(--z-modal);
  border: 1px solid var(--color-slate-200);
  overflow: hidden;
  transform-origin: bottom right;
}

.chat-window.hidden {
  display: none;
}

/* ==========================================================================
   Chat Header
   ========================================================================== */
.chat-header {
  background: var(--color-brand-secondary);
  padding: var(--space-4);
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--color-white);
}

.chat-header-info {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.chat-header-avatar {
  width: 2.5rem;
  height: 2.5rem;
  background: var(--color-white);
  border-radius: var(--radius-full);
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: var(--shadow-sm);
}

.chat-header-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chat-header-title {
  font-weight: 700;
  font-size: var(--text-sm);
}

.chat-header-status {
  font-size: var(--text-xs);
  color: var(--color-brand-main);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.chat-header-status-dot {
  width: 0.5rem;
  height: 0.5rem;
  background: #4ade80;
  border-radius: var(--radius-full);
  animation: pulse 2s infinite;
}

.chat-close-btn {
  width: 2rem;
  height: 2rem;
  background: rgba(62, 83, 94, 0.5);
  border: none;
  border-radius: var(--radius-full);
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.chat-close-btn:hover {
  color: var(--color-white);
  background: rgba(62, 83, 94, 0.7);
}

/* ==========================================================================
   Chat Messages
   ========================================================================== */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  background: rgba(255, 245, 217, 0.3);
}

.chat-message {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
}

.chat-message.user {
  flex-direction: row-reverse;
}

.chat-message-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-full);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  overflow: hidden;
}

.chat-message-avatar.bot {
  background: var(--color-brand-secondary);
  border: 1px solid rgba(255, 255, 255, 0.5);
}

.chat-message-avatar.bot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chat-message-avatar.user {
  background: var(--color-brand-main);
  color: var(--color-brand-secondary);
  font-weight: 700;
}

.chat-message-bubble {
  padding: var(--space-3);
  border-radius: var(--radius-2xl);
  font-size: var(--text-sm);
  max-width: 85%;
  box-shadow: var(--shadow-sm);
  border: 1px solid;
}

.chat-message.bot .chat-message-bubble {
  background: var(--color-white);
  color: var(--color-slate-700);
  border-color: var(--color-slate-100);
  border-top-left-radius: 0;
}

.chat-message.user .chat-message-bubble {
  background: var(--color-brand-secondary);
  color: var(--color-white);
  border-color: var(--color-brand-secondary);
  border-top-right-radius: 0;
}

/* ==========================================================================
   Typing Indicator
   ========================================================================== */
.chat-typing {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.chat-typing-dots {
  display: flex;
  gap: var(--space-1);
  padding: var(--space-3);
  background: var(--color-white);
  border-radius: var(--radius-2xl);
  border-top-left-radius: 0;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-slate-100);
  height: 2.5rem;
  align-items: center;
}

.chat-typing-dot {
  width: 0.5rem;
  height: 0.5rem;
  background: var(--color-slate-400);
  border-radius: var(--radius-full);
}

/* ==========================================================================
   Suggestion Chips
   ========================================================================== */
.chat-chips {
  padding: var(--space-2) var(--space-4);
  background: var(--color-white);
  border-top: 1px solid var(--color-slate-100);
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  overscroll-behavior-x: contain;
  touch-action: pan-x;
  cursor: grab;
  padding-bottom: var(--space-2);
}

.chat-chips:active {
  cursor: grabbing;
}

.chat-chips.hidden {
  display: none;
}

.chat-chips::-webkit-scrollbar {
  height: 4px;
}

.chat-chips::-webkit-scrollbar-track {
  background: transparent;
}

.chat-chips::-webkit-scrollbar-thumb {
  background: var(--color-slate-300);
  border-radius: var(--radius-full);
}

.chat-chips::-webkit-scrollbar-thumb:hover {
  background: var(--color-slate-400);
}

.chat-chip {
  flex-shrink: 0;
  background: rgba(82, 109, 124, 0.1);
  color: var(--color-brand-secondary);
  font-size: var(--text-xs);
  font-weight: 700;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  border: 1px solid rgba(82, 109, 124, 0.2);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.chat-chip:hover {
  background: var(--color-brand-secondary);
  color: var(--color-white);
}

/* ==========================================================================
   Chat Input
   ========================================================================== */
.chat-input-container {
  padding: var(--space-4);
  background: var(--color-white);
  border-top: 1px solid var(--color-slate-100);
}

.chat-input-wrapper {
  display: flex;
  gap: var(--space-2);
}

.chat-input {
  flex: 1;
  padding: var(--space-3) var(--space-4);
  background: var(--color-slate-50);
  border: 1px solid var(--color-slate-200);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  outline: none;
  transition: all var(--transition-fast);
}

.chat-input:focus {
  border-color: var(--color-brand-secondary);
  box-shadow: 0 0 0 1px var(--color-brand-secondary);
}

.chat-send-btn {
  width: 3rem;
  height: 3rem;
  background: var(--color-brand-secondary);
  color: var(--color-white);
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  transition: all var(--transition-fast);
}

.chat-send-btn:hover {
  background: var(--color-brand-dark);
}

.chat-disclaimer {
  text-align: center;
  margin-top: var(--space-2);
  font-size: 10px;
  color: var(--color-slate-400);
}
