/* QUDENOQ fixed-rule support assistant — widget styles */

.qdn-chat {
  --qdn-chat-border: rgba(var(--color-foreground), 0.16);
  --qdn-chat-muted: rgba(var(--color-foreground), 0.72);
  --qdn-chat-icon-size: 2.6rem;
}

.qdn-chat__launcher {
  position: fixed;
  right: 1.6rem;
  bottom: calc(1.6rem + env(safe-area-inset-bottom, 0px));
  z-index: 60;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  min-width: 5.6rem;
  min-height: 5.6rem;
  padding: 0 1.8rem;
  border: 0;
  border-radius: 999px;
  background: rgb(var(--color-button));
  color: rgb(var(--color-button-text));
  box-shadow: 0 0.6rem 2.4rem rgba(0, 0, 0, 0.22);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 0.03rem;
  cursor: pointer;
}

.qdn-chat__launcher:hover {
  opacity: 0.92;
}

.qdn-chat__launcher svg {
  width: var(--qdn-chat-icon-size);
  height: var(--qdn-chat-icon-size);
}

.qdn-chat__launcher-label {
  display: inline;
}

.qdn-chat--open .qdn-chat__launcher {
  display: none;
}

.qdn-chat__panel {
  position: fixed;
  right: 1.6rem;
  bottom: calc(1.6rem + env(safe-area-inset-bottom, 0px));
  z-index: 61;
  display: flex;
  flex-direction: column;
  width: min(40rem, calc(100vw - 3.2rem));
  height: min(64rem, calc(100vh - 10rem));
  max-height: calc(100vh - 10rem);
  overflow: hidden;
  border: 0.1rem solid var(--qdn-chat-border);
  border-radius: 1.6rem;
  background: rgb(var(--color-background));
  color: rgb(var(--color-foreground));
  box-shadow: 0 1.6rem 4.8rem rgba(0, 0, 0, 0.24);
}

.qdn-chat__panel[hidden] {
  display: none;
}

@supports (height: 1dvh) {
  .qdn-chat__panel {
    height: min(64rem, calc(100dvh - 10rem));
    max-height: calc(100dvh - 10rem);
  }
}

@media screen and (max-width: 749px) {
  .qdn-chat__launcher {
    padding: 0;
    width: 5.8rem;
    height: 5.8rem;
  }

  .qdn-chat__launcher-label {
    display: none;
  }

  .qdn-chat__panel {
    right: 0.8rem;
    left: 0.8rem;
    bottom: calc(0.8rem + env(safe-area-inset-bottom, 0px));
    width: auto;
    height: min(78vh, 64rem);
    max-height: calc(100vh - 4rem);
    border-radius: 1.6rem;
  }

  @supports (height: 1dvh) {
    .qdn-chat__panel {
      height: min(78dvh, 64rem);
      max-height: calc(100dvh - 4rem);
    }
  }
}

.qdn-chat__header {
  display: flex;
  flex: none;
  align-items: center;
  gap: 0.6rem;
  padding: 0.8rem 0.8rem 0.8rem 1.6rem;
  border-bottom: 0.1rem solid var(--qdn-chat-border);
}

.qdn-chat__title {
  flex: 1;
  margin: 0;
  font-family: var(--font-heading-family);
  font-size: 1.7rem;
  font-weight: var(--font-heading-weight);
  line-height: 1.3;
}

.qdn-chat__icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 4.8rem;
  min-height: 4.8rem;
  padding: 0 1rem;
  border: 0;
  border-radius: 0.8rem;
  background: transparent;
  color: inherit;
  font-size: 1.4rem;
  font-weight: 600;
  cursor: pointer;
}

.qdn-chat__icon-button:hover {
  background: rgba(var(--color-foreground), 0.07);
}

.qdn-chat__close {
  font-size: 2.4rem;
  line-height: 1;
}

.qdn-chat__log {
  flex: 1 1 auto;
  min-height: 0;
  padding: 1.2rem 1.4rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  font-size: 1.6rem;
}

.qdn-chat__msg {
  max-width: 94%;
  padding: 0.9rem 1.2rem;
  border-radius: 1.2rem;
  font-size: 1.6rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
  white-space: pre-line;
}

.qdn-chat__msg--bot {
  align-self: flex-start;
  border-bottom-left-radius: 0.4rem;
  background: rgba(var(--color-foreground), 0.06);
}

.qdn-chat__msg--user {
  align-self: flex-end;
  border-bottom-right-radius: 0.4rem;
  background: rgb(var(--color-button));
  color: rgb(var(--color-button-text));
}

.qdn-chat__msg a {
  color: rgb(var(--color-link));
  text-decoration: underline;
  text-underline-offset: 0.2rem;
}

.qdn-chat__msg--user a {
  color: inherit;
}

.qdn-chat__links {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin: 0.8rem 0 0;
  padding: 0;
  list-style: none;
}

.qdn-chat__links a {
  display: inline-flex;
  align-items: center;
  min-height: 4.4rem;
  font-size: 1.5rem;
}

.qdn-chat__options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 0.8rem;
}

.qdn-chat__option {
  min-height: 4.8rem;
  padding: 0.8rem 1.4rem;
  border: 0.1rem solid rgba(var(--color-foreground), 0.35);
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font-size: 1.5rem;
  cursor: pointer;
}

.qdn-chat__option:hover {
  background: rgba(var(--color-foreground), 0.07);
}

.qdn-chat__meta {
  margin: 0.6rem 0 0;
  font-size: 1.3rem;
  color: var(--qdn-chat-muted);
}

.qdn-chat__quick {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  padding: 0.8rem 1.4rem;
  border-top: 0.1rem solid var(--qdn-chat-border);
  flex: none;
}

/* When the on-screen keyboard shrinks the viewport, keep the composer usable. */
@media (max-height: 560px) {
  .qdn-chat__quick {
    display: none;
  }

  .qdn-chat__privacy {
    display: none;
  }
}

.qdn-chat__quick-button {
  flex: none;
  min-height: 4.8rem;
  padding: 0.6rem 1.1rem;
  border: 0.1rem solid rgba(var(--color-foreground), 0.3);
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font-size: 1.5rem;
  white-space: nowrap;
  cursor: pointer;
}

.qdn-chat__quick-button:hover {
  background: rgba(var(--color-foreground), 0.07);
}

.qdn-chat__privacy {
  margin: 0;
  padding: 0 1.6rem;
  font-size: 1.25rem;
  line-height: 1.4;
  color: var(--qdn-chat-muted);
}

.qdn-chat__composer {
  display: flex;
  flex: none;
  gap: 0.8rem;
  padding: 0.8rem 1.2rem calc(0.8rem + env(safe-area-inset-bottom, 0px));
  border-top: 0.1rem solid var(--qdn-chat-border);
}

.qdn-chat__input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 4.8rem;
  padding: 0.8rem 1.2rem;
  border: 0.1rem solid rgba(var(--color-foreground), 0.4);
  border-radius: 0.8rem;
  background: rgb(var(--color-background));
  color: inherit;
  font-family: inherit;
  font-size: 1.6rem; /* 16px prevents iOS focus zoom */
}

.qdn-chat__send {
  flex: none;
  min-width: 4.8rem;
  min-height: 4.8rem;
  padding: 0 1.4rem;
  border: 0;
  border-radius: 0.8rem;
  background: rgb(var(--color-button));
  color: rgb(var(--color-button-text));
  font-size: 1.6rem;
  font-weight: 600;
  cursor: pointer;
}

.qdn-chat :focus-visible {
  outline: 0.2rem solid rgb(var(--color-foreground));
  outline-offset: 0.2rem;
}

@media (prefers-reduced-motion: reduce) {
  .qdn-acc__icon,
  .qdn-chat * {
    transition: none !important;
  }
}
