/* Gladly chat widget: custom launcher + restyle (matches homefi.info) */
:root {
  --gladly-grad: linear-gradient(135deg, #ff4d2d 0%, #ff6a2b 55%, #ff8a3d 100%);
}

/* ---------- Custom launcher (replaces Gladly's default button) ---------- */
#gladly-launcher-wrap {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 2147483000;
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  gap: 10px;
}
#gladly-launcher {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: var(--gladly-grad);
  border: none;
  cursor: pointer;
  position: relative;
  padding: 0;
  box-shadow:
    0 12px 30px rgba(255, 90, 40, 0.45),
    0 4px 10px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
}
#gladly-launcher:hover {
  transform: scale(1.07);
}
#gladly-launcher::before {
  content: '';
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 2px solid rgba(255, 106, 43, 0.55);
  animation: gladlyPulse 2.6s ease-out infinite;
}
@keyframes gladlyPulse {
  0% {
    transform: scale(0.92);
    opacity: 0.9;
  }
  70% {
    transform: scale(1.22);
    opacity: 0;
  }
  100% {
    opacity: 0;
  }
}
#gladly-launcher-label {
  background: #fff;
  border-radius: 99px;
  padding: 9px 12px 9px 9px;
  display: flex;
  align-items: center;
  gap: 9px;
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.3);
  font-family: 'Inter', sans-serif;
  white-space: nowrap;
}
#gladly-launcher-label .mini {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--gladly-grad);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 12px;
}
#gladly-launcher-label .txt {
  font-size: 13px;
  font-weight: 600;
  color: #21252c;
  font-family: 'Poppins', sans-serif;
}
#gladly-launcher-label .lx {
  cursor: pointer;
  color: #9a9a98;
  font-size: 14px;
  padding: 0 2px;
  line-height: 1;
  border: none;
  background: none;
}
#gladly-launcher-label .lx:hover {
  color: #21252c;
}
@media (max-width: 560px) {
  #gladly-launcher-wrap {
    right: 14px;
    bottom: 14px;
  }
}

/* ---------- Restyle the live Gladly widget to match the HomeFi look ---------- */
/* Hide Gladly's own default minimized button so only our launcher shows */
#gladlyChat_container #gladlyWidget #gladlyChatDragHandle {
  display: none !important;
}
#gladlyChat [data-aid='selfService-header'] {
  border-radius: 16px !important;
}
/* Customer (user) bubble: brand gradient + white text + soft glow */
body #gladlyChat_container [data-aid='gladlyChatCustomerMessage'] {
  background: var(--gladly-grad) !important;
  color: #fff !important;
  border-radius: 16px !important;
  border-bottom-right-radius: 5px !important;
  box-shadow: 0 4px 12px rgba(255, 90, 40, 0.3) !important;
}
body #gladlyChat_container [data-aid='gladlyChatCustomerMessage'] * {
  color: #fff !important;
}
/* Agent (grey) bubble: rounded with a bottom-left tail + room for the fi avatar */
#gladlyChat_container [class*='message_agent'] {
  border-radius: 16px !important;
  border-bottom-left-radius: 5px !important;
  position: relative !important;
  margin-left: 36px !important;
}
/* fi avatar on every agent message */
#gladlyChat_container [class*='message_agent']::before {
  content: 'fi';
  position: absolute;
  left: -36px;
  bottom: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #ff5a2b;
  color: #fff;
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 13px;
  text-align: center;
  line-height: 28px;
  pointer-events: none;
}
/* fi avatar in the widget header */
#gladlyChat_container [class*='fadeHeaderUp'] {
  position: relative !important;
}
#gladlyChat_container [class*='fadeHeaderUp']::before {
  content: 'fi';
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #ff5a2b;
  color: #fff;
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 20px;
  text-align: center;
  line-height: 42px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  z-index: 3;
  pointer-events: none;
}
/* Remove Gladly's bubble borders */
#gladlyChat_container #gladlyWidget [class*='message_customer'],
#gladlyChat_container #gladlyWidget [class*='message_agent'] {
  border: none !important;
}
/* Input divider line */
#gladlyChat_container #gladlyWidget [class*='Composition__composition'] {
  border-top-color: #e8e6e1 !important;
}
/* Send button: gradient circle + white paper-plane, shown only while typing */
#gladlyChat_container #gladlyWidget [class*='SubmitButton__submitButtonIcon'] {
  background: transparent !important;
  box-shadow: none !important;
}
#gladlyChat_container #gladlyWidget [class*='SubmitButton__submitButtonIcon'] * {
  display: none !important;
}
#gladlyChat_container #gladlyWidget div:has(> svg[class*='SubmitButton__submitButtonIcon']) {
  position: relative !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}
#gladlyChat_container #gladlyWidget div:has(> svg[class*='SubmitButton__submitButtonIcon'])::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background:
    url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3E%3Cpath%20fill='%23ffffff'%20d='M3.4%2020.4%2021.8%2012%203.4%203.6l-.01%206.53L15%2012%203.39%2013.87z'/%3E%3C/svg%3E")
      center/16px no-repeat,
    var(--gladly-grad);
  box-shadow: 0 4px 12px rgba(255, 90, 40, 0.35);
}
/* Typing / loading dots: HomeFi gradient orange instead of black */
#gladlyChat_container #gladlyWidget .typingIndicator_dots,
#gladlyChat_container #gladlyWidget .loadingIndicator_dots {
  background: #ff6a2b !important;
}
#gladlyChat_container #gladlyWidget .typingIndicator_dots:nth-child(1),
#gladlyChat_container #gladlyWidget .loadingIndicator_dots:nth-child(1) {
  background: #ff4d2d !important;
}
#gladlyChat_container #gladlyWidget .typingIndicator_dots:nth-child(2),
#gladlyChat_container #gladlyWidget .loadingIndicator_dots:nth-child(2) {
  background: #ff6a2b !important;
}
#gladlyChat_container #gladlyWidget .typingIndicator_dots:nth-child(3),
#gladlyChat_container #gladlyWidget .loadingIndicator_dots:nth-child(3) {
  background: #ff8a3d !important;
}
/* Message list: smooth scroll + thin rounded scrollbar */
#gladlyChat_container #gladlyWidget [class*='ChatHistory__chatHistory_wrapper'] {
  scroll-behavior: smooth !important;
}
#gladlyChat_container #gladlyWidget [class*='ChatHistory__chatHistory_wrapper']::-webkit-scrollbar {
  width: 6px !important;
}
#gladlyChat_container #gladlyWidget [class*='ChatHistory__chatHistory_wrapper']::-webkit-scrollbar-thumb {
  background: #e0ded8 !important;
  border-radius: 99px !important;
}
#gladlyChat_container #gladlyWidget [class*='ChatHistory__chatHistory_wrapper']::-webkit-scrollbar-track {
  background: transparent !important;
}
/* Preserve message line breaks so bulleted/numbered lists stack vertically */
#gladlyChat_container p,
#gladlyWidget p {
  white-space: pre-line !important;
}
