/* ============================================
   2LZ Leadbot widget: chat op de marketingsite
   Rustig, professioneel, navy (#193259) als enige accent.
   Dark mode via [data-theme="dark"] overrides (site-conventie).
   ============================================ */

.leadbot {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  /* Boven de cookiebanner (z-index 10000, privacy-banner.css): precies bij
     eerste bezoekers moet de chat niet onder de melding verdwijnen. */
  z-index: 10010;
  font-family: inherit;
}

/* ---------- launcher ---------- */

.leadbot-launcher {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.125rem;
  border: none;
  border-radius: 999px;
  background: var(--color-primary, #193259);
  color: #ffffff;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-lg, 0 10px 15px -3px rgb(0 0 0 / 0.15));
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.leadbot-launcher:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-xl, 0 20px 25px -5px rgb(0 0 0 / 0.2));
}

.leadbot-launcher:focus-visible {
  outline: 2px solid var(--color-primary, #193259);
  outline-offset: 3px;
}

.leadbot-launcher--hidden {
  display: none;
}

.leadbot-launcher__icon {
  font-size: 1.125rem;
  line-height: 1;
}

/* ---------- panel ---------- */

.leadbot-panel {
  display: none;
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 10011;
  width: min(380px, calc(100vw - 2rem));
  height: min(560px, calc(100dvh - 4rem));
  flex-direction: column;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  box-shadow: var(--shadow-2xl, 0 25px 50px -12px rgb(0 0 0 / 0.25));
  overflow: hidden;
}

.leadbot-panel--open {
  display: flex;
}

/* ---------- header ---------- */

.leadbot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  background: var(--color-primary, #193259);
  color: #ffffff;
}

.leadbot-header__identity {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-width: 0;
}

.leadbot-header__name-wrap {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.leadbot-header__name {
  font-size: 0.9375rem;
  font-weight: 700;
}

.leadbot-header__sub {
  font-size: 0.75rem;
  opacity: 0.75;
}

.leadbot-header__close {
  border: none;
  background: transparent;
  color: #ffffff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 8px;
}

.leadbot-header__close:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* ---------- avatar (echte teamfoto; initiaal-cirkel als fallback) ---------- */

.leadbot-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 50%;
  background: #ffffff;
  color: var(--color-primary, #193259);
  font-weight: 700;
}

/* Foto-variant: het gezicht vult de cirkel. */
.leadbot-avatar--img {
  display: block;
  object-fit: cover;
}

.leadbot-avatar--md {
  width: 44px;
  height: 44px;
  font-size: 0.9375rem;
  border: 2px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}

.leadbot-avatar--sm {
  width: 28px;
  height: 28px;
  font-size: 0.8125rem;
  background: var(--color-primary-50, #eef2f7);
  border: 1px solid var(--color-primary-100, #d5dfec);
}

/* ---------- berichten ---------- */

.leadbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  background: #f8fafc;
}

.leadbot-msg {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  max-width: 88%;
}

.leadbot-msg--assistant {
  align-self: flex-start;
}

.leadbot-msg--user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.leadbot-msg__bubble {
  padding: 0.625rem 0.875rem;
  border-radius: 14px;
  font-size: 0.9063rem;
  line-height: 1.5;
  word-break: break-word;
}

.leadbot-msg--assistant .leadbot-msg__bubble {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  color: #1e293b;
  border-bottom-left-radius: 4px;
}

.leadbot-msg--user .leadbot-msg__bubble {
  background: var(--color-primary, #193259);
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

/* ---------- typing ---------- */

.leadbot-typing__dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin: 0 2px;
  border-radius: 50%;
  background: #94a3b8;
  animation: leadbotPulse 1.2s infinite ease-in-out;
}

.leadbot-typing__dot:nth-child(2) {
  animation-delay: 0.15s;
}

.leadbot-typing__dot:nth-child(3) {
  animation-delay: 0.3s;
}

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

/* ---------- quick actions ---------- */

.leadbot-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-self: flex-start;
  padding-left: 2.25rem;
}

.leadbot-actions__btn {
  padding: 0.5rem 0.875rem;
  border: 1px solid var(--color-primary-100, #d5dfec);
  border-radius: 999px;
  background: #ffffff;
  color: var(--color-primary, #193259);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.leadbot-actions__btn:hover {
  background: var(--color-primary-50, #eef2f7);
}

/* ---------- lead-formulier ---------- */

.leadbot-form {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  padding: 0.875rem;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
}

.leadbot-form__label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #334155;
}

.leadbot-form__input {
  padding: 0.5rem 0.625rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.9063rem;
  font-family: inherit;
  background: #ffffff;
  color: #1e293b;
}

.leadbot-form__input:focus {
  outline: 2px solid var(--color-primary, #193259);
  outline-offset: 1px;
}

.leadbot-form__textarea {
  resize: vertical;
}

.leadbot-form__consent {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: #475569;
  line-height: 1.45;
}

.leadbot-form__consent input {
  margin-top: 0.2rem;
}

.leadbot-form__privacylink {
  color: var(--color-primary, #193259);
  text-decoration: underline;
}

.leadbot-form__error {
  margin: 0;
  font-size: 0.8125rem;
  color: #b91c1c;
}

.leadbot-form__submit {
  padding: 0.625rem 1rem;
  border: none;
  border-radius: 8px;
  background: var(--color-primary, #193259);
  color: #ffffff;
  font-size: 0.9063rem;
  font-weight: 600;
  cursor: pointer;
}

.leadbot-form__submit:disabled {
  opacity: 0.6;
  cursor: default;
}

/* ---------- inputbar ---------- */

.leadbot-inputbar {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
}

.leadbot-inputbar__input {
  flex: 1;
  padding: 0.625rem 0.875rem;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  font-size: 0.9063rem;
  font-family: inherit;
  background: #ffffff;
  color: #1e293b;
}

.leadbot-inputbar__input:focus {
  outline: 2px solid var(--color-primary, #193259);
  outline-offset: 1px;
}

.leadbot-inputbar__send {
  padding: 0.625rem 1rem;
  border: none;
  border-radius: 999px;
  background: var(--color-primary, #193259);
  color: #ffffff;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}

/* ---------- mobiel ---------- */

@media (max-width: 767px) {
  .leadbot-panel {
    right: 0.5rem;
    bottom: 0.5rem;
    width: calc(100vw - 1rem);
    height: min(70dvh, 560px);
  }

  .leadbot-launcher__label {
    display: none;
  }

  .leadbot-launcher {
    padding: 0.875rem;
  }

  /* iOS Safari zoomt automatisch in op inputs met een font-size onder 16px. */
  .leadbot-inputbar__input,
  .leadbot-form__input {
    font-size: 16px;
  }
}

/* ---------- dark mode ---------- */

[data-theme="dark"] .leadbot-panel {
  background: #0f172a;
  border-color: #1e293b;
}

[data-theme="dark"] .leadbot-messages {
  background: #0b1120;
}

[data-theme="dark"] .leadbot-msg--assistant .leadbot-msg__bubble {
  background: #1e293b;
  border-color: #334155;
  color: #e2e8f0;
}

[data-theme="dark"] .leadbot-msg--user .leadbot-msg__bubble {
  background: var(--color-primary-light, #264a7a);
}

[data-theme="dark"] .leadbot-avatar--sm {
  background: #1e293b;
  border-color: #334155;
  color: #cbd5e1;
}

[data-theme="dark"] .leadbot-actions__btn {
  background: #1e293b;
  border-color: #334155;
  color: #e2e8f0;
}

[data-theme="dark"] .leadbot-actions__btn:hover {
  background: #263449;
}

[data-theme="dark"] .leadbot-form {
  background: #0f172a;
  border-color: #334155;
}

[data-theme="dark"] .leadbot-form__label {
  color: #cbd5e1;
}

[data-theme="dark"] .leadbot-form__input,
[data-theme="dark"] .leadbot-inputbar__input {
  background: #1e293b;
  border-color: #334155;
  color: #e2e8f0;
}

[data-theme="dark"] .leadbot-form__consent {
  color: #94a3b8;
}

[data-theme="dark"] .leadbot-form__privacylink {
  color: #93b4dd;
}

[data-theme="dark"] .leadbot-inputbar {
  background: #0f172a;
  border-color: #1e293b;
}

[data-theme="dark"] .leadbot-form__error {
  color: #f87171;
}

[data-theme="dark"] .leadbot-form__submit,
[data-theme="dark"] .leadbot-inputbar__send {
  background: var(--color-primary-light, #264a7a);
  color: #ffffff;
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .leadbot-launcher {
    transition: none;
  }

  .leadbot-typing__dot {
    animation: none;
    opacity: 0.6;
  }
}
