/* DaynaCity Live Chat — frontend widget
   All rules are namespaced under .dclc-root and hardened against theme resets. */

.dclc-root,
.dclc-root *,
.dclc-root *::before,
.dclc-root *::after {
  box-sizing: border-box !important;
}

.dclc-root {
  --dclc-radius: 20px;
  --dclc-ink: #0f172a;
  --dclc-muted: #64748b;
  --dclc-line: #e4e9f2;
  position: fixed;
  bottom: 24px;
  z-index: 999999;
  margin: 0 !important;
  padding: 0 !important;
  font-family: "Hind Siliguri", "Noto Sans Bengali", Inter, -apple-system,
    BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--dclc-ink);
  text-align: left;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.dclc-root button,
.dclc-root input,
.dclc-root textarea {
  font-family: inherit;
  letter-spacing: normal;
  text-transform: none !important;
}

.dclc-root [hidden] {
  display: none !important;
}

/* ---------------------------------------------------------- backdrop */
.dclc-mobile-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.26s ease;
}
.dclc-mobile-backdrop.is-visible {
  opacity: 1;
}

/* ---------------------------------------------------------- launcher */
.dclc-launcher {
  -webkit-appearance: none !important;
  appearance: none !important;
  position: relative;
  display: grid !important;
  place-items: center;
  width: 64px !important;
  height: 64px !important;
  min-width: 64px !important;
  min-height: 64px !important;
  max-width: 64px !important;
  max-height: 64px !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  border-radius: 50% !important;
  background: var(--dclc-primary);
  color: #fff;
  line-height: normal !important;
  cursor: pointer;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.22);
  transition: transform 0.26s cubic-bezier(0.2, 0.8, 0.2, 1),
    box-shadow 0.26s ease;
  isolation: isolate;
}

/* Brand PNG: the artwork is already a full-bleed circle, so the button itself
   stays transparent — only the icon is visible, never a colour edge. */
.dclc-launcher.dclc-has-brand-icon {
  background: transparent !important;
  background-image: var(--dclc-launcher-icon) !important;
  background-size: 100% 100% !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.24);
}

.dclc-launcher:hover {
  transform: translateY(-3px);
  box-shadow: 0 20px 42px rgba(15, 23, 42, 0.28);
}
.dclc-launcher:active {
  transform: translateY(0) scale(0.95);
}
.dclc-launcher:focus-visible,
.dclc-close:focus-visible,
.dclc-start:focus-visible,
.dclc-composer button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--dclc-primary) 40%, transparent);
  outline-offset: 3px;
}

.dclc-launcher-pulse {
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: 50%;
  background: var(--dclc-primary);
  opacity: 0.22;
  animation: dclc-pulse 2.8s ease-out infinite;
}
.dclc-root.is-open .dclc-launcher-pulse {
  display: none;
}

.dclc-launcher-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 26px !important;
  height: 26px !important;
  margin: 0 !important;
  padding: 0 !important;
  transform: translate(-50%, -50%);
  transition: opacity 0.2s ease, transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.dclc-launcher-icon svg {
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.dclc-icon-chat {
  opacity: 1;
}
.dclc-icon-chat svg {
  fill: currentColor;
  stroke: none;
}
.dclc-launcher.dclc-has-brand-icon .dclc-icon-chat {
  display: none;
}
.dclc-icon-close {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.6) rotate(-40deg);
}
.dclc-root.is-open .dclc-icon-chat {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.6) rotate(40deg);
}
/* When open, hide the brand artwork and show a plain close button. */
.dclc-root.is-open .dclc-launcher.dclc-has-brand-icon {
  background-image: none !important;
  background: var(--dclc-primary) !important;
}
.dclc-root.is-open .dclc-icon-close {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1) rotate(0);
}

.dclc-unread {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
  animation: dclc-pop 0.24s ease;
}

/* ---------------------------------------------------------- panel */
.dclc-panel {
  position: absolute;
  right: 0;
  bottom: 82px;
  display: flex;
  flex-direction: column;
  width: min(384px, calc(100vw - 32px));
  height: min(640px, calc(100vh - 130px));
  min-height: 460px;
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 24px;
  box-shadow: 0 28px 70px rgba(15, 23, 42, 0.24);
  transform-origin: bottom right;
  animation: dclc-panel-in 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---------------------------------------------------------- header */
.dclc-header {
  position: relative;
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 12px;
  padding: 16px 16px;
  background: var(--dclc-primary);
  color: #fff;
  overflow: hidden;
}
.dclc-header::after {
  content: "";
  position: absolute;
  top: -110px;
  right: -70px;
  width: 170px;
  height: 170px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
}

.dclc-agent-avatar {
  position: relative;
  z-index: 1;
  display: grid !important;
  place-items: center;
  flex: 0 0 44px !important;
  width: 44px !important;
  height: 44px !important;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.34);
  font-size: 17px;
  font-weight: 700;
  color: #fff;
}
.dclc-agent-avatar span {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 12px;
  height: 12px;
  border: 2.5px solid color-mix(in srgb, var(--dclc-primary) 80%, #111827);
  border-radius: 50%;
  background: #94a3b8;
}
.dclc-agent-avatar span.is-online {
  background: #4ade80;
}

.dclc-agent-copy {
  position: relative;
  z-index: 1;
  min-width: 0;
  flex: 1 1 auto;
}
.dclc-agent-copy strong {
  display: block;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #fff;
}
.dclc-agent-copy > span {
  display: flex;
  align-items: center;
  margin-top: 3px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.86);
}
.dclc-status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: #cbd5e1;
}
.dclc-status-dot.is-online {
  background: #4ade80;
  box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.22);
}

.dclc-close {
  -webkit-appearance: none !important;
  appearance: none !important;
  position: relative;
  z-index: 2;
  display: grid !important;
  place-items: center;
  flex: 0 0 34px !important;
  width: 34px !important;
  height: 34px !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  border-radius: 50% !important;
  background: rgba(255, 255, 255, 0.16) !important;
  color: #fff !important;
  cursor: pointer;
  transition: background 0.2s ease;
}
.dclc-close:hover {
  background: rgba(255, 255, 255, 0.3) !important;
}
.dclc-close svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

/* ---------------------------------------------------------- notice */
.dclc-notice {
  position: absolute;
  z-index: 10;
  top: 88px;
  left: 16px;
  right: 16px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff1f2;
  border: 1px solid #fecdd3;
  color: #be123c;
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
  animation: dclc-drop 0.22s ease;
}
.dclc-notice.is-success {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #047857;
}

/* ---------------------------------------------------------- pre-chat */
.dclc-prechat {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 24px 22px 22px;
  background: #fff;
  scrollbar-width: thin;
  scrollbar-color: #dbe3ee transparent;
}
.dclc-prechat-intro {
  padding-bottom: 18px;
}
.dclc-wave {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 14px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--dclc-primary) 10%, #fff);
  font-size: 22px;
  transform-origin: 70% 75%;
  animation: dclc-wave 2.8s ease-in-out infinite;
}
.dclc-prechat h3 {
  margin: 0 0 8px !important;
  padding: 0;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.02em;
  color: var(--dclc-ink);
}
.dclc-prechat p {
  margin: 0 !important;
  padding: 0;
  color: var(--dclc-muted);
  font-size: 13.5px;
  line-height: 1.6;
}

#dclc-prechat-form {
  margin: 0;
  padding: 0;
}

.dclc-field {
  display: block;
  margin: 0 0 14px;
}
.dclc-field > span {
  display: block;
  margin: 0 0 6px 2px;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
}
.dclc-field > span b {
  color: #ef4444;
}
.dclc-field input {
  display: block;
  width: 100% !important;
  max-width: 100% !important;
  height: 46px !important;
  margin: 0 !important;
  padding: 0 14px !important;
  border: 1px solid var(--dclc-line) !important;
  border-radius: 12px !important;
  background: #fff !important;
  color: var(--dclc-ink) !important;
  font-size: 14px;
  outline: 0;
  box-shadow: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.dclc-field input:hover {
  border-color: #cbd5e1 !important;
}
.dclc-field input:focus {
  border-color: var(--dclc-primary) !important;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--dclc-primary) 12%, transparent);
}
.dclc-field input.is-invalid {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1);
}

/* Full-width, perfectly centred primary button — hardened so no theme
   button rule can shrink it or misalign the label. */
.dclc-start {
  -webkit-appearance: none !important;
  appearance: none !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  height: 52px !important;
  min-height: 52px !important;
  padding: 0 18px !important;
  margin: 18px 0 0 !important;
  border: 0 !important;
  border-radius: 14px !important;
  background: var(--dclc-primary) !important;
  color: #fff !important;
  font-size: 15px !important;
  font-weight: 700 !important;
  line-height: 1 !important;
  text-align: center !important;
  text-decoration: none !important;
  text-shadow: none !important;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 10px 24px color-mix(in srgb, var(--dclc-primary) 32%, transparent);
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}
.dclc-start > span {
  display: inline-block;
  color: inherit;
}
.dclc-start:hover {
  transform: translateY(-2px);
  filter: brightness(1.06);
  box-shadow: 0 14px 30px color-mix(in srgb, var(--dclc-primary) 40%, transparent);
}
.dclc-start:active {
  transform: translateY(0) scale(0.99);
}
.dclc-start:disabled {
  opacity: 0.7;
  cursor: wait;
  transform: none;
}
.dclc-start svg {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.18s ease;
}
.dclc-start:hover svg {
  transform: translateX(3px);
}
.dclc-start.is-loading svg {
  animation: dclc-spin 0.9s linear infinite;
}

.dclc-prechat small {
  display: block;
  margin-top: 14px;
  color: #94a3b8;
  font-size: 11px;
  line-height: 1.5;
  text-align: center;
}
.dclc-prechat small a {
  color: var(--dclc-primary);
  font-weight: 600;
  text-decoration: none;
}

/* ---------------------------------------------------------- chat */
.dclc-chat {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #f7f9fc;
}
.dclc-messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 16px 10px;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}
.dclc-message {
  display: flex;
  flex-direction: column;
  max-width: 82%;
  margin: 0 0 12px;
  animation: dclc-message-in 0.16s ease-out;
}
.dclc-message > div {
  padding: 10px 13px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.55;
  word-break: break-word;
  overflow-wrap: anywhere;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
}
.dclc-message time {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  font-size: 10.5px;
  color: #94a3b8;
}
.dclc-message.is-admin {
  align-items: flex-start;
  margin-right: auto;
}
.dclc-message.is-admin > div {
  background: #fff;
  border: 1px solid var(--dclc-line);
  border-bottom-left-radius: 6px;
  color: var(--dclc-ink);
}
.dclc-message.is-visitor {
  align-items: flex-end;
  margin-left: auto;
}
.dclc-message.is-visitor > div {
  background: var(--dclc-primary);
  border-bottom-right-radius: 6px;
  color: #fff;
}
.dclc-message.is-pending {
  opacity: 0.65;
}
.dclc-message.is-failed > div {
  background: #fee2e2;
  color: #b91c1c;
}
.dclc-message .dclc-tick {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dclc-typing {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 18px 8px;
  color: var(--dclc-muted);
  font-size: 12px;
}
.dclc-typing-dots {
  display: inline-flex;
  gap: 3px;
}
.dclc-typing-dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--dclc-primary);
  animation: dclc-dot 1.2s infinite;
}
.dclc-typing-dots i:nth-child(2) {
  animation-delay: 0.15s;
}
.dclc-typing-dots i:nth-child(3) {
  animation-delay: 0.3s;
}

.dclc-composer {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin: 0;
  padding: 12px 14px;
  background: #fff;
  border-top: 1px solid var(--dclc-line);
}
.dclc-composer textarea {
  flex: 1 1 auto;
  width: 100% !important;
  min-height: 44px;
  max-height: 118px;
  margin: 0 !important;
  padding: 11px 14px !important;
  border: 1px solid var(--dclc-line) !important;
  border-radius: 14px !important;
  background: #fff !important;
  color: var(--dclc-ink) !important;
  font-size: 14px;
  line-height: 1.45;
  resize: none;
  outline: 0;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.dclc-composer textarea:focus {
  border-color: var(--dclc-primary) !important;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--dclc-primary) 10%, transparent);
}
.dclc-composer textarea::placeholder {
  color: #94a3b8;
}
.dclc-composer button {
  -webkit-appearance: none !important;
  appearance: none !important;
  display: grid !important;
  place-items: center;
  flex: 0 0 44px !important;
  width: 44px !important;
  height: 44px !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  border-radius: 14px !important;
  background: var(--dclc-primary) !important;
  color: #fff !important;
  cursor: pointer;
  box-shadow: 0 8px 18px color-mix(in srgb, var(--dclc-primary) 26%, transparent);
  transition: transform 0.18s ease, opacity 0.18s ease;
}
.dclc-composer button:hover {
  transform: translateY(-2px);
}
.dclc-composer button:active {
  transform: scale(0.95);
}
.dclc-composer button:disabled {
  opacity: 0.55;
  cursor: wait;
  transform: none;
}
.dclc-composer button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dclc-privacy-note {
  padding: 0 14px 10px;
  background: #fff;
  color: #a4b0c0;
  font-size: 10px;
  line-height: 1.45;
  text-align: center;
}

.dclc-hp {
  position: absolute !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.dclc-root.dclc-shake .dclc-panel {
  animation: dclc-shake 0.34s ease;
}

/* ---------------------------------------------------------- keyframes */
@keyframes dclc-panel-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes dclc-message-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes dclc-pulse {
  0% {
    transform: scale(1);
    opacity: 0.22;
  }
  70%,
  100% {
    transform: scale(1.45);
    opacity: 0;
  }
}
@keyframes dclc-pop {
  from {
    opacity: 0;
    transform: scale(0.5);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
@keyframes dclc-wave {
  0%,
  55%,
  100% {
    transform: rotate(0);
  }
  62% {
    transform: rotate(14deg);
  }
  69% {
    transform: rotate(-8deg);
  }
  76% {
    transform: rotate(10deg);
  }
}
@keyframes dclc-dot {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.55;
  }
  30% {
    transform: translateY(-4px);
    opacity: 1;
  }
}
@keyframes dclc-spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes dclc-drop {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes dclc-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-5px);
  }
  50% {
    transform: translateX(5px);
  }
  75% {
    transform: translateX(-3px);
  }
}

/* ---------------------------------------------------------- mobile */
@media (max-width: 480px) {
  body.dclc-chat-open {
    overflow: hidden;
  }
  .dclc-root {
    right: 14px !important;
    left: auto !important;
    bottom: 14px;
  }
  .dclc-launcher,
  .dclc-launcher.dclc-has-brand-icon {
    width: 58px !important;
    height: 58px !important;
    min-width: 58px !important;
    min-height: 58px !important;
    max-width: 58px !important;
    max-height: 58px !important;
  }
  .dclc-panel {
    position: fixed;
    inset: 10px 10px 84px;
    width: auto;
    height: auto;
    min-height: 0;
    border-radius: 22px;
    transform-origin: bottom center;
  }
  .dclc-prechat {
    padding: 20px 18px;
  }
  .dclc-prechat h3 {
    font-size: 21px;
  }
  .dclc-mobile-backdrop {
    display: block !important;
  }
  .dclc-root:not(.is-open) .dclc-mobile-backdrop {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dclc-root *,
  .dclc-root *::before,
  .dclc-root *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
