/* 
 * Birbal Marketing - AI Chatbot & Lead Assistant Stylesheet
 * Luxury Gold & Obsidian Dark-Mode Theme with Vector SVG Icons
 */

:root {
  --chat-gold: #d4af37;
  --chat-gold-light: #f3e5ab;
  --chat-gold-dark: #b8860b;
  --chat-bg: rgba(12, 12, 20, 0.96);
  --chat-card: rgba(22, 22, 36, 0.88);
  --chat-border: rgba(212, 175, 55, 0.35);
  --chat-text: #ffffff;
  --chat-text-muted: #a8a8b8;
  --chat-wa-green: #25d366;
}

/* Body scroll lock when Chatbot is open */
body.birbal-chat-open,
html.birbal-chat-open {
  overflow: hidden !important;
  overscroll-behavior: none !important;
}

/* Floating Action Trigger Button */
.birbal-chat-trigger {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10010;
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, #d4af37, #996515, #1e1b18);
  color: #fff;
  border: 1px solid rgba(212, 175, 55, 0.5);
  padding: 12px 22px;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.7), 0 0 20px rgba(212, 175, 55, 0.35);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.3px;
  text-decoration: none;
  outline: none;

  /* Hidden by default on page load (same as WhatsApp button) */
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  pointer-events: none;
}

.birbal-chat-trigger.is-visible,
.page-packages .birbal-chat-trigger {
  opacity: 1 !important;
  visibility: visible !important;
  transform: translateY(0) !important;
  pointer-events: auto !important;
  display: flex !important;
}

.birbal-chat-trigger.is-visible:hover,
.page-packages .birbal-chat-trigger:hover {
  transform: translateY(-4px) scale(1.04);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.8), 0 0 30px rgba(212, 175, 55, 0.55);
  border-color: #f3e5ab;
}

.birbal-chat-trigger__icon {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #f3e5ab;
  animation: floatSpark 3s ease-in-out infinite;
}

.birbal-chat-trigger__icon svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
}

@keyframes floatSpark {
  0%, 100% { transform: translateY(0px) scale(1); }
  50% { transform: translateY(-2px) scale(1.1); }
}

/* Online status pulsing dot */
.birbal-chat-trigger__status {
  width: 9px;
  height: 9px;
  background: #00ff66;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 8px #00ff66;
  animation: pulseGreen 2s infinite;
}

@keyframes pulseGreen {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.35); opacity: 0.6; }
  100% { transform: scale(1); opacity: 1; }
}

/* Notification badge */
.birbal-chat-trigger__badge {
  background: #ff3366;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  position: absolute;
  top: -8px;
  right: -6px;
  box-shadow: 0 2px 8px rgba(255, 51, 102, 0.6);
  border: 2px solid #0c0c14;
}

/* Chat Modal Panel */
.birbal-chat-modal {
  position: fixed;
  bottom: 92px;
  right: 24px;
  width: 380px;
  height: 560px;
  max-height: calc(100vh - 120px);
  z-index: 10011;
  background: var(--chat-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--chat-border);
  border-radius: 22px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.85), 0 0 40px rgba(212, 175, 55, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px) scale(0.95);
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: 'Poppins', sans-serif;
}

.birbal-chat-modal.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* Modal Header */
.birbal-chat-header {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.18), rgba(20, 20, 32, 0.85));
  border-bottom: 1px solid rgba(212, 175, 55, 0.3);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.birbal-chat-header__info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.birbal-chat-header__avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #000;
  border: 2px solid var(--chat-gold);
  padding: 3px;
  object-fit: contain;
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.45);
}

.birbal-chat-header__title-group {
  display: flex;
  flex-direction: column;
}

.birbal-chat-header__name {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--chat-text);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.birbal-chat-header__badge-svg {
  width: 16px;
  height: 16px;
  color: var(--chat-gold);
  flex-shrink: 0;
}

.birbal-chat-header__subtitle {
  font-size: 0.74rem;
  color: #00ff66;
  font-weight: 500;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 5px;
}

.status-dot--online {
  width: 7px;
  height: 7px;
  background: #00ff66;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 6px #00ff66;
}

.birbal-chat-header__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.birbal-chat-header__btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--chat-text);
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.birbal-chat-header__btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
}

.birbal-chat-header__btn:hover {
  background: rgba(212, 175, 55, 0.25);
  border-color: var(--chat-gold);
  color: var(--chat-gold);
  transform: scale(1.05);
}

/* Chat Messages Area */
.birbal-chat-messages {
  flex: 1;
  padding: 18px 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}

.birbal-chat-messages::-webkit-scrollbar {
  width: 5px;
}

.birbal-chat-messages::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}

.birbal-chat-messages::-webkit-scrollbar-thumb {
  background: rgba(212, 175, 55, 0.4);
  border-radius: 10px;
}

/* Chat Message Bubble */
.chat-msg {
  max-width: 84%;
  padding: 12px 16px;
  font-size: 0.88rem;
  line-height: 1.5;
  word-break: break-word;
  animation: msgPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.chat-msg--bot {
  align-self: flex-start;
  background: var(--chat-card);
  color: #fff;
  border-left: 3px solid var(--chat-gold);
  border-radius: 4px 16px 16px 16px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
}

.chat-msg--user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--chat-gold), #b8860b);
  color: #0c0c14;
  font-weight: 600;
  border-radius: 16px 4px 16px 16px;
  box-shadow: 0 4px 16px rgba(212, 175, 55, 0.4);
}

/* Typing Indicator Dots */
.chat-msg--typing {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.05);
  padding: 10px 16px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.chat-typing-dot {
  width: 7px;
  height: 7px;
  background: var(--chat-gold);
  border-radius: 50%;
  animation: typingBounce 1.4s infinite ease-in-out both;
}

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

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

/* Interactive Quick-Reply Chips */
.chat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
  animation: msgPop 0.3s ease;
}

.chat-chip {
  background: rgba(212, 175, 55, 0.12);
  border: 1px solid rgba(212, 175, 55, 0.45);
  color: var(--chat-gold-light);
  padding: 9px 15px;
  border-radius: 50px;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s ease;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chat-chip svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  flex-shrink: 0;
}

.chat-chip:hover {
  background: var(--chat-gold);
  color: #0c0c14;
  border-color: var(--chat-gold);
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(212, 175, 55, 0.45);
}

/* WhatsApp Action Button inside Bot Message */
.chat-wa-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--chat-wa-green);
  color: #fff !important;
  font-weight: 700;
  font-size: 0.92rem;
  padding: 12px 20px;
  border-radius: 12px;
  text-decoration: none;
  margin-top: 14px;
  width: 100%;
  box-shadow: 0 6px 20px rgba(37, 211, 102, 0.4);
  transition: all 0.25s ease;
}

.chat-wa-cta svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.chat-wa-cta:hover {
  background: #1eb858;
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(37, 211, 102, 0.6);
}

/* Chat Footer Input Area */
.birbal-chat-footer {
  background: rgba(0, 0, 0, 0.5);
  border-top: 1px solid var(--chat-border);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-input-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 2px 8px;
  transition: border-color 0.2s ease;
  min-width: 0;
  overflow: hidden;
}

.chat-input-wrapper:focus-within {
  border-color: var(--chat-gold);
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.25);
}

.chat-country-select {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 6px 6px 2px;
  border-right: 1px solid rgba(255, 255, 255, 0.15);
  outline: none;
  cursor: pointer;
  max-width: 90px;
  flex-shrink: 0;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

.chat-country-select option {
  background: #0c0c14;
  color: #fff;
  font-size: 0.82rem;
}

.chat-input {
  flex: 1;
  min-width: 0;
  width: 100%;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 0.88rem;
  padding: 10px 8px;
  outline: none;
  font-family: inherit;
  text-overflow: ellipsis;
}

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

.chat-send-btn {
  background: linear-gradient(135deg, var(--chat-gold), #b8860b);
  border: none;
  color: #0c0c14;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.25s ease;
}

.chat-send-btn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2.2;
}

.chat-send-btn:hover:not(:disabled) {
  transform: scale(1.06);
  box-shadow: 0 0 16px rgba(212, 175, 55, 0.6);
}

.chat-send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Mobile responsiveness (Phones & Small Tablets) */
@media screen and (max-width: 768px) {
  .chat-input,
  .chat-country-select,
  #birbalChatInput,
  #chatCountrySelect {
    font-size: 16px !important; /* Prevents iOS Safari zoom bug on input focus */
    touch-action: manipulation !important;
  }

  .birbal-chat-modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    height: -webkit-fill-available !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-height: 100% !important;
    max-height: -webkit-fill-available !important;
    max-height: 100vh !important;
    max-height: 100dvh !important;
    border-radius: 0 !important;
    border: none !important;
    z-index: 100050 !important;
    margin: 0 !important;
    transform: translateY(100%);
    box-shadow: none !important;
    display: flex !important;
    flex-direction: column !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease !important;
  }

  .birbal-chat-modal.is-open {
    transform: translateY(0) !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  /* Hide floating trigger when modal is open on mobile */
  .birbal-chat-modal.is-open ~ .birbal-chat-trigger,
  body.birbal-chat-open .birbal-chat-trigger {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }

  .birbal-chat-header {
    padding: 10px 14px !important;
    flex-shrink: 0 !important;
    box-sizing: border-box !important;
    min-height: 52px !important;
  }

  .birbal-chat-header__avatar {
    width: 34px !important;
    height: 34px !important;
  }

  .birbal-chat-header__name {
    font-size: 0.88rem !important;
  }

  .birbal-chat-header__subtitle {
    font-size: 0.70rem !important;
  }

  .birbal-chat-header__btn {
    width: 34px !important;
    height: 34px !important;
  }

  .birbal-chat-messages {
    flex: 1 1 auto !important;
    height: 100% !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior: contain !important;
    padding: 10px 12px !important;
    gap: 10px !important;
    box-sizing: border-box !important;
  }

  .birbal-chat-footer {
    flex: 0 0 auto !important;
    padding: 8px 10px !important;
    padding-bottom: max(8px, env(safe-area-inset-bottom)) !important;
    background: rgba(12, 12, 20, 0.98) !important;
    border-top: 1px solid var(--chat-border) !important;
    position: relative !important;
    z-index: 10 !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .chat-msg {
    max-width: 88% !important;
    padding: 9px 13px !important;
    font-size: 0.84rem !important;
    line-height: 1.4 !important;
    border-radius: 12px !important;
  }

  .chat-chip {
    padding: 7px 12px !important;
    font-size: 0.78rem !important;
  }

  .chat-input-wrapper {
    padding: 1px 6px !important;
    border-radius: 10px !important;
  }

  .chat-input {
    padding: 8px 6px !important;
  }

  .chat-send-btn {
    width: 38px !important;
    height: 38px !important;
    border-radius: 10px !important;
  }

  .birbal-chat-trigger {
    bottom: 20px;
    right: 20px;
    padding: 10px 18px;
    font-size: 0.88rem;
  }
}
