/* ========================================
   AI CHATBOT
======================================== */

/* ========================================
   CHATBOT CONTAINER
======================================== */

.chatbot {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 900;
}

/* ========================================
   CHATBOT TOGGLE
======================================== */

.chatbot-toggle {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  background: #1f2937;
  color: #ffffff;
  cursor: pointer;
  transition:
    background 0.25s ease,
    transform 0.25s ease,
    box-shadow 0.25s ease;
}

.chatbot-toggle:hover {
  background: #111827;
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
}

.chatbot-toggle:focus-visible {
  outline: 2px solid var(--primary-light);
  outline-offset: 4px;
}

/* ========================================
   CHATBOT PANEL
======================================== */

.chatbot-panel {
  position: absolute;
  right: 0;
  bottom: 72px;

  width: min(380px, calc(100vw - 32px));
  height: 620px;

  display: flex;
  flex-direction: column;

  overflow: hidden;

  background: #edeae3;
  border: 1px solid rgba(17, 24, 39, 0.1);
  border-radius: 24px;

  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.35);

  opacity: 0;
  visibility: hidden;
  transform: translateY(12px) scale(0.98);

  pointer-events: none;

  transition:
    opacity 0.25s ease,
    visibility 0.25s ease,
    transform 0.25s ease;
}

/* ========================================
   OPEN STATE
======================================== */

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

/* ========================================
   CHATBOT HEADER
======================================== */

.chatbot-header {
  min-height: 72px;

  display: flex;
  align-items: center;
  justify-content: space-between;

  padding: 16px 20px;

  border-bottom: 1px solid rgba(17, 24, 39, 0.1);
}

.chatbot-header-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chatbot-avatar {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: #1f2937;
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
}

.chatbot-title {
  margin: 0;
  font-family: "Sora", sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: #111827;
}

.chatbot-status {
  margin: 3px 0 0;
  font-size: 12px;
  color: #4b5563;
}

/* ========================================
   CLOSE BUTTON
======================================== */

.chatbot-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #4b5563;
  cursor: pointer;
  transition:
    background 0.2s ease,
    color 0.2s ease;
}

.chatbot-close:hover {
  background: #f7f5f0;
  color: #111827;
}

.chatbot-close:focus-visible {
  outline: 2px solid var(--primary-light);
  outline-offset: 2px;
}

/* ========================================
   MESSAGES
======================================== */

.chatbot-messages {
  flex: 1 1 auto;
  min-height: 0;

  display: flex;
  flex-direction: column;
  gap: 14px;

  padding: 20px;

  overflow-y: auto;
  overscroll-behavior: contain;
}

/* ========================================
   MESSAGE
======================================== */

.chatbot-message {
  max-width: 82%;

  padding: 12px 14px;

  border-radius: 16px;

  font-size: 14px;
  line-height: 1.6;
}

.chatbot-message ul,
.chatbot-message ol {
  margin: 8px 0;
  padding-left: 0;
  list-style-position: inside;
}

.chatbot-message li {
  padding-left: 0;
}

.chatbot-message--assistant {
  align-self: flex-start;

  background: #f7f5f0;
  color: #111827;

  border-bottom-left-radius: 5px;
}

.chatbot-message--user {
  align-self: flex-end;
  background: #e5e2db;
  color: #111827;
  border-bottom-right-radius: 5px;
}

/* ========================================
   INPUT AREA
======================================== */

.chatbot-input-area {
  flex-shrink: 0;
  padding: 14px;

  border-top: 1px solid rgba(17, 24, 39, 0.1);
}

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

  padding: 6px 6px 6px 14px;

  background: #f7f5f0;
  border: 1px solid var(--border);
  border-radius: 14px;
}

.chatbot-input {
  flex: 1;

  min-width: 0;

  border: 0;
  outline: 0;

  background: transparent;
  color: #111827;

  font: inherit;
  font-size: 14px;
}

.chatbot-input::placeholder {
  color: #6b7280;
}

.chatbot-send {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 10px;
  background: #1f2937;
  color: #ffffff;
  cursor: pointer;
  transition:
    background 0.2s ease,
    transform 0.2s ease;
}

.chatbot-send:hover {
  background: #111827;
  transform: translateY(-1px);
}

.chatbot-send:focus-visible {
  outline: 2px solid var(--primary-light);
  outline-offset: 2px;
}

/* ========================================
   MOBILE
======================================== */

@media (max-width: 600px) {
  .chatbot {
    right: 16px;
    bottom: 16px;
    z-index: 2000;
  }

  .chatbot-panel {
    right: 0;
    bottom: 68px;
    width: calc(100vw - 32px);
    height: min(620px, calc(100dvh - 100px));
    border-radius: 20px;
  }

  .chatbot-toggle {
    width: 52px;
    height: 52px;
  }
}

/* ========================================
   ACCESSIBILITY
======================================== */

.sr-only {
  position: absolute;

  width: 1px;
  height: 1px;

  padding: 0;
  margin: -1px;

  overflow: hidden;

  clip: rect(0, 0, 0, 0);

  white-space: nowrap;

  border: 0;
}

/* ========================================
   CHATBOT LEAD FORM
======================================== */

.chatbot-lead {
  flex-shrink: 0;
  padding: 16px 20px;
  border-top: 1px solid rgba(17, 24, 39, 0.1);
  background: #edeae3;
}

.chatbot-lead-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chatbot-lead-title {
  margin: 0;
  font-family: "Sora", sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: #111827;
}

.chatbot-lead-text {
  margin: 0 0 4px;
  font-size: 13px;
  line-height: 1.5;
  color: #374151;
}

.chatbot-lead-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chatbot-lead-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chatbot-lead-field label {
  font-size: 12px;
  font-weight: 500;
  color: #374151;
}

.chatbot-lead-field input {
  width: 100%;
  min-height: 36px;
  padding: 7px 11px;
  border: 1px solid rgba(17, 24, 39, 0.1);
  border-radius: 10px;
  background: #f7f5f0;
  color: #111827;
  font: inherit;
  font-size: 13px;
  outline: none;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.chatbot-lead-field input::placeholder {
  color: #6b7280;
}

.chatbot-lead-field input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(54, 82, 227, 0.1);
}

/* ========================================
   CHATBOT LEAD SUBMIT BUTTON
======================================== */

.chatbot-lead .chatbot-lead-submit {
  display: block;
  width: 100%;
  min-height: 40px;
  margin-top: 4px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  appearance: none;
  -webkit-appearance: none;
  background-color: #3652e3 !important;
  color: #ffffff !important;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition:
    background-color 0.2s ease,
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.chatbot-lead .chatbot-lead-submit:hover {
  background-color: #4c67f0 !important;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(54, 82, 227, 0.2);
}

.chatbot-lead .chatbot-lead-submit:focus-visible {
  outline: 2px solid #5c75f5;
  outline-offset: 2px;
}

.chatbot-lead .chatbot-lead-submit:disabled {
  display: block;
  background-color: #3652e3 !important;
  color: #ffffff !important;
  opacity: 1;
  cursor: default;
  transform: none;
  box-shadow: none;
}

.chatbot-lead-status {
  min-height: 18px;
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  font-weight: 500;
  color: #374151;
}

/* ========================================
   CHATBOT LEAD FORM VISIBILITY
======================================== */

.chatbot-lead-content[hidden] {
  display: none !important;
}

.chatbot-lead-form[hidden] {
  display: none !important;
}
