/* ============================================================
   Miller-Boldt, Inc. — AI Chatbot Styles
   ============================================================ */

/* ---------- Floating Bubble ---------- */
.chatbot-bubble {
  position: fixed;
  bottom: 32px;
  right: 32px;
  z-index: 9999;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--blue);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(14, 61, 107, 0.35);
  transition: var(--transition);
  overflow: visible;
}

.chatbot-bubble:hover {
  background: var(--blue-dark);
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(14, 61, 107, 0.45);
}

.chatbot-bubble.open {
  transform: scale(0);
  opacity: 0;
  pointer-events: none;
}

.chatbot-bubble svg.chatbot-icon {
  width: 28px;
  height: 28px;
  color: var(--white);
  stroke: currentColor;
  fill: none;
}

/* ---------- Pulse Ring — Orange for visibility ---------- */
.chatbot-bubble::before {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2.5px solid var(--orange);
  opacity: 0;
  animation: chatbotPulse 2.5s ease-out infinite;
}

.chatbot-bubble::after {
  content: '';
  position: absolute;
  inset: -14px;
  border-radius: 50%;
  border: 2px solid var(--orange-light);
  opacity: 0;
  animation: chatbotPulse 2.5s 0.7s ease-out infinite;
}

.chatbot-bubble.open::before,
.chatbot-bubble.open::after {
  animation: none;
  opacity: 0;
}

@keyframes chatbotPulse {
  0% {
    opacity: 0.7;
    transform: scale(0.95);
  }
  100% {
    opacity: 0;
    transform: scale(1.5);
  }
}

/* ---------- Number Badge ---------- */
.chatbot-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 22px;
  height: 22px;
  background: var(--orange);
  color: var(--white);
  border-radius: 11px;
  border: 2px solid var(--white);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  animation: badgeBounce 1.8s ease-in-out infinite;
  z-index: 2;
}

@keyframes badgeBounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* ---------- Tooltip / Prompt ---------- */
.chatbot-tooltip {
  position: absolute;
  right: 78px;
  bottom: 12px;
  background: var(--white);
  color: var(--text-dark);
  padding: 14px 20px;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.5;
  width: 240px;
  max-width: 260px;
  white-space: normal;
  opacity: 0;
  transform: translateX(8px);
  animation: tooltipAppear 0.5s 3s ease-out forwards;
  pointer-events: none;
  border: 1px solid var(--warm-100);
}

.chatbot-tooltip::after {
  content: '';
  position: absolute;
  right: -8px;
  top: 50%;
  transform: translateY(-50%);
  border: 8px solid transparent;
  border-right: none;
  border-left: 8px solid var(--white);
  filter: drop-shadow(2px 0 1px rgba(14, 61, 107, 0.06));
}

@keyframes tooltipAppear {
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.chatbot-tooltip-close {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 20px;
  height: 20px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--warm-400);
  font-size: 1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  border-radius: 50%;
  transition: var(--transition);
}

.chatbot-tooltip-close:hover {
  background: var(--warm-100);
  color: var(--text-dark);
}

.chatbot-tooltip.hidden {
  display: none;
}

/* ===================== CHAT PANEL ===================== */
.chatbot-panel {
  position: fixed;
  bottom: 32px;
  right: 32px;
  z-index: 10000;
  width: 380px;
  max-height: 540px;
  background: var(--white);
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(14, 61, 107, 0.22), 0 0 0 1px rgba(14, 61, 107, 0.06);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.4) translateY(40px);
  transform-origin: bottom right;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
              opacity 0.25s ease-out;
}

.chatbot-panel.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* ---------- Panel Header ---------- */
.chatbot-header {
  background: linear-gradient(135deg, var(--blue-deep) 0%, var(--blue-dark) 100%);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.chatbot-header-logo {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chatbot-logo-img {
  width: 44px;
  height: auto;
  display: block;
  filter: brightness(1.6) contrast(0.95);
}

.chatbot-header-info {
  flex: 1;
}

.chatbot-header-title {
  font-family: 'Playfair Display', serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--white);
  line-height: 1.2;
}

.chatbot-header-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.65);
  margin-top: 2px;
}

.chatbot-header-status::before {
  content: '';
  width: 7px;
  height: 7px;
  background: #4ADE80;
  border-radius: 50%;
  flex-shrink: 0;
}

.chatbot-minimize {
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
}

.chatbot-minimize:hover {
  background: rgba(255, 255, 255, 0.2);
}

.chatbot-minimize svg {
  width: 18px;
  height: 18px;
  color: var(--white);
  stroke: currentColor;
  fill: none;
}

/* ---------- Messages Area ---------- */
.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--sand);
  min-height: 260px;
}

.chatbot-msg {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  animation: msgFadeIn 0.4s ease-out both;
}

.chatbot-msg:nth-child(2) { animation-delay: 0.6s; }
.chatbot-msg:nth-child(3) { animation-delay: 1.8s; }

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

.chatbot-msg-avatar {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.chatbot-msg-avatar img {
  width: 32px;
  height: auto;
  display: block;
}

.chatbot-msg-bubble {
  background: var(--white);
  border: 1px solid var(--warm-100);
  border-radius: 12px;
  border-top-left-radius: 4px;
  padding: 12px 16px;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-body);
  max-width: 280px;
  box-shadow: var(--shadow-sm);
}

.chatbot-msg-bubble strong {
  color: var(--blue-deep);
}

.chatbot-msg-time {
  font-size: 0.68rem;
  color: var(--warm-400);
  margin-top: 4px;
  padding-left: 42px;
}

/* Typing indicator */
.chatbot-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 0 0 42px;
  animation: msgFadeIn 0.3s ease-out both;
}

.chatbot-typing-dot {
  width: 7px;
  height: 7px;
  background: var(--warm-200);
  border-radius: 50%;
  animation: typingBounce 1.2s ease-in-out infinite;
}

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

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

/* ---------- Quick Action Buttons ---------- */
.chatbot-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 20px 16px;
  background: var(--sand);
}

.chatbot-action-btn {
  background: var(--white);
  border: 1px solid var(--warm-100);
  border-radius: 20px;
  padding: 8px 16px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--blue-dark);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.chatbot-action-btn:hover {
  background: var(--blue-ice);
  border-color: var(--blue-pale);
  color: var(--blue-deep);
}

/* ---------- Input Area ---------- */
.chatbot-input-area {
  padding: 14px 16px;
  border-top: 1px solid var(--warm-100);
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--white);
  flex-shrink: 0;
}

.chatbot-input {
  flex: 1;
  border: 1px solid var(--warm-100);
  border-radius: 24px;
  padding: 10px 16px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.88rem;
  color: var(--text-dark);
  background: var(--sand);
  outline: none;
  transition: var(--transition);
}

.chatbot-input::placeholder {
  color: var(--warm-400);
}

.chatbot-input:focus {
  border-color: var(--blue-pale);
  box-shadow: 0 0 0 3px rgba(59, 140, 203, 0.1);
}

.chatbot-send {
  width: 38px;
  height: 38px;
  background: var(--blue);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
}

.chatbot-send:hover {
  background: var(--blue-dark);
  transform: scale(1.05);
}

.chatbot-send svg {
  width: 18px;
  height: 18px;
  color: var(--white);
  stroke: currentColor;
  fill: none;
}

/* ---------- Powered-by Footer ---------- */
.chatbot-powered {
  text-align: center;
  padding: 8px;
  font-size: 0.65rem;
  color: var(--warm-400);
  background: var(--white);
  border-top: 1px solid var(--warm-100);
}
