/* ---------------------------------------------------------------------------
   Floating AI Chat Widget
   --------------------------------------------------------------------------- */

.chat-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Chat Bubble Button */
  .chat-bubble {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #f47b20;
    color: #252525;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(249, 115, 22, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.chat-bubble:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 28px rgba(249, 115, 22, 0.5);
}

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

/* Chat Window */
.chat-window {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 400px;
  max-width: calc(100vw - 48px);
  height: 520px;
  max-height: calc(100vh - 150px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: opacity 0.25s, visibility 0.25s, transform 0.25s;
}

.chat-window.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Chat Header */
.chat-header {
  background: #000;
  color: #fff;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.chat-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-header-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #f47b20;
    color: #252525;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.chat-header-text h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.chat-header-text p {
  margin: 2px 0 0;
  font-size: 12px;
  opacity: 0.8;
}

.chat-close {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: background 0.15s;
}

.chat-close:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Chat Messages */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f9fafb;
}

.chat-message {
  display: flex;
  gap: 10px;
  max-width: 85%;
}

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

.chat-message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.chat-message.user .chat-message-avatar {
  background: #f47b20;
  color: #252525;
}

.chat-message.bot .chat-message-avatar {
  background: #000;
  color: #fff;
}

.chat-message-bubble {
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.chat-message.user .chat-message-bubble {
  background: #f47b20;
  color: #252525;
  border-bottom-right-radius: 4px;
}

.chat-message.bot .chat-message-bubble {
  background: #fff;
  color: #000;
  border: 1px solid #e5e7eb;
  border-bottom-left-radius: 4px;
}

/* Typing Indicator */
.chat-typing {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
}

.chat-typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9ca3af;
  animation: chat-typing-bounce 1.4s infinite ease-in-out;
}

.chat-typing-dot:nth-child(1) { animation-delay: 0s; }
.chat-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.chat-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes chat-typing-bounce {
  0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; }
  40% { transform: scale(1); opacity: 1; }
}

/* Quick Actions */
.chat-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px 12px;
}

.chat-quick-btn {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 12px;
  color: #374151;
  cursor: pointer;
  transition: all 0.15s;
}

.chat-quick-btn:hover {
  background: #f47b20;
  color: #252525;
  border-color: #f47b20;
}

/* Chat Input */
.chat-input-area {
  padding: 12px 16px;
  background: #fff;
  border-top: 1px solid #e5e7eb;
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-shrink: 0;
}

.chat-input {
  flex: 1;
  border: 1px solid #e5e7eb;
  border-radius: 24px;
  padding: 10px 16px;
  font-size: 14px;
  resize: none;
  max-height: 100px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}

.chat-input:focus {
  border-color: #f47b20;
}

.chat-send {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #f47b20;
  color: #252525;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: background 0.15s;
  flex-shrink: 0;
}

.chat-send:hover {
  background: #e06a0f;
}

.chat-send:disabled {
  background: #d1d5db;
  cursor: not-allowed;
}

/* Client Selector (PMS only) */
.chat-client-selector {
  padding: 12px 16px;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
}

.chat-client-select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 13px;
  background: #f9fafb;
  outline: none;
}

.chat-client-select:focus {
  border-color: #f47b20;
}

/* Responsive */
@media (max-width: 480px) {
  .chat-window {
    width: calc(100vw - 32px);
    height: calc(100vh - 120px);
    bottom: 70px;
    right: -8px;
    border-radius: 12px;
  }
  
  .chat-widget {
    bottom: 16px;
    right: 16px;
  }
  
  .chat-bubble {
    width: 52px;
    height: 52px;
    font-size: 24px;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .chat-window {
    background: #1f2937;
  }
  
  .chat-messages {
    background: #111827;
  }
  
  .chat-message.bot .chat-message-bubble {
    background: #374151;
    border-color: #4b5563;
    color: #f9fafb;
  }
  
  .chat-input-area {
    background: #1f2937;
    border-color: #374151;
  }
  
  .chat-input {
    background: #374151;
    border-color: #4b5563;
    color: #f9fafb;
  }
  
  .chat-client-selector {
    background: #1f2937;
    border-color: #374151;
  }
  
  .chat-client-select {
    background: #374151;
    border-color: #4b5563;
    color: #f9fafb;
  }
}
