/* chatbot.css - Luxury AI Chatbot Widget Styling */

/* variables */
:root {
  --gold-primary: #c5a059;
  --gold-glow: rgba(197, 160, 89, 0.35);
  --gold-glow-hover: rgba(197, 160, 89, 0.6);
  --ai-cyan: rgba(58, 168, 193, 0.85);
  --ai-purple: rgba(139, 92, 246, 0.85);
  --navy-dark: #080d17;
  --navy-deep: #05080f;
  --ivory-light: #f4f2ee;
  --glass-bg: rgba(8, 13, 23, 0.85);
  --font-family-heading: 'Cormorant Garamond', serif;
  --font-family-sub: 'Sora', sans-serif;
  --font-family-body: 'Manrope', sans-serif;
}

/* Fix custom cursor z-index to be on top of the chatbot window and FAB */
.z-\[90\] {
  z-index: 99999999 !important;
}

/* Floating Action Button (FAB) - AI Avatar Styled */
.ifq-chatbot-fab {
  position: fixed;
  bottom: 28px;
  right: 90px; /* Shifted left to avoid overlapping the Back-to-Top / Scale Up button */
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0e1626, #060b14);
  border: 1px solid rgba(197, 160, 89, 0.5);
  box-shadow: 
    0 4px 24px rgba(0, 0, 0, 0.6), 
    0 0 15px var(--gold-glow),
    0 0 25px rgba(58, 168, 193, 0.15); /* Soft cyan aura */
  cursor: pointer;
  z-index: 9999991;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.4s cubic-bezier(0.19, 1, 0.22, 1);
  outline: none;
  padding: 0;
}

/* Avatar image container inside the FAB */
.ifq-fab-avatar-container {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  position: relative;
  z-index: 2;
  background: #080d17;
}

/* Avatar photo cropped to her face */
.ifq-fab-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 15%; /* Focused crop on her face based on the portrait aspect ratio */
  transition: transform 0.4s cubic-bezier(0.19, 1, 0.22, 1);
}

.ifq-chatbot-fab:hover .ifq-fab-avatar {
  transform: scale(1.08);
}

/* Tiny AI badge overlapping the bottom-right corner of her photo */
.ifq-fab-ai-badge {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: #080d17;
  border: 1px solid var(--gold-primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.8), 0 0 6px rgba(58, 168, 193, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  transition: all 0.3s ease;
}

.ifq-chatbot-fab:hover .ifq-fab-ai-badge {
  transform: scale(1.1);
  background: var(--gold-primary);
  border-color: var(--gold-primary);
  box-shadow: 0 2px 10px rgba(197, 160, 89, 0.6), 0 0 8px rgba(255, 255, 255, 0.5);
}

.ifq-fab-ai-badge svg {
  width: 11px;
  height: 11px;
  fill: var(--gold-primary);
  transition: fill 0.3s ease;
}

.ifq-chatbot-fab:hover .ifq-fab-ai-badge svg {
  fill: #05080f;
}

/* Rotating Aurora Glow Behind the FAB to represent AI */
.ifq-chatbot-fab::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: linear-gradient(45deg, var(--gold-primary), var(--ai-cyan), var(--ai-purple), var(--gold-primary));
  background-size: 400% 400%;
  z-index: -1;
  filter: blur(8px);
  opacity: 0.75;
  animation: ifq-ai-flow 8s ease infinite;
  transition: opacity 0.3s ease, filter 0.3s ease;
}

.ifq-chatbot-fab:hover::before {
  opacity: 1;
  filter: blur(12px);
}

@keyframes ifq-ai-flow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.ifq-chatbot-fab:hover {
  transform: scale(1.06);
  box-shadow: 
    0 6px 28px rgba(0, 0, 0, 0.7), 
    0 0 25px var(--gold-glow-hover),
    0 0 35px rgba(58, 168, 193, 0.3);
  border-color: rgba(197, 160, 89, 0.8);
}

/* Pulse Wave for active AI presence */
.ifq-chatbot-fab::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 50%;
  border: 1px solid var(--ai-cyan);
  opacity: 0;
  animation: ifq-pulse 2.5s infinite;
  pointer-events: none;
  z-index: 1;
}

@keyframes ifq-pulse {
  0% {
    transform: scale(1);
    opacity: 0.6;
    border-color: var(--ai-cyan);
  }
  50% {
    border-color: var(--gold-primary);
  }
  100% {
    transform: scale(1.35);
    opacity: 0;
  }
}

/* Chat Window Container */
.ifq-chatbot-window {
  position: fixed;
  bottom: 104px;
  right: 90px; /* Shifted left aligned with FAB */
  width: 380px;
  height: 560px;
  border-radius: 16px;
  background: var(--glass-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(197, 160, 89, 0.25);
  box-shadow: 
    0 16px 40px rgba(0, 0, 0, 0.6), 
    0 0 25px rgba(197, 160, 89, 0.08),
    0 0 40px rgba(58, 168, 193, 0.04);
  z-index: 9999990;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(24px) scale(0.96);
  transition: all 0.4s cubic-bezier(0.19, 1, 0.22, 1);
  overscroll-behavior: contain; /* Prevents scroll chaining/propagation on touchpad */
}

/* Active State for Chat Window */
.ifq-chatbot-window.is-active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* Header */
.ifq-chat-header {
  padding: 16px 20px;
  background: linear-gradient(to right, rgba(14, 22, 38, 0.4), rgba(6, 11, 20, 0.4));
  border-bottom: 1px solid rgba(197, 160, 89, 0.18);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 10;
}

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

.ifq-header-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1.5px solid var(--gold-primary);
  background: linear-gradient(135deg, #10192e, #0c1220);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 10px rgba(197, 160, 89, 0.15);
  position: relative;
}

.ifq-header-avatar::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 9px;
  height: 9px;
  background-color: #4cd964;
  border: 1.5px solid #080d17;
  border-radius: 50%;
  box-shadow: 0 0 6px #4cd964;
}

.ifq-header-avatar svg {
  width: 20px;
  height: 20px;
  fill: var(--gold-primary);
}

.ifq-header-details {
  display: flex;
  flex-direction: column;
}

.ifq-header-name {
  font-family: var(--font-family-heading);
  font-size: 18px;
  font-weight: 600;
  color: var(--ivory-light);
  letter-spacing: 0.05em;
  margin: 0;
  line-height: 1.2;
}

.ifq-header-status {
  font-family: var(--font-family-sub);
  font-size: 9.5px;
  color: var(--gold-primary);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-weight: 500;
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.ifq-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ifq-header-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s, transform 0.2s;
  outline: none;
}

.ifq-header-btn:hover {
  background-color: rgba(255, 255, 255, 0.06);
}

.ifq-header-btn:active {
  transform: scale(0.95);
}

.ifq-header-btn svg {
  width: 18px;
  height: 18px;
  fill: rgba(244, 242, 238, 0.6);
  transition: fill 0.2s;
}

.ifq-header-btn:hover svg {
  fill: var(--gold-primary);
}

/* Tone Settings Panel */
.ifq-tone-settings {
  position: absolute;
  top: 71px;
  left: 0;
  right: 0;
  background: rgba(6, 10, 18, 0.96);
  border-bottom: 1px solid rgba(197, 160, 89, 0.2);
  padding: 16px 20px;
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
  transition: all 0.35s cubic-bezier(0.19, 1, 0.22, 1);
  z-index: 9;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.ifq-tone-settings.is-visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.ifq-tone-title {
  font-family: var(--font-family-sub);
  font-size: 11px;
  font-weight: 600;
  color: var(--ivory-light);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ifq-tone-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.ifq-tone-option {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  transition: all 0.25s ease;
  text-align: left;
}

.ifq-tone-option:hover {
  background: rgba(197, 160, 89, 0.04);
  border-color: rgba(197, 160, 89, 0.3);
}

.ifq-tone-option.is-selected {
  background: rgba(197, 160, 89, 0.08);
  border-color: var(--gold-primary);
  box-shadow: 0 0 10px rgba(197, 160, 89, 0.08);
}

.ifq-tone-name {
  font-family: var(--font-family-sub);
  font-size: 11px;
  font-weight: 600;
  color: var(--gold-primary);
  margin-bottom: 2px;
}

.ifq-tone-desc {
  font-family: var(--font-family-body);
  font-size: 9px;
  color: rgba(244, 242, 238, 0.45);
  line-height: 1.3;
}

/* Chat Messages Area */
.ifq-chat-messages {
  flex-grow: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: radial-gradient(circle at center, rgba(14, 22, 38, 0.15) 0%, rgba(5, 8, 15, 0) 70%);
  overscroll-behavior: contain; /* CRITICAL: Prevents scroll chaining/propagation to page body when using trackpad */
}

/* Scrollbar styling */
.ifq-chat-messages::-webkit-scrollbar {
  width: 5px;
}

.ifq-chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.ifq-chat-messages::-webkit-scrollbar-thumb {
  background: rgba(197, 160, 89, 0.2);
  border-radius: 10px;
}

.ifq-chat-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(197, 160, 89, 0.4);
}

/* Message Item */
.ifq-msg-item {
  display: flex;
  flex-direction: column;
  max-width: 80%;
  animation: ifq-msg-fade 0.35s ease forwards;
}

@keyframes ifq-msg-fade {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ifq-msg-user {
  align-self: flex-end;
}

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

/* Message Bubble */
.ifq-msg-bubble {
  padding: 11px 15px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
}

.ifq-msg-user .ifq-msg-bubble {
  background: linear-gradient(135deg, var(--gold-primary), #b38c45);
  color: #05080f;
  font-family: var(--font-family-sub);
  font-weight: 500;
  border-bottom-right-radius: 2px;
  box-shadow: 0 4px 12px rgba(197, 160, 89, 0.15);
}

.ifq-msg-bot .ifq-msg-bubble {
  background: rgba(255, 255, 255, 0.04);
  color: #ededf0;
  font-family: var(--font-family-body);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-bottom-left-radius: 2px;
}

.ifq-msg-time {
  font-family: var(--font-family-body);
  font-size: 8.5px;
  color: rgba(244, 242, 238, 0.3);
  margin-top: 4px;
  align-self: flex-end;
}

.ifq-msg-bot .ifq-msg-time {
  align-self: flex-start;
}

/* Disclaimer text styles */
.ifq-msg-bubble em {
  font-size: 11px;
  color: rgba(244, 242, 238, 0.35);
  display: block;
  margin-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 4px;
}

/* Quick Replies container */
.ifq-quick-replies {
  padding: 10px 16px 12px 16px;
  background: transparent;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
  transition: all 0.4s ease;
  max-height: 50px;
  opacity: 1;
}

.ifq-quick-replies::-webkit-scrollbar {
  display: none;
}

.ifq-reply-chip {
  display: inline-block;
  background: rgba(197, 160, 89, 0.04);
  border: 1px solid rgba(197, 160, 89, 0.35);
  color: var(--gold-primary);
  font-family: var(--font-family-sub);
  font-size: 11px;
  font-weight: 500;
  padding: 6px 13px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.25s ease;
  user-select: none;
  outline: none;
}

.ifq-reply-chip:hover {
  background: var(--gold-primary);
  color: #05080f;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(197, 160, 89, 0.15);
  border-color: var(--gold-primary);
}

.ifq-reply-chip:active {
  transform: translateY(0);
}

/* Chat Input Area */
.ifq-chat-input-area {
  padding: 14px 16px;
  background: rgba(10, 15, 26, 0.8);
  border-top: 1px solid rgba(197, 160, 89, 0.16);
  display: flex;
  align-items: center;
  gap: 12px;
}

.ifq-chat-input {
  flex-grow: 1;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  padding: 10px 16px;
  color: #ffffff;
  font-family: var(--font-family-body);
  font-size: 13px;
  outline: none;
  transition: all 0.3s;
}

.ifq-chat-input::placeholder {
  color: rgba(244, 242, 238, 0.25);
  transition: color 0.3s ease;
}

.ifq-chat-input:focus {
  border-color: rgba(197, 160, 89, 0.5);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 0 10px rgba(197, 160, 89, 0.05);
}

.ifq-chat-input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  border-color: rgba(255, 255, 255, 0.04);
}

.ifq-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(197, 160, 89, 0.1);
  border: 1px solid rgba(197, 160, 89, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.19, 1, 0.22, 1);
  outline: none;
}

.ifq-send-btn:hover {
  background: var(--gold-primary);
  border-color: var(--gold-primary);
}

.ifq-send-btn svg {
  width: 16px;
  height: 16px;
  fill: var(--gold-primary);
  transform: translate(1px, 0px);
  transition: fill 0.2s;
}

.ifq-send-btn:hover svg {
  fill: #05080f;
}

.ifq-send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: transparent;
  border-color: rgba(255, 255, 255, 0.1);
}

.ifq-send-btn:disabled svg {
  fill: rgba(255, 255, 255, 0.2);
}

/* Typing Indicator */
.ifq-typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
}

.ifq-typing-dot {
  width: 6px;
  height: 6px;
  background-color: var(--gold-primary);
  border-radius: 50%;
  opacity: 0.4;
  animation: ifq-typing-bounce 1.4s infinite ease-in-out;
}

.ifq-typing-dot:nth-child(1) {
  animation-delay: 0s;
}

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

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

@keyframes ifq-typing-bounce {
  0%, 100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  50% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
  .ifq-chatbot-window {
    bottom: 0;
    right: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
    border: none;
    z-index: 99999999;
  }
  .ifq-chatbot-fab {
    bottom: 16px;
    right: 16px;
  }
  .ifq-chatbot-window.is-active {
    transform: translateY(0) scale(1);
  }
}
