/* ============================================
   MAHIKA CHATBOT — chatbot.css
   Add this file to your root folder
   ============================================ */

/* ── Trigger button ────────────────────────── */
.chat-trigger {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 5000;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem 1.25rem;
  background: #1a1a1a;
  color: #fff;
  border: none;
  border-radius: 100px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  transition: transform 0.25s cubic-bezier(0.25,1,0.5,1),
              box-shadow 0.25s ease,
              background 0.2s ease;
  letter-spacing: 0.01em;
}

.chat-trigger:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 40px rgba(0,0,0,0.22);
  background: #d48c84;
}

.chat-trigger__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9EB89E;
  animation: chat-pulse 2.4s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes chat-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.75); }
}

.chat-trigger__text { white-space: nowrap; }

.chat-trigger.is-open .chat-trigger__text { display: none; }
.chat-trigger.is-open { padding: 0.75rem; border-radius: 50%; }
.chat-trigger.is-open .chat-trigger__dot { display: none; }
.chat-trigger.is-open::after {
  content: '×';
  font-size: 1.3rem;
  line-height: 1;
}

/* ── Modal ─────────────────────────────────── */
.chat-modal {
  position: fixed;
  bottom: 5.5rem;
  right: 2rem;
  z-index: 4999;
  width: min(420px, calc(100vw - 2rem));
  max-height: 70vh;
  background: #faf9f7;
  border-radius: 20px;
  box-shadow:
    0 2px 0 rgba(255,255,255,0.8) inset,
    0 32px 80px rgba(0,0,0,0.16),
    0 8px 24px rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom right;
  transform: scale(0.92) translateY(16px);
  opacity: 0;
  pointer-events: none;
  transition:
    transform 0.3s cubic-bezier(0.25,1,0.5,1),
    opacity 0.25s ease;
}

.chat-modal.is-visible {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* ── Header ────────────────────────────────── */
.chat-header {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  flex-shrink: 0;
}

.chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #d48c84 0%, #c87870 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-size: 1rem;
  color: #fff;
  flex-shrink: 0;
}

.chat-header-text { flex: 1; min-width: 0; }

.chat-name {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  color: #1a1a1a;
  display: block;
}

.chat-status {
  font-size: 0.7rem;
  color: #999;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 1px;
}

.chat-status::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #9EB89E;
  display: inline-block;
}

/* ── Messages ──────────────────────────────── */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar { width: 3px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: #e0d8d5; border-radius: 2px; }

/* Message bubbles */
.chat-msg {
  display: flex;
  gap: 0.6rem;
  align-items: flex-end;
  animation: msg-in 0.3s cubic-bezier(0.25,1,0.5,1) both;
}

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

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

.chat-msg__bubble {
  max-width: 82%;
  padding: 0.7rem 1rem;
  border-radius: 16px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  line-height: 1.65;
  color: #1a1a1a;
}

.chat-msg--ai .chat-msg__bubble {
  background: #fff;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.chat-msg--user .chat-msg__bubble {
  background: #1a1a1a;
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* Typing indicator */
.chat-typing {
  display: flex;
  gap: 0.6rem;
  align-items: flex-end;
}

.chat-typing__bubble {
  background: #fff;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  padding: 0.75rem 1rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  display: flex;
  gap: 4px;
  align-items: center;
}

.chat-typing__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ccc;
  animation: typing-bounce 1.2s ease-in-out infinite;
}

.chat-typing__dot:nth-child(2) { animation-delay: 0.15s; }
.chat-typing__dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); background: #ccc; }
  30% { transform: translateY(-5px); background: #d48c84; }
}

/* ── Suggested prompts ─────────────────────── */
.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0 1.25rem 1rem;
  flex-shrink: 0;
}

.chat-suggestion {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.75rem;
  color: #666;
  background: #fff;
  border: 1px solid #e8e4e0;
  border-radius: 100px;
  padding: 0.35rem 0.8rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  white-space: nowrap;
}

.chat-suggestion:hover {
  border-color: #d48c84;
  color: #d48c84;
  background: #fdf5f4;
}

/* ── Input ─────────────────────────────────── */
.chat-input-row {
  display: flex;
  gap: 0.5rem;
  padding: 0.85rem 1rem;
  border-top: 1px solid rgba(0,0,0,0.06);
  background: #faf9f7;
  flex-shrink: 0;
}

.chat-input {
  flex: 1;
  border: 1px solid #e8e4e0;
  border-radius: 100px;
  padding: 0.6rem 1rem;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.83rem;
  color: #1a1a1a;
  background: #fff;
  outline: none;
  transition: border-color 0.2s;
  resize: none;
  height: 38px;
  line-height: 1.4;
}

.chat-input:focus { border-color: #d48c84; }
.chat-input::placeholder { color: #bbb; }

.chat-send {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #1a1a1a;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.2s;
}

.chat-send:hover { background: #d48c84; transform: scale(1.05); }
.chat-send:disabled { background: #e0e0e0; cursor: not-allowed; transform: none; }

.chat-send svg { display: block; }

/* ── Mobile ────────────────────────────────── */
@media (max-width: 500px) {
  .chat-modal {
    bottom: 0;
    right: 0;
    width: 100vw;
    max-height: 85vh;
    border-radius: 20px 20px 0 0;
  }
  .chat-trigger {
    bottom: 1.25rem;
    right: 1.25rem;
  }
}