/* Course advisor chat — logo_2 only */
.xf-chat-root {
  --xf-chat-moss: #55612e;
  --xf-chat-moss-soft: rgba(85, 97, 46, 0.12);
  --xf-chat-bg: #fcf9f1;
  --xf-chat-panel: #fffdf8;
  --xf-chat-ink: #1c1c17;
  --xf-chat-muted: #5c5f54;
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 110;
  font-family: Manrope, "Noto Sans TC", system-ui, sans-serif;
}

.xf-chat-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: none;
  border-radius: 999px;
  padding: 0.75rem 1.1rem;
  background: var(--xf-chat-moss);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(28, 28, 23, 0.18);
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease;
}

.xf-chat-toggle:hover {
  transform: translateY(-1px);
  background: #465226;
}

.xf-chat-toggle:focus-visible {
  outline: 2px solid var(--xf-chat-moss);
  outline-offset: 3px;
}

.xf-chat-panel {
  display: none;
  flex-direction: column;
  width: min(22.5rem, calc(100vw - 1.5rem));
  height: min(32rem, calc(100vh - 5.5rem));
  margin-bottom: 0.75rem;
  border: 1px solid rgba(85, 97, 46, 0.18);
  border-radius: 1rem;
  background: var(--xf-chat-panel);
  box-shadow: 0 16px 40px rgba(28, 28, 23, 0.16);
  overflow: hidden;
}

.xf-chat-root.is-open .xf-chat-panel {
  display: flex;
}

.xf-chat-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  background: linear-gradient(160deg, #eef1e4 0%, #fcf9f1 100%);
  border-bottom: 1px solid rgba(85, 97, 46, 0.12);
}

.xf-chat-head h2 {
  margin: 0;
  font-family: "Noto Serif TC", serif;
  font-size: 1.05rem;
  color: var(--xf-chat-moss);
  line-height: 1.3;
}

.xf-chat-head p {
  margin: 0.25rem 0 0;
  font-size: 0.75rem;
  color: var(--xf-chat-muted);
  line-height: 1.4;
}

.xf-chat-close {
  border: none;
  background: transparent;
  color: var(--xf-chat-muted);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.15rem 0.35rem;
  border-radius: 0.4rem;
}

.xf-chat-close:hover {
  background: var(--xf-chat-moss-soft);
  color: var(--xf-chat-moss);
}

.xf-chat-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 0.85rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  background: var(--xf-chat-bg);
}

.xf-chat-bubble {
  max-width: 92%;
  padding: 0.65rem 0.8rem;
  border-radius: 0.85rem;
  font-size: 0.875rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--xf-chat-ink);
}

.xf-chat-bubble.bot {
  align-self: flex-start;
  background: #fff;
  border: 1px solid rgba(85, 97, 46, 0.14);
  border-bottom-left-radius: 0.25rem;
}

.xf-chat-bubble.user {
  align-self: flex-end;
  background: var(--xf-chat-moss);
  color: #fff;
  border-bottom-right-radius: 0.25rem;
}

.xf-chat-bubble.err {
  align-self: flex-start;
  background: #fff5f2;
  border: 1px solid #e8c4bb;
  color: #7a3b2e;
}

.xf-chat-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.35rem;
}

.xf-chat-action-btn {
  border: 1px solid rgba(85, 97, 46, 0.35);
  background: #fff;
  color: var(--xf-chat-moss);
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.xf-chat-action-btn:hover {
  background: var(--xf-chat-moss-soft);
}

.xf-chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.55rem 0.9rem 0.15rem;
  background: var(--xf-chat-panel);
  border-top: 1px solid rgba(85, 97, 46, 0.08);
}

.xf-chat-chip {
  border: 1px solid rgba(85, 97, 46, 0.22);
  background: transparent;
  color: var(--xf-chat-moss);
  border-radius: 999px;
  padding: 0.3rem 0.65rem;
  font-size: 0.72rem;
  cursor: pointer;
}

.xf-chat-chip:hover {
  background: var(--xf-chat-moss-soft);
}

.xf-chat-form {
  display: flex;
  gap: 0.45rem;
  padding: 0.65rem 0.75rem 0.85rem;
  background: var(--xf-chat-panel);
  border-top: 1px solid rgba(85, 97, 46, 0.1);
}

.xf-chat-form input {
  flex: 1;
  min-width: 0;
  border: 1px solid rgba(85, 97, 46, 0.25);
  border-radius: 0.65rem;
  padding: 0.55rem 0.7rem;
  font-size: 0.875rem;
  background: #fff;
  color: var(--xf-chat-ink);
}

.xf-chat-form input:focus {
  outline: 2px solid rgba(85, 97, 46, 0.35);
  outline-offset: 1px;
}

.xf-chat-form button[type="submit"] {
  border: none;
  border-radius: 0.65rem;
  padding: 0.55rem 0.85rem;
  background: var(--xf-chat-moss);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.xf-chat-form button[type="submit"]:disabled {
  opacity: 0.55;
  cursor: wait;
}

@media (max-width: 420px) {
  .xf-chat-root {
    right: 0.65rem;
    bottom: 0.65rem;
  }

  .xf-chat-toggle span.xf-chat-toggle-label {
    display: none;
  }

  .xf-chat-toggle {
    padding: 0.85rem;
    border-radius: 999px;
  }
}
