/* ═══════════════════════════════════════════════════════════════
   CleanMate — homepage afspraak-chatbot
   Uses the design tokens defined in style.css (:root)
   ═══════════════════════════════════════════════════════════════ */

.chatbot {
  position: fixed;
  right: 20px;
  bottom: 60px;
  z-index: 9999;
  font-family: var(--ff-body);
}

.chatbot__fab {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 62px;
  height: 62px;
  padding: 0;
  border: none;
  cursor: pointer;
  background: var(--grad);
  color: #fff;
  border-radius: 999px;
  box-shadow: var(--shadow-aqua);
  transition: transform .2s ease, box-shadow .2s ease;
}
.chatbot__fab:hover { transform: translateY(-3px); box-shadow: var(--shadow-md), var(--shadow-aqua); }
.chatbot__fab-icon--close { display: none; }
.chatbot__fab[aria-expanded="true"] .chatbot__fab-icon--chat { display: none; }
.chatbot__fab[aria-expanded="true"] .chatbot__fab-icon--close { display: block; }

.chatbot__wave-arm {
  transform-box: view-box;
  transform-origin: 23px 16px;
}
@keyframes chatbot-wave {
  0%, 100% { transform: rotate(0deg); }
  20%      { transform: rotate(-25deg); }
  40%      { transform: rotate(15deg); }
  60%      { transform: rotate(-18deg); }
  80%      { transform: rotate(8deg); }
}
.chatbot__wave-arm.is-waving {
  animation: chatbot-wave .9s ease-in-out;
}

.chatbot__teaser[hidden] { display: none; }

.chatbot__teaser {
  position: absolute;
  right: 0;
  bottom: calc(100% + 14px);
  width: 250px;
  max-width: calc(100vw - 40px);
  background: var(--white);
  border-radius: 18px;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: stretch;
  animation: chatbot-pop .2s ease;
}
@keyframes chatbot-teaser-bump {
  0%, 100% { transform: scale(1); }
  30%      { transform: scale(1.045); }
  60%      { transform: scale(0.985); }
}
.chatbot__teaser--bump { animation: chatbot-teaser-bump .5s ease; }
.chatbot__teaser::after {
  content: '';
  position: absolute;
  top: 100%;
  right: 26px;
  width: 14px;
  height: 14px;
  background: var(--white);
  transform: rotate(45deg);
  border-radius: 0 0 3px;
}
.chatbot__teaser-close {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink-2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  z-index: 1;
}
.chatbot__teaser-close:hover { background: var(--bg); }
.chatbot__teaser-body {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border: none;
  background: none;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}
.chatbot__teaser-text { font-size: 13px; line-height: 1.4; font-weight: 600; color: var(--ink); }

.chatbot__panel[hidden] { display: none; }

.chatbot__panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 14px);
  width: 392px;
  max-width: calc(100vw - 32px);
  height: 576px;
  max-height: min(640px, calc(100vh - 120px));
  background: var(--white);
  border-radius: 22px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.chatbot__panel:not([hidden]) { animation: chatbot-pop .18s ease; }
@keyframes chatbot-pop {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.chatbot__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px 14px 16px;
  background: var(--grad);
  color: #fff;
  flex: none;
}
.chatbot__head-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .22);
  flex: none;
}
.chatbot__head-text { display: flex; flex-direction: column; gap: 1px; line-height: 1.25; flex: 1; min-width: 0; }
.chatbot__head-text strong { font-family: var(--ff-display); font-size: 14.5px; }
.chatbot__head-text span { font-size: 12px; opacity: .85; }
.chatbot__head-close {
  border: none;
  background: rgba(255, 255, 255, .18);
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: none;
  transition: background .15s ease;
}
.chatbot__head-close:hover { background: rgba(255, 255, 255, .32); }

.chatbot__messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg);
  scroll-behavior: smooth;
}

.chatbot__bubble {
  max-width: 85%;
  padding: 10px 13px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.5;
  white-space: pre-line;
}
.chatbot__bubble--bot {
  align-self: flex-start;
  background: var(--white);
  color: var(--ink);
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow-sm);
}
.chatbot__bubble--user {
  align-self: flex-end;
  background: var(--grad);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chatbot__bubble--error {
  align-self: flex-start;
  background: #FDECEC;
  color: #8A2E2E;
  border: 1px solid #F3C6C6;
}

.chatbot__typing { align-self: flex-start; display: flex; gap: 4px; padding: 12px 14px; background: var(--white); border-radius: 16px; border-bottom-left-radius: 4px; box-shadow: var(--shadow-sm); }
.chatbot__typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-2); opacity: .5; animation: chatbot-bounce 1s infinite; }
.chatbot__typing span:nth-child(2) { animation-delay: .15s; }
.chatbot__typing span:nth-child(3) { animation-delay: .3s; }
@keyframes chatbot-bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }

/* Summary card shown before final submit */
.chatbot__summary { align-self: stretch; background: var(--white); border-radius: 16px; box-shadow: var(--shadow-sm); padding: 12px 14px; font-size: 13px; }
.chatbot__summary-row { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.chatbot__summary-row:last-child { border-bottom: none; }
.chatbot__summary-label { color: var(--ink-2); flex: none; }
.chatbot__summary-value { text-align: right; color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
.chatbot__summary-edit { align-self: center; border: none; background: none; color: var(--aqua-deep); font-size: 12px; font-weight: 600; cursor: pointer; text-decoration: underline; padding: 0; }

.chatbot__composer {
  flex: none;
  border-top: 1px solid var(--line);
  padding: 12px 14px;
  background: var(--white);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.chatbot__composer input[type="text"],
.chatbot__composer input[type="email"],
.chatbot__composer input[type="tel"],
.chatbot__composer input[type="date"],
.chatbot__composer input[type="time"],
.chatbot__composer select,
.chatbot__composer textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
  font-size: 13.5px;
  color: var(--ink);
  background: var(--bg);
}
.chatbot__composer textarea { resize: vertical; min-height: 64px; }
.chatbot__composer input:focus,
.chatbot__composer select:focus,
.chatbot__composer textarea:focus { outline: 2px solid var(--aqua); outline-offset: 1px; }

.chatbot__field-error { color: #B4302F; font-size: 12px; }

.chatbot__chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chatbot__chip {
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  padding: 8px 13px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.chatbot__chip:hover { border-color: var(--aqua); }
.chatbot__chip--active { background: var(--grad); color: #fff; border-color: transparent; }

.chatbot__actions { display: flex; align-items: center; gap: 8px; }
.chatbot__send {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  background: var(--grad);
  color: #fff;
  font-weight: 600;
  font-size: 13.5px;
  padding: 10px 16px;
  border-radius: 12px;
  cursor: pointer;
  flex: 1;
  transition: transform .15s ease, opacity .15s ease;
}
.chatbot__send:hover { transform: translateY(-1px); }
.chatbot__send:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.chatbot__skip,
.chatbot__back {
  border: none;
  background: none;
  color: var(--ink-2);
  font-size: 12.5px;
  cursor: pointer;
  padding: 8px 4px;
  text-decoration: underline;
  flex: none;
}
.chatbot__restart {
  align-self: flex-start;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
}

@media (max-width: 480px) {
  .chatbot { right: 14px; bottom: 14px; }
  .chatbot__panel {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    border-radius: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .chatbot__panel:not([hidden]) { animation: none; }
  .chatbot__typing span { animation: none; opacity: .6; }
  .chatbot__fab-icon--chat,
  .chatbot__head-avatar svg,
  .chatbot__wave-arm.is-waving,
  .chatbot__teaser--bump { animation: none; }
}
