/* ========================================
   AI Assistant — Chat UI Styles
   ======================================== */

/* Hero */
.ai-hero {
  text-align: center;
  padding: 48px 24px 24px;
}

.ai-hero__icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #b5704d, #e86c2e);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 1.6rem;
  color: #fff;
}

.ai-hero__title {
  font-family: 'Poiret One', cursive;
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: #1a1a1a;
}

.ai-hero__subtitle {
  font-family: 'Mulish', sans-serif;
  font-size: 0.95rem;
  color: #888;
  margin-bottom: 12px;
}

.ai-hero__quota {
  font-family: 'Mulish', sans-serif;
  font-size: 0.8rem;
  color: #b5704d;
  font-weight: 600;
}

/* Suggestions */
.ai-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  padding: 0 24px 24px;
  max-width: 700px;
  margin: 0 auto;
}

.ai-suggestion {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1.5px solid #e8e8e8;
  border-radius: 24px;
  background: #fff;
  font-family: 'Mulish', sans-serif;
  font-size: 0.82rem;
  color: #555;
  cursor: pointer;
  transition: all 0.2s;
}

.ai-suggestion:hover {
  border-color: #b5704d;
  color: #b5704d;
  background: #fdf8f5;
}

.ai-suggestion i {
  font-size: 0.9rem;
  color: #b5704d;
}

/* Chat area */
.ai-chat {
  max-width: 700px;
  margin: 0 auto;
  padding: 0 24px;
  min-height: 200px;
}

.ai-chat__messages {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-bottom: 16px;
}

/* Message bubbles */
.ai-msg {
  display: flex;
  gap: 12px;
  max-width: 100%;
  animation: aiMsgIn 0.3s ease;
}

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

.ai-msg--user {
  flex-direction: row-reverse;
}

.ai-msg__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
}

.ai-msg--bot .ai-msg__avatar {
  background: linear-gradient(135deg, #b5704d, #e86c2e);
}

.ai-msg--user .ai-msg__avatar {
  background: #555;
  font-family: 'Mulish', sans-serif;
  font-size: 0.7rem;
}

.ai-msg__bubble {
  background: #f4f4f4;
  border-radius: 18px;
  padding: 14px 18px;
  font-family: 'Mulish', sans-serif;
  font-size: 0.9rem;
  line-height: 1.6;
  color: #333;
  max-width: 80%;
  position: relative;
  word-wrap: break-word;
}

.ai-msg--user .ai-msg__bubble {
  background: #b5704d;
  color: #fff;
  border-bottom-right-radius: 6px;
}

.ai-msg--bot .ai-msg__bubble {
  background: #f4f4f4;
  border-bottom-left-radius: 6px;
}

/* Save button on bot messages */
.ai-msg__actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(0,0,0,0.06);
}

.ai-msg__save {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  font-family: 'Mulish', sans-serif;
  font-size: 0.75rem;
  color: #999;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: all 0.2s;
}

.ai-msg__save:hover {
  color: #b5704d;
  background: rgba(181, 112, 77, 0.08);
}

.ai-msg__save.saved {
  color: #b5704d;
}

.ai-msg__save.saved i {
  color: #e86c2e;
}

/* Typing indicator */
.ai-typing {
  display: flex;
  gap: 4px;
  padding: 8px 4px;
}

.ai-typing__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ccc;
  animation: aiTyping 1.4s ease-in-out infinite;
}

.ai-typing__dot:nth-child(2) { animation-delay: 0.2s; }
.ai-typing__dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes aiTyping {
  0%, 60%, 100% { opacity: 0.3; transform: scale(0.8); }
  30% { opacity: 1; transform: scale(1); }
}

/* Input area */
.ai-input-area {
  position: sticky;
  bottom: 0;
  background: #fafafa;
  padding: 16px 24px 24px;
  max-width: 700px;
  margin: 0 auto;
  width: 100%;
}

.ai-input-wrap {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: #fff;
  border: 2px solid #e0e0e0;
  border-radius: 16px;
  padding: 8px 8px 8px 16px;
  transition: border-color 0.2s;
}

.ai-input-wrap:focus-within {
  border-color: #b5704d;
}

.ai-input {
  flex: 1;
  border: none;
  outline: none;
  font-family: 'Mulish', sans-serif;
  font-size: 0.92rem;
  resize: none;
  max-height: 120px;
  line-height: 1.5;
  color: #333;
  background: transparent;
}

.ai-input::placeholder {
  color: #bbb;
}

.ai-send {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, #b5704d, #e86c2e);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  transition: opacity 0.2s, transform 0.2s;
  flex-shrink: 0;
}

.ai-send:hover {
  opacity: 0.85;
  transform: scale(1.05);
}

.ai-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.ai-input-hint {
  text-align: center;
  font-family: 'Mulish', sans-serif;
  font-size: 0.7rem;
  color: #bbb;
  margin-top: 8px;
}

/* Quota exhausted */
.ai-input-area.exhausted .ai-input-wrap {
  opacity: 0.5;
  pointer-events: none;
}

.ai-quota-warning {
  text-align: center;
  font-family: 'Mulish', sans-serif;
  font-size: 0.85rem;
  color: #e86c2e;
  padding: 12px;
  background: #fff5f0;
  border-radius: 12px;
  margin-bottom: 12px;
}

/* Markdown in bot messages */
.ai-msg--bot .ai-msg__bubble p {
  margin-bottom: 8px;
}

.ai-msg--bot .ai-msg__bubble p:last-child {
  margin-bottom: 0;
}

.ai-msg--bot .ai-msg__bubble ul,
.ai-msg--bot .ai-msg__bubble ol {
  margin: 8px 0;
  padding-left: 20px;
}

.ai-msg--bot .ai-msg__bubble li {
  margin-bottom: 4px;
  list-style: disc;
}

.ai-msg--bot .ai-msg__bubble ol li {
  list-style: decimal;
}

.ai-msg--bot .ai-msg__bubble strong {
  font-weight: 700;
  color: #222;
}

.ai-msg--bot .ai-msg__bubble a {
  color: #b5704d;
  text-decoration: underline;
}

.ai-msg--bot .ai-msg__bubble code {
  background: rgba(0,0,0,0.05);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85em;
}

/* Footer hide when chatting */
.ai-chat:not(:empty) ~ .ai-input-area ~ .footer {
  display: none;
}

/* ========================================
   Dark Theme
   ======================================== */
[data-theme="dark"] .ai-hero__title {
  color: #e0e0e6;
}

[data-theme="dark"] .ai-hero__subtitle {
  color: #7a7a90;
}

[data-theme="dark"] .ai-suggestion {
  background: #1e2030;
  border-color: #2a2d3d;
  color: #a0a0b8;
}

[data-theme="dark"] .ai-suggestion:hover {
  border-color: #b5704d;
  color: #b5704d;
  background: #252030;
}

[data-theme="dark"] .ai-msg--bot .ai-msg__bubble {
  background: #1e2030;
  color: #d0d0dc;
}

[data-theme="dark"] .ai-msg--bot .ai-msg__bubble strong {
  color: #e8e8f0;
}

[data-theme="dark"] .ai-msg--user .ai-msg__avatar {
  background: #3a3a4a;
}

[data-theme="dark"] .ai-input-area {
  background: #12141e;
}

[data-theme="dark"] .ai-input-wrap {
  background: #1e2030;
  border-color: #2a2d3d;
}

[data-theme="dark"] .ai-input {
  color: #d0d0dc;
}

[data-theme="dark"] .ai-input::placeholder {
  color: #5a5a70;
}

[data-theme="dark"] .ai-msg__save {
  color: #6a6a80;
}

[data-theme="dark"] .ai-msg__save:hover {
  color: #b5704d;
  background: rgba(181, 112, 77, 0.12);
}

[data-theme="dark"] .ai-quota-warning {
  background: #2a1a10;
  color: #e86c2e;
}

[data-theme="dark"] .ai-msg--bot .ai-msg__bubble code {
  background: rgba(255,255,255,0.06);
}

[data-theme="dark"] .ai-typing__dot {
  background: #5a5a70;
}

/* ========================================
   Mobile
   ======================================== */
@media (max-width: 768px) {
  .ai-hero {
    padding: 24px 16px 16px;
  }

  .ai-hero__title {
    font-size: 1.5rem;
  }

  .ai-suggestions {
    padding: 0 16px 16px;
  }

  .ai-suggestion {
    font-size: 0.76rem;
    padding: 8px 12px;
  }

  .ai-chat {
    padding: 0 16px;
  }

  .ai-msg__bubble {
    max-width: 88%;
    padding: 12px 14px;
    font-size: 0.85rem;
  }

  .ai-input-area {
    padding: 12px 16px 16px;
  }

  .ai-msg__avatar {
    width: 30px;
    height: 30px;
    font-size: 0.7rem;
  }
}
