/* ===== CHAT TAB ===== */
.chat-container {
  max-width: 700px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 180px);
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  font-size: 0.92rem;
  font-weight: 500;
}

.chat-context-badge {
  padding: 3px 10px;
  background: rgba(124,58,237,0.12);
  border-radius: 50px;
  font-size: 0.78rem;
  color: var(--primary);
  font-weight: 500;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Messages Area */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Starters */
.chat-starters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 20px 0;
}

.chat-starter {
  padding: 8px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50px;
  font-size: 0.82rem;
  color: var(--text-muted);
  transition: all var(--transition);
  cursor: pointer;
  text-align: left;
}

.chat-starter:hover {
  border-color: var(--primary);
  color: var(--text);
  background: rgba(124,58,237,0.08);
}

/* Messages */
.chat-message {
  max-width: 85%;
  animation: chatSlideIn 0.25s ease;
}

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

.chat-message.user {
  align-self: flex-end;
}

.chat-message.ai {
  align-self: flex-start;
}

.chat-bubble {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-family: var(--font-content);
  font-size: 0.92rem;
  line-height: 1.6;
}

.chat-message.user .chat-bubble {
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-message.ai .chat-bubble {
  background: var(--card);
  border-bottom-left-radius: 4px;
}

/* AI Tip */
.chat-tip {
  margin-top: 8px;
  padding: 10px 14px;
  background: rgba(251,191,36,0.08);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--highlight);
  font-size: 0.85rem;
  line-height: 1.5;
}

.chat-tip-label {
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--highlight);
  margin-bottom: 4px;
}

/* Follow-ups */
.chat-followups {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.chat-followup {
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50px;
  font-size: 0.78rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}

.chat-followup:hover {
  border-color: var(--primary);
  color: var(--text);
}

/* Add to deck / quiz inline buttons */
.chat-action-btn {
  display: inline-block;
  margin-top: 8px;
  margin-right: 6px;
  padding: 6px 14px;
  background: rgba(124,58,237,0.12);
  border: 1px solid rgba(124,58,237,0.3);
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
  transition: all var(--transition);
}

.chat-action-btn:hover {
  background: rgba(124,58,237,0.2);
}

/* Loading */
.chat-loading {
  display: flex;
  gap: 6px;
  padding: 12px 16px;
}

.chat-loading-dot {
  width: 8px;
  height: 8px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: chatLoadingBounce 1.4s ease-in-out infinite both;
}

.chat-loading-dot:nth-child(2) { animation-delay: 0.16s; }
.chat-loading-dot:nth-child(3) { animation-delay: 0.32s; }

@keyframes chatLoadingBounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* Input Area */
.chat-input-area {
  display: flex;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

#chat-input {
  flex: 1;
  padding: 12px 16px;
  border-radius: 50px;
  font-size: 0.92rem;
}

.btn-send {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  flex-shrink: 0;
}

.btn-send:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-send:not(:disabled):hover { background: var(--primary-hover); transform: scale(1.05); }
.btn-send svg { width: 18px; height: 18px; }

@media (max-width: 768px) {
  .chat-container { height: calc(100vh - 160px); }
  .chat-message { max-width: 92%; }
}
