/* Luxury AI Chat - Integrated with your design system */
.ai-chat-popup-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  font-family: 'Tajawal', sans-serif;
  direction: rtl;
}

/* Floating Action Button */
.ai-chat-popup-button {
  background: var(--primary-color);
  color: var(--white);
  border: none;
  border-radius: 50%;
  width: 56px;
  height: 56px;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.ai-chat-popup-button:hover {
  transform: translateY(-2px);
  background: var(--primary-dark);
  box-shadow: var(--shadow-xl);
}

/* Chat Window */
.ai-chat-popup {
  display: none;
  width: 380px;
  height: 520px;
  background: var(--white);
  border-radius: var(--radius-large);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--gray-200);
  overflow: hidden;
  flex-direction: column;
  direction: rtl;
}

.ai-chat-popup.active {
  display: flex;
}

/* Header */
.ai-chat-top-bar {
  background: var(--primary-color);
  color: var(--white);
  padding: 1rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.ai-chat-top-bar h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
}

.clear-button {
  background: transparent;
  border: none;
  color: var(--white);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: var(--transition);
}

.clear-button:hover {
  background: rgba(255,255,255,0.1);
}

/* Token Counter */
.ai-chat-token-counter {
  background: var(--gray-50);
  padding: 0.75rem 1.25rem;
  font-size: 0.85rem;
  color: var(--gray-700);
  border-bottom: 1px solid var(--gray-200);
}

.token-info {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.reset-timer {
  color: var(--primary-dark);
  font-weight: 600;
}

.ai-chat-token-progress {
  background: var(--gray-200);
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
}

.ai-chat-token-progress-bar {
  background: var(--primary-color);
  height: 100%;
  transition: width 0.3s ease;
}

/* Chat Messages */
.ai-chat-box {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  background: var(--white);
  scroll-behavior: smooth;
}

.ai-chat-message {
  margin-bottom: 1rem;
  padding: 0.9rem 1.1rem;
  border-radius: var(--radius-large);
  max-width: 80%;
  font-size: 0.95rem;
  line-height: 1.6;
  position: relative;
  box-shadow: var(--shadow-sm);
  animation: fadeIn 0.3s ease-out;
}

.ai-chat-message.user {
  background: var(--primary-color);
  color: var(--white);
  margin-left: auto;
  border-bottom-right-radius: var(--radius);
}

.ai-chat-message.assistant {
  background: var(--gray-100);
  color: var(--gray-800);
  margin-right: auto;
  border-bottom-left-radius: var(--radius);
}

.ai-chat-message.rtl {
  direction: rtl;
  text-align: right;
}

/* Input Area */
.ai-chat-input-area {
  padding: 1rem;
  background: var(--white);
  border-top: 1px solid var(--gray-200);
}

.ai-chat-input-row {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
}

.ai-chat-input-row textarea {
  flex: 1;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-large);
  padding: 0.75rem 1rem;
  resize: none;
  min-height: 48px;
  font-size: 0.95rem;
  background: var(--white);
  color: var(--gray-800);
  transition: var(--transition);
}

.ai-chat-input-row textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(155, 135, 245, 0.2);
}

.ai-chat-send-button {
  background: var(--primary-color);
  color: var(--white);
  border: none;
  border-radius: var(--radius-large);
  width: 48px;
  height: 48px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-chat-send-button:disabled {
  background: var(--gray-300);
  cursor: not-allowed;
}

.ai-chat-send-button:hover:not(:disabled) {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Responsive */
@media (max-width: 480px) {
  .ai-chat-popup {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
  }
  
  .ai-chat-popup-container {
    bottom: 0;
    right: 0;
  }
  
  .ai-chat-popup-button {
    right: 1rem;
    bottom: 1rem;
  }
}

/* Voice button styling */
.ai-chat-voice-button {
  background: transparent;
  border: none;
  color: var(--primary-color);
  padding: 0.25rem;
  margin-right: 0.5rem;
  cursor: pointer;
  transition: var(--transition);
}

.ai-chat-voice-button:hover {
  color: var(--primary-dark);
  transform: scale(1.1);
}

.ai-chat-voice-button i {
  font-size: 0.9rem;
}