/* ==========================================================================
   The Blowout Artist — AI Chatbot Widget Styles
   ========================================================================== */

:root {
  --green: #2D6A4F;
  --green-deep: #1B4332;
  --green-pale: #D8F3DC;
  --cream: #FDF8F0;
  --sand: #E8DCC8;
  --terracotta: #C17F59;
  --clay: #C4A882;
  --black: #1A1A1A;
  --charcoal: #3D3D3D;
  --grey: #6B6B6B;
  --white: #FFFFFF;
}

/* ---------- Container ---------- */
.tba-chatbot {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  font-family: 'DM Sans', sans-serif;
}

/* ---------- Toggle Button ---------- */
.tba-chat-toggle {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: var(--green);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s ease, background 0.2s ease;
  position: relative;
}

/* Pulse ring to draw attention */
.tba-chat-toggle::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--green);
  opacity: 0;
  animation: chatPulse 3s ease-in-out infinite;
}
@keyframes chatPulse {
  0%, 100% { opacity: 0; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.15); }
}

/* Label that shows on hover */
.tba-chat-label {
  position: absolute;
  right: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--white);
  color: var(--green-deep);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.5rem 0.875rem;
  border-radius: 6px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.1);
  white-space: nowrap;
  opacity: 1;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.tba-chatbot.is-open .tba-chat-label { opacity: 0; }

.tba-chat-toggle:hover {
  transform: scale(1.08);
}

/* Chat icon (speech bubble) */
.tba-chat-toggle .tba-icon-chat,
.tba-chat-toggle .tba-icon-close {
  position: absolute;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.tba-chat-toggle .tba-icon-chat {
  opacity: 1;
  transform: scale(1);
}

.tba-chat-toggle .tba-icon-close {
  opacity: 0;
  transform: scale(0.5);
}

/* When open, morph to X */
.tba-chatbot.is-open .tba-chat-toggle .tba-icon-chat {
  opacity: 0;
  transform: scale(0.5);
}

.tba-chatbot.is-open .tba-chat-toggle .tba-icon-close {
  opacity: 1;
  transform: scale(1);
}

/* ---------- Chat Window ---------- */
.tba-chat-window {
  position: absolute;
  bottom: 72px;
  right: 0;
  width: 380px;
  max-height: 520px;
  background: var(--white);
  border-radius: 16px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.tba-chatbot.is-open .tba-chat-window {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* ---------- Header ---------- */
.tba-chat-header {
  background: var(--green-deep);
  padding: 16px 20px;
  flex-shrink: 0;
}

.tba-chat-header-title {
  font-family: 'Playfair Display', serif;
  color: var(--white);
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 2px;
  line-height: 1.3;
}

.tba-chat-header-subtitle {
  font-family: 'DM Sans', sans-serif;
  color: rgba(255, 255, 255, 0.7);
  font-size: 11px;
  font-weight: 400;
  margin: 0;
  line-height: 1.4;
}

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

/* Scrollbar */
.tba-chat-messages::-webkit-scrollbar {
  width: 5px;
}

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

.tba-chat-messages::-webkit-scrollbar-thumb {
  background: var(--sand);
  border-radius: 3px;
}

/* ---------- Message Rows ---------- */
.tba-msg-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.tba-msg-row.bot {
  justify-content: flex-start;
}

.tba-msg-row.user {
  justify-content: flex-end;
}

/* Bot avatar */
.tba-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--green);
  color: var(--white);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Bubbles */
.tba-msg-bubble {
  max-width: 260px;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.5;
  border-radius: 14px;
  word-wrap: break-word;
}

.tba-msg-row.bot .tba-msg-bubble {
  background: var(--white);
  color: var(--charcoal);
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.tba-msg-row.user .tba-msg-bubble {
  background: var(--green);
  color: var(--white);
  border-bottom-right-radius: 4px;
}

.tba-msg-bubble a {
  color: var(--terracotta);
  text-decoration: underline;
  font-weight: 500;
}

.tba-msg-row.user .tba-msg-bubble a {
  color: var(--white);
  text-decoration: underline;
}

/* ---------- Typing Indicator ---------- */
.tba-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
}

.tba-typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--grey);
  animation: tba-bounce 1.2s infinite ease-in-out;
}

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

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

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

/* ---------- Quick Reply Buttons ---------- */
.tba-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 12px;
  background: var(--cream);
}

.tba-quick-reply {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 12px;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: 20px;
  border: 1.5px solid var(--green);
  background: var(--white);
  color: var(--green);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.tba-quick-reply:hover {
  background: var(--green);
  color: var(--white);
}

/* ---------- Email Capture ---------- */
.tba-email-capture {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 14px;
  background: var(--white);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  max-width: 280px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.tba-email-capture input {
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  padding: 8px 10px;
  border: 1.5px solid var(--sand);
  border-radius: 8px;
  outline: none;
  color: var(--black);
  background: var(--cream);
  transition: border-color 0.2s ease;
}

.tba-email-capture input:focus {
  border-color: var(--green);
}

.tba-email-capture input::placeholder {
  color: var(--grey);
}

.tba-email-capture button {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border: none;
  border-radius: 8px;
  background: var(--terracotta);
  color: var(--white);
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.tba-email-capture button:hover {
  opacity: 0.9;
}

/* ---------- Input Area ---------- */
.tba-chat-input-area {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-top: 1px solid #eee;
  background: var(--white);
  flex-shrink: 0;
}

.tba-chat-input {
  flex: 1;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  padding: 10px 12px;
  border: 1.5px solid var(--sand);
  border-radius: 24px;
  outline: none;
  color: var(--black);
  background: var(--cream);
  transition: border-color 0.2s ease;
}

.tba-chat-input:focus {
  border-color: var(--green);
}

.tba-chat-input::placeholder {
  color: var(--grey);
}

.tba-chat-send {
  width: 40px;
  height: 40px;
  margin-left: 8px;
  border: none;
  border-radius: 50%;
  background: var(--terracotta);
  color: var(--white);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.15s ease;
}

.tba-chat-send:hover {
  opacity: 0.9;
}

.tba-chat-send svg {
  width: 18px;
  height: 18px;
}

/* ---------- Mobile Responsive ---------- */
@media (max-width: 480px) {
  .tba-chatbot {
    bottom: 0;
    right: 0;
    left: 0;
  }

  .tba-chatbot.is-open {
    top: 0;
  }

  .tba-chat-toggle {
    position: fixed;
    bottom: 16px;
    right: 16px;
  }

  .tba-chatbot.is-open .tba-chat-toggle {
    bottom: auto;
    right: auto;
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    width: 36px;
    height: 36px;
    background: transparent;
    box-shadow: none;
  }

  .tba-chat-window {
    position: fixed;
    bottom: 0;
    right: 0;
    left: 0;
    top: 0;
    width: 100%;
    max-height: 100%;
    border-radius: 0;
    transform: translateY(100%);
  }

  .tba-chatbot.is-open .tba-chat-window {
    transform: translateY(0);
  }
}
