/* ============================
   SmartHotel.pt Demo — Chat UI
   Matches main landing page branding
   ============================ */

/* ============================
   Chat Area
   ============================ */
.chat-area {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 20px 20px 12px;
  position: relative;
  z-index: 1;
}

.chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-right: 4px;

  /* Custom scrollbar */
  scrollbar-width: thin;
  scrollbar-color: var(--border-hover) transparent;
}

.chat-messages::-webkit-scrollbar {
  width: 4px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: var(--border-hover);
  border-radius: 2px;
}

/* ============================
   Message Bubbles
   ============================ */
.message {
  max-width: min(82%, 640px);
  border-radius: 3px;
  padding: 14px 18px;
  line-height: 1.65;
  font-size: 0.9375rem;
  font-weight: 300;
  white-space: pre-wrap;
  word-break: break-word;
  animation: messageIn 0.35s var(--ease-out);
}

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

.message.ai {
  align-self: flex-start;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 2px solid var(--accent);
  color: var(--text-muted);
}

.message.user {
  align-self: flex-end;
  background: rgba(201, 169, 110, 0.06);
  border: 1px solid var(--border-hover);
  color: var(--text);
}

.message.system {
  align-self: center;
  max-width: 90%;
  color: var(--text-dim);
  font-size: 0.8125rem;
  font-style: italic;
  background: transparent;
  border: none;
  padding: 8px 0;
}

/* Streaming cursor */
.message.streaming::after {
  content: '\2588';
  color: var(--accent);
  font-weight: 400;
  animation: blink 0.8s steps(1, end) infinite;
  margin-left: 1px;
}

@keyframes blink {
  50% { opacity: 0; }
}

/* ============================
   Typing Indicator
   ============================ */
.typing-indicator {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 14px 18px;
  min-height: 0;
}

.typing-indicator .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-dim);
  animation: typingBounce 1.2s ease-in-out infinite;
}

.typing-indicator .dot:nth-child(2) {
  animation-delay: 0.15s;
}

.typing-indicator .dot:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes typingBounce {
  0%, 60%, 100% {
    opacity: 0.3;
    transform: translateY(0);
  }
  30% {
    opacity: 1;
    transform: translateY(-4px);
  }
}

/* ============================
   Markdown in AI Messages
   ============================ */
.message.ai ul {
  margin: 6px 0;
  padding-left: 20px;
  list-style: none;
}

.message.ai li {
  position: relative;
  padding-left: 4px;
  margin-bottom: 3px;
}

.message.ai li::before {
  content: '—';
  position: absolute;
  left: -18px;
  color: var(--accent);
  opacity: 0.6;
}

.message.ai strong {
  color: var(--text);
  font-weight: 500;
}

/* ============================
   Suggestion Chips
   ============================ */
.chip-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 16px 0 4px;
  scrollbar-width: none;
}

.chip-row::-webkit-scrollbar {
  display: none;
}

.chip {
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--bg-card);
  color: var(--text-muted);
  padding: 8px 16px;
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: all 0.3s var(--ease-out);
  white-space: nowrap;
}

.chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

/* ============================
   Lead Capture
   ============================ */
.lead-capture {
  margin-top: 16px;
  border: 1px solid var(--border-hover);
  border-radius: 3px;
  padding: 16px 20px;
  background: var(--accent-soft);
  position: relative;
  overflow: hidden;
  animation: messageIn 0.5s var(--ease-out);
}

/* Gold top accent line — matches briefing callout */
.lead-capture::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(to right, var(--accent), transparent);
}

.lead-capture p {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--text);
}

.lead-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.lead-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid var(--border-hover);
  border-radius: 2px;
  padding: 8px 16px;
  transition: all 0.3s var(--ease-out);
}

.lead-link:hover {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

/* ============================
   Fallback FAQ
   ============================ */
.fallback-faq {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--bg-card);
  padding: 20px;
  animation: messageIn 0.5s var(--ease-out);
}

.fallback-faq h2 {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
}

.fallback-faq > p {
  margin: 0 0 16px;
  color: var(--text-dim);
  font-size: 0.875rem;
}

.fallback-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 8px;
}

.faq-card {
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--bg-subtle);
  overflow: hidden;
  transition: border-color 0.3s var(--ease-out);
}

.faq-card:hover {
  border-color: var(--border-hover);
}

.faq-card button {
  width: 100%;
  background: transparent;
  border: 0;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 400;
  text-align: left;
  cursor: pointer;
  padding: 12px 14px;
  transition: color 0.3s var(--ease-out);
}

.faq-card button:hover {
  color: var(--accent);
}

.faq-answer {
  padding: 0 14px 12px;
  color: var(--text-muted);
  font-size: 0.8125rem;
  line-height: 1.6;
  border-top: 1px solid var(--border);
}

/* ============================
   Mobile
   ============================ */
@media (max-width: 640px) {
  .chat-area {
    padding: 12px 12px 8px;
  }

  .message {
    max-width: 92%;
    padding: 12px 14px;
    font-size: 0.875rem;
  }

  .fallback-grid {
    grid-template-columns: 1fr;
  }

  .lead-capture {
    padding: 14px 16px;
  }
}
