.chatnegar-widget {
  --chatnegar-primary: #0073aa;
  --chatnegar-primary-hover: #005f8a;
  --chatnegar-icon: #ffffff;
  --chatnegar-bg: #ffffff;
  --chatnegar-messages-bg: #f5f5f5;
  --chatnegar-user-bubble: #0073aa;
  --chatnegar-user-text: #ffffff;
  --chatnegar-bot-bubble: #ffffff;
  --chatnegar-bot-text: #333333;
  --chatnegar-border-radius: 16px;
  --chatnegar-focus: #0ea5e9;
  --chatnegar-motion-open: 0.3s;
  --chatnegar-motion-close: 0.25s;
  --chatnegar-font-family: Vazirmatn, Tahoma, sans-serif;
  font-family: var(--chatnegar-font-family);
}

.chatnegar-widget * {
  box-sizing: border-box;
}

.chatnegar-widget button,
.chatnegar-widget input,
.chatnegar-widget textarea,
.chatnegar-widget select {
  font: inherit;
}

.chatnegar-widget [hidden] {
  display: none !important;
}

.chatnegar-floating {
  position: fixed;
  right: 20px;
  left: auto;
  bottom: 20px;
  z-index: 2147483000;
}

.chatnegar-inline {
  width: var(--chatnegar-inline-width, 100%);
  max-width: 100%;
  height: var(--chatnegar-inline-height, 500px);
  min-height: 360px;
  border: 1px solid #d0d7de;
  border-radius: var(--chatnegar-border-radius);
  overflow: hidden;
  position: relative;
}

.chatnegar-toggle-button {
  width: 56px;
  height: 56px;
  position: relative;
  z-index: 2147483003;
  border-radius: 50%;
  border: 0;
  background: var(--chatnegar-primary);
  color: var(--chatnegar-icon);
  cursor: pointer;
  box-shadow: 0 12px 25px rgba(0, 0, 0, 0.2);
  display: grid;
  place-items: center;
  transition: transform 0.2s ease, background 0.2s ease;
}

.chatnegar-toggle-button:hover {
  background: var(--chatnegar-primary-hover);
  transform: translateY(-2px);
}

.chatnegar-toggle-button:focus-visible,
.chatnegar-widget button:focus-visible,
.chatnegar-widget a:focus-visible,
.chatnegar-widget textarea:focus-visible,
.chatnegar-widget input:focus-visible {
  outline: 2px solid var(--chatnegar-focus);
  outline-offset: 2px;
}

.chatnegar-toggle-icon {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  transition: transform 0.25s ease;
}

.chatnegar-toggle-icon svg {
  width: 26px;
  height: 26px;
  display: block;
}

.chatnegar-widget.is-open .chatnegar-toggle-icon--open {
  transform: rotate(90deg) scale(0.2);
  opacity: 0;
}

.chatnegar-widget.is-open .chatnegar-toggle-icon--close {
  display: inline-grid !important;
  transform: rotate(0deg) scale(1);
  opacity: 1;
}

.chatnegar-popup-bubble {
  position: absolute;
  right: 0;
  bottom: 74px;
  z-index: 2147483002;
  background: #fff;
  border-radius: 14px;
  padding: 10px 12px;
  max-width: 260px;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
  animation: chatnegar-slide-in 0.3s ease;
}

.chatnegar-popup-bubble::after {
  content: "";
  position: absolute;
  right: 20px;
  bottom: -8px;
  width: 16px;
  height: 16px;
  background: #fff;
  transform: rotate(45deg);
}

.chatnegar-popup-close {
  position: absolute;
  left: 6px;
  right: auto;
  top: 4px;
  border: 0;
  background: transparent;
  font-size: 16px;
  cursor: pointer;
}

.chatnegar-popup-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.chatnegar-popup-text {
  font-size: 13px;
  line-height: 1.55;
}

.chatnegar-popup-subtitle {
  font-size: 11px;
  line-height: 1.45;
  color: #9ca3af;
}

.chatnegar-window {
  width: 380px;
  height: 520px;
  max-height: calc(100vh - 120px);
  position: relative;
  border-radius: var(--chatnegar-border-radius);
  overflow: hidden;
  background: var(--chatnegar-bg);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.22);
  display: none;
  flex-direction: column;
}

.chatnegar-inline .chatnegar-window {
  width: 100%;
  height: 100%;
  display: flex;
  border-radius: 0;
  box-shadow: none;
}

.chatnegar-floating.is-open .chatnegar-window {
  display: flex;
  animation: chatnegar-window-open var(--chatnegar-motion-open) ease;
}

.chatnegar-floating .chatnegar-window {
  position: absolute;
  right: 0;
  left: auto;
  bottom: 74px;
  z-index: 2147483001;
}

.chatnegar-floating.is-open .chatnegar-toggle-button {
  opacity: 1;
  pointer-events: auto;
}

.chatnegar-header {
  background: var(--chatnegar-primary);
  color: #fff;
  padding: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  position: relative;
}

.chatnegar-agent {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.chatnegar-agent-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: #fff;
}

.chatnegar-agent-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.chatnegar-agent-name {
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chatnegar-agent-title,
.chatnegar-agent-status {
  font-size: 12px;
  opacity: 0.95;
}

.chatnegar-agent-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.chatnegar-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4caf50;
}

.chatnegar-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chatnegar-header-actions button {
  border: 0;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  cursor: pointer;
}

.chatnegar-menu {
  position: absolute;
  right: 10px;
  top: calc(100% + 6px);
  bottom: auto;
  background: #fff;
  color: #111827;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
  z-index: 3;
  min-width: 180px;
}

.chatnegar-menu.chatnegar-menu--down {
  top: calc(100% + 6px) !important;
  bottom: auto !important;
}

.chatnegar-menu button {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 10px;
  text-align: start;
  cursor: pointer;
}

.chatnegar-menu button:hover {
  background: #f1f5f9;
}

.chatnegar-messages {
  flex: 1;
  overflow: auto;
  padding: 12px;
  background: var(--chatnegar-messages-bg);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chatnegar-msg {
  max-width: 84%;
  border-radius: 14px;
  padding: 8px 10px;
  word-break: break-word;
  line-height: 1.45;
  font-size: 14px;
}

.chatnegar-msg code {
  background: rgba(15, 23, 42, 0.06);
  padding: 1px 4px;
  border-radius: 4px;
}

.chatnegar-msg pre {
  overflow: auto;
  background: rgba(15, 23, 42, 0.06);
  padding: 8px;
  border-radius: 8px;
}

.chatnegar-msg--assistant {
  align-self: flex-start;
  background: var(--chatnegar-bot-bubble);
  color: var(--chatnegar-bot-text);
}

.chatnegar-msg--user {
  align-self: flex-end;
  background: var(--chatnegar-user-bubble);
  color: var(--chatnegar-user-text);
}

.chatnegar-msg--system {
  align-self: center;
  background: transparent;
  color: #6b7280;
  font-style: italic;
  text-align: center;
}

.chatnegar-msg-meta {
  margin-top: 4px;
  font-size: 11px;
  opacity: 0.75;
  display: inline-flex;
  gap: 6px;
}

.chatnegar-msg--typing {
  min-width: 62px;
}

.chatnegar-msg--typing .chatnegar-msg-content {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 10px;
}

.chatnegar-msg-typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.chatnegar-typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--chatnegar-ref-typing-dot, #6b7280);
  opacity: 0.2;
  transform: scale(0.82);
  animation: chatnegar-typing-dot-pulse 1.1s infinite ease-in-out;
}

.chatnegar-typing-dot:nth-child(2) {
  animation-delay: 0.12s;
}

.chatnegar-typing-dot:nth-child(3) {
  animation-delay: 0.24s;
}

.chatnegar-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 12px 8px;
}

.chatnegar-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #6b7280;
  animation: chatnegar-blink 1s infinite;
}

.chatnegar-typing span:nth-child(2) {
  animation-delay: 0.12s;
}

.chatnegar-typing span:nth-child(3) {
  animation-delay: 0.24s;
}

.chatnegar-quick-replies {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 0 12px 8px;
}

.chatnegar-quick-reply {
  border: 1px solid #cbd5e1;
  background: #fff;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
}

.chatnegar-privacy-consent {
  margin: 10px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 10px;
  background: #fff;
}

.chatnegar-privacy-consent p {
  margin-top: 0;
}

.chatnegar-end-popup {
  position: absolute;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 14px;
}

.chatnegar-end-popup-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.chatnegar-end-popup-dialog {
  position: relative;
  width: min(100%, 320px);
  border-radius: 14px;
  background: #fff;
  border: 1px solid #d1d5db;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.24);
  padding: 14px;
}

.chatnegar-end-popup-close {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.chatnegar-end-popup .chatnegar-rating,
.chatnegar-end-popup .chatnegar-end-confirm {
  border: 0;
  margin: 0;
  padding: 0;
}

.chatnegar-end-popup .chatnegar-rating p,
.chatnegar-end-popup .chatnegar-end-confirm p {
  margin: 0 0 10px;
}

.chatnegar-stars {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
}

.chatnegar-star {
  border: 0;
  background: transparent;
  font-size: 20px;
  color: #cbd5e1;
  cursor: pointer;
}

.chatnegar-star.is-active {
  color: #f59e0b;
}

.chatnegar-rating-feedback {
  width: 100%;
  margin-bottom: 8px;
}

.chatnegar-rating-actions {
  display: flex;
  gap: 8px;
}

.chatnegar-footer {
  border-top: 1px solid #e5e7eb;
  padding: 8px;
  background: #fff;
}

.chatnegar-input-wrap {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  position: relative;
  width: 100%;
}

.chatnegar-input {
  flex: 1;
  min-width: 0;
  max-width: 100%;
  min-height: 38px;
  max-height: 120px;
  resize: none;
  overflow: auto;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 13px;
  line-height: 1.45;
}

.chatnegar-input::placeholder {
  font-family: inherit;
  font-size: inherit;
}

.chatnegar-send {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 10px;
  background: var(--chatnegar-primary);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.chatnegar-send[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.chatnegar-send svg {
  width: 20px;
  height: 20px;
  transform: rotate(180deg);
}

.chatnegar-char-count {
  margin-top: 4px;
  text-align: end;
  font-size: 11px;
  color: #6b7280;
}

.chatnegar-powered-by {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid #e5e7eb;
  text-align: center;
  font-size: 12px;
  color: #6b7280;
  position: sticky;
  bottom: 0;
  background: #fff;
  z-index: 1;
}

.chatnegar-emoji-panel {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
  padding: 8px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
}

.chatnegar-emoji-item {
  border: 0;
  background: #f3f4f6;
  border-radius: 8px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

html.chatnegar-no-scroll,
body.chatnegar-no-scroll {
  overflow: hidden !important;
  overscroll-behavior: none;
  height: 100%;
}

@media (max-width: 480px) {
  .chatnegar-floating {
    left: 12px;
    right: 12px;
    bottom: 12px;
  }

  .chatnegar-floating .chatnegar-window {
    position: fixed;
    inset: 0;
    width: 100vw !important;
    height: 100vh !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
  }

  .chatnegar-floating.is-open .chatnegar-toggle-button {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
  }

  .chatnegar-header {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 12px;
  }

  .chatnegar-header-actions button {
    width: 44px;
    height: 44px;
  }

  .chatnegar-footer {
    position: sticky;
    bottom: 0;
    z-index: 2;
  }

  .chatnegar-input,
  .chatnegar-send,
  .chatnegar-quick-reply,
  .chatnegar-star {
    min-height: 44px;
  }
}

@keyframes chatnegar-window-open {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes chatnegar-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(0, 115, 170, 0.45);
  }
  70% {
    box-shadow: 0 0 0 16px rgba(0, 115, 170, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(0, 115, 170, 0);
  }
}

@keyframes chatnegar-bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-8px);
  }
  60% {
    transform: translateY(-4px);
  }
}

@keyframes chatnegar-slide-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes chatnegar-blink {
  0%,
  60%,
  100% {
    opacity: 0.2;
  }
  30% {
    opacity: 1;
  }
}

@keyframes chatnegar-typing-dot-pulse {
  0%,
  70%,
  100% {
    opacity: 0.2;
    transform: scale(0.82);
  }
  35% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Reference-like visual layer */
.chatnegar-widget {
  --chatnegar-ref-launcher-from: #4f46e5;
  --chatnegar-ref-launcher-to: #7c3aed;
  --chatnegar-ref-header-from: #4f46e5;
  --chatnegar-ref-header-via: #7c3aed;
  --chatnegar-ref-header-to: #9333ea;
}

.chatnegar-toggle-button {
  background: linear-gradient(135deg, var(--chatnegar-ref-launcher-from), var(--chatnegar-ref-launcher-to));
}

.chatnegar-unread-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  box-shadow: 0 8px 16px rgba(239, 68, 68, 0.35);
}

.chatnegar-popup-bubble {
  right: -8px;
  bottom: 76px;
  width: 320px;
  max-width: min(320px, 85vw);
  border: 1px solid #e0e7ff;
  border-radius: 16px;
  box-shadow: 0 20px 40px rgba(79, 70, 229, 0.18);
}

.chatnegar-header {
  background: linear-gradient(135deg, var(--chatnegar-ref-header-from), var(--chatnegar-ref-header-via), var(--chatnegar-ref-header-to));
}

.chatnegar-messages {
  background: linear-gradient(to bottom, rgba(248, 250, 252, 0.9), #ffffff);
}

.chatnegar-msg--user .chatnegar-msg-content {
  background: linear-gradient(135deg, var(--chatnegar-ref-launcher-from), var(--chatnegar-ref-launcher-to));
  box-shadow: 0 12px 26px rgba(79, 70, 229, 0.18);
}

.chatnegar-msg--assistant .chatnegar-msg-content {
  border: 1px solid #e5e7eb;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}

.chatnegar-input-wrap {
  gap: 6px;
}

.chatnegar-input-action {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 12px;
  background: #f3f4f6;
  color: #6b7280;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.chatnegar-input-action svg {
  width: 18px;
  height: 18px;
}

.chatnegar-send {
  border-radius: 12px;
  background: linear-gradient(135deg, var(--chatnegar-ref-launcher-from), var(--chatnegar-ref-launcher-to));
}

.chatnegar-floating.chatnegar-closing .chatnegar-window {
  animation: chatnegar-window-close var(--chatnegar-motion-close) cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes chatnegar-window-close {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(24px) scale(0.96);
  }
}

@media (max-width: 782px) {
  .chatnegar-floating.is-open .chatnegar-window {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }

  .chatnegar-floating.is-open .chatnegar-toggle-button {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
  }
}

/* Reference parity override (RTL-first) */
.chatnegar-widget.chatnegar-reference {
  direction: rtl;
  text-align: right;
  font-family: var(--chatnegar-font-family);
  --chatnegar-ref-launcher-from: #4f46e5;
  --chatnegar-ref-launcher-to: #7c3aed;
  --chatnegar-ref-header-from: #4f46e5;
  --chatnegar-ref-header-via: #5b4df1;
  --chatnegar-ref-header-to: #6d4cff;
  --chatnegar-ref-window-bg: #ffffff;
  --chatnegar-ref-window-border: #e5e7eb;
  --chatnegar-ref-messages-bg-from: #f4f5f8;
  --chatnegar-ref-messages-bg-to: #ffffff;
  --chatnegar-ref-user-from: #4f46e5;
  --chatnegar-ref-user-to: #7c3aed;
  --chatnegar-ref-user-text: #ffffff;
  --chatnegar-ref-assistant-bg: #ffffff;
  --chatnegar-ref-assistant-border: #e5e7eb;
  --chatnegar-ref-assistant-text: #1f2937;
  --chatnegar-ref-meta-color: #9ca3af;
  --chatnegar-ref-typing-dot: #9ca3af;
  --chatnegar-ref-input-bg: #ffffff;
  --chatnegar-ref-input-border: #d1d5db;
  --chatnegar-ref-input-text: #111827;
  --chatnegar-ref-input-placeholder: #9ca3af;
  --chatnegar-ref-action-bg: #f3f4f6;
  --chatnegar-ref-action-icon: #9ca3af;
  --chatnegar-ref-send-from: var(--chatnegar-ref-launcher-from);
  --chatnegar-ref-send-to: var(--chatnegar-ref-launcher-to);
  --chatnegar-ref-quick-bg: #eef2ff;
  --chatnegar-ref-quick-border: #dbe4ff;
  --chatnegar-ref-quick-text: #4f46e5;
  --chatnegar-ref-quick-hover-bg: #e0e7ff;
  --chatnegar-ref-footer-border: #edf1f6;
  --chatnegar-ref-footer-text: #c4c9d4;
  --chatnegar-ref-popup-border: #e0e7ff;
}

.chatnegar-widget.chatnegar-reference.chatnegar-floating {
  right: 20px;
  left: auto;
}

.chatnegar-widget.chatnegar-reference .chatnegar-toggle-button {
  position: relative;
  z-index: 2147483003;
  background: linear-gradient(135deg, var(--chatnegar-ref-launcher-from), var(--chatnegar-ref-launcher-to));
  box-shadow: 0 14px 32px rgba(79, 70, 229, 0.34);
}

.chatnegar-widget.chatnegar-reference .chatnegar-toggle-button::after {
  content: "";
  position: absolute;
  left: 4px;
  bottom: 4px;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  border: 2px solid #4f46e5;
  background: #34d399;
}

.chatnegar-widget.chatnegar-reference .chatnegar-window {
  border-radius: 22px;
  border: 1px solid var(--chatnegar-ref-window-border);
  overflow: hidden;
  background: var(--chatnegar-ref-window-bg);
}

.chatnegar-widget.chatnegar-reference .chatnegar-header {
  position: relative;
  isolation: isolate;
  min-height: 88px;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--chatnegar-ref-launcher-from) 0%, var(--chatnegar-ref-header-via) 50%, var(--chatnegar-ref-launcher-to) 100%);
}

.chatnegar-widget.chatnegar-reference .chatnegar-header::before,
.chatnegar-widget.chatnegar-reference .chatnegar-header::after {
  content: none;
}

.chatnegar-widget.chatnegar-reference .chatnegar-agent {
  gap: 10px;
}

.chatnegar-widget.chatnegar-reference .chatnegar-agent-avatar {
  width: 44px;
  height: 44px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.2);
}

.chatnegar-widget.chatnegar-reference .chatnegar-agent-info {
  line-height: 1.35;
}

.chatnegar-widget.chatnegar-reference .chatnegar-agent-name {
  font-size: 21px;
  font-weight: 700;
}

.chatnegar-widget.chatnegar-reference .chatnegar-agent-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: currentColor;
  opacity: 0.92;
}

.chatnegar-widget.chatnegar-reference .chatnegar-agent-title::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--chatnegar-status-color, #22c55e);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.24);
}

.chatnegar-widget.chatnegar-reference .chatnegar-agent-status {
  display: none;
}

.chatnegar-widget.chatnegar-reference .chatnegar-header-actions {
  align-self: flex-start;
}

.chatnegar-widget.chatnegar-reference .chatnegar-menu-toggle {
  display: inline-grid;
}

.chatnegar-widget.chatnegar-reference .chatnegar-header-actions button {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.14);
  font-size: 22px;
}

.chatnegar-widget.chatnegar-reference .chatnegar-header-actions button:hover {
  background: rgba(255, 255, 255, 0.22);
}

.chatnegar-widget.chatnegar-reference .chatnegar-messages {
  background: linear-gradient(to bottom, var(--chatnegar-ref-messages-bg-from), var(--chatnegar-ref-messages-bg-to) 38%);
  padding: 14px 16px;
  gap: 12px;
}

.chatnegar-widget.chatnegar-reference .chatnegar-date-separator {
  align-self: center;
  font-size: 12px;
  color: #94a3b8;
  background: #f1f5f9;
  padding: 5px 14px;
  border-radius: 999px;
  margin: 0 auto 8px;
}

.chatnegar-widget.chatnegar-reference .chatnegar-msg {
  max-width: 82%;
  width: fit-content;
  padding: 0;
  background: transparent;
}

.chatnegar-widget.chatnegar-reference .chatnegar-msg--assistant {
  align-self: flex-start;
  margin-right: auto;
  margin-left: 0;
}

.chatnegar-widget.chatnegar-reference .chatnegar-msg--assistant .chatnegar-msg-content {
  border: 1px solid var(--chatnegar-ref-assistant-border);
  border-radius: 18px 18px 18px 6px;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
  color: var(--chatnegar-ref-assistant-text);
  background: var(--chatnegar-ref-assistant-bg);
}

.chatnegar-widget.chatnegar-reference .chatnegar-msg--user {
  align-self: flex-end;
  margin-left: auto;
  margin-right: 0;
}

.chatnegar-widget.chatnegar-reference .chatnegar-msg--user .chatnegar-msg-content {
  background: linear-gradient(135deg, var(--chatnegar-ref-user-from), var(--chatnegar-ref-user-to));
  border-radius: 18px 18px 6px 18px;
  box-shadow: 0 10px 22px rgba(79, 70, 229, 0.2);
  color: var(--chatnegar-ref-user-text);
}

.chatnegar-widget.chatnegar-reference .chatnegar-msg-content {
  padding: 10px 12px;
  line-height: 1.85;
  text-align: right;
}

.chatnegar-widget.chatnegar-reference .chatnegar-msg-meta {
  margin-top: 4px;
  padding-inline: 4px;
  font-size: 11px;
  opacity: 0.78;
  justify-content: flex-start;
}

.chatnegar-widget.chatnegar-reference .chatnegar-msg--assistant .chatnegar-msg-meta {
  color: var(--chatnegar-ref-meta-color);
  justify-content: flex-start;
}

.chatnegar-widget.chatnegar-reference .chatnegar-msg--user .chatnegar-msg-meta {
  color: var(--chatnegar-ref-meta-color);
  justify-content: flex-end;
}

.chatnegar-widget.chatnegar-reference .chatnegar-typing {
  padding: 0 16px 10px;
}

.chatnegar-widget.chatnegar-reference .chatnegar-typing span {
  width: 8px;
  height: 8px;
  background: var(--chatnegar-ref-typing-dot);
}

.chatnegar-widget.chatnegar-reference .chatnegar-typing-dot {
  width: 8px;
  height: 8px;
  background: var(--chatnegar-ref-typing-dot);
}

.chatnegar-widget.chatnegar-reference .chatnegar-quick-replies {
  justify-content: center;
  gap: 10px;
  padding: 8px 14px 8px;
  border-top: 1px solid var(--chatnegar-ref-quick-border);
}

.chatnegar-widget.chatnegar-reference .chatnegar-quick-reply {
  border: 1px solid var(--chatnegar-ref-quick-border);
  background: var(--chatnegar-ref-quick-bg);
  color: var(--chatnegar-ref-quick-text);
  border-radius: 14px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 500;
}

.chatnegar-widget.chatnegar-reference .chatnegar-quick-reply:hover {
  background: var(--chatnegar-ref-quick-hover-bg);
}

.chatnegar-widget.chatnegar-reference .chatnegar-footer {
  border-top: 1px solid var(--chatnegar-ref-footer-border);
  padding: 8px 10px 10px;
  background: #ffffff;
}

.chatnegar-widget.chatnegar-reference .chatnegar-input-wrap {
  align-items: center;
  gap: 8px;
  width: 100%;
}

.chatnegar-widget.chatnegar-reference .chatnegar-input-action {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--chatnegar-ref-action-bg);
  color: var(--chatnegar-ref-action-icon);
}

.chatnegar-widget.chatnegar-reference .chatnegar-input-action:hover {
  background: #ebeef2;
}

.chatnegar-widget.chatnegar-reference .chatnegar-input {
  min-width: 0;
  max-width: 100%;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid var(--chatnegar-ref-input-border);
  background: var(--chatnegar-ref-input-bg);
  color: var(--chatnegar-ref-input-text);
  text-align: right;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.45;
}

.chatnegar-widget.chatnegar-reference .chatnegar-input::placeholder {
  color: var(--chatnegar-ref-input-placeholder);
}

.chatnegar-widget.chatnegar-reference .chatnegar-send {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--chatnegar-ref-send-from), var(--chatnegar-ref-send-to));
}

.chatnegar-widget.chatnegar-reference .chatnegar-send svg {
  transform: rotate(180deg);
}

.chatnegar-widget.chatnegar-reference .chatnegar-menu-toggle svg,
.chatnegar-widget.chatnegar-reference .chatnegar-input-action svg,
.chatnegar-widget.chatnegar-reference .chatnegar-send svg {
  width: 20px;
  height: 20px;
}

.chatnegar-widget.chatnegar-reference .chatnegar-toggle-icon svg {
  width: 26px;
  height: 26px;
}

.chatnegar-widget.chatnegar-reference .chatnegar-char-count {
  margin-top: 3px;
  color: #94a3b8;
}

.chatnegar-widget.chatnegar-reference .chatnegar-powered-by {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--chatnegar-ref-footer-border);
  text-align: center;
  font-size: 11px;
  color: var(--chatnegar-ref-footer-text);
  position: sticky;
  bottom: 0;
  background: #ffffff;
  z-index: 1;
}

.chatnegar-widget.chatnegar-reference .chatnegar-emoji-panel {
  border-color: var(--chatnegar-ref-input-border);
}

.chatnegar-widget.chatnegar-reference .chatnegar-emoji-item {
  background: var(--chatnegar-ref-action-bg);
  color: var(--chatnegar-ref-action-icon);
}

.chatnegar-widget.chatnegar-reference .chatnegar-popup-bubble {
  right: -10px;
  left: auto;
  bottom: 78px;
  width: 320px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid var(--chatnegar-ref-popup-border);
  box-shadow: 0 20px 38px rgba(79, 70, 229, 0.2);
}

.chatnegar-widget.chatnegar-reference .chatnegar-popup-inner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.chatnegar-widget.chatnegar-reference .chatnegar-popup-avatar {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 2px solid var(--chatnegar-ref-popup-border);
}

.chatnegar-widget.chatnegar-reference .chatnegar-popup-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chatnegar-widget.chatnegar-reference .chatnegar-popup-title {
  font-size: 13px;
  color: #111827;
}

.chatnegar-widget.chatnegar-reference .chatnegar-popup-text {
  color: #4b5563;
  font-size: 13px;
  line-height: 1.6;
}

.chatnegar-widget.chatnegar-reference .chatnegar-popup-subtitle {
  font-size: 11px;
  line-height: 1.45;
  color: #9ca3af;
}

@media (max-width: 782px) {
  .chatnegar-widget.chatnegar-reference.chatnegar-floating {
    left: 12px;
    right: 12px;
    bottom: 12px;
  }

  .chatnegar-widget.chatnegar-reference.chatnegar-floating .chatnegar-window,
  .chatnegar-widget.chatnegar-reference.chatnegar-floating.is-open .chatnegar-window {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    border-radius: 0 !important;
  }

  .chatnegar-widget.chatnegar-reference.chatnegar-floating.is-open .chatnegar-toggle-button {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
  }

  .chatnegar-widget.chatnegar-reference .chatnegar-header-actions button,
  .chatnegar-widget.chatnegar-reference .chatnegar-input,
  .chatnegar-widget.chatnegar-reference .chatnegar-send,
  .chatnegar-widget.chatnegar-reference .chatnegar-input-action,
  .chatnegar-widget.chatnegar-reference .chatnegar-quick-reply {
    min-height: 44px;
  }
}
