/* ── TriggerMind chatbot widget styles ──────────────────────────────────────── */
/* Uses the site's design tokens from theme.css */

#tm-chatbot {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  font-family: 'DM Sans', sans-serif;
}

/* Toggle button */
#tm-toggle {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #00e5a0;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0a0a0f;
  box-shadow: 0 4px 24px rgba(0, 229, 160, 0.4);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#tm-toggle:hover {
  transform: scale(1.07);
  box-shadow: 0 6px 32px rgba(0, 229, 160, 0.5);
}

#tm-toggle.tm-active {
  background: #12121a;
  color: #00e5a0;
  border: 1.5px solid rgba(0, 229, 160, 0.3);
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.tm-unread {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 12px;
  height: 12px;
  background: #ff4d6d;
  border-radius: 50%;
  border: 2px solid #0a0a0f;
  animation: tm-pulse 2s infinite;
}

@keyframes tm-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,77,109,0.4); }
  50%       { box-shadow: 0 0 0 6px rgba(255,77,109,0); }
}

/* Chat panel */
#tm-panel {
  position: absolute;
  bottom: 76px;
  right: 0;
  width: 360px;
  height: 520px;
  background: #12121a;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  opacity: 0;
  transform: translateY(12px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

#tm-panel.tm-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* Header */
#tm-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  background: linear-gradient(135deg, rgba(0,229,160,0.12) 0%, rgba(0,229,160,0.03) 100%);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  transition: background 0.4s ease;
}

#tm-panel-header.tm-lead-captured {
  background: linear-gradient(135deg, rgba(0,229,160,0.2) 0%, rgba(0,229,160,0.06) 100%);
}

.tm-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tm-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #00e5a0;
  color: #0a0a0f;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tm-header-name {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  color: #e8e8ec;
}

.tm-header-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: #8b8b9e;
  margin-top: 2px;
}

.tm-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #00e5a0;
  display: inline-block;
}

#tm-close {
  background: none;
  border: none;
  cursor: pointer;
  color: #8b8b9e;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease, background 0.15s ease;
}

#tm-close:hover {
  color: #e8e8ec;
  background: rgba(255,255,255,0.06);
}

/* Messages area */
#tm-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

#tm-messages::-webkit-scrollbar {
  width: 4px;
}
#tm-messages::-webkit-scrollbar-track {
  background: transparent;
}
#tm-messages::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
}

/* Messages */
.tm-msg {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.9rem;
  line-height: 1.55;
  word-wrap: break-word;
  animation: tm-slide-in 0.18s ease;
}

@keyframes tm-slide-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.tm-msg-assistant {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.07);
  color: #e8e8ec;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.tm-msg-user {
  background: rgba(0,229,160,0.12);
  border: 1px solid rgba(0,229,160,0.2);
  color: #e8e8ec;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

/* Typing indicator */
.tm-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 12px 16px;
}

.tm-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #8b8b9e;
  animation: tm-bounce 1.2s ease infinite;
}
.tm-typing span:nth-child(2) { animation-delay: 0.18s; }
.tm-typing span:nth-child(3) { animation-delay: 0.36s; }

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

/* Input area */
#tm-input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.02);
}

#tm-input {
  flex: 1;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 10px 14px;
  color: #e8e8ec;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.15s ease;
}

#tm-input::placeholder {
  color: #8b8b9e;
}

#tm-input:focus {
  border-color: rgba(0,229,160,0.35);
}

#tm-send {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: #00e5a0;
  border: none;
  cursor: pointer;
  color: #0a0a0f;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s ease, transform 0.15s ease;
}

#tm-send:hover {
  background: #00cfbf;
  transform: scale(1.05);
}

#tm-send:active {
  transform: scale(0.96);
}

/* Mobile */
@media (max-width: 480px) {
  #tm-chatbot {
    bottom: 16px;
    right: 16px;
  }

  #tm-panel {
    width: calc(100vw - 32px);
    right: 0;
    height: 460px;
    bottom: 72px;
  }
}
