/* Polkadot Docs Assistant widget.
   Uses the site's theme variables (see polkadot.css) so the widget follows
   light/dark mode automatically. Occupies the slot the kapa.ai button used. */

.da-launcher {
  position: fixed;
  right: 1.2rem;
  bottom: 10vh;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 0.7rem 0.9rem;
  background: var(--md-default-bg-color);
  color: var(--color-text-primary);
  border: 1px solid var(--color-border-strong);
  border-radius: 0.8rem;
  font: inherit;
  font-size: 0.7rem;
  cursor: pointer;
}

.da-launcher:hover {
  background: var(--color-surface);
}

.da-panel {
  position: fixed;
  right: 1.2rem;
  bottom: calc(10vh + 5.2rem);
  z-index: 51;
  width: 21rem;
  max-width: calc(100vw - 2.4rem);
  height: 29rem;
  max-height: calc(100vh - 12rem);
  display: none;
  flex-direction: column;
  overflow: hidden;
  background: var(--md-default-bg-color);
  border: 1px solid var(--color-border-strong);
  border-radius: 0.8rem;
  box-shadow: 0 0.6rem 2rem rgba(0, 0, 0, 0.25);
  font-size: 0.7rem;
}

.da-panel.da-open {
  display: flex;
}

.da-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 0.8rem;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-primary);
}

.da-head small {
  display: block;
  color: var(--color-text-secondary);
  font-size: 0.55rem;
}

.da-close {
  background: none;
  border: none;
  color: var(--color-text-secondary);
  font-size: 0.8rem;
  cursor: pointer;
}

.da-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.da-msg {
  max-width: 90%;
  padding: 0.5rem 0.65rem;
  border-radius: 0.6rem;
  line-height: 1.5;
  overflow-wrap: break-word;
}

.da-user {
  align-self: flex-end;
  background: var(--accent-default);
  color: var(--white);
  border-bottom-right-radius: 0.15rem;
}

.da-bot {
  align-self: flex-start;
  background: var(--color-surface-secondary);
  color: var(--color-text-primary);
  border-bottom-left-radius: 0.15rem;
}

.da-bot p { margin: 0 0 0.45rem; }
.da-bot p:last-child { margin-bottom: 0; }
.da-bot ul, .da-bot ol { margin: 0.3rem 0; padding-left: 1.1rem; }
.da-bot h4 { margin: 0.5rem 0 0.2rem; font-size: 0.72rem; }

.da-bot code {
  background: var(--md-default-bg-color);
  border: 1px solid var(--color-border);
  border-radius: 0.2rem;
  padding: 0 0.2rem;
  font-size: 0.9em;
}

.da-bot pre {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 0.4rem;
  padding: 0.5rem;
  overflow-x: auto;
}

.da-bot pre code { background: none; border: none; padding: 0; }

.da-cites {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.45rem;
}

.da-chip {
  font-size: 0.55rem;
  padding: 0.1rem 0.45rem;
  border: 1px solid var(--color-border-strong);
  border-radius: 1rem;
  background: var(--md-default-bg-color);
  color: var(--color-text-secondary);
  text-decoration: none;
}

a.da-chip:hover {
  border-color: var(--accent-default);
  color: var(--accent-default);
}

.da-fb {
  display: flex;
  gap: 0.25rem;
  margin-top: 0.45rem;
}

.da-fb-btn {
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 0.3rem;
  padding: 0.05rem 0.35rem;
  cursor: pointer;
  font-size: 0.65rem;
}

.da-fb-btn.da-on {
  border-color: var(--accent-default);
}

.da-thinking {
  color: var(--color-text-secondary);
}

.da-input {
  display: flex;
  gap: 0.4rem;
  padding: 0.55rem;
  border-top: 1px solid var(--color-border);
}

.da-input input {
  flex: 1;
  padding: 0.45rem 0.6rem;
  background: var(--color-surface);
  color: var(--color-text-primary);
  border: 1px solid var(--color-border);
  border-radius: 0.5rem;
  font: inherit;
  font-size: 0.7rem;
}

.da-send {
  padding: 0 0.7rem;
  background: var(--accent-default);
  color: var(--white);
  border: none;
  border-radius: 0.5rem;
  font-weight: 600;
  cursor: pointer;
}

.da-send:disabled {
  opacity: 0.5;
  cursor: default;
}

.da-note {
  padding: 0 0.7rem 0.55rem;
  font-size: 0.5rem;
  line-height: 1.4;
  color: var(--color-text-secondary);
  text-align: center;
}

.da-note a {
  color: inherit;
  text-decoration: underline;
}
