/*
 * BODHI GURU CHATBOT STYLES
 * RoasBodhi.in — Left-Aligned, Ultra-Compact Chatbot
 */

/* ============================================================
   WIDGET WRAPPER & TRIGGER BUTTON
   ============================================================ */
#bodhi-guru-widget {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 1000;
  font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  box-sizing: border-box;
}

#bodhi-guru-widget * {
  box-sizing: border-box;
}

#bg-trigger-btn {
  position: relative;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, #FF6B2B 0%, #F5A623 100%);
  box-shadow: 0 4px 14px rgba(255, 107, 43, 0.35);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

#bg-trigger-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 18px rgba(255, 107, 43, 0.45);
}

#bg-trigger-btn:focus-visible {
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.6), 0 4px 14px rgba(255, 107, 43, 0.35);
}

/* Pulse Ring Animation */
.bg-pulse-ring {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid #FF6B2B;
  animation: bg-pulse 2s cubic-bezier(0.24, 0, 0.38, 1) infinite;
  opacity: 0;
  pointer-events: none;
}

@keyframes bg-pulse {
  0% {
    transform: scale(1);
    opacity: 0.6;
  }
  100% {
    transform: scale(1.4);
    opacity: 0;
  }
}

/* Bounce Animation for Attention */
.bg-bounce {
  animation: bg-bounce-anim 0.6s ease infinite alternate;
}

@keyframes bg-bounce-anim {
  0% { transform: translateY(0); }
  100% { transform: translateY(-5px); }
}

.bg-btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.4s ease;
}

.bg-chat-open .bg-btn-icon {
  transform: rotate(180deg);
}

/* Notification Dot */
.bg-notification-dot {
  position: absolute;
  top: 0px;
  right: 0px;
  width: 11px;
  height: 11px;
  background-color: #EF4444;
  border: 2px solid #FFFFFF;
  border-radius: 50%;
  display: none;
  z-index: 2;
}

/* Tooltip (aligned rightwards since widget is on the left) */
.bg-tooltip {
  position: absolute;
  left: 62px;
  background-color: #1E1B4B;
  color: #FFFFFF;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
  opacity: 0;
  visibility: hidden;
  transform: translateX(-10px);
  transition: all 0.3s ease;
  z-index: 10;
}

.bg-tooltip::after {
  content: '';
  position: absolute;
  top: 50%;
  left: -4px;
  margin-top: -4px;
  border-width: 4px 4px 4px 0;
  border-style: solid;
  border-color: transparent #1E1B4B transparent transparent;
}

#bg-trigger-btn:hover .bg-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
}

/* ============================================================
   MESSAGE PREVIEW BUBBLE (Namaste! notification next to icon)
   ============================================================ */
.bg-preview-bubble {
  position: absolute;
  bottom: 62px;
  left: 0;
  width: 210px;
  background-color: #FFFFFF;
  border-radius: 12px;
  padding: 8px 24px 8px 10px;
  box-shadow: 0 6px 18px rgba(30, 27, 75, 0.12);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-left: 3px solid #FF6B2B;
  cursor: pointer;
  z-index: 999;
  transition: all 0.2s ease;
}

.bg-preview-bubble:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(30, 27, 75, 0.15);
}

.bg-preview-text {
  font-size: 10px;
  font-weight: 700;
  color: #374151;
  line-height: 1.4;
  text-align: left;
}

.bg-preview-close {
  position: absolute;
  top: 2px;
  right: 6px;
  font-size: 12px;
  font-weight: bold;
  color: #94A3B8;
  cursor: pointer;
  line-height: 1;
}

.bg-preview-close:hover {
  color: #EF4444;
}

.bg-preview-bubble::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 18px;
  border-width: 5px 5px 0;
  border-style: solid;
  border-color: #FFFFFF transparent;
  display: block;
  width: 0;
}

/* ============================================================
   CHAT WINDOW (ULTRA-COMPACT SIZE: 280px width x 365px height)
   ============================================================ */
#bg-chat-window {
  position: absolute;
  bottom: 62px;
  left: 0;
  width: 280px;
  height: 365px;
  background-color: #FFFFFF;
  border-radius: 16px;
  box-shadow: 0 10px 24px rgba(30, 27, 75, 0.14);
  border: 1px solid rgba(226, 232, 240, 0.9);
  display: none; /* Initially hidden */
  flex-direction: column;
  overflow: hidden;
  z-index: 1000;
}

#bg-chat-window.bg-open {
  display: flex; /* Shown when open */
}

/* Transitions */
.bg-slide-in {
  animation: bg-slide-in-anim 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.bg-slide-out {
  animation: bg-slide-out-anim 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes bg-slide-in-anim {
  0% {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes bg-slide-out-anim {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
  }
}

/* ============================================================
   HEADER SECTION
   ============================================================ */
.bg-header {
  background-color: #1E1B4B;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.bg-header-avatar {
  width: 26px;
  height: 26px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bg-header-info {
  flex-grow: 1;
  text-align: left;
}

.bg-header-name {
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: -0.2px;
}

.bg-header-status {
  color: rgba(255, 255, 255, 0.75);
  font-size: 8px;
  display: flex;
  align-items: center;
  gap: 3px;
  font-weight: 500;
  margin-top: 1px;
}

.bg-online-dot {
  width: 5px;
  height: 5px;
  background-color: #10B981;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 4px #10B981;
}

.bg-header-actions {
  display: flex;
  gap: 3px;
}

.bg-header-actions button {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  padding: 3px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  outline: none;
}

.bg-header-actions button:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #FFFFFF;
}

/* ============================================================
   MESSAGE LOG AREA
   ============================================================ */
.bg-messages {
  flex-grow: 1;
  padding: 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background-color: #F8F9FC;
  scroll-behavior: smooth;
}

.bg-message {
  max-width: 90%;
  padding: 8px 12px;
  font-size: 11px;
  line-height: 1.45;
  font-weight: 500;
}

.bg-msg-bot {
  background-color: #FFFFFF;
  color: #374151;
  border-radius: 4px 14px 14px 14px;
  align-self: flex-start;
  box-shadow: 0 1px 2px rgba(30, 27, 75, 0.03);
  border: 1px solid rgba(226, 232, 240, 0.6);
  text-align: left;
}

.bg-msg-bot p {
  margin: 0;
}

.bg-msg-user {
  background: linear-gradient(135deg, #7C3AED 0%, #4F46E5 100%);
  color: #FFFFFF;
  border-radius: 14px 4px 14px 14px;
  align-self: flex-end;
  box-shadow: 0 2px 6px rgba(124, 58, 237, 0.12);
  text-align: right;
}

.bg-msg-user p {
  margin: 0;
}

/* Typing Indicator Animation */
.bg-typing {
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px 14px 14px 14px;
  width: 44px;
  height: 26px;
}

.bg-typing-dots {
  display: flex;
  align-items: center;
  gap: 3px;
}

.bg-dot {
  width: 4px;
  height: 4px;
  background-color: #9CA3AF;
  border-radius: 50%;
  animation: bg-bounce-dots 1.4s infinite ease-in-out both;
}

.bg-dot:nth-child(1) { animation-delay: -0.32s; }
.bg-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes bg-bounce-dots {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* ============================================================
   INTERACTIVE BUTTONS AREA
   ============================================================ */
.bg-buttons {
  padding: 8px 12px;
  background-color: #F8F9FC;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: flex-start;
  border-top: 1px solid rgba(226, 232, 240, 0.4);
}

.bg-opt-btn {
  background-color: #FFFFFF;
  color: #4F46E5;
  border: 1px solid rgba(79, 70, 229, 0.25);
  padding: 5px 10px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  outline: none;
}

.bg-opt-btn:hover {
  background-color: #4F46E5;
  color: #FFFFFF;
  border-color: #4F46E5;
}

/* ============================================================
   FORM INPUT AREA
   ============================================================ */
.bg-input-area {
  padding: 8px 12px;
  background-color: #FFFFFF;
  display: flex;
  gap: 5px;
  align-items: center;
  border-top: 1px solid rgba(226, 232, 240, 0.6);
}

.bg-input-field {
  flex-grow: 1;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 500;
  color: #374151;
  outline: none;
  background-color: #F8F9FC;
  transition: all 0.2s ease;
}

.bg-input-field:focus {
  border-color: #7C3AED;
  background-color: #FFFFFF;
}

.bg-send-btn {
  background: linear-gradient(135deg, #7C3AED 0%, #4F46E5 100%);
  border: none;
  color: #FFFFFF;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
}

.bg-send-btn:disabled {
  background: #F1F5F9;
  color: #94A3B8;
  cursor: not-allowed;
}

/* ============================================================
   FOOTER SIGNATURE
   ============================================================ */
.bg-footer {
  padding: 5px 0;
  background-color: #FFFFFF;
  color: #94A3B8;
  font-size: 8px;
  font-weight: 600;
  text-align: center;
  border-top: 1px solid rgba(226, 232, 240, 0.4);
}

/* ============================================================
   RESPONSIVE LAYOUT (MOBILE DESIGN: Left-aligned and compact)
   ============================================================ */
@media (max-width: 640px) {
  #bodhi-guru-widget {
    bottom: 16px;
    left: 16px;
    right: auto;
  }
  
  #bg-chat-window {
    position: fixed;
    bottom: 76px; /* Float above the trigger button on mobile */
    left: 16px;
    width: calc(100vw - 32px);
    max-width: 280px;
    height: 340px;
    border-radius: 16px;
    border: 1px solid rgba(226, 232, 240, 0.9);
    max-height: calc(100vh - 100px);
  }

  .bg-preview-bubble {
    bottom: 76px;
    left: 16px;
    width: calc(100vw - 32px);
    max-width: 210px;
  }

  .bg-slide-in {
    animation: bg-slide-in-anim 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  }

  .bg-slide-out {
    animation: bg-slide-out-anim 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  }
}
