/* Shared layout for the storefront assistant and helpdesk. */
dialog.nai-dialog, dialog#nuaa-helpdesk {
  --chat-avatar: 30px;
  --chat-avatar-slot: 40px;
  --chat-line: #e8ebef;
  box-sizing: border-box;
  position: fixed;
  inset: 0;
  margin: auto;
  width: calc(100% - 32px);
  max-width: 736px;
  height: min(700px, calc(100vh - 32px));
  height: min(700px, calc(100dvh - 32px));
  max-height: calc(100% - 32px);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--chat-line);
  border-radius: 18px;
  background: #fff;
  color: #20252b;
  font: 14px/1.55 system-ui, sans-serif;
  box-shadow: 0 18px 54px #17203326;
}
dialog.nai-dialog[open], dialog#nuaa-helpdesk[open] {
  display: flex;
  flex-direction: column;
}
.nai-dialog::backdrop, #nuaa-helpdesk::backdrop { background: #17203352; }

.nai-dialog > header, #nuaa-helpdesk .nuaa-hd-header {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  flex: none;
  gap: 10px;
  min-height: 72px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--chat-line);
  background: #fff;
  color: #20252b;
}
.nai-dialog > header::before, #nuaa-helpdesk .nuaa-hd-header::before {
  content: "";
  box-sizing: border-box;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  border: 1px solid var(--chat-line);
  border-radius: 50%;
  background: #edf5ff url("/ai-shopping/assistant-avatar.jpeg") center / cover no-repeat;
}
#nuaa-helpdesk .nuaa-hd-header > .nuaa-hd-avatar { display: none; }
.nai-dialog > header strong, #nuaa-helpdesk #nuaa-hd-title { font-size: 16px; }
#nuaa-helpdesk .nuaa-hd-header > div { min-width: 0; }
#nuaa-helpdesk .nuaa-hd-status { color: #626b76; font-size: 12px; }
#nuaa-helpdesk .nuaa-hd-status[data-online=true] { color: #167349; }
#nuaa-helpdesk .nuaa-hd-status[data-online=true]::before { content: "●"; margin-right: 5px; font-size: 9px; }
.nai-dialog > header button, #nuaa-helpdesk .nuaa-hd-header .nuaa-hd-close {
  box-sizing: border-box;
  display: grid;
  place-items: center;
  margin-left: auto;
  padding: 0;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border: 1px solid var(--chat-line);
  border-radius: 10px;
  background: #fff;
  color: #344155;
  font: 24px/1 system-ui, sans-serif;
}

.nai-dialog .nai-feed, #nuaa-helpdesk .nuaa-hd-conversation {
  flex: 1 1 auto;
  min-height: 0;
  padding: 16px calc(16px + var(--chat-avatar-slot));
  overflow-y: auto;
  background: #fff;
}
.nai-dialog .nai-feed, #nuaa-helpdesk .nuaa-hd-log {
  display: flex;
  flex-direction: column;
  gap: 12px !important;
}
.nai-dialog .nai-feed > .nai-message, #nuaa-helpdesk .nuaa-hd-log > .nuaa-hd-bubble {
  box-sizing: border-box;
  position: relative;
  align-self: flex-start;
  flex: 0 0 auto;
  width: fit-content;
  max-width: 100%;
  min-width: 0;
  margin: 0;
  padding: 10px 12px;
  border: 0;
  border-radius: 13px;
  background: #eaf3ff;
  color: #20252b;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.nai-dialog .nai-feed > .nai-message::after, #nuaa-helpdesk .nuaa-hd-log > .nuaa-hd-bubble::after {
  content: "";
  box-sizing: border-box;
  position: absolute;
  top: 0;
  left: calc(0px - var(--chat-avatar-slot));
  width: var(--chat-avatar);
  height: var(--chat-avatar);
  border: 1px solid var(--chat-line);
  border-radius: 50%;
  background: #edf5ff url("/ai-shopping/assistant-avatar.jpeg") center / cover no-repeat;
}
.nai-dialog .nai-feed > .nai-message.user, #nuaa-helpdesk .nuaa-hd-log > .nuaa-hd-bubble.visitor {
  align-self: flex-end;
  max-width: 100%;
  border-radius: 13px;
  background: #f1f2f4;
  color: #20252b;
}
.nai-dialog .nai-feed > .nai-message.user::after, #nuaa-helpdesk .nuaa-hd-log > .nuaa-hd-bubble.visitor::after {
  left: auto;
  right: calc(0px - var(--chat-avatar-slot));
  background-image: var(--nuaa-qq-avatar, none), url("/ai-shopping/guest-avatar.jpeg");
}

.nai-dialog form, #nuaa-helpdesk .nuaa-hd-bottom {
  flex: 0 0 auto;
  min-width: 0;
  padding: 12px 16px;
  border-top: 1px solid var(--chat-line);
  background: #fff;
}
#nuaa-helpdesk .nuaa-hd-consent { display: none !important; }
.nai-dialog form textarea, #nuaa-helpdesk .nuaa-hd-compose input {
  min-width: 0;
  border: 1px solid #d7dfe9;
  border-radius: 12px;
  background: #fff;
  color: #20252b;
}
.nai-dialog form > button, #nuaa-helpdesk .nuaa-hd-compose button {
  flex: 0 0 auto;
  border-radius: 12px;
}
#nuaa-helpdesk .nuaa-hd-offline { margin: 6px 0; overflow-wrap: anywhere; }
@media (max-width: 600px) {
  dialog.nai-dialog, dialog#nuaa-helpdesk {
    --chat-avatar: 26px;
    --chat-avatar-slot: 33px;
    width: calc(100% - 16px);
    height: calc(100vh - 16px);
    height: calc(100dvh - 16px);
    max-height: calc(100% - 16px);
  }
  .nai-dialog .nai-feed, #nuaa-helpdesk .nuaa-hd-conversation {
    padding-inline: calc(9px + var(--chat-avatar-slot));
  }
  .nai-dialog form, #nuaa-helpdesk .nuaa-hd-bottom { padding-inline: 10px; }
  .nai-dialog form textarea, #nuaa-helpdesk .nuaa-hd-compose input { font-size: 16px; }
}
