/* Chatbot Widget Styles */
.chat-toggle-button {
  position: fixed;
  bottom: 2rem;
  left: 2rem;
  width: 60px;
  height: 60px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #ffffff;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 8px 24px -4px var(--primary-glow);
  z-index: 9990;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-smooth);
}

[dir="ltr"] .chat-toggle-button {
  left: auto;
  right: 2rem;
}

.chat-toggle-button:hover {
  transform: scale(1.1) translateY(-3px);
  box-shadow: 0 12px 30px -4px var(--primary-glow);
}

.chat-widget-container {
  position: fixed;
  bottom: 6.5rem;
  left: 2rem;
  width: 380px;
  max-width: calc(100vw - 4rem);
  height: 520px;
  max-height: calc(100vh - 8rem);
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 45px -15px var(--shadow-color);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9990;
  transform: scale(0.9) translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: all var(--transition-smooth);
}

[dir="ltr"] .chat-widget-container {
  left: auto;
  right: 2rem;
}

.chat-widget-container.active {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

.chat-header {
  padding: 1.1rem 1.4rem;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.25), rgba(6, 182, 212, 0.15));
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-header h3 {
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}

.chat-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
  display: inline-block;
}

.chat-messages {
  flex: 1;
  padding: 1.25rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.chat-message {
  max-width: 85%;
  padding: 0.75rem 1.1rem;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  line-height: 1.5;
  word-wrap: break-word;
  animation: messageSlideIn 0.3s ease;
}

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

.chat-message.user {
  background: var(--primary);
  color: #ffffff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

[dir="rtl"] .chat-message.user {
  border-bottom-right-radius: var(--radius-md);
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}

.chat-message.ai {
  background: var(--bg-tertiary);
  color: var(--text-heading);
  border: 1px solid var(--border-light);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

[dir="rtl"] .chat-message.ai {
  border-bottom-left-radius: var(--radius-md);
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}

.chat-message.typing {
  background: var(--bg-tertiary);
  color: var(--text-muted);
  font-style: italic;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.6rem 1rem;
}

.chat-form {
  display: flex;
  padding: 0.85rem;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid var(--border-light);
  gap: 0.5rem;
}

.chat-input {
  flex: 1;
  padding: 0.65rem 1rem;
  font-size: 0.9rem;
  border-radius: var(--radius-full);
}

.chat-send-btn {
  width: 2.6rem;
  height: 2.6rem;
  border-radius: var(--radius-full);
  background: var(--primary);
  color: #ffffff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.chat-send-btn:hover {
  background: var(--primary-light);
  transform: scale(1.05);
}

@media (max-width: 480px) {
  .chat-widget-container {
    left: 1rem;
    right: 1rem;
    bottom: 5.5rem;
    width: auto;
    max-width: none;
    height: 70vh;
  }
  .chat-toggle-button {
    bottom: 1rem;
    left: 1rem;
  }
  [dir="ltr"] .chat-toggle-button {
    right: 1rem;
    left: auto;
  }
}
