.chat-wrapper {
  --primary-color: #6366f1;
  --secondary-color: #4f46e5;
  --background: #f8fafc;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.chat-wrapper .chat-toggle {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  border: none;
  background: transparent;
  color: white;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 0px;
}

.chat-wrapper .chat-toggle:hover {
  background: transparent;
  transform: scale(1.1);
}

.chat-wrapper .chat-toggle.hidden {
  display: none;
}

.chat-wrapper .chat-container {
  position: fixed;
  bottom: 6rem;
  right: 2rem;
  width: 360px;
  height: 70vh;
  max-height: 700px;
  background: white;
  border-radius: 1rem;
  box-shadow: var(--shadow);
  transform: translateY(20px);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  z-index: 9999;
}

.chat-wrapper .chat-container.open {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
}


.chat-wrapper .chat-header {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 1rem;
  background: var(--primary-color);
  border-radius: 1rem 1rem 0 0;
  color: white;
}

.chat-wrapper .chat-header h3 {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 0;
  color: white !important;
  font-size: 18px;
  line-height: 1.25;
  white-space: normal;
  word-break: break-word;
}

.chat-wrapper .chat-header-actions {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  flex-shrink: 0;
}

.chat-wrapper .close-button,
.chat-wrapper .maximize-button,
.chat-wrapper .new-chat-button {
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  padding: 0;
  cursor: pointer;
  opacity: 0.92;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s ease, opacity 0.2s ease, transform 0.2s ease;
}

.chat-wrapper .close-button:hover,
.chat-wrapper .maximize-button:hover,
.chat-wrapper .new-chat-button:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.22);
}

.chat-wrapper .new-chat-button:active,
.chat-wrapper .maximize-button:active,
.chat-wrapper .close-button:active {
  transform: scale(0.96);
}

.chat-wrapper .ai-avatar {
  background: white;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 0.75rem;
}

.chat-wrapper .ai-icon {
  color: var(--primary-color);
  font-size: 1.25rem;
}

.chat-wrapper .chat-messages {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
  background: var(--background);
}

.chat-wrapper .message-bubble {
  max-width: 80%;
  margin: 0.5rem 0;
  animation: fadeIn 0.3s ease;
  word-break: break-word;
}

/* Initial question chips */
.initial-questions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.25rem 0.5rem 0.5rem;
  align-items: flex-start;
}

.initial-question-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #fff;
  border: 1.5px solid;
  border-radius: 999px;
  padding: 0.45rem 1rem;
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
  line-height: 1.4;
  text-align: left;
  transition: background 0.18s ease, color 0.18s ease, transform 0.15s ease, box-shadow 0.18s ease;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
  animation: fadeIn 0.3s ease;
}

.initial-question-chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.initial-question-chip:active {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.chip-icon {
  font-size: 0.9em;
  flex-shrink: 0;
}

.chat-wrapper .message-bubble.user {
  margin-left: auto;
}

.chat-wrapper .message-content {
  font-size: 18px;
  padding: 0.75rem 1rem;
  border-radius: 1rem;
  background: var(--primary-color);
  color: white;
  overflow-wrap: break-word;
  /* Modern replacement for word-wrap */
  white-space: pre-wrap;
  /* Preserve spaces and wrap text naturally */
  word-break: break-word;
  /* Break long words to prevent overflow */
  /* 	line-height:20px; */
}

.message-bubble.bot .message-content {
  background: white;
  color: var(--text-primary);
  box-shadow: var(--shadow);
  display: block;
  overflow-wrap: break-word;
  /* Ensure wrapping for bot messages */
  white-space: pre-wrap;
  /* Preserve spaces and wrap text */
  word-break: break-word;
  /* Break long words */
  align-items: flex-start;
}

/* Bot logo/icon inside message bubble */
.bot-icon {
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: 7px;
}

.typing-indicator {
  display: flex;
  padding: 1rem;
  justify-content: center;
}

.chat-wrapper .dot {
  width: 8px;
  height: 8px;
  margin: 0 4px;
  background: var(--text-secondary);
  border-radius: 50%;
  animation: typingPulse 1.4s infinite ease-in-out;
}

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

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

.chat-wrapper .message-form {
  display: flex;
  padding: 1rem;
  border-top: 1px solid #e2e8f0;
  gap: 0.5rem;
  align-items: center;
}

.chat-wrapper .message-form input {
  flex: 1;
  padding: .5rem 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  font-size: 14px;
  transition: border-color 0.2s ease;
  margin-bottom: 0px !important;
}

.message-form input:focus {
  outline: none;
}

.chat-wrapper .send-button {
  background: var(--primary-color);
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 0.75rem;
  color: white;
  cursor: pointer;
  transition: background 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0px
}

.send-button:hover {
  background: var(--secondary-color);
}

.send-button:disabled {
  opacity: 0.8;
  cursor: not-allowed;
}

.hello-help-text {
  position: fixed;
  bottom: 6rem;
  right: 2rem;
  border-radius: 0.75rem;
  box-shadow: var(--shadow);
  background: #fff;
  font-size: 16px;
  padding: 5px 20px;
  cursor: pointer;
  /* Show clickable hand cursor */
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 1000;
}

.chatbot-footer-text {
  font-size: 11px;
  text-align: center;
  padding: 0px 12px 10px;
  color: gray;
  line-height: 18px;
}


.message-bubble.bot .message-content {
  width: fit-content;
}

.message-bubble.user .message-content {
  width: fit-content;
}

.message-bubble.user {
  display: flex;
  justify-content: end;
}

.message-content a {
  color: #2563eb;
  text-decoration: underline;
  background: transparent;
  padding: 0;
  display: inline;
  font-weight: normal;
}

.message-content a:hover {
  color: #1d4ed8;
}

.message-content a.chatbot-custom-link {
  color: #fff;
  background-color: #e62129;
  padding: 6px 12px;
  display: inline-block;
  font-weight: bold;
  border-radius: 6px;
  text-decoration: none;
  transition: all 0.2s ease;
  font-size: 13px;
  line-height: 1.2;
}

.message-content a.chatbot-custom-link:hover {
  color: #000;
  opacity: 0.9;
}

/* Disabled badge shown after appointment is booked */
.message-content .chatbot-booked-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background-color: #1a7f37;
  color: #fff;
  padding: 6px 12px;
  border-radius: 6px;
  font-weight: bold;
  font-size: 13px;
  line-height: 1.2;
  cursor: default;
  user-select: none;
  opacity: 0.9;
}

.chat-container.open.maximized {
  width: 100%;
  height: 100%;
  bottom: 0;
  right: 0;
  border-radius: 0px !important;
  min-height: 100%;
}

.chat-container.open.maximized header.chat-header {
  border-radius: 0px !important;
}

.chat-container.open.maximized button.chat-toggle {
  display: none;
}

/* @keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
 
@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-1px); }
} */

@keyframes typingPulse {

  0%,
  80%,
  100% {
    transform: scale(0.8);
    opacity: 0.4;
  }

  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
  .chat-container {
    width: 90%;
    height: 55vh;
    bottom: 5rem;
  }

  .chat-header {
    padding: 0.75rem;
  }

  .ai-avatar {
    width: 30px;
    height: 30px;
  }

  .ai-icon {
    font-size: 1.1rem;
  }

  .message-content {
    font-size: 16px;
    padding: 0.5rem 0.75rem;
  }

  .message-form input {
    font-size: 12px;
    padding: 0.5rem 0.75rem;
  }

  .send-button {
    width: 35px;
    height: 35px;
  }

  .send-button:hover {
    background: var(--primary-color);
  }

  .chat-container.open {
    width: 100%;
    right: 0;
    height: 100%;
    bottom: 0;
    min-height: 100%;
  }

  header.chat-header {
    border-radius: 0px !important;
  }

  .chat-wrapper .chat-header {
    justify-content: space-between;
  }

  button.maximize-button {
    display: none;
  }
}

@media (max-width: 480px) {
  .chat-toggle {
    width: 50px;
    height: 50px;
  }

  .chat-container {
    bottom: 6rem;
    width: 70%;
    height: 45vh;
  }

  .message-form input {
    font-size: 14px;
    padding: 0.5rem;
  }

  .send-button {
    width: 38px;
    height: 38px;
  }

  .ai-avatar {
    width: 28px;
    height: 28px;
  }

  .chat-container.open {
    width: 100%;
    right: 0;
    height: 100%;
    bottom: 0;
    min-height: 100%;
  }

  header.chat-header {
    border-radius: 0px !important;
  }

  .chat-wrapper .chat-header {
    justify-content: space-between;
  }

  button.maximize-button {
    display: none;
  }
}

/* IPad media query start here */
@media (min-width: 768px) and (max-width: 1024px) {
  .chat-container.open {
    width: 75%;
  }

  .chat-container.open.maximized {
    width: 100%;
    top: 0;
    right: 0;
    min-height: 100%;
  }
}

.history-loading-indicator svg {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ─── Lead Forms ──────────────────────────────────────────────────── */

.cb-lead-form {
  width: 100%;
  max-width: 315px;
  background: #fff;
  border-radius: 14px;
  border: 1px solid #e8eaf0;
  margin-top: 12px;
  overflow: hidden;
  animation: cbFormSlideIn 0.38s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

.cb-lead-form__header {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 13px 15px 12px;
  border-bottom: 1px solid #f1f3f7;
  background: linear-gradient(135deg, #fafbff 0%, #f8f9fc 100%);
}

.cb-lead-form__icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--cb-icon-bg, rgba(99, 102, 241, 0.10));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cb-lead-form__title {
  font-size: 13.5px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.cb-lead-form__subtitle {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 2px;
}

.cb-lead-form__body {
  padding: 14px 15px 16px;
}

.cb-lead-form__label {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  color: #475569;
  margin-top: 11px;
  margin-bottom: 5px;
  letter-spacing: 0.01em;
}

.cb-lead-form__label:first-child {
  margin-top: 0;
}

.cb-lead-form__label-optional {
  font-weight: 400;
  color: #b0b8c8;
  margin-left: 3px;
  font-size: 10.5px;
}

.cb-lead-form__input,
.cb-lead-form__select {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid #b4b4b4 !important;
  border-radius: 9px;
  font-size: 13px;
  font-family: inherit;
  color: #1e293b !important;
  background: #ffffff !important;
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  outline: none;
  appearance: auto;
  line-height: 1.4;
	margin-bottom:0px!important;
}

.cb-lead-form__input::placeholder {
  color: #878787;
  font-size: 12.5px;
}

.cb-lead-form__input:hover:not(:disabled),
.cb-lead-form__select:hover:not(:disabled) {
  border-color: #cbd5e1;
}

.cb-lead-form__input:focus,
.cb-lead-form__select:focus {
  border-color: var(--cb-accent, #6366f1);
  box-shadow: 0 0 0 3px var(--cb-focus-ring, rgba(99, 102, 241, 0.15));
  background: #ffffff !important;
}

.cb-lead-form__input--error,
.cb-lead-form__input--error:focus {
  border-color: #f87171 !important;
}

.cb-lead-form__input:disabled,
.cb-lead-form__select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: #f8fafc !important;
}

/* ── Custom inline service dropdown (replaces native <select>) ── */
.cb-custom-select {
  width: 100%;
  font-family: inherit;
  font-size: 13px;
}

.cb-custom-select__trigger {
  width: 100%;
  padding: 9px 11px;
  border:1px solid #b4b4b4 !important;
  font-size: 13px;
  font-family: inherit;
  color: #1e293b;
  background: #ffffff;
  box-sizing: border-box;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.cb-custom-select__trigger:hover:not(:disabled) {
  border-color: #cbd5e1;
}

.cb-custom-select--open .cb-custom-select__trigger {
  border-color: var(--cb-accent, #6366f1);
  box-shadow: 0 0 0 3px var(--cb-focus-ring, rgba(99,102,241,0.15));
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.cb-custom-select--error .cb-custom-select__trigger {
  border-color: #f87171 !important;
}

.cb-custom-select__placeholder {
  color: #c1c9d8;
}

.cb-custom-select__arrow {
  flex-shrink: 0;
  color: #94a3b8;
  transition: transform 0.15s ease;
}

.cb-custom-select--open .cb-custom-select__arrow {
  transform: rotate(180deg);
}

/* Inline list — no absolute positioning, pushes content down */
.cb-custom-select__options {
  width: 100%;
  background: #ffffff;
  border: 1.5px solid var(--cb-accent, #6366f1);
  border-top: none;
  border-bottom-left-radius: 9px;
  border-bottom-right-radius: 9px;
  margin: 0;
  padding: 4px 0;
  list-style: none;
  box-shadow: 0 4px 10px rgba(0,0,0,0.08);
  box-sizing: border-box;
}

.cb-custom-select__option {
  padding: 8px 11px;
  font-size: 13px;
  color: #1e293b;
  cursor: pointer;
  transition: background 0.1s ease;
}

.cb-custom-select__option:hover {
  background: var(--cb-icon-bg, rgba(99,102,241,0.08));
}

.cb-custom-select__option--active {
  background: var(--cb-icon-bg, rgba(99,102,241,0.12));
  color: var(--cb-accent, #6366f1);
  font-weight: 500;
}

.cb-custom-select--disabled .cb-custom-select__trigger {
  opacity: 0.5;
  cursor: not-allowed;
  background: #f8fafc;
}

.cb-lead-form__input:-webkit-autofill,
.cb-lead-form__input:-webkit-autofill:hover,
.cb-lead-form__input:-webkit-autofill:focus,
.cb-lead-form__input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0px 9999px #ffffff inset !important;
  box-shadow: 0 0 0px 9999px #ffffff inset !important;
  -webkit-text-fill-color: #1e293b !important;
  caret-color: #1e293b !important;
  transition: background-color 99999s ease-in-out 0s !important;
}

.cb-lead-form__field-error {
  display: block;
  font-size: 11px;
  color: #ef4444;
  margin-top: 4px;
  line-height: 1.3;
}

.cb-lead-form__btn {
  width: 100%;
  padding: 12px 14px;
  border: none;
  background: #ed1c24;
  color: var(--cb-btn-color, #fff);
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
  margin-top: 16px;
  font-family: inherit;
  letter-spacing: 0.02em;
  transition: opacity 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
  box-shadow: 0 2px 8px var(--cb-focus-ring, rgba(99,102,241,0.3));
}

.cb-lead-form__btn:hover:not(:disabled) {
  opacity: 0.9;
  box-shadow: 0 4px 14px var(--cb-focus-ring, rgba(99,102,241,0.4));
}

.cb-lead-form__btn:active:not(:disabled) {
  transform: scale(0.98);
  opacity: 1;
}

.cb-lead-form__btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.cb-lead-form__error {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  color: #dc2626;
  background: #fef2f2;
  border: 1px solid #fecaca;
  padding: 8px 11px;
  border-radius: 8px;
  font-size: 12px;
  margin-top: 12px;
  line-height: 1.4;
}

/* Success */
.cb-lead-form__success {
  padding: 26px 16px;
  text-align: center;
  animation: cbSuccessPop 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes cbSuccessPop {
  from { opacity: 0; transform: scale(0.85); }
  to   { opacity: 1; transform: scale(1);    }
}

.cb-lead-form__success-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #ecfdf5;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  box-shadow: 0 0 0 6px rgba(5, 150, 105, 0.08);
}

.cb-lead-form__success-title {
  font-size: 14px;
  font-weight: 700;
  color: #065f46;
  letter-spacing: -0.01em;
}

.cb-lead-form__success-msg {
  font-size: 12px;
  color: #6b7280;
  margin-top: 6px;
  line-height: 1.55;
  max-width: 220px;
  margin-left: auto;
  margin-right: auto;
}

/* ── Service Checkbox Group ────────────────────────────── */
.cb-checkbox-group {
  display: flex;
    flex-direction: column;
  gap: 6px 8px;
  padding: 10px 12px;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  background: #fafbff;
  margin-top: 2px;
  transition: border-color 0.2s ease;
}
.cb-checkbox-group input.cb-checkbox-input {
    padding: 8px!important;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cb-checkbox-group--error {
  border-color: #ef4444;
  background: #fff5f5;
}

.cb-checkbox-group--disabled {
  opacity: 0.5;
  pointer-events: none;
}

.cb-checkbox-item {
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  padding: 5px 6px;
  border-radius: 7px;
  transition: background 0.15s ease;
  font-size: 12.5px;
  color: #1e293b;
  user-select: none;
}

.cb-checkbox-item:hover {
  background: #ebebeb;
}

.cb-checkbox-input {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 2px solid #cbd5e1;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
  position: relative;
}

.cb-checkbox-input:checked {
  background: var(--cb-accent, #6366f1);
  border-color: var(--cb-accent, #6366f1);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.cb-checkbox-input:checked::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 1px;
  width: 5px;
  height: 9px;
  border: 2px solid #fff;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}

.cb-checkbox-input:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.cb-checkbox-label {
  line-height: 1.3;
}

/* "Other" text-input row — spans full width */
.cb-checkbox-other-wrap {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-top: 6px;
  border-top: 1px dashed #e2e8f0;
  margin-top: 4px;
}

.cb-checkbox-other-label {
  font-size: 11.5px !important;
  color: #000 !important;
  font-weight: 600 !important;
  margin: 0 !important;
}