/* DUCA - agente flutuante (lado esquerdo) */
.ead-duca {
  position: fixed;
  left: 22px;
  bottom: 22px;
  z-index: 99990;
  font-family: 'Poppins', 'Segoe UI', system-ui, sans-serif;
}

.ead-duca-fab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.35rem 1.15rem 0.35rem 0.35rem;
  border: none;
  border-radius: 999px;
  background: #0b148e;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(11, 20, 142, 0.28);
  overflow: hidden;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease,
    padding 0.45s cubic-bezier(0.4, 0, 0.2, 1),
    gap 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

.ead-duca-fab:hover {
  transform: translateY(-2px);
  background: #09107a;
  box-shadow: 0 14px 34px rgba(11, 20, 142, 0.36);
}

.ead-duca-fab:focus-visible {
  outline: 2px solid #ffcd00;
  outline-offset: 3px;
}

.ead-duca-fab-photo {
  position: relative;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  overflow: visible;
  flex-shrink: 0;
}

.ead-duca-fab-photo img {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  box-shadow: 0 0 0 2px rgba(255, 205, 0, 0.95);
}

.ead-duca-fab-online {
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 2px #0b148e;
}

.ead-duca-fab-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.08rem;
  line-height: 1.2;
  padding-right: 0.15rem;
  text-align: left;
  max-width: 11.5rem;
  opacity: 1;
  overflow: hidden;
  white-space: nowrap;
  transition:
    max-width 0.45s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.35s ease,
    padding 0.45s cubic-bezier(0.4, 0, 0.2, 1),
    margin 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

.ead-duca-fab-title {
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.ead-duca-fab-sub {
  font-size: 0.68rem;
  font-weight: 400;
  opacity: 0.7;
  white-space: nowrap;
}

/* Recolhido: só o avatar; expande no hover/focus */
.ead-duca.is-fab-compact .ead-duca-fab {
  padding-right: 0.35rem;
  gap: 0;
}

.ead-duca.is-fab-compact .ead-duca-fab-meta {
  max-width: 0;
  opacity: 0;
  padding-right: 0;
  margin: 0;
  pointer-events: none;
}

.ead-duca.is-fab-compact:hover .ead-duca-fab,
.ead-duca.is-fab-compact:focus-within .ead-duca-fab {
  padding-right: 1.15rem;
  gap: 0.75rem;
}

.ead-duca.is-fab-compact:hover .ead-duca-fab-meta,
.ead-duca.is-fab-compact:focus-within .ead-duca-fab-meta {
  max-width: 11.5rem;
  opacity: 1;
  padding-right: 0.15rem;
  pointer-events: auto;
}

@media (prefers-reduced-motion: reduce) {
  .ead-duca-fab,
  .ead-duca-fab-meta {
    transition-duration: 0.01ms !important;
  }
}

.ead-duca-panel {
  position: absolute;
  left: 0;
  bottom: calc(100% + 12px);
  width: min(380px, calc(100vw - 28px));
  height: min(560px, calc(100vh - 110px));
  display: flex;
  flex-direction: column;
  border-radius: 20px;
  overflow: hidden;
  background: #fff;
  border: none;
  box-shadow: 0 24px 60px rgba(11, 20, 142, 0.22);
  transform-origin: bottom left;
  animation: ead-duca-in 0.28s ease;
}

@keyframes ead-duca-in {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.ead-duca-panel[hidden] {
  display: none !important;
}

.ead-duca-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.95rem 1rem;
  background: linear-gradient(135deg, #0b148e, #080f68);
  color: #fff;
}

.ead-duca-panel-agent {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
}

.ead-duca-panel-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 205, 0, 0.9);
}

.ead-duca-panel-name {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.ead-duca-panel-status {
  margin: 0.1rem 0 0;
  font-size: 0.75rem;
  opacity: 0.88;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.ead-duca-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
}

.ead-duca-panel-close {
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
}

.ead-duca-panel-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.ead-duca-panel-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #f7f8fc 0%, #eef1f8 100%);
}

.ead-duca-lead {
  padding: 1.25rem 1.15rem 1.35rem;
  overflow: auto;
}

.ead-duca-lead-title {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
  font-weight: 600;
  color: #0b148e;
}

.ead-duca-lead-text {
  margin: 0 0 1.1rem;
  font-size: 0.9rem;
  color: #64748b;
  line-height: 1.5;
}

.ead-duca-lead-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.ead-duca-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: #475569;
}

.ead-duca-field input {
  border: 1px solid #e2e8f0;
  border-radius: 0.7rem;
  padding: 0.7rem 0.85rem;
  font-size: 0.9375rem;
  font-family: inherit;
  background: #fff;
  color: #1e293b;
}

.ead-duca-field input:focus {
  outline: none;
  border-color: #0b148e;
  box-shadow: 0 0 0 3px rgba(11, 20, 142, 0.12);
}

.ead-duca-lead-error {
  margin: 0;
  font-size: 0.8125rem;
  color: #dc2626;
}

.ead-duca-btn {
  margin-top: 0.25rem;
  border: none;
  border-radius: 999px;
  padding: 0.8rem 1.1rem;
  background: #ffcd00;
  color: #000a1a;
  font-weight: 600;
  font-size: 0.9375rem;
  font-family: inherit;
  cursor: pointer;
}

.ead-duca-btn:hover {
  background: #ffe566;
}

.ead-duca-btn:disabled {
  opacity: 0.7;
  cursor: wait;
}

.ead-duca-chat {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.ead-duca-chat[hidden],
.ead-duca-lead[hidden] {
  display: none !important;
}

.ead-duca-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 1rem 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.ead-duca-bubble {
  max-width: 88%;
  padding: 0.7rem 0.85rem;
  border-radius: 1rem;
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.ead-duca-bubble--assistant {
  align-self: flex-start;
  background: #fff;
  color: #1e293b;
  border: 1px solid rgba(15, 23, 42, 0.06);
  border-bottom-left-radius: 0.3rem;
}

.ead-duca-bubble--user {
  align-self: flex-end;
  background: #0b148e;
  color: #fff;
  border-bottom-right-radius: 0.3rem;
}

.ead-duca-typing {
  align-self: flex-start;
  display: inline-flex;
  gap: 0.28rem;
  padding: 0.75rem 0.9rem;
  background: #fff;
  border-radius: 1rem;
  border: 1px solid rgba(15, 23, 42, 0.06);
}

.ead-duca-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #94a3b8;
  animation: ead-duca-dot 1s ease infinite;
}

.ead-duca-typing span:nth-child(2) { animation-delay: 0.15s; }
.ead-duca-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes ead-duca-dot {
  0%, 80%, 100% { opacity: 0.35; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

.ead-duca-composer {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 0.85rem 0.9rem;
  background: #fff;
  border-top: 1px solid #e8ecf4;
}

.ead-duca-composer input {
  flex: 1;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  padding: 0.7rem 1rem;
  font-size: 0.9rem;
  font-family: inherit;
}

.ead-duca-composer input:focus {
  outline: none;
  border-color: #0b148e;
}

.ead-duca-send {
  width: 2.6rem;
  height: 2.6rem;
  border: none;
  border-radius: 50%;
  background: #ffcd00;
  color: #000a1a;
  cursor: pointer;
  flex-shrink: 0;
}

.ead-duca-send:hover {
  background: #ffe566;
}

.ead-duca-send:disabled {
  opacity: 0.6;
  cursor: wait;
}

.ead-duca-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding: 0 0.85rem 0.75rem;
  animation: ead-duca-in 0.25s ease;
}

.ead-duca-options[hidden] {
  display: none !important;
}

.ead-duca-option {
  border: 1px solid rgba(11, 20, 142, 0.22);
  background: #fff;
  color: #0b148e;
  border-radius: 999px;
  padding: 0.48rem 0.85rem;
  font-size: 0.8125rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.ead-duca-option:hover {
  background: rgba(11, 20, 142, 0.06);
  border-color: #0b148e;
  transform: translateY(-1px);
}

.ead-duca-option:disabled {
  opacity: 0.55;
  cursor: wait;
}

.ead-duca-composer[hidden] {
  display: none !important;
}

body.ead-public-site.ead-theme-dark .ead-duca-panel {
  background: #1a1a22;
}

body.ead-public-site.ead-theme-dark .ead-duca-panel-body {
  background: linear-gradient(180deg, #16161c 0%, #121217 100%);
}

body.ead-public-site.ead-theme-dark .ead-duca-lead-title {
  color: #fff;
}

body.ead-public-site.ead-theme-dark .ead-duca-lead-text,
body.ead-public-site.ead-theme-dark .ead-duca-field {
  color: #a8a8b0;
}

body.ead-public-site.ead-theme-dark .ead-duca-field input,
body.ead-public-site.ead-theme-dark .ead-duca-composer input {
  background: #22222c;
  border-color: #3a3a45;
  color: #f0f0f0;
}

body.ead-public-site.ead-theme-dark .ead-duca-composer {
  background: #1a1a22;
  border-top-color: #3a3a45;
}

body.ead-public-site.ead-theme-dark .ead-duca-bubble--assistant,
body.ead-public-site.ead-theme-dark .ead-duca-typing {
  background: #22222c;
  border-color: #3a3a45;
  color: #f0f0f0;
}

body.ead-public-site.ead-theme-dark .ead-duca-bubble--user {
  background: #000;
}

body.ead-public-site.ead-theme-dark .ead-duca-option {
  background: #22222c;
  border-color: #3a3a45;
  color: #f0f0f0;
}

body.ead-public-site.ead-theme-dark .ead-duca-option:hover {
  border-color: #ffcd00;
  background: #2a2a35;
}

body.ead-public-site.ead-theme-dark .ead-duca-fab {
  background: #000;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}

body.ead-public-site.ead-theme-dark .ead-duca-fab:hover {
  background: #111;
}

body.ead-public-site.ead-theme-dark .ead-duca-fab-online {
  box-shadow: 0 0 0 2px #000;
}

@media (max-width: 575.98px) {
  .ead-duca {
    left: 14px;
    bottom: 14px;
  }

  .ead-duca-panel {
    width: calc(100vw - 28px);
    height: min(70vh, 520px);
  }
}
