/* The documentation assistant (assets/js/assistant.js).
 *
 * Loaded on every page, so every selector is namespaced to .dga- — the same
 * rule fleet.css follows, and for the same reason: a bare .chip or .badge here
 * would silently restyle the theme on pages nobody thought to look at.
 * Colors come from Material's own variables so the widget follows the palette
 * and the light/dark toggle without a second definition of either.
 */

.dga-launcher {
  position: fixed;
  right: 1.1rem;
  bottom: 1.1rem;
  z-index: 60; /* above content and the back-to-top button, below dialogs */
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 0.9rem;
  border: none;
  border-radius: 2rem;
  background: var(--md-primary-fg-color);
  color: var(--md-primary-bg-color);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--md-shadow-z2);
}
.dga-launcher:hover { box-shadow: var(--md-shadow-z3); }
.dga-launcher-icon { font-size: 0.85rem; line-height: 1; }

.dga-panel {
  position: fixed;
  right: 1.1rem;
  bottom: 3.6rem;
  z-index: 61;
  display: flex;
  flex-direction: column;
  width: min(24rem, calc(100vw - 2rem));
  max-height: min(34rem, calc(100vh - 6rem));
  border: 0.05rem solid var(--md-default-fg-color--lightest);
  border-radius: 0.6rem;
  background: var(--md-default-bg-color);
  color: var(--md-default-fg-color);
  box-shadow: var(--md-shadow-z3);
  font-size: 0.7rem;
}

.dga-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.8rem;
  border-bottom: 0.05rem solid var(--md-default-fg-color--lightest);
}
.dga-title-wrap { display: flex; align-items: center; gap: 0.5rem; min-width: 0; }
.dga-title { font-size: 0.75rem; }
.dga-badge {
  padding: 0.1rem 0.45rem;
  border-radius: 1rem;
  background: var(--md-accent-fg-color--transparent);
  color: var(--md-accent-fg-color);
  font-size: 0.6rem;
  font-weight: 700;
  white-space: nowrap;
}
.dga-close {
  border: none;
  background: none;
  color: var(--md-default-fg-color--light);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.2rem;
}
.dga-close:hover { color: var(--md-default-fg-color); }

.dga-privacy {
  margin: 0;
  padding: 0.45rem 0.8rem;
  font-size: 0.62rem;
  color: var(--md-default-fg-color--light);
  border-bottom: 0.05rem solid var(--md-default-fg-color--lightest);
}

.dga-log {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0.6rem 0.8rem;
  min-height: 6rem;
}
.dga-msg { margin: 0 0 0.6rem; }
.dga-msg-body p { margin: 0 0 0.4rem; line-height: 1.45; }
.dga-msg-body p:last-child { margin-bottom: 0; }
.dga-msg-user .dga-msg-body {
  background: var(--md-primary-fg-color);
  color: var(--md-primary-bg-color);
  border-radius: 0.5rem 0.5rem 0.15rem 0.5rem;
  padding: 0.45rem 0.6rem;
  margin-left: 2rem;
}
.dga-msg-assistant .dga-msg-body {
  background: var(--md-code-bg-color);
  border-radius: 0.5rem 0.5rem 0.5rem 0.15rem;
  padding: 0.45rem 0.6rem;
  margin-right: 2rem;
}
.dga-msg-links { margin: 0.35rem 2rem 0 0; display: flex; flex-wrap: wrap; gap: 0.35rem; }
.dga-link {
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 1rem;
  border: 0.05rem solid var(--md-accent-fg-color);
  color: var(--md-accent-fg-color);
}
.dga-link:hover { background: var(--md-accent-fg-color--transparent); }

.dga-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; padding: 0 0.8rem 0.5rem; }
.dga-chip {
  border: 0.05rem solid var(--md-default-fg-color--lighter);
  border-radius: 1rem;
  background: none;
  color: var(--md-default-fg-color--light);
  font: inherit;
  font-size: 0.6rem;
  padding: 0.18rem 0.55rem;
  cursor: pointer;
}
.dga-chip:hover { border-color: var(--md-accent-fg-color); color: var(--md-accent-fg-color); }

.dga-progress {
  height: 0.2rem;
  margin: 0 0.8rem 0.3rem;
  border-radius: 0.2rem;
  background: var(--md-default-fg-color--lightest);
  overflow: hidden;
}
.dga-progress-bar {
  height: 100%;
  width: 0;
  background: var(--md-accent-fg-color);
  transition: width 0.2s ease;
}
.dga-status {
  min-height: 0.9rem;
  padding: 0 0.8rem 0.3rem;
  font-size: 0.6rem;
  color: var(--md-default-fg-color--light);
}

.dga-enable {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.8rem;
  border-top: 0.05rem solid var(--md-default-fg-color--lightest);
}
.dga-enable-btn {
  flex: 0 0 auto;
  border: none;
  border-radius: 0.3rem;
  background: var(--md-accent-fg-color);
  color: var(--md-accent-bg-color, #fff);
  font: inherit;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0.3rem 0.7rem;
  cursor: pointer;
}
.dga-enable-btn:disabled { opacity: 0.55; cursor: default; }
.dga-enable-note { font-size: 0.58rem; color: var(--md-default-fg-color--light); }

.dga-form {
  display: flex;
  gap: 0.4rem;
  padding: 0.55rem 0.8rem 0.7rem;
  border-top: 0.05rem solid var(--md-default-fg-color--lightest);
}
.dga-input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0.05rem solid var(--md-default-fg-color--lighter);
  border-radius: 0.3rem;
  background: var(--md-default-bg-color);
  color: var(--md-default-fg-color);
  font: inherit;
  font-size: 0.68rem;
  padding: 0.35rem 0.5rem;
}
.dga-input:focus { outline: none; border-color: var(--md-accent-fg-color); }
.dga-send {
  border: none;
  border-radius: 0.3rem;
  background: var(--md-primary-fg-color);
  color: var(--md-primary-bg-color);
  font: inherit;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0.35rem 0.8rem;
  cursor: pointer;
}

/* On a phone the panel takes the full width above the launcher. */
@media (max-width: 32rem) {
  .dga-panel {
    right: 0.6rem;
    left: 0.6rem;
    width: auto;
  }
}

/* Dark scheme: only the pieces Material's variables do not already flip. */
[data-md-color-scheme="slate"] .dga-panel {
  border-color: var(--md-default-fg-color--lightest);
}
