:root {
  --dn-chat-primary: #075e54;
  --dn-chat-primary-hover: #128c7e;
  --dn-chat-accent: #25d366;
  --dn-chat-bg: #e5ddd5;
  --dn-chat-bubble: #ffffff;
  --dn-chat-bubble-user: #dcf8c6;
  --dn-chat-text: #1f2937;
  --dn-chat-muted: #6b7280;
  --dn-chat-border: #e5e7eb;
}

.dn-chat-hide-legacy .whatsbutton {
  display: none !important;
}

.dn-chat-widget {
  bottom: 24px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  font-family: "Inter", "Helvetica Neue", Arial, sans-serif;
  position: fixed;
  right: 24px;
  z-index: 9999;
  pointer-events: none;
}

.dn-chat-widget.dn-chat--left {
  align-items: flex-start;
  left: 24px;
  right: auto;
}

.dn-chat-widget .dn-chat-toggle,
.dn-chat-widget .dn-chat-tooltip,
.dn-chat-widget.is-open .dn-chat-panel {
  pointer-events: auto;
}

.dn-chat-panel {
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  transform: translateY(20px) scale(0.98);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  width: 350px;
}

.dn-chat-widget.is-open .dn-chat-panel {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.dn-chat-header {
  background: var(--dn-chat-primary);
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
}

.dn-chat-header__identity {
  display: flex;
  gap: 12px;
  align-items: center;
}

.dn-chat-avatar {
  align-items: center;
  background: #0f3d34;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  display: flex;
  font-size: 18px;
  font-weight: 700;
  height: 40px;
  justify-content: center;
  width: 40px;
}

.dn-chat-title {
  font-size: 14px;
  font-weight: 700;
}

.dn-chat-status {
  font-size: 12px;
  opacity: 0.8;
}

.dn-chat-close {
  background: transparent;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

.dn-chat-body {
  background: var(--dn-chat-bg);
  background-image: url("https://user-images.githubusercontent.com/15075759/28719144-86dc0f70-73b1-11e7-911d-60d70fcded21.png");
  background-blend-mode: overlay;
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 350px;
  overflow-y: auto;
  padding: 16px;
  transition: height 0.3s ease;
}

.dn-chat-body.has-preference {
  height: 525px;
}

.dn-chat-bubble {
  background: var(--dn-chat-bubble);
  border-radius: 14px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
  color: var(--dn-chat-text);
  font-size: 14px;
  max-width: 85%;
  padding: 12px;
  line-height: 1.4;
}

.dn-chat-bubble--bot {
  align-self: flex-start;
  border-top-left-radius: 6px;
}

.dn-chat-bubble--user {
  align-self: flex-end;
  background: var(--dn-chat-bubble-user);
  border-top-right-radius: 6px;
}

.dn-chat-time {
  color: var(--dn-chat-muted);
  display: block;
  font-size: 10px;
  margin-top: 6px;
  text-align: right;
}

.dn-chat-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.dn-chat-input,
.dn-chat-textarea {
  border: 1px solid var(--dn-chat-border);
  border-radius: 8px;
  font-size: 14px;
  padding: 8px 10px;
  width: 100%;
}

.dn-chat-textarea {
  min-height: 140px;
  resize: none;
}

.dn-chat-input.error,
.dn-chat-textarea.error {
  border-color: #dc2626;
}

.dn-chat-error {
  color: #dc2626;
  font-size: 12px;
}

.dn-chat-radio-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dn-chat-radio-group.inline {
  flex-direction: row;
  gap: 16px;
}

.dn-chat-radio label {
  align-items: center;
  cursor: pointer;
  display: flex;
  gap: 8px;
  font-size: 14px;
}

.dn-chat-radio input {
  accent-color: var(--dn-chat-primary);
}

.dn-chat-btn {
  border: none;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  gap: 6px;
  padding: 8px 12px;
  transition: background 0.2s ease, transform 0.2s ease;
}

.dn-chat-btn--primary {
  background: var(--dn-chat-primary);
  color: #fff;
}

.dn-chat-btn--primary:hover {
  background: var(--dn-chat-primary-hover);
}

.dn-chat-btn--secondary {
  background: var(--dn-chat-accent);
  color: #fff;
}

.dn-chat-btn--outline {
  background: transparent;
  border: 1px solid var(--dn-chat-border);
  color: var(--dn-chat-text);
}

.dn-chat-btn.full {
  width: 100%;
}

.dn-chat-toggle-wrap {
  align-items: center;
  display: inline-flex;
  justify-content: flex-end;
  position: relative;
}

.dn-chat-tooltip {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  color: var(--dn-chat-primary);
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  padding: 10px 14px;
  pointer-events: none;
  position: absolute;
  right: calc(100% + 16px);
  top: 50%;
  transform: translateY(-50%) translateX(-12px);
  transition: opacity 0.3s ease-out, transform 0.3s ease-out;
  white-space: nowrap;
}

.dn-chat-widget.dn-chat--left .dn-chat-tooltip {
  left: calc(100% + 16px);
  right: auto;
  transform: translateY(-50%) translateX(12px);
}

.dn-chat-tooltip::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 10px;
  height: 10px;
  background: #fff;
  transform: translateY(-50%) rotate(45deg);
  right: -6px;
}

.dn-chat-widget.dn-chat--left .dn-chat-tooltip::after {
  left: -6px;
  right: auto;
}

.dn-chat-tooltip.is-visible {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.dn-chat-toggle {
  align-items: center;
  background: var(--dn-chat-accent);
  border: none;
  border-radius: 50%;
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  display: flex;
  height: 64px;
  justify-content: center;
  transition: transform 0.2s ease, background 0.2s ease;
  width: 64px;
}

.dn-chat-toggle:hover {
  background: var(--dn-chat-primary-hover);
  transform: scale(1.05);
}

.dn-chat-toggle__icon {
  display: flex;
  height: 32px;
  width: 32px;
}

.dn-chat-toggle__icon svg {
  fill: #fff;
}

.dn-chat-toggle__icon--close {
  display: none;
}

.dn-chat-widget.is-open .dn-chat-toggle__icon--open {
  display: none;
}

.dn-chat-widget.is-open .dn-chat-toggle__icon--close {
  display: flex;
}

.dn-chat-modal {
  align-items: center;
  display: none;
  justify-content: center;
  inset: 0;
  position: fixed;
  z-index: 10000;
}

.dn-chat-modal.is-open {
  display: flex;
}

.dn-chat-modal__overlay {
  background: rgba(0, 0, 0, 0.45);
  inset: 0;
  position: absolute;
}

.dn-chat-modal__content {
  background: #fff;
  border: 1px solid hsl(var(--border));
  border-radius: 20px;
  box-shadow: 0 24px 60px -40px rgba(0, 0, 0, 0.45);
  max-width: 520px;
  padding: 28px;
  position: relative;
  width: 90%;
  z-index: 1;
  font-family: "Inter", sans-serif;
}

.dn-chat-modal__close {
  background: hsl(var(--muted) / 0.6);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  font-size: 20px;
  height: 36px;
  width: 36px;
  position: absolute;
  right: 16px;
  top: 16px;
  color: hsl(var(--primary));
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.dn-chat-modal__title {
  color: hsl(var(--primary));
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 1.5rem;
  text-align: center;
  font-family: "Playfair Display", serif;
}

.dn-chat-modal__body {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.dn-chat-modal__footer {
  display: flex;
  gap: 12px;
}

.dn-voice-recorder {
  background: hsl(var(--muted) / 0.35);
  border: 1px solid hsl(var(--border));
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 24px;
  align-items: center;
}

.dn-voice-bars {
  display: flex;
  gap: 4px;
  height: 48px;
  align-items: flex-end;
}

.dn-voice-bar {
  background: hsl(var(--border));
  border-radius: 999px;
  height: 6px;
  transition: height 0.1s ease;
  width: 4px;
}

.dn-voice-recorder.is-recording .dn-voice-bar {
  background: hsl(var(--secondary));
}

.dn-voice-timer {
  font-family: "Courier New", monospace;
  font-size: 1.5rem;
  font-weight: 600;
  color: hsl(var(--primary));
}

.dn-voice-controls {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
}

.dn-voice-button svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dn-voice-button {
  border: none;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 64px;
  width: 64px;
  color: #fff;
  box-shadow: 0 10px 25px -15px rgba(0, 0, 0, 0.45);
}

.dn-voice-button--record {
  background: #ef4444;
}

.dn-voice-button--stop {
  background: hsl(var(--primary));
}

.dn-voice-button--play {
  background: hsl(var(--primary));
  height: 48px;
  width: 48px;
}

.dn-voice-button--reset {
  background: #fff;
  border: 1px solid hsl(var(--border));
  color: hsl(var(--primary));
  height: 48px;
  width: 48px;
}

.dn-hidden {
  display: none !important;
}

.dn-modal-success {
  align-items: center;
  display: flex;
  flex-direction: column;
  text-align: center;
  padding: 16px 0;
}

.dn-modal-success__icon {
  align-items: center;
  background: #dcfce7;
  border-radius: 50%;
  color: #16a34a;
  display: flex;
  height: 72px;
  justify-content: center;
  margin-bottom: 16px;
  width: 72px;
}

.dn-modal-success__icon svg {
  height: 36px;
  width: 36px;
}

@media (max-width: 520px) {
  .dn-chat-widget {
    bottom: 16px;
    right: 16px;
  }

  .dn-chat-widget.dn-chat--left {
    left: 16px;
  }

  .dn-chat-panel {
    width: calc(100vw - 32px);
  }
}

.dn-chat-label {
  font-weight: 600;
  margin-bottom: 4px;
}

.dn-chat-muted {
  color: var(--dn-chat-muted);
  font-size: 13px;
}

.dn-chat-bubble .dn-chat-muted {
  margin-top: 5px;
  color: inherit;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
}
