/* Live-chat widget: launcher button + chat window in the bottom-right corner */
.livechat {
  --lc-accent: #3478f6;
  --lc-accent-hover: #2563eb;
  --lc-header: #1a2134;
  --lc-bg: #f7f8fa;
  --lc-surface: #fff;
  --lc-text: #1b1f2a;
  --lc-muted: #6b7280;
  --lc-border: #e5e7eb;
  --lc-quick: #2b3558;
  --lc-quick-hover: #36426c;
  font-family: 'Roboto', sans-serif;
  color: var(--lc-text);
}
.livechat *,
.livechat *::before,
.livechat *::after { box-sizing: border-box; }

.livechat__launcher {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1001;
  width: 60px;
  height: 60px;
  border: 0;
  border-radius: 50%;
  background: var(--lc-accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(52, 120, 246, .45);
  transition: transform .2s ease, background .2s ease;
  -webkit-tap-highlight-color: transparent;
}
.livechat__launcher:hover { background: var(--lc-accent-hover); transform: scale(1.05); }
.livechat__launcher:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.livechat__launcher-icon--close { display: none; }
.livechat.is-open .livechat__launcher-icon--open { display: none; }
.livechat.is-open .livechat__launcher-icon--close { display: block; }

/* keep "back to top" above the launcher */
.btnTop { bottom: 100px; }

.livechat__window {
  position: fixed;
  right: 24px;
  bottom: 96px;
  z-index: 1002;
  width: 370px;
  height: 560px;
  max-height: calc(100vh - 120px);
  display: flex;
  flex-direction: column;
  background: var(--lc-bg);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(0, 0, 0, .35);
  transform-origin: bottom right;
  animation: livechat-in .2s ease;
}
.livechat__window[hidden] { display: none; }

@keyframes livechat-in {
  from { opacity: 0; transform: translateY(12px) scale(.97); }
  to { opacity: 1; transform: none; }
}

.livechat__header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 14px 14px 18px;
  background: var(--lc-header);
  color: #fff;
  flex-shrink: 0;
}
.livechat__avatar {
  position: relative;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 50%;
  background: #2b3558;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #aab4d4;
}
.livechat__avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.livechat__status {
  position: absolute;
  right: 0;
  bottom: 1px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid var(--lc-header);
}
.livechat__heading { flex: 1; min-width: 0; }
.livechat__title { font-size: 17px; font-weight: 700; line-height: 1.2; }
.livechat__subtitle { font-size: 13px; opacity: .75; margin-top: 2px; }
.livechat__close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.livechat__close:hover { background: rgba(255, 255, 255, .12); }

.livechat__body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overscroll-behavior: contain;
}
.livechat__date {
  align-self: center;
  padding: 4px 14px;
  border-radius: 999px;
  background: #eceef1;
  color: var(--lc-muted);
  font-size: 13px;
  margin-bottom: 4px;
}
.livechat__msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-line;
  word-wrap: break-word;
}
.livechat__msg--agent {
  align-self: flex-start;
  background: var(--lc-surface);
  border: 1px solid var(--lc-border);
  border-bottom-left-radius: 4px;
}
.livechat__msg--user {
  align-self: flex-end;
  background: var(--lc-accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.livechat__msg--error {
  align-self: center;
  background: #fde8e8;
  color: #b42318;
  font-size: 13px;
}
.livechat__msg--typing { color: var(--lc-muted); }
.livechat__msg--typing span {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin: 0 2px;
  border-radius: 50%;
  background: currentColor;
  animation: livechat-dot 1s infinite ease-in-out;
}
.livechat__msg--typing span:nth-child(2) { animation-delay: .15s; }
.livechat__msg--typing span:nth-child(3) { animation-delay: .3s; }
@keyframes livechat-dot { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }

.livechat__quick {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}
.livechat__quick:empty { display: none; }
.livechat__quick-btn {
  width: 100%;
  padding: 11px 16px;
  border: 0;
  border-radius: 999px;
  background: var(--lc-quick);
  color: #fff;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: background .15s ease;
}
.livechat__quick-btn:hover { background: var(--lc-quick-hover); }

.livechat__form {
  flex-shrink: 0;
  padding: 10px 14px 14px;
  border-top: 1px solid var(--lc-border);
  background: var(--lc-bg);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.livechat__hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.livechat__contact,
.livechat__input {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 14px;
  background: #eef0f3;
  color: var(--lc-text);
  font: inherit;
  font-size: 14px;
  outline: none;
}
.livechat__contact { padding: 10px 14px; }
.livechat__contact:focus,
.livechat__input:focus { border-color: var(--lc-accent); background: #fff; }
.livechat__contact.is-invalid { border-color: #e5484d; background: #fff5f5; }
.livechat__contact[hidden] { display: none; }
.livechat__composer { display: flex; align-items: flex-end; gap: 10px; }
.livechat__input {
  flex: 1;
  min-height: 46px;
  max-height: 120px;
  padding: 12px 14px;
  resize: none;
  line-height: 1.4;
}
.livechat__send {
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  border: 0;
  border-radius: 14px;
  background: var(--lc-accent);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s ease, opacity .15s ease;
}
.livechat__send:hover:not(:disabled) { background: var(--lc-accent-hover); }
.livechat__send:disabled { opacity: .45; cursor: default; }

@media (max-width: 767px) {
  .livechat__launcher { right: 16px; bottom: 16px; width: 56px; height: 56px; }
  .btnTop { bottom: 84px; right: 22px; }
  /* lift launcher above the sticky "download app" bar when it is shown */
  body:has(.app-download-block-wrapper.is-visible) .livechat__launcher { bottom: 104px; }
  body:has(.app-download-block-wrapper.is-visible) .btnTop { bottom: 172px; }

  .livechat__window {
    inset: 0;
    width: 100%;
    height: 100%;
    max-height: none;
    border-radius: 0;
  }
  .livechat.is-open .livechat__launcher { display: none; }
  .livechat__input { font-size: 16px; } /* prevents iOS zoom on focus */
  .livechat__contact { font-size: 16px; }
  html.livechat-lock, html.livechat-lock body { overflow: hidden; }
}
