/* DingdongBot landing floating chat */
.ddb-fab {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 90;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  padding: 0;
  cursor: pointer;
  background: #fff;
  box-shadow: 0 8px 28px rgba(37, 99, 235, 0.28), 0 2px 8px rgba(15, 23, 42, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .18s ease, box-shadow .18s ease;
}
.ddb-fab:hover { transform: translateY(-2px) scale(1.03); box-shadow: 0 12px 32px rgba(37, 99, 235, 0.34); }
.ddb-fab:focus-visible { outline: 2px solid #2563eb; outline-offset: 3px; }
.ddb-fab img {
  width: 46px;
  height: 46px;
  object-fit: contain;
  pointer-events: none;
}
.ddb-fab.is-open {
  background: #1d4ed8;
  box-shadow: 0 8px 24px rgba(29, 78, 216, 0.4);
}
.ddb-fab.is-open img { filter: brightness(0) invert(1); opacity: .95; width: 28px; height: 28px; }
.ddb-fab-badge {
  position: absolute;
  top: 4px; right: 4px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid #fff;
}

.ddb-panel {
  position: fixed;
  right: 22px;
  bottom: 96px;
  z-index: 91;
  width: min(380px, calc(100vw - 28px));
  height: min(560px, calc(100vh - 130px));
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.16);
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.ddb-panel.is-open { display: flex; }

.ddb-panel-hd {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .9rem 1rem;
  background: linear-gradient(135deg, #eff6ff, #ffffff 60%);
  border-bottom: 1px solid #e2e8f0;
}
.ddb-panel-hd img {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: #fff;
  object-fit: contain;
  box-shadow: 0 1px 4px rgba(15,23,42,.08);
}
.ddb-panel-hd .meta { flex: 1; min-width: 0; }
.ddb-panel-hd .meta strong {
  display: block;
  font-size: .95rem;
  letter-spacing: -0.02em;
  color: #0f172a;
}
.ddb-panel-hd .meta span {
  display: block;
  font-size: .75rem;
  color: #64748b;
  margin-top: .1rem;
}
.ddb-panel-close {
  border: none; background: transparent;
  width: 32px; height: 32px; border-radius: 8px;
  color: #64748b; cursor: pointer; font-size: 1.2rem; line-height: 1;
}
.ddb-panel-close:hover { background: #f1f5f9; color: #0f172a; }

.ddb-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: .7rem;
}
.ddb-msg {
  max-width: 88%;
  padding: .65rem .85rem;
  border-radius: 14px;
  font-size: .88rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
.ddb-msg.bot {
  align-self: flex-start;
  background: #fff;
  border: 1px solid #e2e8f0;
  color: #0f172a;
  border-bottom-left-radius: 5px;
}
.ddb-msg.user {
  align-self: flex-end;
  background: #2563eb;
  color: #fff;
  border-bottom-right-radius: 5px;
}
.ddb-msg.sys {
  align-self: center;
  background: transparent;
  color: #94a3b8;
  font-size: .75rem;
  padding: .2rem;
}
.ddb-msg.err {
  align-self: stretch;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  font-size: .82rem;
}
.ddb-typing {
  align-self: flex-start;
  display: inline-flex;
  gap: 4px;
  padding: .7rem .9rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
}
.ddb-typing i {
  width: 6px; height: 6px; border-radius: 50%;
  background: #94a3b8;
  animation: ddb-bounce 1s infinite ease-in-out;
}
.ddb-typing i:nth-child(2) { animation-delay: .15s; }
.ddb-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes ddb-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: .45; }
  40% { transform: translateY(-4px); opacity: 1; }
}

.ddb-suggest {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  padding: 0 1rem .65rem;
  background: #f8fafc;
  border-top: none;
}
.ddb-suggest button {
  border: 1px solid #bfdbfe;
  background: #fff;
  color: #1d4ed8;
  border-radius: 999px;
  padding: .28rem .7rem;
  font-size: .75rem;
  cursor: pointer;
}
.ddb-suggest button:hover { background: #eff6ff; }

.ddb-form {
  display: flex;
  gap: .5rem;
  padding: .75rem;
  border-top: 1px solid #e2e8f0;
  background: #fff;
}
.ddb-form textarea {
  flex: 1;
  resize: none;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: .6rem .75rem;
  font: inherit;
  font-size: .88rem;
  min-height: 42px;
  max-height: 100px;
  line-height: 1.4;
  color: #0f172a;
}
.ddb-form textarea:focus {
  outline: none;
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.ddb-form button[type="submit"] {
  border: none;
  background: #2563eb;
  color: #fff;
  border-radius: 12px;
  padding: 0 1rem;
  font-weight: 600;
  font-size: .85rem;
  cursor: pointer;
  white-space: nowrap;
}
.ddb-form button[type="submit"]:disabled {
  opacity: .55;
  cursor: not-allowed;
}

@media (max-width: 480px) {
  .ddb-fab { right: 14px; bottom: 14px; width: 54px; height: 54px; }
  .ddb-panel { right: 10px; bottom: 80px; width: calc(100vw - 20px); height: min(70vh, 520px); }
}
