.ps-chat-widget {
  --ps-chat-brand: var(--brand, #6d37ff);
  --ps-chat-brand-dark: #5b2ed4;
  --ps-chat-accent: var(--pink, #ff5dcc);
  --ps-chat-teal: var(--teal, #18c0b9);
  --ps-chat-brand-light: #f1efff;
  --ps-chat-chip-border: #cfd4ff;
  --ps-chat-surface: #f5f2ff;
  --ps-chat-ink: var(--ink, #1b2430);
  --ps-chat-muted: var(--muted, #667085);
  --ps-chat-line: var(--border, #eef0f6);
  --ps-chat-head-grad: var(
    --grad-cta,
    linear-gradient(90deg, var(--brand, #6d37ff), var(--pink, #ff5dcc))
  );
  --ps-chat-msg-in-duration: 0.38s;
  --ps-chat-msg-in-ease: cubic-bezier(0.22, 1, 0.36, 1);
  position: fixed;
  inset-inline-start: max(14px, env(safe-area-inset-left));
  inset-block-end: max(18px, env(safe-area-inset-bottom));
  z-index: 1050;
  font-family: "Rubik", system-ui, sans-serif;
  direction: rtl;
  text-align: right;
}

body.ps-chat-lock {
  overflow: hidden;
}
body.ps-chat-lock iframe[src*="vee-crm"],
body.ps-chat-lock #vplugin,
body.ps-chat-lock [id*="accessibility"],
body.ps-chat-lock [class*="accessibility"],
body.ps-chat-lock [id*="acsb"],
body.ps-chat-lock [class*="acsb"],
body.ps-chat-lock [id*="a11y"],
body.ps-chat-lock [class*="a11y"] {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.ps-chat-backdrop {
  position: fixed;
  inset: 0;
  border: 0;
  background: rgba(8, 14, 28, 0.42);
  backdrop-filter: blur(3px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s ease, visibility 0.22s ease;
  z-index: 0;
}
.ps-chat-widget.ps-chat-open .ps-chat-backdrop {
  opacity: 1;
  visibility: visible;
}

.ps-chat-fab {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 0;
  cursor: pointer;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--ps-chat-head-grad);
  box-shadow: 0 12px 32px rgba(109, 55, 255, 0.42);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  z-index: 2;
}
.ps-chat-widget.ps-chat-open .ps-chat-fab {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: scale(0.92);
}
.ps-chat-fab:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 16px 40px rgba(109, 55, 255, 0.5);
}
.ps-chat-fab:focus-visible {
  outline: 3px solid rgba(24, 192, 185, 0.55);
  outline-offset: 3px;
}
.ps-chat-fab i {
  font-size: 22px;
}

.ps-chat-panel {
  position: fixed;
  inset: 0;
  top: 0;
  left: 0;
  inset-inline-start: auto;
  inset-block-end: auto;
  width: 100vw;
  height: var(--ps-chat-vh, 100vh);
  max-height: var(--ps-chat-vh, 100vh);
  background: #fff;
  border-radius: 0;
  border: 0;
  box-shadow:
    0 4px 6px -1px rgba(15, 23, 42, 0.06),
    0 22px 50px rgba(15, 23, 42, 0.14);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px) scale(0.99);
  transition:
    opacity 0.28s var(--ps-chat-msg-in-ease),
    transform 0.28s var(--ps-chat-msg-in-ease),
    visibility 0.28s;
  z-index: 1;
}
.ps-chat-widget.ps-chat-open .ps-chat-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.ps-chat-head {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 14px 14px;
  background: linear-gradient(
    100deg,
    rgba(91, 46, 212, 0.9) 0%,
    rgba(109, 55, 255, 0.84) 42%,
    rgba(255, 93, 204, 0.78) 100%
  );
  border-bottom: 1px solid rgba(255, 255, 255, 0.22);
  direction: rtl;
}
.ps-chat-head-center {
  text-align: center;
  min-width: 0;
}
.ps-chat-head h2 {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
}
.ps-chat-head-sub {
  margin: 4px 0 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.92);
  line-height: 1.35;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}
.ps-chat-online {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.4);
  flex-shrink: 0;
}
.ps-chat-head-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-size: 1.05rem;
  color: var(--ps-chat-brand);
  background: linear-gradient(180deg, #faf8ff 0%, var(--ps-chat-brand-light) 100%);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.ps-chat-close {
  border: 0;
  background: rgba(255, 255, 255, 0.2);
  width: 34px;
  height: 34px;
  border-radius: 10px;
  cursor: pointer;
  color: #fff;
  flex-shrink: 0;
  transition: background 0.15s ease;
}
.ps-chat-close:hover {
  background: rgba(255, 255, 255, 0.32);
}

.ps-chat-messages {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
  padding: 14px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--ps-chat-surface);
  direction: rtl;
  text-align: right;
}

.ps-chat-row {
  display: flex;
  width: 100%;
  align-items: flex-end;
  gap: 8px;
  padding: 3px 0;
}
.ps-chat-row--user {
  justify-content: flex-start;
}
.ps-chat-row--assistant {
  justify-content: flex-start;
}
.ps-chat-row--continue {
  margin-top: -2px;
  padding-top: 0;
}
.ps-chat-row--continue .ps-chat-bubble.bot {
  margin-top: 2px;
}

.ps-chat-msg-in {
  animation: psChatRowIn var(--ps-chat-msg-in-duration) var(--ps-chat-msg-in-ease) both;
}

@keyframes psChatRowIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ps-chat-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-size: 0.88rem;
  color: var(--ps-chat-brand);
  background: #fff;
  border: 1px solid var(--ps-chat-line);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}
.ps-chat-avatar--ghost {
  visibility: hidden;
  box-shadow: none;
  background: transparent;
  border-color: transparent;
}

.ps-chat-bubble {
  max-width: min(92%, 44rem);
  padding: 10px 13px;
  border-radius: 18px;
  font-size: 0.86rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
  direction: rtl;
  text-align: right;
}
.ps-chat-bubble .ps-chat-em,
.ps-chat-bubble.bot strong {
  font-weight: 800;
  color: var(--ps-chat-brand);
}
.ps-chat-bubble.user {
  background: var(--ps-chat-head-grad);
  color: #fff;
  border-bottom-right-radius: 7px;
  box-shadow: 0 4px 14px rgba(109, 55, 255, 0.35);
}
.ps-chat-bubble.bot {
  background: #fff;
  border: 1px solid var(--ps-chat-line);
  color: var(--ps-chat-ink);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
  border-bottom-left-radius: 7px;
}

.ps-chat-typing {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 10px 14px;
}
.ps-chat-typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.ps-chat-typing-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ps-chat-brand);
  animation: psChatDotBounce 1.05s ease-in-out infinite both;
}
.ps-chat-typing-dots span:nth-child(1) {
  animation-delay: 0ms;
}
.ps-chat-typing-dots span:nth-child(2) {
  animation-delay: 0.15s;
}
.ps-chat-typing-dots span:nth-child(3) {
  animation-delay: 0.3s;
}
.ps-chat-typing-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ps-chat-muted);
  letter-spacing: 0.01em;
}
@keyframes psChatDotBounce {
  0%,
  100% {
    transform: translateY(0);
    opacity: 0.45;
  }
  50% {
    transform: translateY(-5px);
    opacity: 1;
  }
}

.ps-chat-quick {
  flex: 0 0 auto;
  padding: 8px 10px 10px;
  background: var(--ps-chat-brand-light);
  border-top: 1px solid var(--ps-chat-line);
}
.ps-chat-quick[hidden] {
  display: none !important;
}
.ps-chat-quick-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.ps-chat-chip {
  border: 1px solid var(--ps-chat-chip-border);
  background: #fff;
  color: var(--ps-chat-brand);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  line-height: 1.25;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease;
  box-shadow: 0 1px 2px rgba(109, 55, 255, 0.08);
}
.ps-chat-chip:hover {
  background: var(--ps-chat-brand-light);
  border-color: var(--ps-chat-brand);
}
.ps-chat-chip:focus-visible {
  outline: 2px solid var(--ps-chat-teal);
  outline-offset: 2px;
}

.ps-chat-link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
  justify-content: flex-start;
  direction: rtl;
}
.ps-chat-link-btn {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 800;
  text-decoration: none;
  color: #fff !important;
  background: var(--ps-chat-head-grad);
  border: 0;
  box-shadow: 0 4px 12px rgba(109, 55, 255, 0.32);
  transition: transform 0.12s, box-shadow 0.12s, background 0.12s;
}
.ps-chat-link-btn:hover {
  transform: translateY(-1px);
  filter: brightness(0.95);
  box-shadow: 0 6px 16px rgba(109, 55, 255, 0.38);
}

.ps-chat-reply-extras {
  padding-top: 4px;
}

.ps-chat-security-hint {
  flex-shrink: 0;
  margin: 0;
  padding: 5px 10px 6px;
  font-size: 0.64rem;
  font-weight: 600;
  color: var(--ps-chat-muted);
  line-height: 1.35;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  background: #fff;
  border-top: 1px dashed var(--ps-chat-line);
  direction: rtl;
  text-align: right;
}
.ps-chat-security-hint[hidden] {
  display: none !important;
}
.ps-chat-security-hint i {
  color: var(--ps-chat-teal);
  margin-top: 1px;
  flex-shrink: 0;
}

.ps-chat-ads {
  margin-top: 8px;
  padding: 0;
  list-style: none;
}
.ps-chat-ads li {
  margin: 6px 0;
}
.ps-chat-ads a {
  display: block;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--ps-chat-brand-light);
  color: var(--ps-chat-ink);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.86rem;
  border: 1px solid var(--ps-chat-chip-border);
  transition: background 0.12s, transform 0.12s;
}
.ps-chat-ads a:hover {
  background: #e8e4ff;
  transform: translateX(-2px);
}
.ps-chat-meta {
  display: block;
  font-weight: 600;
  color: var(--ps-chat-muted);
  font-size: 0.75rem;
  margin-top: 4px;
}
.ps-chat-ads-grid {
  margin-top: 8px;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}
.ps-chat-ad-card-wrap { margin: 0; }
.ps-chat-ad-card {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 10px;
  border-radius: 14px;
  border: 1px solid var(--ps-chat-chip-border);
  background: #fff;
  text-decoration: none;
  color: var(--ps-chat-ink);
  overflow: hidden;
}
.ps-chat-ad-card:hover {
  border-color: #c3b6ff;
  box-shadow: 0 8px 18px rgba(109,55,255,.15);
}
.ps-chat-ad-media {
  background: #f5f6ff;
  min-height: 92px;
  position: relative;
}
.ps-chat-ad-logo{
  position:absolute;
  top:6px;
  left:6px;
  width:18px;
  height:18px;
  border-radius:6px;
  background:#fff;
  padding:2px;
  box-shadow:0 1px 6px rgba(15,23,42,.2);
  z-index:2;
}
.ps-chat-ad-media > img:not(.ps-chat-ad-logo) {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.ps-chat-ad-ph {
  width: 100%;
  height: 100%;
  min-height: 92px;
  display: grid;
  place-items: center;
  color: #98a2b3;
}
.ps-chat-ad-body {
  padding: 8px 10px 8px 10px;
  min-width: 0;
}
.ps-chat-ad-title {
  margin: 0 0 4px;
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.35;
  color: #101828;
}
.ps-chat-ad-meta {
  font-size: 0.74rem;
  color: #667085;
  margin-bottom: 4px;
}
.ps-chat-ad-snippet {
  display: block;
  font-weight: 500;
  color: var(--ps-chat-muted);
  font-size: 0.75rem;
  line-height: 1.35;
  margin: 0;
}
.ps-chat-ad-price {
  margin-top: 6px;
  font-size: 0.82rem;
  font-weight: 900;
  color: var(--ps-chat-brand);
}

.ps-chat-more {
  margin-top: 10px;
}
.ps-chat-more a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
  color: var(--ps-chat-brand);
  text-decoration: none;
  font-size: 0.88rem;
}
.ps-chat-more a:hover {
  text-decoration: underline;
}

.ps-chat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 0;
  justify-content: flex-start;
  direction: rtl;
}
.ps-chat-chips button {
  border: 1px solid var(--ps-chat-chip-border);
  background: #fff;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--ps-chat-brand);
  cursor: pointer;
  font-family: inherit;
  text-align: right;
  direction: rtl;
  transition:
    border-color 0.15s ease,
    color 0.15s ease,
    background 0.15s ease,
    box-shadow 0.15s ease;
  box-shadow: 0 1px 2px rgba(109, 55, 255, 0.08);
}
.ps-chat-chips button:hover {
  border-color: var(--ps-chat-brand);
  background: var(--ps-chat-brand-light);
}

.ps-chat-form {
  flex: 0 0 auto;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--ps-chat-line);
  background: #fff;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  direction: rtl;
}
.ps-chat-form textarea {
  flex: 1;
  min-height: 42px;
  max-height: 88px;
  resize: none;
  box-sizing: border-box;
  border: 1px solid var(--ps-chat-line);
  border-radius: 14px;
  padding: 9px 11px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ps-chat-ink);
  text-align: right;
  direction: rtl;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}
.ps-chat-form textarea::placeholder {
  color: var(--ps-chat-muted);
}
.ps-chat-form textarea:focus {
  outline: none;
  border-color: var(--ps-chat-brand);
  box-shadow: 0 0 0 3px rgba(109, 55, 255, 0.18);
}
.ps-chat-send {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 0;
  cursor: pointer;
  background: var(--ps-chat-head-grad);
  color: #fff;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    opacity 0.15s ease;
  box-shadow: 0 4px 12px rgba(109, 55, 255, 0.38);
}
.ps-chat-send:hover:not(:disabled) {
  transform: scale(1.04);
  filter: brightness(0.95);
  box-shadow: 0 6px 18px rgba(109, 55, 255, 0.45);
}
.ps-chat-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.ps-chat-send i {
  transform: rotate(-14deg);
  font-size: 1rem;
}

@media (prefers-reduced-motion: reduce) {
  .ps-chat-panel,
  .ps-chat-fab,
  .ps-chat-bubble,
  .ps-chat-form textarea,
  .ps-chat-send,
  .ps-chat-link-btn,
  .ps-chat-ads a,
  .ps-chat-chips button,
  .ps-chat-chip {
    transition: none;
  }
  .ps-chat-msg-in {
    animation: none;
    opacity: 1;
    transform: none;
  }
  .ps-chat-typing-dots span {
    animation: none;
    opacity: 0.85;
  }
  .ps-chat-messages {
    scroll-behavior: auto;
  }
}

@media (max-width: 480px) {
  .ps-chat-widget {
    inset-inline-start: 10px;
    inset-block-end: 14px;
  }
  .ps-chat-panel {
    width: 100vw;
    max-width: 100vw;
    height: var(--ps-chat-vh, 100vh);
    max-height: var(--ps-chat-vh, 100vh);
  }
}

@supports (height: 100dvh) {
  .ps-chat-panel {
    height: var(--ps-chat-vh, 100dvh);
    max-height: var(--ps-chat-vh, 100dvh);
  }
}
