/* BGP Advisory Color Palette */
:root {
  --cream: #EFEDE7;
  --royal-blue: #112C5F;
  --bronze: #9E6B3E;
  --charcoal: #2B2B2B;
  --sage: #344F3D;
  --light-gray: #E0DDD8;
  --white: #FFFFFF;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: var(--font);
  background-color: var(--cream);
  color: var(--charcoal);
}

/* ── Full-page layout ── */
.chat-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 600px;
  margin: 0 auto;
  background: var(--white);
  box-shadow: 0 0 40px rgba(0,0,0,0.08);
}

/* ── Header ── */
.chat-header {
  background: var(--royal-blue);
  color: var(--white);
  padding: 16px 20px;
  flex-shrink: 0;
}

.chat-header h1 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.chat-header p {
  font-size: 12px;
  opacity: 0.75;
  margin-top: 2px;
}

/* ── Messages area ── */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--cream);
}

.chat-messages::-webkit-scrollbar {
  width: 4px;
}
.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}
.chat-messages::-webkit-scrollbar-thumb {
  background: var(--light-gray);
  border-radius: 2px;
}

/* ── Message bubbles ── */
.message {
  display: flex;
  flex-direction: column;
  max-width: 80%;
}

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

.message.assistant {
  align-self: flex-start;
  align-items: flex-start;
}

.message-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
}

.message.user .message-bubble {
  background: var(--royal-blue);
  color: var(--white);
  border-bottom-right-radius: 4px;
}

.message.assistant .message-bubble {
  background: var(--white);
  color: var(--charcoal);
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.message-time {
  font-size: 11px;
  color: #999;
  margin-top: 4px;
  padding: 0 4px;
}

/* ── Typing indicator ── */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 14px;
  background: var(--white);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  width: fit-content;
}

.typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #bbb;
  animation: typing-bounce 1.2s infinite ease-in-out;
}

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

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

/* ── Book a call button ── */
.book-call-wrapper {
  display: flex;
  justify-content: center;
  padding: 8px 0 4px;
}

.book-call-btn {
  display: inline-block;
  background: var(--bronze);
  color: var(--white);
  text-decoration: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.2s, transform 0.1s;
}

.book-call-btn:hover {
  background: #7e5531;
  transform: translateY(-1px);
}

/* ── Input area ── */
.chat-input-area {
  padding: 12px 16px;
  background: var(--white);
  border-top: 1px solid var(--light-gray);
  flex-shrink: 0;
}

.input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.chat-input {
  flex: 1;
  border: 1.5px solid var(--light-gray);
  border-radius: 10px;
  padding: 10px 14px;
  font-family: var(--font);
  font-size: 14px;
  color: var(--charcoal);
  resize: none;
  line-height: 1.5;
  max-height: 120px;
  outline: none;
  transition: border-color 0.2s;
}

.chat-input:focus {
  border-color: var(--royal-blue);
}

.send-btn {
  background: var(--bronze);
  color: var(--white);
  border: none;
  border-radius: 10px;
  padding: 10px 18px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.1s;
  height: 42px;
}

.send-btn:hover:not(:disabled) {
  background: #7e5531;
  transform: translateY(-1px);
}

.send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── Mic button ── */
.mic-btn {
  background: var(--bronze);
  color: var(--white);
  border: none;
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  flex-shrink: 0;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.1s;
}

.mic-btn:hover:not(:disabled) {
  background: #7e5531;
  transform: translateY(-1px);
}

.mic-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.mic-btn.mic-active {
  background: #c0392b;
  animation: mic-pulse 1.2s infinite;
}

@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(192, 57, 43, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(192, 57, 43, 0); }
}

/* ── Footer ── */
.chat-footer {
  text-align: center;
  padding: 8px 16px 12px;
  font-size: 11px;
  color: #aaa;
  background: var(--white);
}

.chat-footer a {
  color: var(--sage);
  text-decoration: none;
}

.chat-footer a:hover {
  text-decoration: underline;
}

/* ── Responsive ── */
@media (max-width: 640px) {
  .chat-page {
    max-width: 100%;
    box-shadow: none;
  }
}

@media (max-width: 400px) {
  .message {
    max-width: 92%;
  }
}
