#asc-chat-root {
  position: static !important;
  width: 0 !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}

#asc-widget {
  position: fixed !important;
  left: auto !important;
  right: max(12px, env(safe-area-inset-right, 0px)) !important;
  bottom: max(12px, env(safe-area-inset-bottom, 0px)) !important;
  z-index: 999999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --asc-safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* Live-support launcher: pill + circular chat badge, matching the requested
 * green/white visual direction. */
#asc-bubble {
  position: relative;
  width: 195px;
  min-height: 56px;
  border-radius: 40px;
  background: #fff;
  color: #145c32;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(20, 92, 50, 0.22);
  border: 2px solid var(--asc-primary, #1b6e3c);
  padding: 6px 60px 6px 11px;
  transition: none;
  touch-action: manipulation;
  text-align: left;
}
#asc-bubble:hover {
  transform: none !important;
  box-shadow: 0 16px 34px rgba(20, 92, 50, 0.28);
}
#asc-bubble:focus-visible {
  outline: 3px solid rgba(27, 110, 60, .28);
  outline-offset: 3px;
}
.asc-launcher-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.asc-launcher-title {
  font-size: 17.5px;
  line-height: 1.05;
  font-weight: 800;
  letter-spacing: -.5px;
  color: #12612f;
}
.asc-launcher-sub {
  font-size: 10.5px;
  line-height: 1.2;
  color: #4b5563;
  white-space: nowrap;
}
.asc-launcher-sub-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin: 0 4px 1px 2px;
  border-radius: 50%;
  background: #28c75a;
}
.asc-launcher-lightning {
  width: 19px;
  height: 25px;
  flex: 0 0 auto;
  color: #20c94d;
  filter: drop-shadow(0 3px 5px rgba(32, 201, 77, .16));
}
.asc-launcher-orb {
  position: absolute;
  right: -5px;
  top: 50%;
  width: 58px;
  height: 58px;
  transform: translateY(-50%);
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #3cdb61 0%, #20bd4b 42%, #0d9637 100%);
  box-shadow: 0 8px 22px rgba(13, 150, 55, .34), inset 0 2px 4px rgba(255,255,255,.35);
  display: flex;
  align-items: center;
  justify-content: center;
}
.asc-launcher-orb::before,
.asc-launcher-orb::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid rgba(32, 201, 77, .48);
  background: transparent;
  z-index: -1;
  pointer-events: none;
}
.asc-launcher-orb::before {
}
.asc-launcher-orb::after {
  display: none;
}
.asc-launcher-chat-icon {
  width: 38px;
  height: 38px;
  color: #fff;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,.08));
}
.asc-launcher-online {
  position: absolute;
  right: 0;
  top: -11px;
  padding: 5px 8px;
  border-radius: 18px;
  background: #f4fff5;
  border: 1px solid #39d865;
  color: #174b2c;
  font-size: 9.5px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 5px 14px rgba(23, 91, 43, .13);
  white-space: nowrap;
}
.asc-launcher-online::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 5px;
  border-radius: 50%;
  background: #2acb55;
  vertical-align: -1px;
}

.asc-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  overflow: hidden;
  background: rgba(255,255,255,0.18);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .2px;
}
.asc-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.asc-avatar svg { width: 100%; height: 100%; display: block; }
.asc-avatar-initials { background: rgba(255,255,255,0.18); }
.asc-avatar-bubble { width: 40px; height: 40px; background: rgba(255,255,255,0.18); }

#asc-panel {
  position: fixed;
  right: 18px;
  bottom: 12px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 540px;
  max-height: calc(100dvh - 140px);
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.25);
  display: flex;
  flex-direction: column;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px) scale(.985);
  transition: none;
  overflow: hidden;
  min-height: 0;
}
#asc-panel.asc-open {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}
#asc-widget.asc-open #asc-bubble {
  opacity: 0;
  transform: scale(.94);
  pointer-events: none;
}

#asc-header {
  flex: 0 0 auto;
  background: var(--asc-primary, #1b6e3c);
  color: #fff;
  padding: 13px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.asc-agent-wrap { display: flex; align-items: center; min-width: 0; gap: 10px; }
.asc-agent-copy { min-width: 0; }
#asc-header-title { font-weight: 700; font-size: 15px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#asc-header-sub { font-size: 12px; opacity: 0.9; margin-top: 3px; display: flex; align-items: center; gap: 5px; }
.asc-online-dot { width: 7px; height: 7px; border-radius: 50%; background: #a7f3d0; display: inline-block; box-shadow: 0 0 0 2px rgba(255,255,255,.12); }
#asc-close {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 10px;
  color: #fff;
  font-size: 24px;
  font-weight: 300;
  cursor: pointer;
  line-height: 1;
  padding: 0 0 2px;
  margin-left: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,.10);
  transition: none;
  touch-action: manipulation;
}

#asc-close:hover {
  background: rgba(255,255,255,.20);
  border-color: rgba(255,255,255,.30);
}
#asc-close:active {
  transform: scale(.96);
}
#asc-close:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}
@media (prefers-reduced-motion: reduce) {
  #asc-close { transition: none; }
}


#asc-messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 16px;
  background: #f7f8fa;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.asc-msg {
  max-width: 82%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.asc-msg-bot {
  align-self: flex-start;
  background: #fff;
  border: 1px solid #e5e7eb;
  color: #1f2937;
  border-bottom-left-radius: 4px;
}
.asc-msg-user {
  align-self: flex-end;
  background: var(--asc-primary, #1b6e3c);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.asc-msg-typing {
  align-self: flex-start;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  padding: 12px 16px;
  display: flex;
  gap: 4px;
}
.asc-dot { width: 6px; height: 6px; border-radius: 50%; background: #9ca3af; opacity: .65; }

#asc-input-row {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 10px 8px;
  border-top: 1px solid #e5e7eb;
  background: #fff;
}
#asc-input {
  flex: 1;
  min-width: 0;
  resize: none;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 16px;
  line-height: 1.35;
  font-family: inherit;
  max-height: 90px;
  outline: none;
  box-sizing: border-box;
}
#asc-input:focus { border-color: var(--asc-primary, #1b6e3c); }
#asc-send {
  background: var(--asc-primary, #1b6e3c);
  border: none;
  color: #fff;
  width: 44px;
  height: 44px;
  border-radius: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  touch-action: manipulation;
}
#asc-send:disabled { opacity: 0.5; cursor: not-allowed; }
.asc-footer-note { flex: 0 0 auto; text-align: center; font-size: 10px; color: #9ca3af; padding: 0 8px 8px; background: #fff; }

@media (max-width: 480px) {
  /* Keep the launcher physically attached to the viewport's right edge.
   * The !important rules intentionally beat theme/page CSS that often
   * applies left:0 or width:100% to fixed/mobile widgets. */
  #asc-widget {
    position: fixed !important;
    left: auto !important;
    right: max(10px, env(safe-area-inset-right, 0px)) !important;
    bottom: max(10px, env(safe-area-inset-bottom, 0px)) !important;
    width: auto !important;
    max-width: calc(100vw - 20px) !important;
    margin: 0 !important;
    transform: none !important;
  }

  #asc-bubble {
    width: 195px !important;
    max-width: calc(100vw - 20px) !important;
    min-height: 50px !important;
    padding: 6px 60px 6px 11px !important;
    border-radius: 30px;
  }
  .asc-launcher-title { font-size: 17.5px; }
  .asc-launcher-sub { font-size: 10.5px; }
  .asc-launcher-orb { width: 58px; height: 58px; right: -5px; }
  .asc-launcher-chat-icon { width: 38px; height: 38px; }
  .asc-launcher-online { top: -11px; right: 0; font-size: 9.5px; padding: 5px 8px; }

  #asc-panel {
    left: 0;
    right: 0;
    bottom: var(--asc-safe-bottom);
    width: 100%;
    max-width: none;
    height: min(680px, calc(100dvh - 30px));
    max-height: calc(100dvh - 30px);
    border-radius: 20px 20px 0 0;
  }

  #asc-header { padding: 12px 14px; }
  #asc-close { width: 40px; height: 40px; flex-basis: 40px; font-size: 26px; }
  .asc-avatar { width: 40px; height: 40px; }
  #asc-messages { padding: 12px; gap: 8px; }
  .asc-msg { max-width: 88%; font-size: 15px; }
  #asc-input-row { padding: 8px 8px 6px; padding-bottom: max(6px, env(safe-area-inset-bottom, 0px)); }
  .asc-footer-note { display: none; }

  /* JS sets exact top/height while the keyboard is visible. */
  #asc-panel.asc-keyboard-open {
    left: 0;
    right: 0;
    top: var(--asc-visual-top, 0px);
    bottom: auto;
    height: calc(var(--asc-visual-vh, 100dvh) - 8px);
    max-height: calc(var(--asc-visual-vh, 100dvh) - 16px);
    border-radius: 18px 18px 0 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .asc-launcher-orb::before { }
  #asc-panel { transition: none; }
}


/* Never show the support launcher/chat while the WooCommerce cart drawer is open.
 * The theme can place .cart-sidebar-open on body, html, or another ancestor. */
.cart-sidebar-open #asc-widget,
html.cart-sidebar-open #asc-widget,
body.cart-sidebar-open #asc-widget,
#asc-widget.asc-cart-drawer-open {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Keep the widget completely static. The ONLY animation allowed is the
 * three-dot typing indicator below. */
#asc-widget, #asc-widget *, #asc-widget *::before, #asc-widget *::after {
  animation: none !important;
  transition: none !important;
}

@keyframes asc-typing-dot {
  0%, 60%, 100% {
    transform: translateY(0) scale(.85);
    opacity: .35;
  }
  30% {
    transform: translateY(-5px) scale(1);
    opacity: 1;
  }
}

/* The typing indicator is intentionally the ONLY animated element in the
 * widget. Explicitly set every animation property here so theme CSS and the
 * widget's global "no animation" reset cannot leave the dots static. */
#asc-typing-indicator .asc-dot {
  animation-name: asc-typing-dot !important;
  animation-duration: 1.05s !important;
  animation-timing-function: ease-in-out !important;
  animation-iteration-count: infinite !important;
  animation-direction: normal !important;
  animation-fill-mode: both !important;
  animation-play-state: running !important;
  will-change: transform, opacity;
}
#asc-typing-indicator .asc-dot:nth-child(2) {
  animation-delay: .15s !important;
}
#asc-typing-indicator .asc-dot:nth-child(3) {
  animation-delay: .30s !important;
}
