/* Scopnatic Service Assistant widget.
   Uses the site's existing palette (--theme-color-dark #1a3841, green #1a4137,
   buttons #144891) and typography so it does not introduce a new visual style. */

.scopnatic-chatbot {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 9998;
  font-family: inherit;
}

.chatbot-launcher {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  border: 0;
  border-radius: 50%;
  background: var(--theme-color1, #144891);
  color: #ffffff;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(20, 30, 40, 0.28);
  transition: transform 0.25s ease, background 0.25s ease;
}

.chatbot-launcher:hover {
  transform: translateY(-3px);
  background: var(--theme-color-dark, #1a3841);
}

.scopnatic-chatbot.open .chatbot-launcher .fa-comment-dots {
  display: none;
}

.scopnatic-chatbot.open .chatbot-launcher .fa-xmark {
  display: inline-block;
}

.chatbot-launcher .fa-comment-dots {
  display: inline-block;
}

.chatbot-launcher .fa-xmark {
  display: none;
}

.chatbot-panel {
  position: absolute;
  right: 0;
  bottom: 70px;
  width: 370px;
  max-width: calc(100vw - 32px);
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 22px 55px rgba(20, 30, 40, 0.26);
  border: 1px solid #e8ecef;
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  transform-origin: bottom right;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  color: var(--theme-color-dark, #1a3841);
}

.scopnatic-chatbot.open .chatbot-panel {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Header */
.chatbot-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: var(--theme-color-dark, #1a3841);
  color: #ffffff;
  border-bottom: 3px solid var(--theme-color1, #144891);
}

.chatbot-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.chatbot-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #1a4137;
  color: #ffffff;
  font-size: 18px;
}

.chatbot-title {
  margin: 0;
  font-size: 16px;
  line-height: 1.2;
  color: #ffffff;
}

.chatbot-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.82);
}

.chatbot-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4cd964;
  box-shadow: 0 0 0 3px rgba(76, 217, 100, 0.25);
}

.chatbot-close {
  background: none;
  border: 0;
  color: rgba(255, 255, 255, 0.85);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  transition: color 0.2s ease, background 0.2s ease;
}

.chatbot-close:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
}

/* Messages area */
.chatbot-body {
  flex: 1 1 auto;
  height: 320px;
  overflow-y: auto;
  background: var(--theme-color-gray2, #f8f5f2);
  padding: 16px 14px;
}

.chatbot-messages {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 12px;
  min-height: 100%;
}

.chatbot-bubble {
  display: flex;
  animation: chatbot-pop-in 0.25s ease;
}

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

.chatbot-bubble.assistant {
  align-items: flex-start;
  gap: 8px;
}

.chatbot-bubble .chatbot-bubble-inner {
  max-width: 85%;
  padding: 11px 15px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.6;
  font-weight: 400;
  word-break: break-word;
}

.chatbot-bubble.user .chatbot-bubble-inner {
  background: var(--theme-color1, #144891);
  color: #ffffff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 10px rgba(20, 72, 145, 0.18);
}

.chatbot-bubble.assistant .chatbot-bubble-inner {
  background: #ffffff;
  color: var(--theme-color-dark, #1a3841);
  border: 1px solid #e9edf0;
  border-bottom-left-radius: 4px;
  white-space: pre-wrap;
  box-shadow: 0 4px 12px rgba(20, 30, 40, 0.07);
  font-family: Cambria, Cochin, Georgia, Times, serif;
  font-size: 13px;
}

/* Typography for formatted assistant replies. Scoped to the assistant bubble
   content so the widget's look stays unchanged; only the generated paragraphs,
   lists, headings and bold runs inside replies are styled. */
.chatbot-bubble.assistant .chatbot-bubble-inner p,
.chatbot-bubble.assistant .chatbot-bubble-inner ul,
.chatbot-bubble.assistant .chatbot-bubble-inner ol {
  margin: 0 0 6px;
  /* font-family: Cambria, Cochin, Georgia, Times, serif; */
  font-size: 16px;
}

.chatbot-bubble.assistant .chatbot-bubble-inner p:last-child,
.chatbot-bubble.assistant .chatbot-bubble-inner ul:last-child,
.chatbot-bubble.assistant .chatbot-bubble-inner ol:last-child {
  margin-bottom: 0;
}

.chatbot-bubble.assistant .chatbot-bubble-inner ul,
.chatbot-bubble.assistant .chatbot-bubble-inner ol {
  padding-left: 18px;
  margin-right: 0;
}

.chatbot-bubble.assistant .chatbot-bubble-inner ul {
  list-style: disc;
}

.chatbot-bubble.assistant .chatbot-bubble-inner ol {
  list-style: decimal;
}

.chatbot-bubble.assistant .chatbot-bubble-inner li {
  margin: 0 0 3px;
  line-height: 1.5;
  font-family: Cambria, Cochin, Georgia, Times, serif;
  font-size: 13px;
}

.chatbot-bubble.assistant .chatbot-bubble-inner li:last-child {
  margin-bottom: 0;
}

.chatbot-bubble.assistant .chatbot-bubble-inner strong {
  font-weight: 600;
}

.chatbot-bubble.assistant .chatbot-bubble-inner .chatbot-reply-heading {
  font-weight: 600;
}

.chatbot-bubble.assistant .chatbot-bubble-inner br + br {
  display: none;
}

.chatbot-msg-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--theme-color-dark, #1a3841);
  color: #ffffff;
  font-size: 13px;
}

/* Typing / bouncing balls indicator */
.chatbot-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  background: #ffffff;
}

.typing-ball {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9aa3ab;
  animation: chatbot-bounce 1.2s infinite ease-in-out;
}

.typing-ball:nth-child(2) {
  animation-delay: 0.15s;
}

.typing-ball:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes chatbot-bounce {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.45;
  }
  30% {
    transform: translateY(-6px);
    opacity: 1;
  }
}

@keyframes chatbot-pop-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* WhatsApp handoff */
.chatbot-handoff {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.chatbot-whatsapp-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  padding: 10px 16px;
  border-radius: 10px;
  background: #25d366;
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 5px 14px rgba(37, 211, 102, 0.3);
  transition: filter 0.2s ease, transform 0.2s ease;
}

.chatbot-whatsapp-btn:hover {
  filter: brightness(0.95);
  transform: translateY(-1px);
  color: #ffffff;
}

/* Callback request form inside the handoff bubble */
.chatbot-callback {
  width: 100%;
}

.chatbot-callback-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: none;
  padding: 4px 2px;
  font-size: 13px;
  font-weight: 600;
  color: var(--theme-color1, #144891);
  cursor: pointer;
}

.chatbot-callback-toggle:hover {
  text-decoration: underline;
}

.chatbot-callback-form {
  display: grid;
  gap: 8px;
  margin-top: 4px;
  width: 100%;
}

.chatbot-callback-field {
  display: grid;
  gap: 3px;
  font-size: 12px;
  color: #6b757c;
}

.chatbot-callback-input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #e2e8ec;
  border-radius: 10px;
  background: var(--theme-color-gray2, #f8f5f2);
  padding: 8px 11px;
  font-size: 13px;
  color: var(--theme-color-dark, #1a3841);
  outline: none;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.chatbot-callback-input:focus {
  border-color: var(--theme-color1, #144891);
  background: #ffffff;
}

.chatbot-callback-submit {
  justify-content: center;
  margin-top: 2px;
  font-size: 13px;
}

.chatbot-callback-submit:disabled {
  opacity: 0.6;
  cursor: default;
  transform: none;
}

.chatbot-callback-status {
  font-size: 12px;
  line-height: 1.5;
  color: #6b757c;
}

.chatbot-callback-status.success {
  color: #1a7a45;
  font-weight: 600;
}

.chatbot-callback-status.error {
  color: #b3261e;
}

/* Footer / input area */
.chatbot-footer {
  flex: 0 0 auto;
  position: relative;
  background: #ffffff;
  border-top: 1px solid #ecf0f2;
  padding: 10px 14px 8px;
}

.chatbot-inputbar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chatbot-input {
  flex: 1 1 auto;
  min-width: 0;
  height: 42px;
  border: 1px solid #e2e8ec;
  border-radius: 21px;
  background: var(--theme-color-gray2, #f8f5f2);
  padding: 0 16px;
  font-size: 14px;
  color: var(--theme-color-dark, #1a3841);
  outline: none;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.chatbot-input::placeholder {
  color: #8a9299;
}

.chatbot-input:focus {
  border-color: var(--theme-color1, #144891);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(20, 72, 145, 0.12);
}

.chatbot-emoji-toggle,
.chatbot-send {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.chatbot-emoji-toggle {
  background: transparent;
  color: #6b757c;
  font-size: 19px;
}

.chatbot-emoji-toggle:hover,
.chatbot-emoji-toggle.active {
  color: var(--theme-color1, #144891);
}

.chatbot-send {
  background: var(--theme-color1, #144891);
  color: #ffffff;
  font-size: 16px;
  box-shadow: 0 5px 14px rgba(20, 72, 145, 0.3);
}

.chatbot-send:hover {
  background: var(--theme-color-dark, #1a3841);
  transform: translateY(-1px);
}

.chatbot-send:disabled {
  opacity: 0.55;
  cursor: default;
  transform: none;
}

/* Emoji picker */
.chatbot-emoji-panel {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: calc(100% - 6px);
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  padding: 10px;
  max-height: 170px;
  overflow-y: auto;
  background: #ffffff;
  border: 1px solid #e8ecef;
  border-radius: 12px;
  box-shadow: 0 -6px 25px rgba(20, 30, 40, 0.14);
  z-index: 5;
}

.chatbot-emoji-panel button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease;
}

.chatbot-emoji-panel button:hover {
  background: var(--theme-color-gray, #f1f1f2);
}

.chatbot-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin: 8px 0 0;
  font-size: 10.5px;
  color: #8a9299;
}

.chatbot-note i {
  font-size: 11px;
}

@media (max-width: 480px) {
  .scopnatic-chatbot {
    right: 16px;
    bottom: 16px;
  }

  .chatbot-panel {
    width: calc(100vw - 32px);
    bottom: 64px;
  }
}