/* ==========================================================
   SKTCHFRST CHATBOT CSS (FULL UPDATED VERSION)
   ========================================================== */

/* Root wrapper for chat container */
#sf-chatbot-widget.sf-chatbot {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 99;
  font-family: 'Open Sans', 'Helvetica Neue', sans-serif;
  max-width: 540px;
  width: 100%;
  display: flex !important;
  flex-direction: column;
  align-items: flex-end;
  visibility: visible !important;
}

/* ==========================================================
   CHAT BUBBLE LAUNCHER BUTTON (Intercom-style)
========================================================== */

#sf-chatbot-widget .sf-chat-toggle-bubble {
  display: flex !important;
  align-items: center;
  gap: 1rem;
  padding: 1.2rem 1.8rem;
  background-color: #232323; /* charcoal */
  color: #fff;
  border-radius: 3rem;
  border: none;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22);
  transition: background-color 250ms ease, box-shadow 250ms ease, transform 250ms ease, opacity 200ms ease;
  position: relative;
  margin-left: auto; /* Push button to the right */
  visibility: visible !important;
  opacity: 1 !important;
}

#sf-chatbot-widget .sf-chat-toggle-bubble:hover {
  background-color: #ff4556; /* SKTCHFRST pink/red */
  transform: translateY(-2px);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.28);
}

#sf-chatbot-widget .sf-chat-bubble-icon {
  background-color: transparent;
  width: 2rem;
  height: 2.8rem;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: #ccc;
  transition: color 200ms ease;
}

#sf-chatbot-widget .sf-chat-toggle-bubble:hover .sf-chat-bubble-icon {
  color: #fff !important;
}

#sf-chatbot-widget .sf-chat-bubble-text {
  font-family: 'Lato', 'Helvetica Neue', sans-serif;
  text-transform: uppercase;
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: 0.08rem;
}

/* Typing Indicator (Assistant typing...) */
#sf-chatbot-widget .sf-chat-typing-indicator {
  display: flex;
  gap: 0.8rem;
  margin-bottom: 1.4rem;
  align-items: center;
}

#sf-chatbot-widget .sf-chat-typing-indicator .dot {
  width: 10px;
  height: 10px;
  background-color: #888;
  border-radius: 50%;
  animation: typingDot 1.5s infinite ease-in-out;
}

#sf-chatbot-widget .sf-chat-typing-indicator .dot:nth-child(2) {
  animation-delay: 0.2s;
}

#sf-chatbot-widget .sf-chat-typing-indicator .dot:nth-child(3) {
  animation-delay: 0.4s;
}

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

/* ==========================================================
   CHAT PANEL STYLES
========================================================== */

#sf-chatbot-widget .sf-chat-panel {
  position: absolute;
  bottom: calc(2rem + 6rem); /* Offset for the chat bubble */
  right: 0;
  width: 100%;
  max-width: 440px;
  max-height: 64vh;
  /* Frosted glass effect - semi-transparent background with backdrop blur */
  background-color: rgba(255, 255, 255, 0.5); /* 50% opacity white background */
  backdrop-filter: blur(10px); /* Medium blur intensity */
  -webkit-backdrop-filter: blur(10px); /* Safari support */
  /* border: 1px solid #eee; */
  border-radius: 0.6rem;
  overflow: hidden;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.30);
  opacity: 0;
  visibility: hidden;
  transform: translateY(1.5rem);
  transition: opacity 260ms ease, transform 260ms ease, visibility 260ms ease, backdrop-filter 260ms ease;
  align-self: flex-end; /* Align panel to the right */
  display: flex;
  flex-direction: column;
}

#sf-chatbot-widget.sf-chat-open .sf-chat-panel {
  opacity: 1 !important;
  visibility: visible !important;
  transform: translateY(0) !important;
  display: flex !important;
}

/* ==========================================================
   MESSAGES CONTAINER (SCROLLABLE)
========================================================== */

#sf-chatbot-widget .sf-chat-messages {
  max-height: calc(64vh - 5.5rem); /* Calculated to fit within 44vh panel minus input area height */
  overflow-y: auto; /* Enable vertical scrolling */
  overflow-x: hidden; /* Prevent horizontal scrolling */
  padding: 1.4rem;
  /* Transparent background to allow frosted glass effect from parent panel */
  background-color: transparent;
  /* Smooth scrolling */
  scroll-behavior: smooth;
  /* Gradient mask for smooth fade-out at top - transparent fade */
  -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,0) 0%, rgba(0,0,0,0.3) 5%, rgba(0,0,0,1) 15%, rgba(0,0,0,1) 100%);
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0) 0%, rgba(0,0,0,0.3) 5%, rgba(0,0,0,1) 15%, rgba(0,0,0,1) 100%);
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  /* Custom scrollbar styling for webkit browsers */
  scrollbar-width: thin;
  scrollbar-color: #ccc #f4f4f4;
}

/* Hide messages container when empty (no chat messages) */
#sf-chatbot-widget .sf-chat-messages:empty {
  display: none;
}

#sf-chatbot-widget .sf-chat-messages::-webkit-scrollbar {
  width: 8px;
}

#sf-chatbot-widget .sf-chat-messages::-webkit-scrollbar-track {
  background: #f4f4f4;
  border-radius: 4px;
}

#sf-chatbot-widget .sf-chat-messages::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 4px;
}

#sf-chatbot-widget .sf-chat-messages::-webkit-scrollbar-thumb:hover {
  background: #999;
}

/* ==========================================================
   MESSAGE BUBBLES (USER & ASSISTANT)
========================================================== */

/* USER MESSAGE STYLES (Left-Aligned Avatar, Right Padding) */
#sf-chatbot-widget .sf-chat-message-user {
  display: flex;
  justify-content: flex-start;
  gap: 1rem;
  margin-bottom: 1.4rem;
}

#sf-chatbot-widget .sf-chat-message-user .sf-chat-avatar {
  flex-shrink: 0; /* Prevent avatar from being squashed */
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#sf-chatbot-widget .sf-chat-message-user .sf-chat-avatar img {
  width: 34px;
  height: 34px;
  min-width: 34px; /* Prevent image from shrinking */
  min-height: 34px; /* Prevent image from shrinking */
  border-radius: 50%;
  object-fit: cover;
  display: block; /* Remove any inline spacing */
}

#sf-chatbot-widget .sf-chat-message-user .sf-chat-bubble-wrapper {
  display: flex;
  flex-direction: column;
  align-items: flex-start; /* Left align bubble */
}

#sf-chatbot-widget .sf-chat-message-user .sf-chat-bubble {
  background-color: #232323; /* Dark background for user */
  color: #fff;
  padding: 0.9rem 1.2rem;
  border-radius: 1.2rem;
  border-bottom-left-radius: 0.4rem;
  margin-bottom: 0.6rem;
  max-width: 80%;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
  padding-right: 1.5rem;  /* Right padding on user's message box */
  font-size: 1.3rem; /* Reduced font size */
  line-height: 1.5;
}

/* ASSISTANT MESSAGE STYLES (Right-Aligned Avatar) */
#sf-chatbot-widget .sf-chat-message-assistant {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.4rem;
}

#sf-chatbot-widget .sf-chat-message-assistant .sf-chat-avatar {
  flex-shrink: 0; /* Prevent avatar from being squashed */
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#sf-chatbot-widget .sf-chat-message-assistant .sf-chat-avatar img {
  width: 34px;
  height: 34px;
  min-width: 34px; /* Prevent image from shrinking */
  min-height: 34px; /* Prevent image from shrinking */
  border-radius: 50%;
  object-fit: cover;
  display: block; /* Remove any inline spacing */
}

/* Assistant avatar icon styling */
#sf-chatbot-widget .sf-chat-message-assistant .sf-chat-avatar .icon-emoji-happy {
  font-size: 2.2rem;
  color: #ff4556; /* Match chatbot accent colour */
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  line-height: 34px;
}

#sf-chatbot-widget .sf-chat-message-assistant .sf-chat-bubble-wrapper {
  display: flex;
  flex-direction: column;
  align-items: flex-end; /* Right align bubble */
}

#sf-chatbot-widget .sf-chat-message-assistant .sf-chat-bubble {
  background-color: #f4f4f4;
  color: #232323;
  padding: 0.9rem 1.2rem;
  border-radius: 1.2rem;
  border-bottom-right-radius: 0.4rem;
  margin-bottom: 0.6rem;
  max-width: 80%;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.10);
  font-size: 1.3rem; /* Reduced font size */
  line-height: 1.5;
}

/* Bold company names in assistant messages */
#sf-chatbot-widget .sf-chat-message-assistant .sf-chat-bubble strong {
  font-weight: 700;
  color: #232323;
}

/* ==========================================================
   MARKDOWN ELEMENT STYLES (within chat bubbles)
========================================================== */

/* Paragraphs */
#sf-chatbot-widget .sf-chat-message-assistant .sf-chat-bubble p {
  margin: 0 0 0.8rem 0;
  line-height: 1.5;
}

#sf-chatbot-widget .sf-chat-message-assistant .sf-chat-bubble p:last-child {
  margin-bottom: 0;
}

/* Headings */
#sf-chatbot-widget .sf-chat-message-assistant .sf-chat-bubble h1,
#sf-chatbot-widget .sf-chat-message-assistant .sf-chat-bubble h2,
#sf-chatbot-widget .sf-chat-message-assistant .sf-chat-bubble h3,
#sf-chatbot-widget .sf-chat-message-assistant .sf-chat-bubble h4,
#sf-chatbot-widget .sf-chat-message-assistant .sf-chat-bubble h5,
#sf-chatbot-widget .sf-chat-message-assistant .sf-chat-bubble h6 {
  font-weight: 700;
  color: #232323;
  margin: 1.2rem 0 0.6rem 0;
  line-height: 1.3;
}

#sf-chatbot-widget .sf-chat-message-assistant .sf-chat-bubble h1:first-child,
#sf-chatbot-widget .sf-chat-message-assistant .sf-chat-bubble h2:first-child,
#sf-chatbot-widget .sf-chat-message-assistant .sf-chat-bubble h3:first-child,
#sf-chatbot-widget .sf-chat-message-assistant .sf-chat-bubble h4:first-child,
#sf-chatbot-widget .sf-chat-message-assistant .sf-chat-bubble h5:first-child,
#sf-chatbot-widget .sf-chat-message-assistant .sf-chat-bubble h6:first-child {
  margin-top: 0;
}

#sf-chatbot-widget .sf-chat-message-assistant .sf-chat-bubble h1 {
  font-size: 1.8rem;
}

#sf-chatbot-widget .sf-chat-message-assistant .sf-chat-bubble h2 {
  font-size: 1.6rem;
}

#sf-chatbot-widget .sf-chat-message-assistant .sf-chat-bubble h3 {
  font-size: 1.4rem;
}

#sf-chatbot-widget .sf-chat-message-assistant .sf-chat-bubble h4,
#sf-chatbot-widget .sf-chat-message-assistant .sf-chat-bubble h5,
#sf-chatbot-widget .sf-chat-message-assistant .sf-chat-bubble h6 {
  font-size: 1.3rem;
}

/* Lists - ensure proper spacing after headings */
#sf-chatbot-widget .sf-chat-message-assistant .sf-chat-bubble ul,
#sf-chatbot-widget .sf-chat-message-assistant .sf-chat-bubble ol {
  margin: 0.6rem 0 0.8rem 0;
  padding-left: 1.8rem;
  line-height: 1.5;
}

#sf-chatbot-widget .sf-chat-message-assistant .sf-chat-bubble ul:last-child,
#sf-chatbot-widget .sf-chat-message-assistant .sf-chat-bubble ol:last-child {
  margin-bottom: 0;
}

/* List items */
#sf-chatbot-widget .sf-chat-message-assistant .sf-chat-bubble li {
  margin: 0.4rem 0;
  line-height: 1.5;
}

/* Ensure lists following headings have reduced top margin */
#sf-chatbot-widget .sf-chat-message-assistant .sf-chat-bubble h1 + ul,
#sf-chatbot-widget .sf-chat-message-assistant .sf-chat-bubble h1 + ol,
#sf-chatbot-widget .sf-chat-message-assistant .sf-chat-bubble h2 + ul,
#sf-chatbot-widget .sf-chat-message-assistant .sf-chat-bubble h2 + ol,
#sf-chatbot-widget .sf-chat-message-assistant .sf-chat-bubble h3 + ul,
#sf-chatbot-widget .sf-chat-message-assistant .sf-chat-bubble h3 + ol,
#sf-chatbot-widget .sf-chat-message-assistant .sf-chat-bubble h4 + ul,
#sf-chatbot-widget .sf-chat-message-assistant .sf-chat-bubble h4 + ol,
#sf-chatbot-widget .sf-chat-message-assistant .sf-chat-bubble h5 + ul,
#sf-chatbot-widget .sf-chat-message-assistant .sf-chat-bubble h5 + ol,
#sf-chatbot-widget .sf-chat-message-assistant .sf-chat-bubble h6 + ul,
#sf-chatbot-widget .sf-chat-message-assistant .sf-chat-bubble h6 + ol {
  margin-top: 0.4rem;
}

/* Links */
#sf-chatbot-widget .sf-chat-message-assistant .sf-chat-bubble a {
  color: #232323;
  text-decoration: underline;
  transition: color 250ms ease, opacity 200ms ease;
}

#sf-chatbot-widget .sf-chat-message-assistant .sf-chat-bubble a:hover {
  
  color: #304cd1; /* Blue - matches existing CSS blue */
  transition: color 250ms ease;
}

/* Code blocks and inline code */
#sf-chatbot-widget .sf-chat-message-assistant .sf-chat-bubble code {
  background-color: rgba(0, 0, 0, 0.05);
  padding: 0.2rem 0.4rem;
  border-radius: 0.3rem;
  font-family: 'Courier New', monospace;
  font-size: 1.1rem;
}

#sf-chatbot-widget .sf-chat-message-assistant .sf-chat-bubble pre {
  background-color: rgba(0, 0, 0, 0.05);
  padding: 0.8rem;
  border-radius: 0.4rem;
  overflow-x: auto;
  margin: 0.8rem 0;
  line-height: 1.4;
}

#sf-chatbot-widget .sf-chat-message-assistant .sf-chat-bubble pre code {
  background-color: transparent;
  padding: 0;
}

/* Blockquotes */
#sf-chatbot-widget .sf-chat-message-assistant .sf-chat-bubble blockquote {
  border-left: 3px solid #ff4556;
  padding-left: 1rem;
  margin: 0.8rem 0;
  color: #666;
  font-style: italic;
}

/* Horizontal rules */
#sf-chatbot-widget .sf-chat-message-assistant .sf-chat-bubble hr {
  border: none;
  border-top: 1px solid #ddd;
  margin: 1rem 0;
}

/* ==========================================================
   INPUT AREA AND SEND BUTTON STYLES
========================================================== */

#sf-chatbot-widget .sf-chat-input-area {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 1rem 1rem 0rem 1rem;
  border-top: 1px solid rgba(238, 238, 238, 0.5); /* Semi-transparent border for frosted glass */
  background-color: rgba(250, 250, 250, 0.5); /* Semi-transparent background to match frosted glass */
}

#sf-chatbot-widget .sf-chat-input-field {
  flex: 1;
  border: none;
  padding: 1rem;
  font-size: 1.6rem;
  font-weight: 500;
  color: #666;
  border-radius: 0.6rem;
  background-color: #fff;
  text-transform: none; /* Convert input text to lowercase */
}

#sf-chatbot-widget .sf-chat-clear-btn {
  background-color: #f0f0f0;
  color: #666;
  border: none;
  padding: 1rem;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: background-color 0.2s ease, color 0.2s ease;
  flex-shrink: 0;
}

#sf-chatbot-widget .sf-chat-clear-btn:hover {
  background-color: #ff4556;
  color: #fff;
}

#sf-chatbot-widget .sf-chat-clear-btn .icon-trash {
  font-size: 1.4rem;
}

#sf-chatbot-widget .sf-chat-send-btn {
  background-color: #232323;
  color: #fff;
  border: none;
  padding: 1rem;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: background-color 0.2s ease;
  flex-shrink: 0;
}

#sf-chatbot-widget .sf-chat-send-btn:hover {
  background-color: #ff4556;
}

#sf-chatbot-widget .sf-chat-send-btn .icon-paper-plane {
  font-size: 1.6rem;
}

/* ==========================================================
   AVATAR STYLES
========================================================== */

#sf-chatbot-widget .sf-chat-avatar {
  flex-shrink: 0; /* Prevent avatar from being squashed */
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#sf-chatbot-widget .sf-chat-avatar img {
  width: 34px;
  height: 34px;
  min-width: 34px; /* Prevent image from shrinking */
  min-height: 34px; /* Prevent image from shrinking */
  border-radius: 50%;
  object-fit: cover;
  display: block; /* Remove any inline spacing */
}

/* Assistant avatar icon styling */
#sf-chatbot-widget .sf-chat-avatar .icon-emoji-happy {
  font-size: 2.2rem;
  color: #ff4556; /* Match chatbot accent colour */
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  line-height: 34px;
}

/* User's avatar to the left of the bubble 
#sf-chatbot-widget .sf-chat-message-user .sf-chat-avatar {
  order: 2; 
} */

#sf-chatbot-widget .sf-chat-message-assistant .sf-chat-avatar {
  order: 1; /* Assistant's avatar to the right of the bubble */
}
