.vls-widget,
.vls-widget * {
  box-sizing: border-box;
}

.vls-widget {
  --vls-primary: #07564e;
  --vls-text: #103a36;
  --vls-muted: #6d7f7d;
  --vls-border: #dce8e5;
  --vls-surface: #ffffff;
  position: fixed;
  bottom: 24px;
  z-index: 999999;
  direction: rtl;
  font-family: "Vazirmatn", Tahoma, "Segoe UI", Arial, sans-serif;
  line-height: 1.7;
  color: var(--vls-text);
}

.vls-position-right { right: 24px; }
.vls-position-left { left: 24px; }

.vls-launcher {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 58px;
  padding: 0 17px;
  border: 0;
  border-radius: 18px;
  background: var(--vls-primary);
  color: #fff;
  box-shadow: 0 14px 38px rgba(5, 65, 58, .28);
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  transition: transform .2s ease, box-shadow .2s ease;
}

.vls-launcher:hover { transform: translateY(-2px); box-shadow: 0 18px 44px rgba(5, 65, 58, .34); }
.vls-launcher:focus-visible, .vls-panel button:focus-visible, .vls-panel input:focus-visible, .vls-panel textarea:focus-visible { outline: 3px solid rgba(205, 148, 37, .45); outline-offset: 2px; }
.vls-launcher-icon { display: grid; place-items: center; width: 28px; height: 28px; }
.vls-launcher-icon svg { width: 27px; height: 27px; }
.vls-unread-badge { position: absolute; top: -7px; left: -7px; min-width: 24px; height: 24px; padding: 0 6px; border: 2px solid #fff; border-radius: 999px; background: #d64040; color: #fff; font-size: 11px; line-height: 20px; text-align: center; }

.vls-panel {
  position: absolute;
  bottom: 72px;
  width: min(380px, calc(100vw - 32px));
  height: min(610px, calc(100vh - 120px));
  overflow: hidden;
  border: 1px solid var(--vls-border);
  border-radius: 24px;
  background: var(--vls-surface);
  box-shadow: 0 26px 80px rgba(6, 50, 46, .22);
  animation: vls-panel-in .22s ease-out;
}

.vls-position-right .vls-panel { right: 0; }
.vls-position-left .vls-panel { left: 0; }

@keyframes vls-panel-in {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.vls-header {
  min-height: 80px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 14px 16px;
  color: #fff;
  background: linear-gradient(135deg, var(--vls-primary), #043b36);
}

.vls-avatar { flex: 0 0 44px; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 15px; background: rgba(255,255,255,.14); }
.vls-avatar svg { width: 25px; height: 25px; }
.vls-header-copy { min-width: 0; display: flex; flex: 1; flex-direction: column; }
.vls-header-copy strong { overflow: hidden; font-size: 15px; font-weight: 900; text-overflow: ellipsis; white-space: nowrap; }
.vls-header-copy span { display: flex; align-items: center; gap: 6px; color: rgba(255,255,255,.82); font-size: 11px; }
.vls-status-dot { width: 8px; height: 8px; border-radius: 50%; background: #4ce89a; box-shadow: 0 0 0 4px rgba(76,232,154,.15); }
.vls-status-dot.is-offline { background: #f3bf58; box-shadow: 0 0 0 4px rgba(243,191,88,.15); }
.vls-close { width: 36px; height: 36px; padding: 0; border: 0; border-radius: 11px; background: rgba(255,255,255,.1); color: #fff; cursor: pointer; font: 400 25px/34px Arial, sans-serif; }
.vls-close:hover { background: rgba(255,255,255,.18); }

.vls-prechat { height: calc(100% - 114px); overflow-y: auto; padding: 20px; background: linear-gradient(180deg, #f4faf8 0, #fff 45%); }
.vls-welcome { padding: 15px; margin-bottom: 17px; border: 1px solid #dcebe7; border-radius: 16px 16px 5px 16px; background: #fff; box-shadow: 0 7px 20px rgba(7,86,78,.06); }
.vls-welcome strong { display: block; margin-bottom: 5px; color: var(--vls-primary); font-size: 13px; }
.vls-welcome p { margin: 0; color: #405b58; font-size: 13px; }
.vls-prechat form { display: flex; flex-direction: column; gap: 7px; }
.vls-prechat label { margin-top: 4px; color: #274b47; font-size: 12px; font-weight: 800; }
.vls-prechat input { width: 100%; height: 48px; padding: 0 13px; border: 1px solid #ccdcda; border-radius: 13px; background: #fff; color: #153f3a; font: inherit; font-size: 13px; }
.vls-prechat input:focus { border-color: var(--vls-primary); box-shadow: 0 0 0 3px rgba(7,86,78,.09); }
.vls-prechat button { min-height: 49px; margin-top: 10px; border: 0; border-radius: 13px; background: var(--vls-primary); color: #fff; cursor: pointer; font: inherit; font-size: 13px; font-weight: 900; }
.vls-prechat button:disabled, .vls-message-form button:disabled { cursor: wait; opacity: .65; }
.vls-hp { position: absolute !important; left: -10000px !important; width: 1px !important; height: 1px !important; opacity: 0 !important; }

.vls-chat { display: grid; grid-template-rows: 1fr auto auto; height: calc(100% - 114px); background: #f4f8f7; }
.vls-messages { overflow-y: auto; padding: 18px 15px; scroll-behavior: smooth; }
.vls-message { display: flex; flex-direction: column; max-width: 82%; padding: 10px 12px 6px; margin-bottom: 10px; border-radius: 15px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; }
.vls-message-admin { margin-left: auto; border: 1px solid #dce7e4; border-bottom-right-radius: 4px; background: #fff; color: #264a46; }
.vls-message-visitor { margin-right: auto; border-bottom-left-radius: 4px; background: var(--vls-primary); color: #fff; }
.vls-message-time { align-self: flex-end; margin-top: 3px; opacity: .65; font-size: 9px; direction: ltr; }
.vls-typing { padding: 3px 16px 6px; color: var(--vls-muted); font-size: 10px; }
.vls-message-form { display: grid; grid-template-columns: 1fr 45px; gap: 8px; padding: 11px 12px; border-top: 1px solid var(--vls-border); background: #fff; }
.vls-message-form textarea { width: 100%; min-height: 45px; max-height: 105px; resize: none; padding: 11px 12px; border: 1px solid #d1dfdc; border-radius: 13px; color: #153f3a; font: inherit; font-size: 13px; line-height: 1.7; }
.vls-message-form button { align-self: end; display: grid; place-items: center; width: 45px; height: 45px; padding: 0; border: 0; border-radius: 13px; background: var(--vls-primary); color: #fff; cursor: pointer; }
.vls-message-form svg { width: 22px; height: 22px; }
.vls-error { margin: 7px 0 0; color: #b42318; font-size: 11px; }
.vls-chat-error { position: absolute; right: 12px; bottom: 59px; left: 12px; padding: 7px 9px; border-radius: 8px; background: #fff0ee; }
.vls-footer { height: 34px; display: grid; place-items: center; border-top: 1px solid #edf2f1; background: #fff; color: #7a8987; font-size: 9px; }

@media (max-width: 600px) {
  .vls-widget { right: 14px; bottom: 16px; left: auto; }
  .vls-widget.vls-position-left { right: auto; left: 14px; }
  .vls-launcher { width: 58px; min-height: 58px; justify-content: center; padding: 0; border-radius: 18px; }
  .vls-launcher-label { position: absolute; overflow: hidden; width: 1px; height: 1px; clip: rect(0 0 0 0); white-space: nowrap; }
  .vls-panel { position: fixed; top: 12px; right: 12px !important; bottom: 12px; left: 12px !important; width: auto; height: auto; max-height: none; border-radius: 20px; }
  body.admin-bar .vls-panel { top: 58px; }
}

@media (prefers-reduced-motion: reduce) {
  .vls-panel { animation: none; }
  .vls-launcher, .vls-messages { transition: none; scroll-behavior: auto; }
}

