/*
 * Telada live chat widget.
 * Self-contained: every rule is scoped to #tlc-widget and uses the tlc- prefix.
 * Colours match telada-whatsapp (the theme's dark and yellow primary).
 */

#tlc-widget {
  --tlc-dark: hsl(58 11% 8%);
  --tlc-accent: hsl(58 100% 50%);
  --tlc-accent-hover: hsl(58 100% 40%);
  --tlc-on-dark: #fff;
  --tlc-light: #f5f5f0;
  --tlc-text: hsl(58 11% 8%);
  --tlc-muted: hsl(58 6% 40%);
  --tlc-line: hsl(58 6% 85%);
  font-family: Inter, sans-serif;
}

#tlc-widget *,
#tlc-widget *::before,
#tlc-widget *::after {
  box-sizing: border-box;
}

#tlc-widget .tlc-toggle {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 999;
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 50%;
  background: var(--tlc-accent);
  color: var(--tlc-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

#tlc-widget .tlc-toggle:hover {
  background: var(--tlc-accent-hover);
  color: var(--tlc-on-dark);
}

#tlc-widget .tlc-toggle:focus-visible,
#tlc-widget .tlc-close:focus-visible,
#tlc-widget .tlc-send:focus-visible,
#tlc-widget .tlc-email-send:focus-visible,
#tlc-widget .tlc-whatsapp:focus-visible {
  outline: 3px solid var(--tlc-accent);
  outline-offset: 3px;
}

#tlc-widget .tlc-glyph {
  width: 28px;
  height: 28px;
}

#tlc-widget .tlc-unread {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 10px;
  background: #d92d20;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
}

#tlc-widget .tlc-unread[hidden] {
  display: none;
}

#tlc-widget .tlc-panel {
  position: fixed;
  right: 16px;
  bottom: 84px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  width: min(380px, calc(100vw - 32px));
  height: min(560px, calc(100dvh - 108px));
  border-radius: 12px;
  overflow: hidden;
  background: var(--tlc-light);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
  animation: tlc-in 150ms ease-out;
}

#tlc-widget .tlc-panel[hidden] {
  display: none;
}

#tlc-widget .tlc-header {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--tlc-dark);
  color: var(--tlc-on-dark);
}

#tlc-widget .tlc-avatar {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

#tlc-widget .tlc-avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--tlc-accent);
  color: var(--tlc-dark);
  font-weight: 700;
}

#tlc-widget .tlc-header-text {
  flex: 1;
  min-width: 0;
}

#tlc-widget .tlc-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--tlc-on-dark);
}

#tlc-widget .tlc-status {
  margin: 2px 0 0;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.75);
}

#tlc-widget .tlc-status::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 50%;
  background: #3ccf6e;
  vertical-align: 1px;
}

#tlc-widget.tlc-offline .tlc-status::before {
  background: rgba(255, 255, 255, 0.45);
}

#tlc-widget .tlc-close {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--tlc-on-dark);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

#tlc-widget .tlc-body {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px;
}

#tlc-widget .tlc-greeting,
#tlc-widget .tlc-msg {
  max-width: 85%;
  margin: 0 0 10px;
  padding: 10px 14px;
  border-radius: 12px 12px 12px 4px;
  background: #fff;
  color: var(--tlc-text);
  font-size: 15px;
  line-height: 1.45;
}

#tlc-widget .tlc-msg p {
  margin: 0;
}

#tlc-widget .tlc-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

#tlc-widget .tlc-msg-visitor {
  margin-left: auto;
  border-radius: 12px 12px 4px 12px;
  background: var(--tlc-accent);
}

#tlc-widget .tlc-pending {
  opacity: 0.6;
}

#tlc-widget .tlc-who {
  margin-bottom: 2px !important;
  color: var(--tlc-muted);
  font-size: 12px;
  font-weight: 600;
}

#tlc-widget .tlc-note {
  margin: 4px 0 12px;
  color: var(--tlc-muted);
  font-size: 13px;
  text-align: center;
}

#tlc-widget .tlc-note-error {
  color: #b42318;
}

#tlc-widget .tlc-email {
  margin: 4px 0 8px;
  padding: 12px;
  border: 1px solid var(--tlc-line);
  border-radius: 10px;
  background: #fff;
}

#tlc-widget .tlc-email[hidden] {
  display: none;
}

#tlc-widget .tlc-email-note {
  margin: 0 0 8px;
  color: var(--tlc-text);
  font-size: 14px;
  line-height: 1.4;
}

#tlc-widget .tlc-email-row {
  display: flex;
  gap: 8px;
}

#tlc-widget .tlc-email input {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--tlc-line);
  border-radius: 6px;
  color: var(--tlc-text);
  font: inherit;
  font-size: 16px;
}

#tlc-widget .tlc-email input[aria-invalid='true'] {
  border-color: #b42318;
}

#tlc-widget .tlc-email-send {
  padding: 8px 14px;
  border: 0;
  border-radius: 6px;
  background: var(--tlc-dark);
  color: var(--tlc-on-dark);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

#tlc-widget .tlc-composer {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--tlc-line);
  background: #fff;
}

#tlc-widget .tlc-composer textarea {
  flex: 1;
  min-width: 0;
  max-height: 120px;
  padding: 8px 10px;
  border: 1px solid var(--tlc-line);
  border-radius: 8px;
  color: var(--tlc-text);
  font: inherit;
  font-size: 16px; /* 16px stops iOS zooming on focus */
  line-height: 1.35;
  resize: none;
  overflow-y: hidden; /* widget.js turns scrolling on past the max height */
}

#tlc-widget .tlc-composer textarea:focus {
  outline: 2px solid var(--tlc-accent);
  outline-offset: 0;
  border-color: transparent;
}

#tlc-widget .tlc-send {
  /* Flex, not text-align: the theme makes every svg display:block. */
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--tlc-accent);
  color: var(--tlc-dark);
  cursor: pointer;
}

#tlc-widget .tlc-send svg {
  width: 20px;
  height: 20px;
}

#tlc-widget .tlc-send:hover {
  background: var(--tlc-accent-hover);
  color: var(--tlc-on-dark);
}

#tlc-widget .tlc-footer {
  flex: 0 0 auto;
  margin: 0;
  padding: 0 12px 10px;
  background: #fff;
  font-size: 13px;
  text-align: center;
}

#tlc-widget .tlc-whatsapp {
  color: var(--tlc-muted);
  text-decoration: underline;
}

#tlc-widget .tlc-whatsapp:hover {
  color: var(--tlc-text);
}

/* Visually hidden, still read by screen readers. */
#tlc-widget .tlc-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Honeypot: off-screen rather than display:none, which some bots skip. */
#tlc-widget .tlc-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

/*
 * Phones: the open panel fills the screen (8px margin) and the bubble hides,
 * since the panel has its own close button. widget.js then sets top and height
 * from window.visualViewport, so the panel stays above the on-screen keyboard.
 */
@media (max-width: 480px) {
  #tlc-widget .tlc-panel {
    top: 8px;
    right: 8px;
    bottom: auto;
    left: 8px;
    width: auto;
    height: calc(100% - 16px);
    height: calc(100dvh - 16px);
  }

  #tlc-widget.tlc-open .tlc-toggle {
    display: none;
  }
}

@keyframes tlc-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  #tlc-widget .tlc-panel {
    animation: none;
  }
}

/*
 * Lift the reCAPTCHA badge above the chat bubble (16px offset + 56px bubble + 16px gap),
 * as telada-whatsapp does; its stylesheet is not loaded while live chat replaces its bubble.
 */
.grecaptcha-badge {
  bottom: 88px !important;
}
