/* Live chat widget — public shell */
.lc-root {
  --lc-bg: color-mix(in srgb, var(--mp-surface, #121826) 92%, #000);
  --lc-panel: color-mix(in srgb, var(--mp-elevated, #182033) 96%, #0a0f18);
  --lc-border: color-mix(in srgb, var(--mp-border, #2a3548) 85%, transparent);
  --lc-text: var(--mp-text, #eef2f8);
  --lc-muted: var(--mp-muted, #94a3b8);
  --lc-accent: var(--fatima-accent, #0d9f7a);
  --lc-primary: var(--fatima-primary, #2f6fed);
  position: fixed;
  z-index: 1200;
  inset-inline-start: 1.1rem;
  bottom: 1.1rem;
  font-family: "latin-digits", iransans, "IRANSans", Tahoma, sans-serif;
  font-variant-numeric: lining-nums tabular-nums;
}

.lc-fab {
  width: 58px;
  height: 58px;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, var(--lc-primary), var(--lc-accent));
  box-shadow: 0 12px 28px color-mix(in srgb, var(--lc-accent) 35%, transparent);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
}
.lc-fab:hover { transform: translateY(-2px) scale(1.03); }
.lc-fab:focus-visible { outline: 2px solid var(--lc-accent); outline-offset: 3px; }
.lc-fab i { font-size: 1.55rem; line-height: 1; }
.lc-fab.is-open i.bx-message-rounded-dots { display: none; }
.lc-fab:not(.is-open) i.bx-x { display: none; }

.lc-badge {
  position: absolute;
  top: -2px;
  inset-inline-end: -2px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 2px var(--lc-bg, #0b1018);
}
.lc-badge.is-on { display: inline-flex; }

.lc-panel {
  position: absolute;
  bottom: calc(58px + 0.75rem);
  inset-inline-start: 0;
  width: min(380px, calc(100vw - 1.5rem));
  height: min(560px, calc(100vh - 6.5rem));
  display: none;
  flex-direction: column;
  border-radius: 18px;
  overflow: hidden;
  background: var(--lc-panel);
  border: 1px solid var(--lc-border);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  transform-origin: bottom right;
  animation: lc-pop 0.22s ease;
}
.lc-panel.is-open { display: flex; }
@keyframes lc-pop {
  from { opacity: 0; transform: translateY(10px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.lc-head {
  padding: 0.95rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: linear-gradient(120deg, color-mix(in srgb, var(--lc-primary) 88%, #000), color-mix(in srgb, var(--lc-accent) 80%, #000));
  color: #fff;
}
.lc-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,0.18);
  flex-shrink: 0;
}
.lc-avatar i { font-size: 1.25rem; }
.lc-head-copy { min-width: 0; flex: 1; }
.lc-head-copy strong {
  display: block;
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.2;
}
.lc-status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.2rem;
  font-size: 0.72rem;
  opacity: 0.95;
}
.lc-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #86efac;
  box-shadow: 0 0 0 3px rgba(134, 239, 172, 0.25);
}
.lc-dot.is-off { background: #fbbf24; box-shadow: none; }
.lc-head-close {
  border: 0;
  background: rgba(255,255,255,0.12);
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  cursor: pointer;
}
.lc-head-close:hover { background: rgba(255,255,255,0.22); }

.lc-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse 80% 40% at 100% 0%, color-mix(in srgb, var(--lc-primary) 10%, transparent), transparent 55%),
    var(--lc-bg);
}

.lc-prechat {
  padding: 1.1rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  overflow: auto;
}
.lc-prechat h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  color: var(--lc-text);
}
.lc-prechat p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--lc-muted);
  line-height: 1.55;
}
.lc-field label {
  display: block;
  font-size: 0.72rem;
  color: var(--lc-muted);
  margin-bottom: 0.28rem;
}
.lc-field input {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--lc-border);
  background: color-mix(in srgb, var(--lc-panel) 80%, #000);
  color: var(--lc-text);
  padding: 0.7rem 0.8rem;
  font-size: 0.9rem;
  outline: none;
}
.lc-field input:focus {
  border-color: color-mix(in srgb, var(--lc-accent) 55%, var(--lc-border));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--lc-accent) 18%, transparent);
}
.lc-error {
  color: #f87171;
  font-size: 0.78rem;
  min-height: 1.1em;
}
.lc-btn {
  border: 0;
  border-radius: 12px;
  padding: 0.75rem 1rem;
  font-weight: 700;
  cursor: pointer;
  background: linear-gradient(135deg, var(--lc-primary), var(--lc-accent));
  color: #fff;
}
.lc-btn:disabled { opacity: 0.6; cursor: wait; }

.lc-thread {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0.9rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  scroll-behavior: smooth;
}

.lc-bubble {
  max-width: 86%;
  padding: 0.65rem 0.8rem;
  border-radius: 14px;
  font-size: 0.86rem;
  line-height: 1.55;
  color: var(--lc-text);
  white-space: pre-wrap;
  word-break: break-word;
  animation: lc-in 0.18s ease;
}
@keyframes lc-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.lc-bubble time {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.68rem;
  opacity: 0.65;
  font-variant-numeric: lining-nums;
}
.lc-bubble--visitor {
  align-self: flex-start;
  background: color-mix(in srgb, var(--lc-primary) 22%, var(--lc-panel));
  border-bottom-right-radius: 5px;
}
.lc-bubble--agent {
  align-self: flex-end;
  background: color-mix(in srgb, var(--lc-accent) 28%, var(--lc-panel));
  border-bottom-left-radius: 5px;
}
.lc-bubble--system {
  align-self: center;
  max-width: 94%;
  text-align: center;
  background: transparent;
  color: var(--lc-muted);
  font-size: 0.78rem;
  padding: 0.35rem 0.5rem;
}
.lc-bubble--system time { display: none; }

.lc-typing {
  display: none;
  align-items: center;
  gap: 0.35rem;
  padding: 0 0.95rem 0.35rem;
  color: var(--lc-muted);
  font-size: 0.75rem;
}
.lc-typing.is-on { display: inline-flex; }
.lc-typing-dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--lc-muted);
  display: inline-block;
  animation: lc-bounce 1s infinite;
}
.lc-typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.lc-typing-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes lc-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.45; }
  40% { transform: translateY(-3px); opacity: 1; }
}

.lc-composer {
  display: none;
  gap: 0.45rem;
  padding: 0.7rem 0.75rem 0.85rem;
  border-top: 1px solid var(--lc-border);
  background: color-mix(in srgb, var(--lc-panel) 92%, #000);
}
.lc-composer.is-on { display: flex; }
.lc-composer textarea {
  flex: 1;
  resize: none;
  min-height: 42px;
  max-height: 110px;
  border-radius: 12px;
  border: 1px solid var(--lc-border);
  background: color-mix(in srgb, var(--lc-bg) 80%, #000);
  color: var(--lc-text);
  padding: 0.65rem 0.75rem;
  font-size: 0.88rem;
  outline: none;
  font-family: inherit;
}
.lc-composer textarea:focus {
  border-color: color-mix(in srgb, var(--lc-accent) 50%, var(--lc-border));
}
.lc-send {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 12px;
  background: var(--lc-accent);
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
  display: grid;
  place-items: center;
}
.lc-send:hover { filter: brightness(1.08); }
.lc-send:disabled { opacity: 0.5; cursor: not-allowed; }

html[data-theme="light"] .lc-root {
  --lc-bg: #f7f9fc;
  --lc-panel: #ffffff;
  --lc-border: #d7dee8;
  --lc-text: #0f172a;
  --lc-muted: #64748b;
}

@media (max-width: 480px) {
  .lc-root {
    inset-inline-start: 0.75rem;
    bottom: 0.75rem;
  }
  .lc-panel {
    width: calc(100vw - 1.2rem);
    height: min(72vh, 560px);
  }
}
