.callchat { --cc-size: 54px; }
.callchat__group {
  position: fixed;
  z-index: 2147483000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.callchat[hidden] { display: none !important; }
.callchat--bottom-right { right: var(--cc-x, 20px); bottom: var(--cc-y, 20px); align-items: flex-end; }
.callchat--bottom-left { left: var(--cc-x, 20px); bottom: var(--cc-y, 20px); align-items: flex-start; }
/* Manual placement: --cc-x/--cc-y are percentages; the shift keeps the button on screen at 0% and 100%. */
.callchat--custom {
  left: var(--cc-x, 95%);
  top: var(--cc-y, 85%);
  transform: translate(calc(-1 * var(--cc-x, 95%)), calc(-1 * var(--cc-y, 85%)));
  align-items: center;
}
.callchat--small { --cc-size: 44px; }
.callchat--medium { --cc-size: 54px; }
.callchat--large { --cc-size: 64px; }

.callchat__btn {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-sizing: border-box;
  height: var(--cc-size);
  min-width: var(--cc-size);
  padding: 0;
  border-radius: var(--cc-size);
  background: var(--cc-color);
  color: #fff !important;
  font: 600 15px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  text-decoration: none !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.callchat__btn:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28); }
.callchat__btn:focus-visible { outline: 3px solid #fff; outline-offset: 2px; box-shadow: 0 0 0 6px var(--cc-color); }
.callchat__icon { display: inline-flex; align-items: center; justify-content: center; width: calc(var(--cc-size) * 0.7); height: calc(var(--cc-size) * 0.7); }
.callchat__icon svg { width: 80%; height: 80%; }
.callchat__btn--text { padding: 0 calc(var(--cc-size) / 3) 0 calc(var(--cc-size) / 4); }
/* Icon-only buttons keep the label for screen readers. */
.callchat__btn:not(.callchat__btn--text) .callchat__label {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* Notification badge on the WhatsApp button */
.callchat__btn { position: relative; }
.callchat__badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  box-sizing: border-box;
  border: 2px solid #fff;
  border-radius: 10px;
  background: #e5242b;
  color: #fff;
  font: 700 11px/16px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  text-align: center;
}

/* WhatsApp chat popup. Every rule sets its own type and spacing so theme styles don't leak in. */
.callchat__popup {
  --cc-accent: #25D366;
  --cc-dark: color-mix(in srgb, var(--cc-accent) 55%, #000);
  --cc-tint: color-mix(in srgb, var(--cc-accent) 9%, #fff);
  position: absolute;
  bottom: calc(100% + 14px);
  width: min(360px, calc(100vw - 32px));
  max-height: min(600px, calc(100vh - 120px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 18px;
  background: var(--cc-tint);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
  color: #1a1a1a;
  font: 400 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  text-align: left;
  pointer-events: auto;
  animation: callchat-popup-in 0.18s ease-out both;
}
.callchat__popup[hidden] { display: none !important; }
.callchat__popup--right { right: 0; }
.callchat__popup--left { left: 0; }
.callchat__popup--below { bottom: auto; top: calc(100% + 14px); }
.callchat__popup *, .callchat__popup *::before, .callchat__popup *::after { box-sizing: border-box; }

.callchat__popup-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 16px 14px;
  border-bottom: 1px solid color-mix(in srgb, var(--cc-accent) 18%, #fff);
}
.callchat__popup-logo {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--cc-dark);
  color: #fff;
}
.callchat__popup-logo svg { width: 24px; height: 24px; }
.callchat__popup-titles { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.callchat__popup-title { font-size: 17px; font-weight: 700; line-height: 1.25; color: var(--cc-dark); }
.callchat__popup-subtitle {
  margin-top: 2px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--cc-accent) 70%, #000);
}
.callchat__popup-close {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin: 0;
  padding: 6px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--cc-dark);
  cursor: pointer;
}
.callchat__popup-close:hover { background: color-mix(in srgb, var(--cc-accent) 14%, #fff); }
.callchat__popup-close svg { width: 22px; height: 22px; }

.callchat__popup-body { flex: 1; overflow-y: auto; padding: 16px; overscroll-behavior: contain; }
.callchat__panel { display: flex; flex-direction: column; gap: 12px; }
.callchat__panel[hidden] { display: none !important; }

.callchat__welcome { padding: 18px; border-radius: 14px; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06); }
.callchat__welcome-text { margin: 0; font-size: 15px; white-space: pre-line; }
.callchat__reply { display: flex; align-items: center; gap: 8px; margin: 12px 0 0; font-size: 13px; color: #555; }
.callchat__dot {
  flex: none;
  width: 10px;
  height: 10px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--cc-dark);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--cc-accent) 40%, #fff);
}

.callchat__agents-heading { margin: 8px 0 0; padding: 0 2px; font-size: 17px; font-weight: 700; line-height: 1.3; color: #1a1a1a; }

.callchat__agent, .callchat__start {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  color: #1a1a1a !important;
  text-decoration: none !important;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.callchat__agent:hover, .callchat__start:hover { box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12); transform: translateY(-1px); }
.callchat__agent:focus-visible, .callchat__start:focus-visible, .callchat__tab:focus-visible, .callchat__popup-close:focus-visible {
  outline: 3px solid var(--cc-accent);
  outline-offset: 2px;
}
.callchat__avatar {
  position: relative;
  flex: none;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--cc-accent) 22%, #fff);
}
.callchat__avatar img { display: block; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.callchat__initials {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 16px;
  font-weight: 700;
  color: var(--cc-dark);
}
.callchat__dot--avatar { position: absolute; right: 0; bottom: 1px; }
.callchat__agent-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.callchat__agent-info strong { overflow: hidden; font-size: 15px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.callchat__agent-info small { overflow: hidden; font-size: 13px; color: #666; text-overflow: ellipsis; white-space: nowrap; }
.callchat__agent-cta, .callchat__start {
  font-size: 14px;
  font-weight: 700;
}
.callchat__agent-cta {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: 10px;
  background: var(--cc-dark);
  color: #fff;
  white-space: nowrap;
}
.callchat__start { justify-content: center; background: var(--cc-dark); color: #fff !important; }
.callchat__cta-icon { display: inline-flex; width: 18px; height: 18px; }
.callchat__cta-icon svg { width: 100%; height: 100%; }

/* Help tab: category list -> questions -> answer */
.callchat__popup-back {
  display: none;
  flex: 1;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  margin: 0;
  padding: 4px 2px;
  border: 0;
  background: transparent;
  color: var(--cc-dark);
  font: 700 15px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  text-align: left;
  cursor: pointer;
}
.callchat__back-icon { display: inline-flex; width: 18px; height: 18px; }
.callchat__back-icon svg { width: 100%; height: 100%; }
.callchat__popup--sub .callchat__popup-back { display: inline-flex; }
.callchat__popup--sub .callchat__popup-logo,
.callchat__popup--sub .callchat__popup-titles { display: none; }

.callchat__help-heading { margin: 4px 2px 0; font-size: 18px; font-weight: 700; line-height: 1.3; color: #1a1a1a; }
.callchat__help-list {
  margin: 0;
  padding: 0;
  overflow: hidden;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  list-style: none;
}
.callchat__help-list li { margin: 0; padding: 0; }
.callchat__help-list li + li { border-top: 1px solid #ececec; }
.callchat__help-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  margin: 0;
  padding: 16px 18px;
  border: 0;
  background: #fff;
  color: #1a1a1a;
  font: 400 15px/1.35 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  text-align: left;
  cursor: pointer;
}
.callchat__help-row:hover { background: color-mix(in srgb, var(--cc-accent) 6%, #fff); }
.callchat__help-row:focus-visible, .callchat__popup-back:focus-visible { outline: 3px solid var(--cc-accent); outline-offset: -3px; }
.callchat__chevron { flex: none; display: inline-flex; width: 16px; height: 16px; color: #8a8a8a; }
.callchat__chevron svg { width: 100%; height: 100%; }

.callchat__article-title { margin: 4px 2px 4px; font-size: 20px; font-weight: 700; line-height: 1.3; color: #1a1a1a; }
.callchat__help-heading:focus, .callchat__article-title:focus { outline: none; }
.callchat__article { padding: 0 2px; font-size: 15px; line-height: 1.6; color: #2a2a2a; overflow-wrap: anywhere; }
.callchat__article p { margin: 0 0 12px; }
.callchat__article ul { margin: 0 0 12px; padding-left: 22px; list-style: disc; }
.callchat__article li { margin: 4px 0; }
.callchat__article strong { font-weight: 700; color: #1a1a1a; }

.callchat__tabs { display: flex; gap: 8px; padding: 10px 14px 12px; background: #fff; border-top: 1px solid #eee; }
.callchat__tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin: 0;
  padding: 8px 6px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #888;
  font: 600 13px/1.2 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  cursor: pointer;
}
.callchat__tab[aria-selected="true"] { background: var(--cc-accent); color: #fff; }
.callchat__tab-icon { display: inline-flex; width: 22px; height: 22px; }
.callchat__tab-icon svg { width: 100%; height: 100%; }

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

/* Pro animation effects */
.callchat--fade .callchat__btn { animation: callchat-fade 0.6s ease both; }
.callchat--fade .callchat__btn:nth-child(2) { animation-delay: 0.15s; }
.callchat--pulse .callchat__btn { animation: callchat-pulse 2s ease-out infinite; }
.callchat--bounce .callchat__btn { animation: callchat-bounce 2.4s ease infinite; }
.callchat--bounce .callchat__btn:nth-child(2) { animation-delay: 0.3s; }

@keyframes callchat-fade { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes callchat-pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--cc-color) 60%, transparent); }
  70% { box-shadow: 0 0 0 14px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
@keyframes callchat-bounce { 0%, 20%, 50%, 80%, 100% { transform: none; } 40% { transform: translateY(-8px); } 60% { transform: translateY(-4px); } }

@media (prefers-reduced-motion: reduce) {
  .callchat__btn, .callchat__popup, .callchat__agent, .callchat__start { animation: none !important; transition: none; }
}
@media print { .callchat { display: none !important; } }
