/* ==========================================================================
   CARFIX — sAI ASSISTANT MODULE STYLES (ai.css)
   مطابق لـ AskSAiScreen.kt — شات بوت للمركبات
   ========================================================================== */

/* --------------------------------------------------------------------------
   0. HEADER
   -------------------------------------------------------------------------- */
.ai-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-6) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.ai-header-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.ai-header-title {
  font-size: var(--text-lg);
  font-weight: var(--font-bold);
  color: var(--text-primary);
}

.ai-header-sub {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 2px;
}

/* --------------------------------------------------------------------------
   1. MAIN CONTAINER
   -------------------------------------------------------------------------- */
.ai-screen {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background: transparent;
}

/* --------------------------------------------------------------------------
   2. CHAT AREA
   -------------------------------------------------------------------------- */
.ai-chat-area {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5) var(--space-3);
  scroll-behavior: smooth;
}

.ai-chat-area::-webkit-scrollbar { width: 4px; }
.ai-chat-area::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.12);
  border-radius: 4px;
}

/* --------------------------------------------------------------------------
   3. CHAT BUBBLES
   -------------------------------------------------------------------------- */
.ai-bubble-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  max-width: 85%;
  animation: fadeUp 0.20s ease;
}

.ai-bubble-row.user {
  align-self: flex-start;
  flex-direction: row-reverse;
}

.ai-bubble-row.bot {
  align-self: flex-end;
}

/* Avatar */
.ai-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.ai-avatar.bot-avatar {
  background: rgba(139,92,246,0.12);
  border: 1px solid rgba(139,92,246,0.25);
}

.ai-avatar.user-avatar {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
}

/* Bubble */
.ai-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.6;
  font-weight: var(--font-medium);
  white-space: pre-wrap;
  word-break: break-word;
  max-width: 100%;
}

.ai-bubble.bot {
  background: rgba(139,92,246,0.12);
  border: 1px solid rgba(139,92,246,0.22);
  border-radius: 16px 16px 2px 16px;
  color: rgba(255,255,255,0.92);
  cursor: copy;
}

.ai-bubble.user {
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 16px 16px 16px 2px;
  color: rgba(255,255,255,0.92);
}

/* --------------------------------------------------------------------------
   4. TYPING INDICATOR
   -------------------------------------------------------------------------- */
.ai-typing-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  align-self: flex-end;
  padding-right: 4px;
}

.ai-typing-dots {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 10px 14px;
  background: rgba(139,92,246,0.10);
  border: 1px solid rgba(139,92,246,0.20);
  border-radius: 14px 14px 2px 14px;
}

.ai-typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #8B5CF6;
  animation: ai-dot-bounce 1.2s ease-in-out infinite;
}

.ai-typing-dot:nth-child(2) { animation-delay: 0.15s; }
.ai-typing-dot:nth-child(3) { animation-delay: 0.30s; }

@keyframes ai-dot-bounce {
  0%, 60%, 100% { opacity: 0.25; transform: scale(0.8); }
  30%            { opacity: 1.00; transform: scale(1.1); }
}

/* --------------------------------------------------------------------------
   5. SUGGESTIONS ROW
   -------------------------------------------------------------------------- */
.ai-suggestions-wrap {
  padding: var(--space-2) var(--space-5) var(--space-3);
  flex-shrink: 0;
  animation: fadeUp 0.25s ease;
}

.ai-suggestions-label {
  font-size: 11px;
  font-weight: var(--font-semi);
  color: rgba(255,255,255,0.50);
  margin-bottom: var(--space-2);
}

.ai-suggestions-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.ai-chip {
  padding: 7px 12px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 12px;
  font-size: 12px;
  font-weight: var(--font-semi);
  color: rgba(255,255,255,0.85);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.ai-chip:hover {
  background: rgba(139,92,246,0.18);
  border-color: rgba(139,92,246,0.40);
}

/* --------------------------------------------------------------------------
   6. INPUT BAR
   -------------------------------------------------------------------------- */
.ai-input-bar {
  flex-shrink: 0;
  padding: var(--space-3) var(--space-4);
  background: rgba(255,255,255,0.04);
  border-top: 1px solid rgba(255,255,255,0.08);
}

.ai-input-inner {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 20px;
  padding: 8px 8px 8px 14px;
  transition: border-color 0.2s;
}

.ai-input-inner:focus-within {
  border-color: rgba(139,92,246,0.50);
  background: rgba(139,92,246,0.05);
}

.ai-input-field {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: rgba(255,255,255,0.90);
  font-size: 13.5px;
  font-family: inherit;
  direction: rtl;
  min-width: 0;
  resize: none;
  height: 24px;
  line-height: 1.4;
  overflow: hidden;
}

.ai-input-field::placeholder { color: rgba(255,255,255,0.35); }

.ai-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #8B5CF6 0%, #6D28D9 100%);
  color: #fff;
  font-size: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity 0.2s, transform 0.15s;
}

.ai-send-btn:hover:not(:disabled) { opacity: 0.85; transform: scale(0.96); }
.ai-send-btn:disabled { background: rgba(255,255,255,0.10); cursor: not-allowed; }

/* --------------------------------------------------------------------------
   7. EMPTY STATE (no messages)
   -------------------------------------------------------------------------- */
.ai-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  text-align: center;
  padding: var(--space-8);
}

.ai-empty-icon {
  font-size: 56px;
  animation: floatAi 3s ease-in-out infinite;
}

@keyframes floatAi {
  0%,100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}

.ai-empty-title {
  font-size: var(--text-lg);
  font-weight: var(--font-bold);
  color: var(--text-primary);
}

.ai-empty-sub {
  font-size: var(--text-sm);
  color: var(--text-muted);
  max-width: 300px;
  line-height: 1.5;
}

/* --------------------------------------------------------------------------
   8. RESPONSIVE
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .ai-chat-area { padding: var(--space-3) var(--space-3) var(--space-2); }
  .ai-input-bar  { padding: var(--space-2) var(--space-3); }
}
