/**
 * extendedIDEA Widget — Shared Stylesheet
 * Contains both mode stylesheets, namespaced by prefix (no collisions):
 *   .ei-*  /  #ei-*   — LeadBot mode
 *   .sb-*  /  #sb-*   — SmartBot mode
 * A client only ever activates one mode, so only one rule set applies.
 * Ported unchanged from legacy/leadbot-v2/chatbot.css and legacy/smartbot-resco/smartbot.css.
 */

/* ============================================================
   LEADBOT MODE (ei-*)
   ============================================================ */

/*
 * ============================================================
 * extendedIDEA — Chatbot Widget CSS v2.0
 * ============================================================
 * TO THEME FOR A NEW CLIENT:
 *   Override the variables in the :root block below.
 *   Everything else adapts automatically.
 *
 * FONT NOTE:
 *   Default uses system fonts. Swap --ei-font-body and
 *   --ei-font-display for Google Fonts or client brand fonts.
 * ============================================================
 */

/* ---- 1. THEME VARIABLES — edit these per client ---------- */
:root {
  /* Brand colors */
  --ei-primary:        #b07d55;      /* warm terracotta — Room & Craft */
  --ei-primary-hover:  #8f6139;
  --ei-primary-text:   #ffffff;

  /* Header */
  --ei-header-bg:      #1c1916;      /* deep espresso */
  --ei-header-fg:      #f5f0e8;

  /* Chat area */
  --ei-chat-bg:        #faf7f2;      /* warm cream */
  --ei-border:         #e8e1d6;

  /* Bot bubble */
  --ei-bot-bg:         #eeeae3;
  --ei-bot-text:       #2a2520;

  /* User bubble */
  --ei-user-bg:        var(--ei-primary);
  --ei-user-text:      #ffffff;

  /* Option buttons */
  --ei-option-bg:      #ffffff;
  --ei-option-text:    #2a2520;
  --ei-option-border:  #d4c9b8;
  --ei-option-hover-bg:  var(--ei-primary);
  --ei-option-hover-text: #ffffff;

  /* Input */
  --ei-input-bg:       #ffffff;
  --ei-input-text:     #2a2520;
  --ei-input-border:   var(--ei-border);

  /* Progress bar */
  --ei-progress-bg:    #e8e1d6;
  --ei-progress-fill:  var(--ei-primary);

  /* Toggle button */
  --ei-toggle-bg:      #1c1916;
  --ei-toggle-text:    #f5f0e8;

  /* Footer */
  --ei-footer-bg:      #f0ebe2;
  --ei-footer-text:    #9a8e80;
  --ei-footer-link:    var(--ei-primary);

  /* Typography */
  --ei-font-body:      'Georgia', 'Times New Roman', serif;
  --ei-font-ui:        -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --ei-font-size-base: 14px;
  --ei-font-size-sm:   12px;

  /* Sizing */
  --ei-widget-width:   340px;
  --ei-widget-height:  500px;
  --ei-radius:         14px;
  --ei-radius-bubble:  10px;
  --ei-radius-toggle:  30px;
  --ei-shadow:         0 24px 60px rgba(0, 0, 0, 0.18), 0 8px 24px rgba(0, 0, 0, 0.10);
  --ei-z-index:        9999;

  /* Transitions */
  --ei-transition:     0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- 2. TOGGLE BUTTON ------------------------------------ */
#ei-chat-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: var(--ei-z-index);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px 12px 16px;
  background: var(--ei-toggle-bg);
  color: var(--ei-toggle-text);
  border: none;
  border-radius: var(--ei-radius-toggle);
  font-family: var(--ei-font-ui);
  font-size: var(--ei-font-size-base);
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.22);
  transition: transform var(--ei-transition), box-shadow var(--ei-transition), background var(--ei-transition);
  letter-spacing: 0.01em;
}

#ei-chat-toggle:hover {
  background: var(--ei-primary);
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
}

#ei-toggle-label {
  white-space: nowrap;
}

/* ---- 3. WIDGET CONTAINER --------------------------------- */
#ei-chatbot-widget {
  position: fixed;
  bottom: 84px;
  right: 24px;
  z-index: var(--ei-z-index);
  width: var(--ei-widget-width);
  height: var(--ei-widget-height);
  background: var(--ei-chat-bg);
  border-radius: var(--ei-radius);
  box-shadow: var(--ei-shadow);
  display: flex;
  flex-direction: column;
  font-family: var(--ei-font-body);
  font-size: var(--ei-font-size-base);
  overflow: hidden;
  border: 1px solid var(--ei-border);

  /* Hidden by default; revealed by .ei-open */
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px) scale(0.97);
  transform-origin: bottom right;
  transition:
    opacity var(--ei-transition),
    transform var(--ei-transition);
}

#ei-chatbot-widget.ei-open {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0) scale(1);
}

/* ---- 4. HEADER ------------------------------------------- */
#ei-chat-header {
  background: var(--ei-header-bg);
  color: var(--ei-header-fg);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

#ei-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Logo image */
.ei-logo {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid rgba(255,255,255,0.15);
}

/* Fallback initial when no logo URL */
.ei-logo-placeholder {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--ei-primary);
  color: #fff;
  font-family: var(--ei-font-ui);
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

#ei-header-text {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

#ei-header-title {
  font-family: var(--ei-font-ui);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ei-header-fg);
}

#ei-header-subtitle {
  font-family: var(--ei-font-body);
  font-size: 11px;
  color: rgba(245, 240, 232, 0.65);
  font-style: italic;
}

#ei-header-status {
  font-family: var(--ei-font-ui);
  font-size: 11px;
  color: rgba(245, 240, 232, 0.7);
  display: flex;
  align-items: center;
  gap: 5px;
}

.ei-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #5fc98a;
  display: inline-block;
  animation: ei-pulse 2.2s ease-in-out infinite;
}

@keyframes ei-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

/* ---- 5. PROGRESS BAR ------------------------------------- */
#ei-progress-bar {
  background: var(--ei-progress-bg);
  height: 4px;
  position: relative;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

#ei-progress-fill {
  height: 100%;
  background: var(--ei-progress-fill);
  width: 0%;
  transition: width 0.5s ease;
}

#ei-progress-label {
  position: absolute;
  right: 10px;
  font-family: var(--ei-font-ui);
  font-size: 10px;
  color: #9a8e80;
  line-height: 1;
  top: 50%;
  transform: translateY(-50%);
  background: var(--ei-progress-bg);
  padding: 0 4px;
}

/* ---- 6. MESSAGES AREA ------------------------------------ */
#ei-chat-messages {
  flex: 1;
  padding: 16px 14px 8px;
  overflow-y: auto;
  scroll-behavior: smooth;
  background: var(--ei-chat-bg);
}

#ei-chat-messages::-webkit-scrollbar {
  width: 4px;
}
#ei-chat-messages::-webkit-scrollbar-track {
  background: transparent;
}
#ei-chat-messages::-webkit-scrollbar-thumb {
  background: var(--ei-border);
  border-radius: 4px;
}

/* ---- 7. BUBBLES ------------------------------------------ */
.ei-bot,
.ei-user {
  padding: 10px 13px;
  border-radius: var(--ei-radius-bubble);
  margin-bottom: 8px;
  max-width: 82%;
  line-height: 1.5;
  font-size: var(--ei-font-size-base);
  word-break: break-word;
  animation: ei-bubble-in 0.22s ease both;
}

@keyframes ei-bubble-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.ei-bot {
  background: var(--ei-bot-bg);
  color: var(--ei-bot-text);
  border-bottom-left-radius: 3px;
}

.ei-user {
  background: var(--ei-user-bg);
  color: var(--ei-user-text);
  margin-left: auto;
  border-bottom-right-radius: 3px;
  font-family: var(--ei-font-ui);
}

/*------------ Toggle skip button -----------------------*/
#ei-skip-btn {
  background: transparent;
  border: none;
  color: var(--ei-footer-text);
  font-family: var(--ei-font-ui);
  font-size: 12px;
  cursor: pointer;
  padding: 0 10px 0 4px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: color var(--ei-transition);
}

#ei-skip-btn:hover {
  color: var(--ei-primary);
}

/* ---- 8. TYPING INDICATOR --------------------------------- */
.ei-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 12px 14px;
  width: fit-content;
  min-width: 52px;
}

.ei-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #aaa4a0;
  display: inline-block;
  animation: ei-bounce 1.2s infinite ease-in-out;
}

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

@keyframes ei-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.5; }
  40%            { transform: translateY(-5px); opacity: 1; }
}

/* ---- 9. OPTION BUTTONS ----------------------------------- */
#ei-options-wrap {
  padding: 8px 14px 10px;
  flex-wrap: wrap;
  gap: 7px;
  background: var(--ei-chat-bg);
  border-top: 1px solid var(--ei-border);
}

.ei-option-btn {
  background: var(--ei-option-bg);
  color: var(--ei-option-text);
  border: 1.5px solid var(--ei-option-border);
  border-radius: 20px;
  padding: 7px 14px;
  font-family: var(--ei-font-ui);
  font-size: 13px;
  cursor: pointer;
  transition: background var(--ei-transition), color var(--ei-transition), border-color var(--ei-transition), transform 0.15s ease;
  white-space: nowrap;
}

.ei-option-btn:hover {
  background: var(--ei-option-hover-bg);
  color: var(--ei-option-hover-text);
  border-color: var(--ei-option-hover-bg);
  transform: translateY(-1px);
}

/* ---- 10. INPUT AREA -------------------------------------- */
#ei-input-area {
  display: flex;
  align-items: center;
  border-top: 1px solid var(--ei-input-border);
  background: var(--ei-input-bg);
  flex-shrink: 0;
  padding: 2px 4px 2px 0;
}

#ei-chat-input {
  flex: 1;
  padding: 11px 12px;
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--ei-font-body);
  font-size: var(--ei-font-size-base);
  color: var(--ei-input-text);
}

#ei-chat-input::placeholder {
  color: #bbb4aa;
  font-style: italic;
}

#ei-send-btn {
  background: var(--ei-primary);
  color: var(--ei-primary-text);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-right: 6px;
  flex-shrink: 0;
  transition: background var(--ei-transition), transform 0.15s ease;
}

#ei-send-btn:hover {
  background: var(--ei-primary-hover);
  transform: scale(1.08);
}

/* ---- 11. FOOTER ------------------------------------------ */
#ei-chat-footer {
  background: var(--ei-footer-bg);
  border-top: 1px solid var(--ei-border);
  padding: 6px 14px;
  text-align: center;
  font-family: var(--ei-font-ui);
  font-size: var(--ei-font-size-sm);
  color: var(--ei-footer-text);
  flex-shrink: 0;
}

#ei-chat-footer a {
  color: var(--ei-footer-link);
  text-decoration: none;
  font-weight: 600;
}

#ei-chat-footer a:hover {
  text-decoration: underline;
}

/* ---- 12. RESPONSIVE -------------------------------------- */
@media (max-width: 480px) {
  #ei-chatbot-widget {
    width: calc(100vw - 20px);
    right: 10px;
    bottom: 76px;
    height: min(520px, calc(100dvh - 100px));
    border-radius: 12px;
  }

  #ei-chat-toggle {
    right: 12px;
    bottom: 16px;
    padding: 11px 16px 11px 14px;
  }
}

/* ---- 13. ACCESSIBILITY ----------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---- 14. DARK MODE (optional) ----------------------------
   Uncomment to automatically flip to dark if OS prefers it.
   Or remove entirely if client prefers fixed colors.
@media (prefers-color-scheme: dark) {
  :root {
    --ei-chat-bg:    #1e1b18;
    --ei-bot-bg:     #2c2820;
    --ei-bot-text:   #f0ebe0;
    --ei-input-bg:   #252219;
    --ei-input-text: #f0ebe0;
    --ei-border:     #3a342c;
    --ei-footer-bg:  #1a1713;
    --ei-footer-text: #7a7068;
    --ei-option-bg:  #2c2820;
    --ei-option-text: #f0ebe0;
    --ei-option-border: #4a4038;
  }
}
*/

/* ============================================================
   SMARTBOT MODE (sb-*)
   ============================================================ */

/*
 * ============================================================
 * extendedIDEA — SmartBot Widget CSS v1.0
 * ============================================================
 * AI-powered FAQ + Lead Capture Widget
 * 
 * TO THEME FOR A NEW CLIENT:
 *   Override the variables in the :root block below.
 *   Everything else adapts automatically.
 * ============================================================
 */

/* ---- 1. THEME VARIABLES --------------------------------- */
:root {
  /* Brand colors — neutral defaults; override per client */
  --sb-primary:        #334155;      /* slate */
  --sb-primary-hover:  #1e293b;
  --sb-primary-text:   #ffffff;

  /* Header */
  --sb-header-bg:      #1a1a2e;      /* deep navy */
  --sb-header-fg:      #f0f0f5;

  /* Chat area */
  --sb-chat-bg:        #f8f8fa;
  --sb-border:         #e2e2ea;

  /* Bot bubble */
  --sb-bot-bg:         #ffffff;
  --sb-bot-text:       #1a1a2e;
  --sb-bot-border:     #e2e2ea;

  /* User bubble */
  --sb-user-bg:        var(--sb-primary);
  --sb-user-text:      #ffffff;

  /* Input */
  --sb-input-bg:       #ffffff;
  --sb-input-text:     #1a1a2e;
  --sb-input-border:   var(--sb-border);

  /* Toggle button */
  --sb-toggle-bg:      var(--sb-primary);
  --sb-toggle-text:    #ffffff;

  /* Footer */
  --sb-footer-bg:      #f0f0f5;
  --sb-footer-text:    #8a8a9a;
  --sb-footer-link:    var(--sb-primary);

  /* Lead form */
  --sb-form-bg:        #ffffff;
  --sb-form-border:    #d0d0da;
  --sb-form-focus:     var(--sb-primary);

  /* Typography */
  --sb-font-body:      -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --sb-font-size-base: 14px;
  --sb-font-size-sm:   12px;

  /* Sizing */
  --sb-widget-width:   370px;
  --sb-widget-height:  min(600px, calc(100vh - 120px));  /* mobile: section 11 */
  --sb-radius:         16px;
  --sb-radius-bubble:  12px;
  --sb-radius-toggle:  28px;
  --sb-shadow:         0 20px 60px rgba(0, 0, 0, 0.15), 0 4px 20px rgba(0, 0, 0, 0.08);
  --sb-z-index:        9999;

  /* Transitions */
  --sb-transition:     0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- 2. TOGGLE BUTTON ----------------------------------- */
#sb-chat-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: var(--sb-z-index);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px 12px 14px;
  background: var(--sb-toggle-bg);
  color: var(--sb-toggle-text);
  border: none;
  border-radius: var(--sb-radius-toggle);
  font-family: var(--sb-font-body);
  font-size: var(--sb-font-size-base);
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.30);
  transition: transform var(--sb-transition), box-shadow var(--sb-transition), background var(--sb-transition);
  letter-spacing: 0.01em;
}

#sb-chat-toggle:hover {
  background: var(--sb-primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 28px rgba(15, 23, 42, 0.40);
}

#sb-toggle-label {
  white-space: nowrap;
}

/* ---- 3. WIDGET CONTAINER -------------------------------- */
#sb-widget {
  position: fixed;
  bottom: 84px;
  right: 24px;
  z-index: var(--sb-z-index);
  width: var(--sb-widget-width);
  height: var(--sb-widget-height);
  background: var(--sb-chat-bg);
  border-radius: var(--sb-radius);
  box-shadow: var(--sb-shadow);
  display: flex;
  flex-direction: column;
  font-family: var(--sb-font-body);
  font-size: var(--sb-font-size-base);
  overflow: hidden;
  border: 1px solid var(--sb-border);

  opacity: 0;
  pointer-events: none;
  transform: translateY(16px) scale(0.97);
  transform-origin: bottom right;
  transition:
    opacity var(--sb-transition),
    transform var(--sb-transition);
}

#sb-widget.sb-open {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0) scale(1);
}

/* ---- 4. HEADER ------------------------------------------ */
#sb-header {
  background: var(--sb-header-bg);
  color: var(--sb-header-fg);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

#sb-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sb-logo {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid rgba(255,255,255,0.12);
}

.sb-logo-placeholder {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--sb-primary);
  color: #fff;
  font-family: var(--sb-font-body);
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

#sb-header-text {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

#sb-header-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

#sb-header-subtitle {
  font-size: 11px;
  color: rgba(240, 240, 245, 0.6);
}

#sb-header-status {
  font-size: 11px;
  color: rgba(240, 240, 245, 0.7);
  display: flex;
  align-items: center;
  gap: 5px;
}

.sb-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #34d399;
  display: inline-block;
  animation: sb-pulse 2.2s ease-in-out infinite;
}

@keyframes sb-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}

/* ---- 5. MESSAGES AREA ----------------------------------- */
#sb-messages {
  flex: 1;
  padding: 16px 14px 8px;
  overflow-y: auto;
  scroll-behavior: smooth;
  background: var(--sb-chat-bg);
}

#sb-messages::-webkit-scrollbar {
  width: 4px;
}
#sb-messages::-webkit-scrollbar-track {
  background: transparent;
}
#sb-messages::-webkit-scrollbar-thumb {
  background: var(--sb-border);
  border-radius: 4px;
}

/* ---- 6. BUBBLES ----------------------------------------- */
.sb-bot,
.sb-user {
  padding: 10px 14px;
  border-radius: var(--sb-radius-bubble);
  margin-bottom: 8px;
  max-width: 85%;
  line-height: 1.55;
  font-size: var(--sb-font-size-base);
  word-break: break-word;
  animation: sb-bubble-in 0.2s ease both;
}

@keyframes sb-bubble-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.sb-bot {
  background: var(--sb-bot-bg);
  color: var(--sb-bot-text);
  border: 1px solid var(--sb-bot-border);
  border-bottom-left-radius: 4px;
}

.sb-user {
  background: var(--sb-user-bg);
  color: var(--sb-user-text);
  margin-left: auto;
  border-bottom-right-radius: 4px;
}

/* ---- 7. TYPING INDICATOR -------------------------------- */
.sb-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 12px 14px;
  width: fit-content;
  min-width: 52px;
}

.sb-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #b0b0be;
  display: inline-block;
  animation: sb-bounce 1.2s infinite ease-in-out;
}

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

@keyframes sb-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.5; }
  40%           { transform: translateY(-5px); opacity: 1; }
}

/* ---- 8. INPUT AREA -------------------------------------- */
#sb-input-area {
  display: flex;
  align-items: center;
  border-top: 1px solid var(--sb-input-border);
  background: var(--sb-input-bg);
  flex-shrink: 0;
  padding: 4px 6px 4px 0;
}

#sb-chat-input {
  flex: 1;
  padding: 12px 12px;
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--sb-font-body);
  font-size: var(--sb-font-size-base);
  color: var(--sb-input-text);
}

#sb-chat-input::placeholder {
  color: #b0b0be;
}

#sb-chat-input:disabled {
  opacity: 0.5;
}

#sb-send-btn {
  background: var(--sb-primary);
  color: var(--sb-primary-text);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-right: 4px;
  flex-shrink: 0;
  transition: background var(--sb-transition), transform 0.15s ease;
}

#sb-send-btn:hover {
  background: var(--sb-primary-hover);
  transform: scale(1.06);
}

#sb-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ---- 9. LEAD CAPTURE FORM ------------------------------ */
/* While the form is open it takes over the widget: chat messages and the
   chat input are hidden, and come back when the form is removed (×,
   "No thanks", or a successful submit).
   Layout: fixed .sb-form-head (intro + ×) / scrolling .sb-form-body /
   fixed .sb-form-actions. Only the body scrolls, so ×, submit and
   "No thanks" are always on screen. */
#sb-widget:has(#sb-lead-form) #sb-messages,
#sb-widget:has(#sb-lead-form) #sb-input-area {
  display: none;
}

#sb-lead-form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  padding: 14px 14px 10px;
  background: var(--sb-form-bg);
  border-top: 1px solid var(--sb-border);
  animation: sb-bubble-in 0.25s ease both;
}

.sb-form-head {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  flex-shrink: 0;
  margin-bottom: 8px;
}

#sb-lead-form .sb-form-head p {
  flex: 1;
  margin: 0;
}

.sb-form-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.sb-form-actions {
  flex-shrink: 0;
  padding-top: 8px;
}

#sb-lead-close {
  flex-shrink: 0;
  margin: -6px -6px 0 0;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--sb-footer-text);
  font-size: 20px;
  line-height: 28px;
  cursor: pointer;
}

#sb-lead-close:hover,
#sb-lead-close:focus-visible {
  color: var(--sb-primary);
  background: var(--sb-chat-bg);
}

#sb-lead-form p {
  margin: 0 0 10px 0;
  font-size: var(--sb-font-size-sm);
  color: var(--sb-footer-text);
  line-height: 1.4;
}

.sb-form-input {
  width: 100%;
  min-height: 40px;           /* tap target */
  padding: 8px 11px;
  border: 1px solid var(--sb-form-border);
  border-radius: 8px;
  font-family: var(--sb-font-body);
  font-size: 13px;
  color: var(--sb-input-text);
  background: var(--sb-input-bg);
  margin-bottom: 8px;
  box-sizing: border-box;
  outline: none;
  transition: border-color var(--sb-transition);
}

.sb-form-input:focus {
  border-color: var(--sb-form-focus);
}

.sb-form-input::placeholder {
  color: #b0b0be;
}

/* ~60px per field: 14px label + 3px gap + 40px input + 6px gap */
.sb-form-field {
  margin-bottom: 6px;
}

.sb-form-field:last-of-type {
  margin-bottom: 0;  /* no 6px of pointless scroll when everything fits */
}

.sb-form-field .sb-form-input {
  margin-bottom: 0;
}

.sb-form-label {
  display: block;
  margin: 0 0 3px 2px;
  font-size: var(--sb-font-size-sm);
  line-height: 14px;
  color: var(--sb-input-text);
}

.sb-form-optional {
  color: var(--sb-footer-text);
}

.sb-form-input.sb-invalid {
  border-color: #e53e3e;
}

#sb-lead-form .sb-form-error {
  margin: 4px 0 0 2px;
  color: #c53030;
  font-size: var(--sb-font-size-sm);
}

#sb-lead-submit {
  width: 100%;
  padding: 10px;
  background: var(--sb-primary);
  color: var(--sb-primary-text);
  border: none;
  border-radius: 8px;
  font-family: var(--sb-font-body);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--sb-transition);
}

#sb-lead-submit:hover {
  background: var(--sb-primary-hover);
}

#sb-lead-dismiss {
  width: 100%;
  padding: 6px;
  background: transparent;
  color: var(--sb-footer-text);
  border: none;
  font-family: var(--sb-font-body);
  font-size: var(--sb-font-size-sm);
  cursor: pointer;
  margin-top: 4px;
}

#sb-lead-dismiss:hover {
  color: var(--sb-primary);
}

/* ---- 10. FOOTER ----------------------------------------- */
#sb-footer {
  background: var(--sb-footer-bg);
  border-top: 1px solid var(--sb-border);
  padding: 6px 14px;
  text-align: center;
  font-size: var(--sb-font-size-sm);
  color: var(--sb-footer-text);
  flex-shrink: 0;
}

#sb-footer a {
  color: var(--sb-footer-link);
  text-decoration: none;
  font-weight: 600;
}

#sb-footer a:hover {
  text-decoration: underline;
}

/* ---- 11. RESPONSIVE ------------------------------------- */
@media (max-width: 480px) {
  #sb-widget {
    width: calc(100vw - 20px);
    right: 10px;
    bottom: 76px;
    height: min(540px, calc(100dvh - 100px));
    border-radius: 12px;
  }

  #sb-chat-toggle {
    right: 12px;
    bottom: 16px;
    padding: 11px 16px 11px 14px;
  }

  /* iOS zooms the page when focusing an input under 16px */
  #sb-chat-input,
  .sb-form-input {
    font-size: 16px;
  }
}


/* ---- 12. ACCESSIBILITY ---------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
/* ---- APPEND THIS TO THE END OF smartbot.css --------------- */

/* ---- 13. SUGGESTION BUTTONS ----------------------------- */
#sb-suggestions-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 0 8px;
  animation: sb-bubble-in 0.2s ease both;
}

.sb-suggestion-btn {
  background: transparent;
  color: var(--sb-primary);
  border: 1.5px solid var(--sb-primary);
  border-radius: 18px;
  padding: 6px 14px;
  font-family: var(--sb-font-body);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--sb-transition), color var(--sb-transition), transform 0.12s ease;
  white-space: nowrap;
  line-height: 1.3;
}

.sb-suggestion-btn:hover {
  background: var(--sb-primary);
  color: #ffffff;
  transform: translateY(-1px);
}

.sb-suggestion-btn:active {
  transform: scale(0.97);
}
