/* ==========================================================================
   GrowLoyal Smart Chatbot — Ultra-Realistic Chat Styling
   Style: Luxury Dark Glassmorphism, True Chat Bubbles & Streaming Animations
   ========================================================================== */

:root {
  --bot-primary: #0a0a0a;
  --bot-surface: rgba(18, 18, 20, 0.96);
  --bot-surface-bubble: #1c1c20;
  --bot-user-bubble: linear-gradient(135deg, #d4af37 0%, #b89326 100%);
  --bot-border: rgba(212, 175, 55, 0.28);
  --bot-border-subtle: rgba(255, 255, 255, 0.08);
  --bot-gold: #d4af37;
  --bot-gold-light: #f5e7b2;
  --bot-gold-glow: rgba(212, 175, 55, 0.3);
  --bot-text-main: #f4f4f5;
  --bot-text-muted: #8e8e93;
  --bot-success: #10b981;
  --bot-whatsapp: #25d366;
  --bot-radius-lg: 22px;
  --bot-radius-md: 14px;
  --bot-radius-sm: 8px;
  --bot-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 25px rgba(212, 175, 55, 0.15);
}

/* --------------------------------------------------------------------------
   1. Floating Launcher & Bubble Tooltip
   -------------------------------------------------------------------------- */
.gl-bot-launcher-wrap {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Poppins', sans-serif;
}

.gl-bot-preview-bubble {
  background: var(--bot-surface);
  border: 1px solid var(--bot-border);
  color: #fff;
  padding: 12px 16px;
  border-radius: var(--bot-radius-md);
  border-bottom-right-radius: 4px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
  margin-bottom: 12px;
  max-width: 280px;
  font-size: 13px;
  line-height: 1.45;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  animation: glSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  transition: all 0.25s ease;
}

.gl-bot-preview-bubble:hover {
  transform: translateY(-2px);
  border-color: var(--bot-gold);
}

.gl-bot-preview-bubble .gl-preview-close {
  color: var(--bot-text-muted);
  font-size: 16px;
  line-height: 1;
  padding: 2px 4px;
}

.gl-bot-preview-bubble .gl-preview-close:hover {
  color: #fff;
}

/* Floating Action Button */
.gl-bot-btn {
  position: relative;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: linear-gradient(135deg, #18181b 0%, #0a0a0a 100%);
  border: 1.8px solid var(--bot-gold);
  color: var(--bot-gold);
  box-shadow: var(--bot-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
  outline: none;
}

.gl-bot-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.6), 0 0 28px rgba(212, 175, 55, 0.4);
}

.gl-bot-btn:active {
  transform: scale(0.95);
}

.gl-bot-btn .gl-icon-close { display: none; }
.gl-bot-launcher-wrap.is-open .gl-icon-chat { display: none; }
.gl-bot-launcher-wrap.is-open .gl-icon-close { display: block; }

.gl-bot-pulse {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 12px;
  height: 12px;
  background: var(--bot-success);
  border: 2px solid #111;
  border-radius: 50%;
}

.gl-bot-pulse::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid var(--bot-success);
  animation: glPulse 2s infinite;
}

/* --------------------------------------------------------------------------
   2. Main Chat Window
   -------------------------------------------------------------------------- */
.gl-bot-window {
  position: fixed;
  bottom: 98px;
  right: 24px;
  width: 390px;
  max-width: calc(100vw - 32px);
  height: 600px;
  max-height: calc(100vh - 120px);
  background: var(--bot-surface);
  border: 1px solid var(--bot-border);
  border-radius: var(--bot-radius-lg);
  box-shadow: var(--bot-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 99998;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  opacity: 0;
  pointer-events: none;
  transform: translateY(24px) scale(0.95);
  transform-origin: bottom right;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Poppins', sans-serif;
}

.gl-bot-window.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* --------------------------------------------------------------------------
   3. Chat Header
   -------------------------------------------------------------------------- */
.gl-bot-header {
  background: rgba(14, 14, 16, 0.95);
  padding: 14px 18px;
  border-bottom: 1px solid var(--bot-border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Pinned In-Chat Announcement Banner */
.gl-bot-announcement-banner {
  background: rgba(212, 175, 55, 0.12);
  border-bottom: 1px solid rgba(212, 175, 55, 0.25);
  color: #fff;
  font-size: 11.5px;
  font-weight: 500;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.35;
  animation: glSlideUp 0.3s ease;
}

.gl-bot-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.gl-bot-avatar {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #222, #0a0a0a);
  border: 1.5px solid var(--bot-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.25);
  flex-shrink: 0;
}

.gl-bot-avatar .gl-avatar-status {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 11px;
  height: 11px;
  background: var(--bot-success);
  border: 2px solid #141416;
  border-radius: 50%;
}

.gl-bot-info h3 {
  color: #fff;
  font-size: 14.5px;
  font-weight: 600;
  margin: 0;
  line-height: 1.2;
}

.gl-bot-info p {
  color: var(--bot-gold);
  font-size: 11.5px;
  margin: 2px 0 0;
  display: flex;
  align-items: center;
  gap: 5px;
}

.gl-bot-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.gl-bot-action-btn {
  background: transparent;
  border: none;
  color: var(--bot-text-muted);
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.gl-bot-action-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

/* --------------------------------------------------------------------------
   4. Chat Messages Flow
   -------------------------------------------------------------------------- */
.gl-bot-messages {
  flex: 1;
  padding: 18px 16px;
  overflow-y: auto;
  scroll-behavior: smooth;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.gl-bot-messages::-webkit-scrollbar { width: 5px; }
.gl-bot-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

/* Chat Message Row with Avatar */
.gl-msg-row {
  display: flex;
  gap: 9px;
  max-width: 88%;
  animation: glSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.gl-msg-row-bot {
  align-self: flex-start;
}

.gl-msg-row-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.gl-msg-bot-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #111;
  border: 1px solid var(--bot-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
  margin-top: 2px;
}

.gl-msg-body {
  display: flex;
  flex-direction: column;
}

/* Speech Bubbles */
.gl-msg-bubble {
  padding: 11px 15px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.5;
  word-break: break-word;
  position: relative;
}

/* Bot Speech Bubble */
.gl-msg-row-bot .gl-msg-bubble {
  background: var(--bot-surface-bubble);
  color: var(--bot-text-main);
  border: 1px solid var(--bot-border-subtle);
  border-top-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* User Speech Bubble */
.gl-msg-row-user .gl-msg-bubble {
  background: var(--bot-user-bubble);
  color: #000;
  font-weight: 500;
  border-top-right-radius: 4px;
  box-shadow: 0 4px 14px rgba(212, 175, 55, 0.25);
}

/* Message Meta & Delivery Ticks */
.gl-msg-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: var(--bot-text-muted);
  margin-top: 4px;
  padding: 0 4px;
}

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

.gl-tick {
  color: #38bdf8;
  font-weight: bold;
  letter-spacing: -2px;
}

/* Typewriter Cursor Effect */
.gl-cursor {
  display: inline-block;
  width: 2px;
  height: 14px;
  background: var(--bot-gold);
  margin-left: 2px;
  vertical-align: middle;
  animation: glBlink 0.7s infinite;
}

/* Natural Typing Indicator (Bouncing Dots) */
.gl-typing-bubble {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 10px 14px;
  background: var(--bot-surface-bubble);
  border: 1px solid var(--bot-border-subtle);
  border-radius: 16px;
  border-top-left-radius: 4px;
  width: fit-content;
  animation: glSlideUp 0.2s ease;
}

.gl-typing-dot {
  width: 6px;
  height: 6px;
  background: var(--bot-gold);
  border-radius: 50%;
  animation: glBounce 1.4s infinite both;
}

.gl-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.gl-typing-dot:nth-child(3) { animation-delay: 0.4s; }

/* --------------------------------------------------------------------------
   5. Interactive Action Chips (Floating Pill Buttons)
   -------------------------------------------------------------------------- */
.gl-chips-flow {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
  padding-left: 37px; /* Aligns with bot message text */
  animation: glSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.gl-chip-pill {
  background: rgba(35, 35, 40, 0.85);
  border: 1px solid var(--bot-border);
  color: var(--bot-gold-light);
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.gl-chip-pill:hover {
  background: var(--bot-gold);
  color: #000;
  font-weight: 600;
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(212, 175, 55, 0.35);
}

.gl-chip-pill:active {
  transform: scale(0.96);
}

/* --------------------------------------------------------------------------
   6. Product Cards (In-Chat Cart Action)
   -------------------------------------------------------------------------- */
.gl-cards-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
  width: 100%;
}

.gl-product-row {
  display: flex;
  gap: 12px;
  background: rgba(12, 12, 14, 0.9);
  border: 1px solid var(--bot-border-subtle);
  border-radius: var(--bot-radius-md);
  padding: 10px;
  transition: all 0.25s ease;
}

.gl-product-row:hover {
  border-color: var(--bot-border);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.35);
}

.gl-prod-thumb {
  width: 58px;
  height: 58px;
  border-radius: var(--bot-radius-sm);
  object-fit: cover;
  background: #111;
  flex-shrink: 0;
}

.gl-prod-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.gl-prod-name {
  font-size: 12.5px;
  font-weight: 600;
  color: #fff;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-decoration: none;
}

.gl-prod-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
}

.gl-prod-price {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--bot-gold);
}

.gl-btn-cart-tap {
  background: linear-gradient(135deg, #d4af37, #b89326);
  color: #0a0a0a;
  border: none;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 4px;
}

.gl-btn-cart-tap:hover {
  filter: brightness(1.15);
  transform: scale(1.04);
}

.gl-btn-cart-tap.added {
  background: var(--bot-success);
  color: #fff;
}

/* --------------------------------------------------------------------------
   7. Order Tracker & Calculator Cards
   -------------------------------------------------------------------------- */
.gl-tracker-card {
  background: rgba(12, 12, 14, 0.9);
  border: 1px solid var(--bot-border);
  border-radius: var(--bot-radius-md);
  padding: 14px;
  width: 100%;
  margin-top: 6px;
}

.gl-tracker-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--bot-border-subtle);
}

.gl-tracker-status {
  background: rgba(16, 185, 129, 0.15);
  color: var(--bot-success);
  border: 1px solid rgba(16, 185, 129, 0.3);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 12px;
}

.gl-steps-row {
  display: flex;
  justify-content: space-between;
  margin: 14px 0 10px;
}

.gl-step-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 10px;
  color: var(--bot-text-muted);
  gap: 4px;
}

.gl-node-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #27272a;
  border: 2px solid #3f3f46;
}

.gl-step-node.done .gl-node-dot {
  background: var(--bot-success);
  border-color: var(--bot-success);
}

.gl-step-node.done { color: #fff; font-weight: 600; }

.gl-whatsapp-card {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--bot-whatsapp);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--bot-radius-md);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  margin-top: 8px;
  width: 100%;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.25);
}

.gl-whatsapp-card:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

/* --------------------------------------------------------------------------
   7.5. VIP Lead Capture Card
   -------------------------------------------------------------------------- */
.gl-lead-card {
  background: #141416;
  border: 1px solid var(--bot-border);
  border-radius: var(--bot-radius-md);
  padding: 14px;
  margin-top: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}
.gl-lead-title {
  color: var(--bot-gold);
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.gl-lead-desc {
  font-size: 11px;
  color: var(--bot-text-muted);
  line-height: 1.4;
  margin-bottom: 10px;
}
.gl-lead-field {
  width: 100%;
  background: #1c1c20;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 8px 12px;
  color: #fff;
  font-size: 12px;
  margin-bottom: 8px;
  outline: none;
  box-sizing: border-box;
  font-family: inherit;
  transition: border-color 0.2s;
}
.gl-lead-field:focus {
  border-color: var(--bot-gold);
}
.gl-lead-submit {
  width: 100%;
  background: var(--bot-gold);
  color: #000;
  border: none;
  border-radius: 8px;
  padding: 9px;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.gl-lead-submit:hover {
  filter: brightness(1.12);
  transform: translateY(-1px);
}

/* --------------------------------------------------------------------------
   8. Chat Input Bar
   -------------------------------------------------------------------------- */
.gl-bot-footer {
  padding: 12px 14px 10px;
  background: rgba(14, 14, 16, 0.98);
  border-top: 1px solid var(--bot-border-subtle);
}

.gl-bot-input-box {
  display: flex;
  align-items: center;
  background: #18181b;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 30px;
  padding: 4px 6px 4px 15px;
  transition: all 0.25s ease;
}

.gl-bot-input-box:focus-within {
  border-color: var(--bot-gold);
  box-shadow: 0 0 14px rgba(212, 175, 55, 0.25);
  background: #141416;
}

.gl-bot-input {
  flex: 1;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 13.5px;
  outline: none;
  padding: 7px 0;
}

.gl-bot-input::placeholder { color: var(--bot-text-muted); }

.gl-bot-send {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bot-gold);
  color: #000;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.gl-bot-send:hover {
  transform: scale(1.08);
  filter: brightness(1.1);
}

.gl-bot-branding {
  text-align: center;
  font-size: 10.5px;
  color: var(--bot-text-muted);
  margin-top: 6px;
}

/* --------------------------------------------------------------------------
   9. Animations
   -------------------------------------------------------------------------- */
@keyframes glSlideUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes glPulse {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(2.2); opacity: 0; }
}

@keyframes glBounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1.1); opacity: 1; }
}

@keyframes glBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* --------------------------------------------------------------------------
   10. Mobile Responsiveness
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
  .gl-bot-launcher-wrap { bottom: 16px; right: 16px; }
  .gl-bot-window {
    right: 0; bottom: 0;
    width: 100vw; height: 100vh;
    max-height: 100vh; max-width: 100vw;
    border-radius: 0; border: none;
  }
}
