/* ========================================
   Chat page styles — Nawiri Financial
   ======================================== */

/* Page layout */
.chat-page {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: #0d0d0d;
  overflow: hidden;
}

/* Top nav */
.chat-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  background: #111;
  flex-shrink: 0;
  z-index: 10;
}

.chat-nav-logo {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: #D4A853;
  text-decoration: none;
  letter-spacing: -0.01em;
}

.chat-nav-lang {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lang-label-small {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.4);
  font-family: 'DM Sans', sans-serif;
}

.lang-select {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  color: #fff;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  padding: 5px 10px;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s;
}

.lang-select:focus {
  border-color: #D4A853;
}

.lang-select option {
  background: #1a1a1a;
}

/* Main chat area */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.chat-window {
  flex: 1;
  overflow-y: auto;
  padding: 24px 0 8px;
  scroll-behavior: smooth;
}

/* Welcome screen */
.chat-welcome {
  text-align: center;
  padding: 48px 24px 32px;
  max-width: 560px;
  margin: 0 auto;
}

.welcome-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #D4A853 0%, #a07820 100%);
  color: #0d0d0d;
  font-family: 'Playfair Display', serif;
  font-size: 1.4rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}

.welcome-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.7rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 10px;
}

.welcome-sub {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  color: rgba(255,255,255,0.55);
  line-height: 1.6;
  margin-bottom: 28px;
}

.welcome-starters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  max-width: 460px;
  margin: 0 auto;
}

.starter-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  color: rgba(255,255,255,0.75);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.82rem;
  line-height: 1.4;
  padding: 12px 14px;
  cursor: pointer;
  text-align: left;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.starter-btn:hover {
  background: rgba(212,168,83,0.1);
  border-color: rgba(212,168,83,0.35);
  color: #fff;
}

/* Messages area */
.messages {
  padding: 0 16px;
  max-width: 760px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Individual messages */
.msg {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  animation: fadeUp 0.25s ease;
}

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

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

.msg-user .msg-bubble {
  background: #D4A853;
  color: #0d0d0d;
  border-radius: 18px 18px 4px 18px;
  margin-left: auto;
}

.msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #D4A853 0%, #a07820 100%);
  color: #0d0d0d;
  font-family: 'Playfair Display', serif;
  font-size: 0.9rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.msg-bubble {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 18px 18px 18px 4px;
  padding: 14px 18px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.93rem;
  line-height: 1.65;
  color: rgba(255,255,255,0.9);
  max-width: 600px;
}

.msg-bubble p {
  margin: 0 0 8px;
}

.msg-bubble p:last-child {
  margin-bottom: 0;
}

/* Markdown-rendered content in AI responses */
.msg-bubble ul,
.msg-bubble ol {
  margin: 4px 0 8px 0;
  padding-left: 1.4em;
}

.msg-bubble ul:last-child,
.msg-bubble ol:last-child {
  margin-bottom: 0;
}

.msg-bubble li {
  margin-bottom: 4px;
  line-height: 1.6;
}

.msg-bubble li:last-child {
  margin-bottom: 0;
}

.msg-bubble strong {
  font-weight: 600;
  color: rgba(255,255,255,0.97);
}

.msg-bubble em {
  font-style: italic;
}

.msg-bubble code {
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
  padding: 1px 5px;
  font-family: 'Courier New', monospace;
  font-size: 0.85em;
}

.msg-error .msg-bubble {
  background: rgba(220, 53, 69, 0.15);
  border-color: rgba(220, 53, 69, 0.3);
  color: #ff7b7b;
}

/* Typing indicator */
.msg-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 16px 20px;
  min-width: 64px;
}

.msg-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255,255,255,0.4);
  animation: bounce 1.2s ease infinite;
  display: inline-block;
}

.msg-typing span:nth-child(1) { animation-delay: 0s; }
.msg-typing span:nth-child(2) { animation-delay: 0.18s; }
.msg-typing span:nth-child(3) { animation-delay: 0.36s; }

@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* Input area */
.chat-input-area {
  flex-shrink: 0;
  padding: 12px 16px 16px;
  border-top: 1px solid rgba(255,255,255,0.07);
  background: #0d0d0d;
}

.chat-input-inner {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  max-width: 760px;
  margin: 0 auto;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  padding: 10px 10px 10px 16px;
  transition: border-color 0.2s;
}

.chat-input-inner:focus-within {
  border-color: rgba(212,168,83,0.5);
}

.chat-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  line-height: 1.5;
  resize: none;
  max-height: 160px;
  overflow-y: auto;
}

.chat-input::placeholder {
  color: rgba(255,255,255,0.3);
}

.send-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #D4A853;
  border: none;
  color: #0d0d0d;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.1s;
}

.send-btn:hover {
  background: #e6bb66;
}

.send-btn:active {
  transform: scale(0.95);
}

.send-btn:disabled {
  background: rgba(212,168,83,0.35);
  cursor: not-allowed;
}

.chat-disclaimer {
  text-align: center;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.7rem;
  color: rgba(255,255,255,0.25);
  margin: 8px auto 0;
  max-width: 560px;
  line-height: 1.4;
}

/* Scrollbar */
.chat-window::-webkit-scrollbar { width: 4px; }
.chat-window::-webkit-scrollbar-track { background: transparent; }
.chat-window::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

/* Mobile */
@media (max-width: 600px) {
  .welcome-starters {
    grid-template-columns: 1fr;
  }

  .chat-nav {
    padding: 12px 16px;
  }

  .welcome-title {
    font-size: 1.4rem;
  }

  .msg-bubble {
    font-size: 0.88rem;
  }
}
