/* ── Chat Widget – Maya Standard ── */
.chat-widget-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-family: 'Outfit', sans-serif;
}

/* ── Toggle button ── */
.chat-toggle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--teal, #2a7a4e);
  border: none;
  padding: 4px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(42, 122, 78, 0.4);
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}
.chat-toggle:hover {
  transform: scale(1.05);
  background: var(--teal-mid, #2e7a52);
  box-shadow: 0 6px 24px rgba(42, 122, 78, 0.5);
}
.chat-toggle .toggle-logo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

/* ── Chat panel ── */
.chat-panel {
  position: absolute;
  bottom: 68px;
  right: 0;
  width: 360px;
  max-width: calc(100vw - 48px);
  max-height: 480px;
  background: var(--bg, #0e1411);
  border: 1px solid var(--border, #24352d);
  border-radius: var(--radius, 12px);
  box-shadow: 0 12px 48px rgba(0,0,0,0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: opacity 0.25s ease, transform 0.25s ease;
  opacity: 0;
  transform: translateY(12px) scale(0.96);
  pointer-events: none;
}
.chat-panel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* ── Header ── */
.chat-header {
  padding: 16px 20px;
  background: var(--surface, #141c18);
  border-bottom: 1px solid var(--border, #24352d);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.chat-header-title {
  font-family: 'Fraunces', serif;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--white, #f4f8f4);
  display: flex;
  align-items: center;
  gap: 10px;
}
.chat-header-title .avatar-img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--teal, #2a7a4e);
}
.chat-close {
  background: none;
  border: none;
  color: var(--muted, #8fa79a);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px 8px;
  transition: color 0.2s;
}
.chat-close:hover { color: var(--white, #f4f8f4); }

/* ── Messages ── */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 200px;
  max-height: 320px;
  background: var(--bg, #0e1411);
}
.chat-messages::-webkit-scrollbar {
  width: 4px;
}
.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}
.chat-messages::-webkit-scrollbar-thumb {
  background: var(--border, #24352d);
  border-radius: 4px;
}

.message {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.5;
  word-wrap: break-word;
  animation: chatFadeIn 0.2s ease;
}
.message.user {
  align-self: flex-end;
  background: var(--teal, #2a7a4e);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.message.bot {
  align-self: flex-start;
  background: var(--surface, #141c18);
  border: 1px solid var(--border, #24352d);
  color: var(--white, #f4f8f4);
  border-bottom-left-radius: 4px;
}
.message.bot a {
  color: var(--orange, #f28c28);
  text-decoration: underline;
}
.message.bot a:hover { color: var(--orange-mid, #d96a1f); }
.message .msg-time {
  font-size: 0.65rem;
  color: var(--muted, #8fa79a);
  margin-top: 6px;
  display: block;
  text-align: right;
}

/* ── Typing indicator ── */
.typing-indicator {
  display: none;
  align-self: flex-start;
  padding: 10px 14px;
  background: var(--surface, #141c18);
  border: 1px solid var(--border, #24352d);
  border-radius: 12px;
  border-bottom-left-radius: 4px;
  color: var(--muted, #8fa79a);
  font-size: 0.85rem;
}
.typing-indicator.active { display: block; }
.typing-dots {
  display: inline-flex;
  gap: 4px;
}
.typing-dots span {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--muted, #8fa79a);
  border-radius: 50%;
  animation: typingBounce 1.4s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

/* ── Input area ── */
.chat-input-area {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border, #24352d);
  background: var(--bg, #0e1411);
}
.chat-input-area input {
  flex: 1;
  background: var(--surface, #141c18);
  border: 1px solid var(--border, #24352d);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--white, #f4f8f4);
  font-family: 'Outfit', sans-serif;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}
.chat-input-area input:focus { border-color: var(--teal, #2a7a4e); }
.chat-input-area input::placeholder { color: var(--muted, #8fa79a); }
.chat-input-area button {
  background: var(--teal, #2a7a4e);
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.chat-input-area button:hover:not(:disabled) {
  background: var(--teal-mid, #2e7a52);
}
.chat-input-area button:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Animations ── */
@keyframes chatFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Responsive ── */
@media (max-width: 480px) {
  .chat-panel {
    width: calc(100vw - 32px);
    max-height: 70vh;
    bottom: 76px;
  }
  .chat-messages { max-height: 50vh; }
}
