/* ==========================================================================
   Home Solution — chatwidget
   Enige bron voor de styling van de chat. Namespace: .hsc-*
   (De oude .hs-* regels in de themestylesheets raken dit bewust niet meer.)
   ========================================================================== */

.hsc {
  --hsc-navy: #002d55;
  --hsc-navy-soft: #06407a;
  --hsc-blue: #0060a9;
  --hsc-green: #25d366;
  --hsc-green-dark: #1da851;

  --hsc-surface: #ffffff;
  --hsc-canvas: #f3f6fa;
  --hsc-bubble: #ffffff;
  --hsc-bubble-user: #e7f2fd;
  --hsc-ink: #16233a;
  --hsc-ink-soft: #6b7a90;
  --hsc-line: rgba(13, 42, 74, 0.1);

  --hsc-gap: 22px;
  --hsc-launcher: 60px;
  --hsc-radius: 20px;

  --hsc-shadow: 0 1px 2px rgba(9, 26, 48, 0.06),
                0 12px 24px -8px rgba(9, 26, 48, 0.16),
                0 32px 64px -24px rgba(9, 26, 48, 0.3);

  font-family: "Roboto", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--hsc-ink);
  -webkit-font-smoothing: antialiased;
}

@media (prefers-color-scheme: dark) {
  .hsc {
    --hsc-surface: #0e1626;
    --hsc-canvas: #0a111d;
    --hsc-bubble: #182336;
    --hsc-bubble-user: #1c3a5e;
    --hsc-ink: #e6ebf3;
    --hsc-ink-soft: #93a1b5;
    --hsc-line: rgba(148, 163, 184, 0.16);
    --hsc-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.5),
                  0 32px 64px -24px rgba(0, 0, 0, 0.7);
  }
}

.hsc *,
.hsc *::before,
.hsc *::after {
  box-sizing: border-box;
}

.hsc button,
.hsc textarea,
.hsc a {
  font: inherit;
  color: inherit;
}

.hsc :focus-visible {
  outline: 2px solid var(--hsc-green);
  outline-offset: 2px;
}

.hsc-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

.hsc-fab {
  position: fixed;
  right: var(--hsc-gap);
  bottom: calc(var(--hsc-gap) + env(safe-area-inset-bottom, 0px));
  z-index: 99998;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  /* De entree is puur CSS: als de JS niet laadt, staat de knop er toch.
     fill-mode 'both' houdt de begintoestand vast tijdens de vertraging. */
  animation: hsc-enter 0.35s cubic-bezier(0.22, 1, 0.36, 1) 1.2s both;
}

@keyframes hsc-enter {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.94);
    visibility: hidden;
    pointer-events: none;
  }
  to {
    opacity: 1;
    transform: none;
    visibility: visible;
    pointer-events: auto;
  }
}

/* "Bel direct" — alleen op smalle schermen naast de launcher */
.hsc-callbtn {
  display: none;
  align-items: center;
  gap: 8px;
  height: 48px;
  padding: 0 18px;
  border-radius: 16px;
  background: var(--hsc-navy);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.1px;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 10px 24px -8px rgba(0, 45, 85, 0.6);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hsc-callbtn:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 30px -10px rgba(0, 45, 85, 0.7);
}

.hsc-callbtn svg {
  width: 19px;
  height: 19px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hsc-launcher {
  position: relative;
  width: var(--hsc-launcher);
  height: var(--hsc-launcher);
  border: 0;
  padding: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: #fff;
  background: radial-gradient(120% 120% at 30% 20%, var(--hsc-navy-soft), var(--hsc-navy) 70%);
  box-shadow: 0 10px 24px -6px rgba(0, 45, 85, 0.55),
              0 2px 6px rgba(9, 26, 48, 0.2);
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.22s ease;
}

.hsc-launcher:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 34px -8px rgba(0, 45, 85, 0.65),
              0 2px 6px rgba(9, 26, 48, 0.2);
}

.hsc-launcher:active {
  transform: translateY(0) scale(0.96);
}

.hsc-launcher svg {
  width: 28px;
  height: 28px;
  display: block;
  position: relative;
  z-index: 1;
}

/* zachte pulsering zolang het bericht ongelezen is */
.hsc-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--hsc-green);
  opacity: 0;
  animation: hsc-ring 2.6s ease-out infinite;
}

.hsc-launcher.is-read .hsc-ring {
  animation: none;
  opacity: 0;
}

@keyframes hsc-ring {
  0%   { opacity: 0.55; transform: scale(1); }
  70%  { opacity: 0;    transform: scale(1.45); }
  100% { opacity: 0;    transform: scale(1.45); }
}

.hsc-badge {
  position: absolute;
  top: -1px;
  right: -1px;
  min-width: 21px;
  height: 21px;
  padding: 0 6px;
  border-radius: 999px;
  background: #ff3b30;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 21px;
  text-align: center;
  box-shadow: 0 0 0 3px var(--hsc-navy);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.hsc-badge.is-hidden {
  opacity: 0;
  transform: scale(0.5);
}

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

.hsc-panel {
  position: fixed;
  right: var(--hsc-gap);
  bottom: calc(var(--hsc-gap) + var(--hsc-launcher) + 14px + env(safe-area-inset-bottom, 0px));
  z-index: 99999;
  width: min(370px, calc(100vw - (var(--hsc-gap) * 2)));
  max-height: min(74vh, 620px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  background: var(--hsc-surface);
  border: 1px solid var(--hsc-line);
  border-radius: var(--hsc-radius);
  box-shadow: var(--hsc-shadow);
  overflow: hidden;
  opacity: 0;
  transform: translateY(14px) scale(0.97);
  transform-origin: bottom right;
  pointer-events: none;
  /* zonder visibility blijven de knoppen in een gesloten paneel tabbaar */
  visibility: hidden;
  transition: opacity 0.24s ease,
              transform 0.28s cubic-bezier(0.22, 1, 0.36, 1),
              visibility 0s linear 0.28s;
}

.hsc-panel.is-open {
  opacity: 1;
  transform: none;
  pointer-events: auto;
  visibility: visible;
  transition-delay: 0s, 0s, 0s;
}

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

.hsc-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 14px 14px 16px;
  background: linear-gradient(135deg, var(--hsc-navy) 0%, var(--hsc-blue) 100%);
  color: #fff;
}

.hsc-avatar {
  position: relative;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
}

.hsc-avatar img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9);
}

.hsc-dot {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--hsc-green);
  box-shadow: 0 0 0 2.5px var(--hsc-blue);
}

.hsc-dot.is-away {
  background: #f0b429;
}

.hsc-ident {
  min-width: 0;
  flex: 1 1 auto;
  line-height: 1.25;
}

.hsc-ident strong {
  display: block;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hsc-ident small {
  display: block;
  font-size: 12px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.82);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hsc-headbtn {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  padding: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s ease;
}

.hsc-headbtn:hover {
  background: rgba(255, 255, 255, 0.26);
  transform: translateY(-1px);
}

.hsc-headbtn svg {
  width: 17px;
  height: 17px;
  display: block;
  fill: currentColor;
}

.hsc-headbtn.is-hidden {
  display: none;
}

/* ------------------------------------------------------------------- body */

.hsc-body {
  padding: 16px 16px 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--hsc-canvas);
  scrollbar-width: thin;
  scrollbar-color: rgba(107, 122, 144, 0.35) transparent;
}

.hsc-body::-webkit-scrollbar {
  width: 6px;
}

.hsc-body::-webkit-scrollbar-thumb {
  background: rgba(107, 122, 144, 0.3);
  border-radius: 3px;
}

.hsc-row {
  display: flex;
  flex-direction: column;
  margin-bottom: 12px;
  animation: hsc-in 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.hsc-row.is-agent { align-items: flex-start; }
.hsc-row.is-user  { align-items: flex-end; }

@keyframes hsc-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

.hsc-bubble {
  max-width: 86%;
  padding: 10px 14px;
  border-radius: 16px;
  background: var(--hsc-bubble);
  box-shadow: 0 1px 2px rgba(9, 26, 48, 0.08);
  line-height: 1.5;
  word-break: break-word;
  white-space: pre-wrap;
}

.is-agent .hsc-bubble { border-bottom-left-radius: 5px; }

.is-user .hsc-bubble {
  background: var(--hsc-bubble-user);
  border-bottom-right-radius: 5px;
}

@media (prefers-color-scheme: dark) {
  .is-user .hsc-bubble { color: #f2f6fb; }
}

.hsc-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  padding: 0 4px;
  color: var(--hsc-ink-soft);
  font-size: 11px;
  user-select: none;
}

.hsc-meta svg {
  width: 15px;
  height: 15px;
  display: block;
  fill: #34b7f1;
}

/* typindicator */
.hsc-typing {
  display: flex;
  gap: 4px;
  padding: 13px 16px;
}

.hsc-typing i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--hsc-ink-soft);
  animation: hsc-bounce 1.2s ease-in-out infinite;
}

.hsc-typing i:nth-child(2) { animation-delay: 0.15s; }
.hsc-typing i:nth-child(3) { animation-delay: 0.3s; }

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

/* ---------------------------------------------------------- snelle keuzes */

.hsc-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 4px 16px 12px;
  background: var(--hsc-canvas);
}

.hsc-quick.is-hidden {
  display: none;
}

.hsc-chip {
  border: 1px solid rgba(0, 96, 169, 0.3);
  background: var(--hsc-surface);
  color: var(--hsc-blue);
  font-size: 13px;
  padding: 6px 13px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.hsc-chip:hover {
  background: var(--hsc-blue);
  border-color: var(--hsc-blue);
  color: #fff;
  transform: translateY(-1px);
}

/* ----------------------------------------------------------------- footer */

.hsc-foot {
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px));
  background: var(--hsc-surface);
  border-top: 1px solid var(--hsc-line);
}

.hsc-inputwrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
  padding: 5px 5px 5px 15px;
  border: 1px solid var(--hsc-line);
  border-radius: 24px;
  background: var(--hsc-canvas);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.hsc-inputwrap:focus-within {
  border-color: rgba(0, 96, 169, 0.55);
  box-shadow: 0 0 0 3px rgba(0, 96, 169, 0.12);
}

.hsc-input {
  border: 0;
  outline: 0;
  background: transparent;
  resize: none;
  width: 100%;
  min-height: 38px;
  max-height: 116px;
  padding: 9px 0;
  margin: 0;
  line-height: 1.45;
  overflow-y: auto;
  color: var(--hsc-ink);
  scrollbar-width: thin;
}

.hsc-input::placeholder {
  color: var(--hsc-ink-soft);
}

.hsc-send {
  width: 38px;
  height: 38px;
  border: 0;
  padding: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  background: #d8dfe8;
  color: #fff;
  transition: background 0.2s ease, transform 0.2s ease;
}

.hsc-send svg {
  width: 17px;
  height: 17px;
  display: block;
  fill: currentColor;
  transform: translateX(1px);
}

.hsc-send.is-ready {
  background: var(--hsc-green);
  box-shadow: 0 4px 12px -3px rgba(37, 211, 102, 0.7);
}

.hsc-send.is-ready:hover {
  background: var(--hsc-green-dark);
  transform: scale(1.06);
}

.hsc-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin: 9px 0 0;
  color: var(--hsc-ink-soft);
  font-size: 11.5px;
}

.hsc-note svg {
  width: 13px;
  height: 13px;
  display: block;
  fill: var(--hsc-green);
  flex: 0 0 auto;
}

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

@media (max-width: 560px) {
  .hsc {
    --hsc-gap: 14px;
    --hsc-launcher: 56px;
  }

  .hsc-callbtn {
    display: inline-flex;
  }

  .hsc-panel {
    right: var(--hsc-gap);
    left: var(--hsc-gap);
    width: auto;
    max-height: 78vh;
  }

  .hsc-ident small {
    font-size: 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  /* geen entree-animatie, maar de knop moet wel zichtbaar zijn */
  .hsc-fab {
    animation: none !important;
    opacity: 1;
    visibility: visible;
    transform: none;
    pointer-events: auto;
  }

  .hsc-panel,
  .hsc-row,
  .hsc-launcher,
  .hsc-callbtn,
  .hsc-send,
  .hsc-chip,
  .hsc-headbtn {
    transition: none !important;
    animation: none !important;
  }

  .hsc-panel.is-open {
    transform: none;
  }

  .hsc-ring,
  .hsc-typing i {
    animation: none !important;
  }
}
