/* Room identity, boosted messages, guest logout and unread chat marker. */
#chat-section,
#chat-layout {
  --room-accent: #d6a85c;
}

body.chat-active .chat-shell {
  border-color: color-mix(in srgb, var(--room-accent) 62%, #39323f) !important;
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--room-accent) 13%, transparent),
    0 18px 55px rgba(0, 0, 0, .3) !important;
  transition: border-color .22s ease, box-shadow .22s ease;
}

body.chat-active .chat-header {
  box-shadow: inset 0 3px 0 color-mix(in srgb, var(--room-accent) 80%, white 5%);
}

.room-button {
  border-color: color-mix(in srgb, var(--room-accent) 34%, rgba(255,255,255,.1)) !important;
  background: color-mix(in srgb, var(--room-accent) 5%, transparent);
  transition: background .18s ease, border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.room-button:hover:not(:disabled),
.room-button:focus-visible {
  border-color: color-mix(in srgb, var(--room-accent) 68%, white 4%) !important;
  background: color-mix(in srgb, var(--room-accent) 12%, transparent) !important;
}

.room-button.is-active {
  border-color: var(--room-accent) !important;
  background: color-mix(in srgb, var(--room-accent) 17%, transparent) !important;
  box-shadow:
    inset 3px 0 0 var(--room-accent),
    0 0 18px color-mix(in srgb, var(--room-accent) 19%, transparent);
}

.room-button .room-icon {
  color: color-mix(in srgb, var(--room-accent) 78%, white 12%);
  background: color-mix(in srgb, var(--room-accent) 12%, rgba(255,255,255,.035));
  border: 1px solid color-mix(in srgb, var(--room-accent) 30%, transparent);
}

.room-button.is-active .room-icon {
  color: #fff;
  background: color-mix(in srgb, var(--room-accent) 43%, #201c25);
  border-color: color-mix(in srgb, var(--room-accent) 70%, white 7%);
}

.message-bubble.message-bubble--boosted {
  border: 2px solid color-mix(in srgb, var(--room-accent) 62%, #f4c96f) !important;
  box-shadow:
    0 0 0 2px color-mix(in srgb, var(--room-accent) 16%, transparent),
    0 0 17px color-mix(in srgb, var(--room-accent) 36%, transparent) !important;
  animation: dd-message-boost-color-pulse 2.2s ease-in-out infinite;
}

.message-bubble.message-bubble--boosted::before {
  display: none;
}

@keyframes dd-message-boost-color-pulse {
  0%, 100% {
    border-color: color-mix(in srgb, var(--room-accent) 62%, #f4c96f);
  }
  50% {
    border-color: color-mix(in srgb, var(--room-accent) 34%, #ffe5a4);
    filter: brightness(1.08);
  }
}

#leave-chat.is-guest-logout {
  width: auto !important;
  min-width: 112px !important;
  padding: 0 12px !important;
  flex: 0 0 auto;
  border-radius: 999px !important;
  gap: 7px;
}

#leave-chat.is-guest-logout .leave-chat-label {
  display: inline;
  font-size: .72rem;
  font-weight: 850;
}

.composer {
  position: relative !important;
}

.chat-unread-alert {
  position: absolute;
  z-index: 12;
  left: 50%;
  top: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: calc(100% - 24px);
  min-height: 38px;
  padding: 8px 13px;
  transform: translate(-50%, calc(-100% - 10px));
  border: 1px solid var(--room-accent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--room-accent) 18%, #17151c);
  box-shadow: 0 8px 24px rgba(0,0,0,.38), 0 0 16px color-mix(in srgb, var(--room-accent) 20%, transparent);
  color: #fff;
  font: inherit;
  font-size: .76rem;
  font-weight: 850;
  white-space: nowrap;
  cursor: pointer;
}

.chat-unread-alert[hidden] {
  display: none !important;
}

.chat-unread-alert:hover,
.chat-unread-alert:focus-visible {
  background: color-mix(in srgb, var(--room-accent) 28%, #17151c);
}

@media (max-width: 560px) {
  #leave-chat.is-guest-logout {
    min-width: 94px !important;
    padding-inline: 9px !important;
  }

  #leave-chat.is-guest-logout .leave-chat-label {
    font-size: .65rem;
  }

  .chat-unread-alert {
    min-height: 36px;
    font-size: .7rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.chat-active .chat-shell,
  .room-button,
  .message-bubble.message-bubble--boosted {
    transition: none;
    animation: none;
  }
}

/* Keep every chat heading row at its natural height. The message list is the
   only flexible/scrolling area, so header text can never collapse over it. */
body.chat-active .chat-shell > #chat-status,
body.chat-active .chat-shell > .chat-header,
body.chat-active .chat-shell > .system-banner,
body.chat-active .chat-shell > #chat-pin-bar,
body.chat-active .chat-shell > .composer,
body.chat-active .chat-shell > .chat-footnote {
  flex: 0 0 auto;
}

body.chat-active .chat-shell > .message-list {
  flex: 1 1 0;
  min-height: 0;
}

/* At tablet widths the title and controls use separate rows. This also keeps
   the open rooms drawer from visually crowding the chat controls. */
@media (max-width: 900px) {
  body.chat-active .chat-shell > .chat-header {
    grid-template-columns: minmax(0, 1fr) !important;
    align-items: start !important;
    gap: 10px !important;
    padding: 14px 16px !important;
  }

  body.chat-active .chat-header-actions {
    width: 100% !important;
    justify-content: flex-start !important;
  }

  body.chat-active .chat-shell > .system-banner {
    line-height: 1.45;
  }
}
