/* Live shop chat: messenger dock. Uses store tokens; isolated from theme type rules. */
.live-chat {
  position: fixed;
  inset-inline-end: max(1rem, env(safe-area-inset-right));
  inset-block-end: max(1rem, env(safe-area-inset-bottom));
  z-index: 2400;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.7rem;
  pointer-events: none;
  isolation: isolate;
  mix-blend-mode: normal;
  filter: none;
  font-family: var(--font-body, system-ui, sans-serif);
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.4;
  text-transform: none;
  color: var(--text);
  color-scheme: light;
}
.live-chat[data-scheme="dark"] { color-scheme: dark; }
.live-chat[hidden],
.live-chat-launch[hidden],
.live-chat-panel[hidden] { display: none !important; }
.live-chat > * { pointer-events: auto; mix-blend-mode: normal; }

html body .live-chat .live-chat-launch,
.live-chat-launch {
  position: relative;
  width: 3.65rem;
  height: 3.65rem;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--ink-on-accent, #111114);
  box-shadow:
    0 0 0 2px var(--bg, #fff),
    0 0 0 3px color-mix(in srgb, var(--accent) 70%, var(--text)),
    0 12px 28px color-mix(in srgb, var(--text) 22%, transparent);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.live-chat-launch:hover,
.live-chat-launch:focus-visible {
  transform: translateY(-2px) scale(1.03);
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.live-chat-launch svg { width: 1.45rem; height: 1.45rem; display: block; }
.live-chat-dot {
  position: absolute;
  inset-inline-end: 0.18rem;
  inset-block-start: 0.18rem;
  width: 0.72rem;
  height: 0.72rem;
  border-radius: 999px;
  background: #22c55e;
  box-shadow:
    0 0 0 2px #fff,
    0 0 0 3px rgb(0 0 0 / 55%);
}
.live-chat-dot::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: inherit;
  border: 2px solid #22c55e;
  animation: live-chat-ping 1.8s ease-out infinite;
}
.live-chat-badge {
  position: absolute;
  inset-inline-start: -0.15rem;
  inset-block-start: -0.2rem;
  min-width: 1.15rem;
  height: 1.15rem;
  padding: 0 0.28rem;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  box-shadow: 0 0 0 2px var(--bg, #fff);
}
.live-chat-badge[hidden] { display: none; }

.live-chat-panel {
  width: min(22.5rem, calc(100vw - 1.6rem));
  height: min(34rem, calc(100dvh - 7.2rem));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 1.25rem;
  background: var(--surface, #fff);
  color: var(--text);
  border: 1px solid color-mix(in srgb, var(--text) 12%, transparent);
  box-shadow:
    0 24px 60px color-mix(in srgb, var(--text) 28%, transparent),
    0 0 0 1px color-mix(in srgb, var(--accent) 18%, transparent);
  transform-origin: bottom right;
  animation: live-chat-in 0.18s ease-out;
}
[dir="rtl"] .live-chat-panel { transform-origin: bottom left; }
.live-chat-panel[hidden] { display: none; }

.live-chat-head {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.85rem 0.9rem 0.8rem;
  color: var(--ink-on-header, var(--text));
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--accent) 22%, var(--header, var(--surface, #fff))) 0%,
    color-mix(in srgb, var(--accent) 8%, var(--header, var(--surface, #fff))) 100%
  );
  border-bottom: 1px solid color-mix(in srgb, var(--ink-on-header, var(--text)) 12%, transparent);
}
.live-chat-avatar {
  position: relative;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--ink-on-accent, #111114);
  font-weight: 700;
  flex: none;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--ink-on-header, #fff) 62%, transparent);
}
.live-chat-avatar .live-chat-dot {
  inset-inline-end: -1px;
  inset-block-start: auto;
  inset-block-end: -1px;
}
.live-chat #sn-live-chat-title,
.live-chat-head h2 {
  margin: 0;
  font-family: var(--font-heading, inherit);
  font-size: 1.02rem;
  line-height: 1.25;
  letter-spacing: 0;
  font-weight: 700;
  text-transform: none;
  color: inherit;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.live-chat-status {
  margin: 0.12rem 0 0;
  font-size: 0.78rem;
  font-weight: 650;
  color: inherit;
}
.live-chat-head-text { min-width: 0; flex: 1; }
.live-chat-x {
  width: 2.75rem;
  height: 2.75rem;
  border: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink-on-header, var(--text)) 12%, transparent);
  color: inherit;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.live-chat-x:hover,
.live-chat-x:focus-visible {
  background: color-mix(in srgb, var(--ink-on-header, var(--text)) 20%, transparent);
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.live-chat-log {
  flex: 1;
  overflow: auto;
  padding: 0.85rem 0.8rem 0.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  background:
    radial-gradient(120% 80% at 100% 0%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 46%),
    var(--surface, #fff);
  color: var(--text);
}
.live-chat-intro,
.live-chat-empty,
.live-chat-note {
  margin: 0;
  padding: 0.65rem 0.75rem;
  border-radius: 0.9rem;
  background: var(--bg, #fff);
  color: var(--text);
  font-size: 0.88rem;
  line-height: 1.4;
}
.live-chat-bubble {
  max-width: 84%;
  padding: 0.55rem 0.75rem;
  border-radius: 1.05rem;
  font-size: 0.92rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.live-chat-bubble p { margin: 0; }
.live-chat-bubble p + p { margin-top: 0.35rem; }
.live-chat-meta {
  display: block;
  margin-top: 0.28rem;
  font-size: 0.68rem;
  font-weight: 650;
}
.live-chat-bubble.is-you {
  align-self: flex-end;
  background: var(--accent);
  color: var(--ink-on-accent, #111114);
  border-bottom-right-radius: 0.35rem;
}
[dir="rtl"] .live-chat-bubble.is-you { border-bottom-right-radius: 1.05rem; border-bottom-left-radius: 0.35rem; }
.live-chat-bubble.is-shop {
  align-self: flex-start;
  background: var(--bg, #fff);
  color: var(--text);
  border: 1px solid color-mix(in srgb, var(--text) 12%, transparent);
  border-bottom-left-radius: 0.35rem;
}
[dir="rtl"] .live-chat-bubble.is-shop { border-bottom-left-radius: 1.05rem; border-bottom-right-radius: 0.35rem; }
.live-chat-bubble.is-deleted { opacity: 0.7; font-style: italic; }
.live-chat-photos {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.4rem;
}
.live-chat-photos a {
  display: block;
  width: 4.4rem;
  height: 4.4rem;
  border-radius: 0.5rem;
  overflow: hidden;
}
.live-chat-photos img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.live-chat-compose {
  display: flex;
  align-items: flex-end;
  gap: 0.45rem;
  padding: 0.65rem 0.7rem calc(0.65rem + env(safe-area-inset-bottom));
  border-top: 1px solid color-mix(in srgb, var(--text) 8%, transparent);
  background: var(--surface, #fff);
}
.live-chat .live-chat-compose textarea {
  flex: 1;
  min-height: 2.75rem;
  max-height: 7.5rem;
  resize: none;
  border: 1px solid color-mix(in srgb, var(--text) 14%, transparent);
  border-radius: 1rem;
  padding: 0.55rem 0.8rem;
  background: var(--bg, #fff);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  letter-spacing: 0;
  text-transform: none;
  line-height: 1.35;
  box-shadow: none;
  filter: none;
}
.live-chat .live-chat-compose textarea::placeholder {
  color: color-mix(in srgb, var(--text) 78%, var(--bg, #fff));
  opacity: 1;
}
.live-chat .live-chat-compose textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.live-chat-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}
html body .live-chat .live-chat-send,
.live-chat-send {
  width: 2.75rem;
  height: 2.75rem;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--ink-on-accent, #111114);
  cursor: pointer;
  display: grid;
  place-items: center;
  flex: none;
  box-shadow: none;
  filter: none;
  text-transform: none;
}
.live-chat-send:disabled { opacity: 0.55; cursor: wait; }
.live-chat-send svg { width: 1.1rem; height: 1.1rem; }

@keyframes live-chat-in {
  from { opacity: 0; transform: translateY(10px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes live-chat-ping {
  0% { transform: scale(1); opacity: 0.7; }
  100% { transform: scale(1.9); opacity: 0; }
}

@media (max-width: 640px) {
  .live-chat-panel {
    width: min(100vw - 1.2rem, 26rem);
    height: min(78dvh, calc(100dvh - 6.4rem));
    border-radius: 1.1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .live-chat-launch,
  .live-chat-panel,
  .live-chat-dot::after { animation: none; transition: none; }
}

.live-chat-offer {
  margin: 0 0.9rem 0.4rem;
  padding: 0.55rem 0.7rem;
  border-radius: 0.7rem;
  background: color-mix(in srgb, var(--accent) 14%, var(--surface, var(--bg, #fff)));
  color: var(--text);
  font-size: 0.86rem;
  line-height: 1.35;
}
