/* ═══════════════════════════════════════════
   CHATBOT PAGE — Chat UI for Risposta
   Palette: mirrors theme.css (amber + dark)
   ═══════════════════════════════════════════ */

.chat-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg);
}

/* ─── HEADER ─────────────────────────────── */

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
}

.back-link {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.2s;
}
.back-link:hover { color: var(--amber); }

.chat-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.brand-name {
  font-family: var(--serif);
  font-size: 20px;
  color: var(--text);
  line-height: 1;
}

.brand-sub {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

/* ─── CHAT CONTAINER ───────────────────────── */

.chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 680px;
  width: 100%;
  margin: 0 auto;
  padding: 0 24px;
  padding-bottom: 24px;
  width: 100%;
}

/* ─── CHAT WINDOW ─────────────────────────── */

.chat-window {
  flex: 1;
  overflow-y: auto;
  padding: 32px 0 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scrollbar-width: thin;
  scrollbar-color: var(--amber-dim) transparent;
}

.chat-window::-webkit-scrollbar { width: 4px; }
.chat-window::-webkit-scrollbar-track { background: transparent; }
.chat-window::-webkit-scrollbar-thumb { background: var(--amber-dim); border-radius: 2px; }

/* ─── WELCOME ──────────────────────────────── */

.welcome-message {
  text-align: center;
  padding: 40px 24px;
  border: 1px dashed var(--border);
  border-radius: 16px;
  margin: auto;
}

.welcome-icon {
  width: 64px;
  height: 64px;
  border: 1px solid var(--border);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}

.welcome-message h2 {
  font-family: var(--serif);
  font-size: 22px;
  color: var(--text);
  margin-bottom: 8px;
}

.welcome-message p {
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.6;
  max-width: 400px;
  margin: 0 auto 24px;
}

.suggestion-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.chip {
  background: var(--amber-dim);
  border: 1px solid var(--amber-mid);
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 13px;
  font-family: var(--sans);
  font-weight: 500;
  color: var(--amber);
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}

.chip:hover {
  background: rgba(224, 124, 36, 0.25);
  transform: translateY(-1px);
}

/* ─── MESSAGES ─────────────────────────────── */

.msg {
  display: flex;
  flex-direction: column;
  max-width: 78%;
  animation: fadeIn 0.2s ease;
}

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

.msg-user {
  align-self: flex-end;
  align-items: flex-end;
}

.msg-bot {
  align-self: flex-start;
  align-items: flex-start;
}

.msg p {
  background: #1c1c19;
  border: 1px solid var(--border);
  border-radius: 14px 14px 14px 4px;
  padding: 12px 16px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
}

.msg-user p {
  background: var(--amber-dim);
  border-color: var(--amber-mid);
  border-radius: 14px 14px 4px 14px;
}

.msg-time {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
  padding: 0 4px;
}

/* ─── TYPING INDICATOR ─────────────────────── */

.typing-dots {
  display: flex;
  gap: 4px;
  padding: 4px 0;
  align-self: flex-start;
  margin-left: 4px;
}

.typing-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--amber);
  opacity: 0.4;
  animation: pulse 1.2s infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes pulse {
  0%, 100% { opacity: 0.4; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1); }
}

/* ─── INPUT BAR ─────────────────────────────── */

.chat-input-bar {
  display: flex;
  gap: 12px;
  padding: 16px 0;
  border-top: 1px solid var(--border);
  align-items: center;
}

.chat-input-bar input {
  flex: 1;
  background: #1c1c19;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 14px;
  font-family: var(--sans);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
}

.chat-input-bar input::placeholder { color: var(--text-muted); }

.chat-input-bar input:focus {
  border-color: var(--amber-mid);
}

.chat-input-bar button {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--amber);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--bg);
  transition: background 0.2s, transform 0.15s;
  flex-shrink: 0;
}

.chat-input-bar button:hover:not(:disabled) {
  background: #c05d10;
  transform: scale(1.05);
}

.chat-input-bar button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ─── RESPONSIVE ───────────────────────────── */

@media (max-width: 600px) {
  .chat-header { padding: 16px 20px; }
  .chat-container { padding: 0 16px; padding-bottom: 16px; }
  .msg { max-width: 90%; }
}