/* =========================================================
   FAHAD SEO AGENCY — PRODUCTION CHATBOT
   Isolated selectors: does not depend on the main website CSS.
   ========================================================= */

.chat-button,
.chat-window,
.chat-window *,
.lead-form-window,
.lead-form-window * {
  box-sizing: border-box;
}

.chat-button {
  position: fixed;
  right: 24px;
  bottom: 88px;
  width: 60px;
  height: 60px;
  border: 0;
  border-radius: 50%;
  background: #081b35;
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 25px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 12px 32px rgba(8, 27, 53, .28);
  z-index: 10000;
  transition: transform .2s ease, background .2s ease;
}

.chat-button:hover {
  transform: translateY(-2px) scale(1.04);
  background: #ef1d2d;
}

.chat-button:focus-visible,
.chat-window button:focus-visible,
.lead-form-window button:focus-visible,
.lead-form-window a:focus-visible {
  outline: 3px solid rgba(239, 29, 45, .28);
  outline-offset: 2px;
}

.chat-window,
.lead-form-window {
  position: fixed;
  right: 24px;
  bottom: 158px;
  width: 380px;
  max-width: calc(100vw - 32px);
  background: #fff;
  border: 1px solid rgba(8, 27, 53, .10);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 24px 70px rgba(8, 27, 53, .22);
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(12px) scale(.98);
  transition: opacity .18s ease, transform .18s ease, visibility .18s ease;
  z-index: 10001;
}

.chat-window {
  height: min(590px, calc(100vh - 185px));
}

.lead-form-window {
  max-height: min(680px, calc(100vh - 185px));
}

.chat-window.is-open,
.lead-form-window.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* Header */

.chat-header,
.lead-form-header {
  flex: 0 0 auto;
  background: #081b35;
  color: #fff;
  padding: 17px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
}

.chat-header strong,
.lead-form-header strong {
  display: block;
  font-size: 17px;
  line-height: 1.25;
}

.chat-header span,
.lead-form-header span {
  display: block;
  margin-top: 4px;
  color: #72f2a3;
  font-size: 11px;
  font-weight: 600;
}

.chat-header button,
.lead-form-header button {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: rgba(255,255,255,.08);
  color: #fff;
  font-size: 25px;
  line-height: 1;
  cursor: pointer;
}

/* AI messages */

.messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 17px;
  background: #f7f9fc;
  overscroll-behavior: contain;
}

.message {
  display: flex;
  margin: 0 0 12px;
}

.message.bot {
  justify-content: flex-start;
}

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

.bubble {
  max-width: 84%;
  padding: 11px 13px;
  border-radius: 15px;
  font-size: 13px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.bot .bubble {
  background: #fff;
  border: 1px solid #e4e8ee;
  color: #182230;
  border-bottom-left-radius: 5px;
}

.user .bubble {
  background: #081b35;
  color: #fff;
  border-bottom-right-radius: 5px;
}

.typing-bubble {
  display: flex;
  gap: 4px;
  align-items: center;
  min-width: 48px;
}

.typing-bubble span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #7b8797;
  animation: chatbotTyping 1.1s infinite ease-in-out;
}

.typing-bubble span:nth-child(2) { animation-delay: .12s; }
.typing-bubble span:nth-child(3) { animation-delay: .24s; }

@keyframes chatbotTyping {
  0%, 60%, 100% { transform: translateY(0); opacity: .45; }
  30% { transform: translateY(-3px); opacity: 1; }
}

/* Quick actions */

.quick-buttons {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 12px;
  border-top: 1px solid #e8ebf0;
  background: #fff;
}

.quick-buttons button {
  border: 1px solid #d8dee7;
  background: #fff;
  color: #243044;
  padding: 7px 10px;
  border-radius: 999px;
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}

.quick-buttons button:hover {
  border-color: #ef1d2d;
  color: #ef1d2d;
}

/* Chat input */

.chat-form {
  flex: 0 0 auto;
  display: flex;
  min-width: 0;
  border-top: 1px solid #e8ebf0;
  background: #fff;
}

.chat-form input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  padding: 14px;
  color: #1f2937;
  font: inherit;
  font-size: 13px;
}

.chat-form button {
  flex: 0 0 52px;
  border: 0;
  background: #081b35;
  color: #fff;
  font-size: 19px;
  cursor: pointer;
}

/* Quote form */

.lead-form-window {
  overflow: hidden;
}

#leadForm {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 18px;
  overscroll-behavior: contain;
}

#leadForm input,
#leadForm select,
#leadForm textarea {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 0 0 11px;
  padding: 12px 13px;
  border: 1px solid #ccd4df;
  border-radius: 9px;
  background: #fff;
  color: #182230;
  outline: none;
  font: inherit;
  font-size: 13px;
  transition: border-color .15s ease, box-shadow .15s ease;
}

#leadForm input,
#leadForm select {
  height: 43px;
}

#leadForm textarea {
  min-height: 102px;
  resize: vertical;
}

#leadForm input:focus,
#leadForm select:focus,
#leadForm textarea:focus {
  border-color: #081b35;
  box-shadow: 0 0 0 3px rgba(8, 27, 53, .07);
}

#leadForm input:invalid:not(:placeholder-shown) {
  border-color: #ef1d2d;
}

.submit-lead {
  width: 100%;
  min-height: 45px;
  border: 0;
  border-radius: 9px;
  background: #081b35;
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s ease, transform .15s ease;
}

.submit-lead:hover:not(:disabled) {
  background: #ef1d2d;
  transform: translateY(-1px);
}

.submit-lead:disabled {
  opacity: .65;
  cursor: wait;
}

.lead-form-window #leadForm.is-complete {
  display: none;
}

/* Result */

.lead-result {
  display: none;
  flex: 0 0 auto;
  margin: 0 18px 18px;
  padding: 14px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.lead-result.is-visible {
  display: block;
}

.lead-result p {
  margin: 5px 0 13px;
}

.lead-result.is-loading {
  background: #f3f6fa;
  color: #3b4758;
  border: 1px solid #e1e7ef;
}

.lead-result.is-error {
  background: #fff1f2;
  color: #9f1239;
  border: 1px solid #fecdd3;
}

.lead-result.is-success {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.lead-success-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.whatsapp-lead-button,
.secondary-lead-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 9px 12px;
  border-radius: 8px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.whatsapp-lead-button {
  background: #25d366;
  color: #fff;
}

.whatsapp-lead-button:hover {
  background: #1ebe5d;
}

.secondary-lead-button {
  border: 1px solid #cfd7e2;
  background: #fff;
  color: #1f2937;
}

/* Hidden honeypot */

#leadWebsiteTrap {
  position: absolute !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Mobile */

@media (max-width: 600px) {
  .chat-button {
    right: 14px;
    bottom: 78px;
    width: 56px;
    height: 56px;
  }

  .chat-window,
  .lead-form-window {
    right: 10px;
    bottom: 84px;
    width: calc(100vw - 20px);
    max-width: none;
  }

  .chat-window {
    height: min(650px, calc(100vh - 105px));
  }

  .lead-form-window {
    max-height: calc(100vh - 105px);
  }

  .lead-success-actions {
    flex-direction: column;
  }

  .whatsapp-lead-button,
  .secondary-lead-button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .chat-window,
  .lead-form-window,
  .submit-lead,
  .chat-button {
    transition: none;
  }
}
