/*
 * Channels, direct messages and their dialogs of the team chat (W1.2/W1.3). Tokens and the shared
 * classes (chat-button, chat-field, chat-badge, chat-avatar) come from chat.css; the dialogs reuse the
 * layout classes chat-admin-* of admin.css. Both load before this file.
 */

.chat-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.chat-channel-main {
  display: flex;
  gap: 7px;
  align-items: center;
  min-width: 0;
}

.chat-channel-icon {
  display: inline-flex;
  flex: none;
  justify-content: center;
  width: 14px;
  color: var(--muted);
  font-weight: 600;
}

.chat-channel[aria-current="true"] .chat-channel-icon {
  color: inherit;
}

.chat-channel[data-preview="true"] .chat-channel-name {
  font-style: italic;
}

.chat-channel[data-muted="true"]:not([aria-current="true"]) {
  color: var(--muted);
}

.chat-lock {
  position: relative;
  display: inline-block;
  width: 10px;
  height: 12px;
}

.chat-lock::before {
  position: absolute;
  top: 0;
  left: 2px;
  width: 6px;
  height: 7px;
  border: 1.5px solid currentColor;
  border-bottom: 0;
  border-radius: 3px 3px 0 0;
  content: "";
}

.chat-lock::after {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 10px;
  height: 7px;
  border-radius: 2px;
  background: currentColor;
  content: "";
}

.chat-avatar-small {
  width: 20px;
  height: 20px;
  border-radius: 5px;
  font-size: 9px;
}

.chat-avatar-count {
  background: var(--muted-bright);
}

.chat-sidebar-action,
.chat-person {
  display: flex;
  gap: 8px;
  align-items: center;
  width: 100%;
  padding: 5px 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted-bright);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.chat-sidebar-action:hover,
.chat-person:hover {
  background: var(--cyan-soft);
  color: var(--cyan);
}

.chat-person-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-sidebar-toggle {
  display: flex;
  gap: 6px;
  align-items: center;
  width: calc(100% - 12px);
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.chat-sidebar-toggle::before {
  width: 0;
  height: 0;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 5px solid currentColor;
  content: "";
}

.chat-sidebar-toggle[aria-expanded="true"]::before {
  transform: rotate(90deg);
}

.chat-header-main {
  min-width: 0;
}

.chat-header-name {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.chat-header-name-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-header-icon {
  display: inline-flex;
  flex: none;
  align-items: center;
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
}

.chat-header-icon:empty,
.chat-header-topic:empty {
  display: none;
}

.chat-header-details {
  flex: none;
}

.chat-join-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  justify-content: space-between;
}

.chat-join-bar .chat-composer-hint {
  color: var(--muted-bright);
  font-size: 13px;
}

/* Dialogs */

/* Narrower than the admin dialog; both classes keep that independent of the load order. */
.chat-admin-dialog.chat-modal {
  max-width: 560px;
}

.chat-modal-form {
  display: grid;
  gap: 14px;
  margin: 0 0 8px;
}

.chat-modal-inline {
  gap: 8px;
}

.chat-modal-section:empty {
  display: none;
}

.chat-modal-section:not(:empty) ~ .chat-modal-section:not(:empty) {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.chat-modal-facts {
  margin: 0 0 10px;
}

.chat-modal-topic {
  margin: 0;
  overflow-wrap: anywhere;
}

.chat-modal-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}

.chat-modal-toolbar .chat-input {
  flex: 1 1 220px;
  width: auto;
}

.chat-choice {
  display: grid;
  gap: 6px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.chat-choice legend {
  margin: 0 0 6px;
  padding: 0;
}

.chat-choice-option {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

.chat-choice-option:has(input:checked) {
  border-color: var(--cyan);
  background: var(--cyan-soft);
}

.chat-choice-option input {
  flex: none;
  margin: 3px 0 0;
  accent-color: var(--cyan);
}

.chat-choice-text {
  display: grid;
  gap: 1px;
}

.chat-choice-label {
  font-weight: 600;
}

.chat-choice-hint {
  color: var(--muted);
  font-size: 12px;
}

.chat-people-picker {
  display: grid;
  gap: 6px;
}

.chat-people-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chat-people-chips:empty,
.chat-people-hint:empty {
  display: none;
}

.chat-people-chip {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding: 2px 4px 2px 10px;
  border: 1px solid var(--cyan);
  border-radius: 999px;
  background: var(--cyan-soft);
  color: var(--cyan);
  font-size: 13px;
  font-weight: 600;
}

.chat-people-chip-remove {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}

.chat-people-chip-remove:hover {
  background: rgba(0, 111, 120, 0.18);
}

.chat-people-results {
  max-height: 220px;
  margin: 0;
  padding: 4px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  list-style: none;
}

.chat-people-option {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 5px 8px;
  border-radius: 6px;
  cursor: pointer;
}

.chat-people-option[aria-selected="true"] {
  background: var(--cyan-soft);
}

.chat-people-option[aria-disabled="true"] {
  opacity: 0.5;
  cursor: default;
}

.chat-people-name {
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-people-handle {
  flex: none;
  color: var(--muted);
  font-size: 12px;
}

.chat-people-empty {
  padding: 6px 8px;
  color: var(--muted);
}
