/* ==========================================================================
   DorjiPay — Live chat / AI assistant widget
   Self-contained (works on the public site, admin panel and merchant panel)
   ========================================================================== */

.djchat {
  --dj-brand: #6d5efc;
  --dj-brand-2: #8b5cf6;
  --dj-bg: #ffffff;
  --dj-bg-soft: #f4f5fb;
  --dj-text: #1f2233;
  --dj-muted: #6b7280;
  --dj-line: #e6e7ef;
  --dj-radius: 18px;
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 2147483000;
  font-family: "Poppins", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans Bengali", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--dj-text);
}

.djchat *,
.djchat *::before,
.djchat *::after { box-sizing: border-box; }

/* ---------------------------------------------------------------- launcher */
.djchat__fab {
  position: relative;
  width: 58px;
  height: 58px;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--dj-brand) 0%, var(--dj-brand-2) 100%);
  box-shadow: 0 12px 28px rgba(109, 94, 252, .42);
  transition: transform .2s ease, box-shadow .2s ease;
}
.djchat__fab:hover { transform: translateY(-2px) scale(1.03); }
.djchat__fab svg { width: 26px; height: 26px; }
.djchat__fab .djchat__fab-close { display: none; }
.djchat.is-open .djchat__fab .djchat__fab-open { display: none; }
.djchat.is-open .djchat__fab .djchat__fab-close { display: block; }
.djchat__dot {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid #fff;
}

/* ------------------------------------------------------------------- panel */
.djchat__panel {
  position: absolute;
  right: 0;
  bottom: 74px;
  width: 384px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 120px);
  display: flex;
  flex-direction: column;
  background: var(--dj-bg);
  border-radius: var(--dj-radius);
  border: 1px solid var(--dj-line);
  box-shadow: 0 26px 60px rgba(15, 23, 42, .26);
  overflow: hidden;
  opacity: 0;
  transform: translateY(14px) scale(.98);
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.djchat.is-open .djchat__panel {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.djchat__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  color: #fff;
  background: linear-gradient(135deg, var(--dj-brand) 0%, var(--dj-brand-2) 100%);
}
.djchat__avatar {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
}
.djchat__who { flex: 1 1 auto; min-width: 0; }
.djchat__name { font-weight: 700; font-size: 15px; line-height: 1.2; }
.djchat__status { font-size: 11.5px; opacity: .9; display: flex; align-items: center; gap: 5px; }
.djchat__status i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  display: inline-block;
}
.djchat__icon-btn {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 9px;
  cursor: pointer;
  color: #fff;
  background: rgba(255, 255, 255, .16);
  display: flex;
  align-items: center;
  justify-content: center;
}
.djchat__icon-btn:hover { background: rgba(255, 255, 255, .28); }
.djchat__icon-btn svg { width: 16px; height: 16px; }

/* ---------------------------------------------------------------- messages */
.djchat__body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px 14px;
  background: var(--dj-bg-soft);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.djchat__msg {
  max-width: 84%;
  padding: 10px 13px;
  border-radius: 14px;
  white-space: pre-wrap;
  word-wrap: break-word;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .06);
}
.djchat__msg--bot {
  align-self: flex-start;
  background: #fff;
  border: 1px solid var(--dj-line);
  border-bottom-left-radius: 4px;
}
.djchat__msg--me {
  align-self: flex-end;
  color: #fff;
  background: linear-gradient(135deg, var(--dj-brand) 0%, var(--dj-brand-2) 100%);
  border-bottom-right-radius: 4px;
}
.djchat__msg b, .djchat__msg strong { font-weight: 700; }
.djchat__msg code {
  background: rgba(109, 94, 252, .12);
  color: #4c3fd6;
  padding: 1px 5px;
  border-radius: 5px;
  font-size: 12.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.djchat__msg--me code { background: rgba(255, 255, 255, .22); color: #fff; }
.djchat__msg a { color: var(--dj-brand); }
.djchat__msg--me a { color: #fff; text-decoration: underline; }

.djchat__typing { display: inline-flex; gap: 4px; align-items: center; }
.djchat__typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #b9bccb;
  animation: djchat-blink 1.2s infinite ease-in-out both;
}
.djchat__typing span:nth-child(2) { animation-delay: .18s; }
.djchat__typing span:nth-child(3) { animation-delay: .36s; }
@keyframes djchat-blink {
  0%, 80%, 100% { opacity: .3; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

/* ------------------------------------------------------------------ chips */
.djchat__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 14px 10px;
  background: var(--dj-bg-soft);
}
.djchat__chip {
  border: 1px solid var(--dj-line);
  background: #fff;
  color: var(--dj-text);
  border-radius: 999px;
  padding: 6px 11px;
  font-size: 12.5px;
  cursor: pointer;
  transition: all .15s ease;
}
.djchat__chip:hover {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--dj-brand) 0%, var(--dj-brand-2) 100%);
}

/* ------------------------------------------------------------------ input */
.djchat__form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 11px 12px;
  border-top: 1px solid var(--dj-line);
  background: var(--dj-bg);
}
.djchat__input {
  flex: 1 1 auto;
  resize: none;
  max-height: 96px;
  min-height: 40px;
  padding: 10px 12px;
  border: 1px solid var(--dj-line);
  border-radius: 12px;
  font: inherit;
  color: inherit;
  background: var(--dj-bg-soft);
  outline: none;
}
.djchat__input:focus { border-color: var(--dj-brand); background: #fff; }
.djchat__send {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--dj-brand) 0%, var(--dj-brand-2) 100%);
}
.djchat__send:disabled { opacity: .55; cursor: not-allowed; }
.djchat__send svg { width: 18px; height: 18px; }

.djchat__foot {
  padding: 0 12px 10px;
  text-align: center;
  font-size: 10.5px;
  color: var(--dj-muted);
  background: var(--dj-bg);
}

/* -------------------------------------------------------------- responsive */
@media (max-width: 480px) {
  .djchat { right: 14px; bottom: 14px; }
  .djchat__panel {
    right: 0;
    bottom: 70px;
    width: calc(100vw - 28px);
    height: calc(100vh - 130px);
    max-height: none;
  }
}

@media (prefers-color-scheme: dark) {
  .djchat {
    --dj-bg: #171a2b;
    --dj-bg-soft: #1f2336;
    --dj-text: #eef0f8;
    --dj-muted: #9aa0b5;
    --dj-line: #2b3049;
  }
  .djchat__msg--bot { background: #232840; }
}

