:root {
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --bg-light: #ffffff;
  --bg-light-secondary: #f8fafc;
  --text-light: #1e293b;
  --text-light-secondary: #64748b;
  --border-light: #e2e8f0;
  
  --bg-dark: #222;
  --bg-dark-secondary: #111;
  --text-dark: #f8fafc;
  --text-dark-secondary: #cbd5e1;
  --border-dark: #333;
}

/* Floating Action Button */
.chat-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: auto; /* Changed from 56px */
  height: 56px;
  padding: 0 20px; /* Added padding */
  border-radius: 28px; /* Changed from 50% */
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: white;
  border: none;
  box-shadow: 0 4px 12px rgba(11, 147, 246, 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px; /* Added gap between icon and text */
  transition: all 0.3s ease;
  z-index: 1000;
}

.chat-fab:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(11, 147, 246, 0.5);
}

.chat-fab .material-icons {
  font-size: 24px;
}

.chat-fab-text {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}

.chat-fab.chat-open .material-icons {
  transform: rotate(180deg);
  transition: transform 0.3s ease;
}

/* Hide text on small screens */
@media (max-width: 640px) {
  .chat-fab {
    width: 52px;
    height: 52px;
    padding: 0;
    border-radius: 50%;
  }
  
  .chat-fab-text {
    display: none;
  }
  
  .chat-fab .material-icons {
    font-size: 28px;
  }
}

/* Avatar Images - Make them circular */
.chat-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.message-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

/* Chat Dialog */
.chat-dialog {
  position: fixed;
  bottom: 90px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 48px);
  height: 550px;
  max-height: calc(100vh - 140px);
  background: white;
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 999;
  animation: slideUp 0.3s ease;
}

.chat-dialog.show {
  display: flex;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Chat Header */
.chat-header {
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: white;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 16px 16px 0 0;
}

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

.chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  color: linear-gradient(135deg, var(--accent), var(--accent-hover));
}

.chat-avatar .material-icons {
  font-size: 24px;
}

.chat-title-wrapper h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.chat-status {
  font-size: 12px;
  opacity: 0.9;
  margin-top: 2px;
}

.chat-close {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s;
}

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

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

.chat-messages::-webkit-scrollbar {
  width: 6px;
}

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

.chat-messages::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Message Bubble */
.chat-message {
  display: flex;
  gap: 8px;
  animation: messageSlide 0.3s ease;
}

@keyframes messageSlide {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

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

.chat-message.bot .message-avatar {
  background: #e2e8f0;
  color: #64748b;
}

.chat-message.user .message-avatar {
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: white;
}

.message-content {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
}

.chat-message.bot .message-content {
  background: white;
  color: #1e293b;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.chat-message.user .message-content {
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: white;
  border-bottom-right-radius: 4px;
}

/* Support HTML formatting in bot messages */
.message-content b,
.message-content strong {
  font-weight: 600;
}

.message-content i,
.message-content em {
  font-style: italic;
}

.message-content a {
  color: inherit;
  text-decoration: underline;
}

.chat-message.user .message-content a {
  color: white;
}

.chat-message.bot .message-content a {
  color: #0b93f6;
}

.message-content ul,
.message-content ol {
  margin: 8px 0;
  padding-left: 20px;
}

.message-content li {
  margin: 4px 0;
}

.message-content p {
  margin: 4px 0;
}

.message-content p:first-child {
  margin-top: 0;
}

.message-content p:last-child {
  margin-bottom: 0;
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 10px 14px;
  background: white;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  width: fit-content;
}

.typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #94a3b8;
  animation: typingBounce 1.4s infinite ease-in-out;
}

.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);
  }
  30% {
    transform: translateY(-10px);
  }
}

/* Chat Input Area */
.chat-input-area {
  padding: 12px 16px;
  background: white;
  border-top: 1px solid #e2e8f0;
  display: flex;
  gap: 8px;
  align-items: center;
}

.chat-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 24px;
  font-size: 14px;
  outline: none;
  transition: all 0.2s;
  font-family: inherit;
}

.chat-input:focus {
  border-color: #0b93f6;
  box-shadow: 0 0 0 3px rgba(11, 147, 246, 0.1);
}

.chat-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.chat-send-btn:hover {
  background: #0668d4;
  transform: scale(1.05);
}

.chat-send-btn:disabled {
  background: #cbd5e1;
  cursor: not-allowed;
  transform: scale(1);
}

.chat-send-btn .material-icons {
  font-size: 20px;
}

/* Dark mode support */
.dark .chat-dialog {
  background: #1e293b;
}

.dark .chat-messages {
  background: #191919;
}

.dark .chat-message.bot .message-content {
  background: #334155;
  color: #e2e8f0;
}

.dark .chat-message.bot .message-content a {
  color: #60a5fa;
}

.dark .chat-input-area {
  background: #1e293b;
  border-top-color: #334155;
}

.dark .chat-input {
  background: #0f172a;
  border-color: #334155;
  color: #e2e8f0;
}

.dark .chat-input:focus {
  border-color: #0b93f6;
}

.dark .typing-indicator {
  background: #334155;
}

/* Mobile Responsive */
@media (max-width: 640px) {
  .chat-fab {
    bottom: 20px;
    right: 20px;
    width: 52px;
    height: 52px;
  }
  
  .chat-dialog {
    bottom: 80px;
    right: 16px;
    left: 16px;
    width: auto;
    max-width: none;
  }
  
  .message-content {
    max-width: 80%;
  }
}