/* v2 scrim dialogs (reaction picker, role menu): a native <dialog> shown as a
   modal over a dimmed scrim. The card sits on the raised surface; the scrim
   click-closes (dialog_controller) while clicks on the card land on its
   descendants and pass through. */

.scrim-dialog {
  background-color: var(--color-bg-raised);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  box-shadow: var(--shadow-overlay);
  color: var(--color-text);
  inline-size: var(--dialog-width, 296px);
  inset: 0;
  /* the global reset zeroes margins, which would pin the dialog to the
     top-left — restore the UA's centered placement */
  margin: auto;
  max-inline-size: calc(100dvw - var(--inline-space) * 2);
  padding: 0;
  position: fixed;

  &::backdrop {
    background-color: rgb(12 14 20 / 0.36);
  }
}

.scrim-dialog__header {
  border-block-end: 1px solid var(--color-border);
  font-size: 0.8125rem;
  font-weight: 700;
  padding: 12px 14px;
}

/* Header with a title and a trailing ✕ close */
.scrim-dialog__header--titled {
  align-items: center;
  display: flex;
  gap: 10px;
  padding: 16px 18px;
}

.scrim-dialog__title {
  flex: 1;
  font-size: 1.125rem;
  font-weight: 700;
}

.scrim-dialog__close {
  background: none;
  border: 0;
  color: var(--color-text-subtle);
  cursor: pointer;
  font-size: 0.9375rem;
  line-height: 1;
  padding: 4px;

  &:hover {
    color: var(--color-text);
  }
}

.scrim-dialog__body {
  padding: 14px;
}

/* Footer action bar: right-aligned buttons over a hairline */
.scrim-dialog__footer {
  align-items: center;
  border-block-start: 1px solid var(--color-border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 14px 18px;
}

/* Footer buttons ride the 8px rounded-rect scale, not the default .btn pill.
   The primary (.settings-save) brings its own accent fill; the bare .btn is
   the secondary (Cancel) — a quiet outlined rect matching the primary's
   geometry, muted until hover. */
.scrim-dialog__footer .btn {
  --btn-border-radius: 8px;

  font-size: 0.8125rem;
  font-weight: 600;
}

.scrim-dialog__footer .btn:not(.settings-save) {
  --btn-background: transparent;
  --btn-border-color: var(--color-border);
  --btn-color: var(--color-text-muted);
  --btn-padding: 9px 15px;
  --hover-color: transparent;
  --hover-filter: none;

  @media (any-hover: hover) {
    &:hover {
      --btn-background: var(--color-bg-hover);
      --btn-color: var(--color-text);
    }
  }
}

/* Small-caps section eyebrow inside the card */
.scrim-dialog__label {
  color: var(--color-text-subtle);
  display: block;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

/* Reaction picker: the full emoji grid over a custom-boost input */
.reaction-grid {
  display: grid;
  gap: 4px;
  /* minmax(0, 1fr): a bare 1fr bottoms out at the buttons' intrinsic width,
     overflowing the card and clipping the seventh column */
  grid-template-columns: repeat(7, minmax(0, 1fr));
  margin-block-start: 10px;
}

.reaction-grid .btn {
  --btn-background: transparent;
  --btn-border-color: transparent;
  --btn-border-radius: 8px;
  --btn-padding: 0;
  --hover-color: transparent;
  --hover-filter: none;

  block-size: 34px;
  inline-size: 100%;

  @media (any-hover: hover) {
    &:hover {
      background-color: var(--color-bg-hover);
    }

    &:where(:not(:active):hover) .boost-character {
      transform: scale(1.15);
    }
  }
}

.reaction-custom {
  align-items: center;
  display: flex;
  gap: 8px;
  margin-block-start: 12px;
}

.reaction-custom__input {
  flex: 1;
  min-inline-size: 0;
}

/* Manage-member dialog: role rows over badge chips over account actions */
.manage-member {
  display: flex;
  flex-direction: column;
  padding: 6px;
}

.manage-member__name {
  font-size: 0.8125rem;
  font-weight: 700;
  margin: 0;
  padding: 10px 12px 8px;
}

.manage-member__label {
  padding: 2px 12px 4px;
}

.manage-member__rule {
  background-color: var(--color-border);
  block-size: 1px;
  border: 0;
  margin: 6px 8px;
}

.role-option,
.manage-member__action {
  --btn-background: transparent;
  --btn-border-color: transparent;
  --btn-border-radius: 9px;
  --btn-padding: 9px 12px;
  --hover-color: transparent;
  --hover-filter: none;

  font-size: 0.875rem;
  font-weight: 400;
  gap: 10px;
  inline-size: 100%;
  justify-content: flex-start;

  @media (any-hover: hover) {
    &:hover:not(:disabled) {
      background-color: var(--color-bg-hover);
    }
  }
}

.role-option__tick {
  flex-shrink: 0;
  font-size: 0.75rem;
  inline-size: 15px;
  text-align: center;
}

.role-option__label {
  flex: 1;
  text-align: start;
}

.role-option__hint {
  color: var(--color-text-subtle);
  font-size: 0.71875rem;
}

.role-option--current {
  background-color: var(--color-selected);
  color: var(--color-accent-brand);
}

.badge-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 12px 10px;
}

.badge-chip {
  --badge-color: var(--color-text-muted);
  --btn-background: color-mix(in srgb, var(--badge-color) 12%, transparent);
  --btn-border-color: transparent;
  --btn-border-radius: 5px;
  --btn-padding: 3px 8px;
  --hover-filter: none;

  color: var(--badge-color);
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.badge-chip--current {
  --btn-border-color: var(--badge-color);
}

.manage-member__action--negative {
  color: var(--color-negative);
}

/* ⌘K search palette: a wide card parked near the top of the viewport */
.scrim-dialog--palette {
  --dialog-width: 640px;

  margin-block-start: min(96px, 14dvh);
  overflow: hidden;
}

/* New room: a form dialog parked near the top of the viewport */
.scrim-dialog--new-room {
  --dialog-width: 460px;

  margin-block-start: min(88px, 12dvh);
  /* Short viewports: scroll the card rather than letting the footer fall
     off-screen. */
  max-block-size: calc(100dvh - min(88px, 12dvh) - var(--block-space));
  overflow-y: auto;

  .scrim-dialog__body {
    padding: 18px;
  }
}

/* The auto-join toggle sits in its own bordered box */
.scrim-dialog--new-room .new-room-autojoin {
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 12px 14px;

  .setting-row {
    padding-block: 0;
  }
}

.search-palette__field {
  align-items: center;
  border-block-end: 1px solid var(--color-border);
  display: flex;
  gap: 11px;
  padding: 15px 18px;
}

.search-palette__glyph {
  --icon-size: 16px;

  color: var(--color-text-subtle);
  flex-shrink: 0;
}

.search-palette__input {
  background: transparent;
  border: 0;
  color: var(--color-text);
  flex: 1;
  font-size: max(16px, 1rem);
  min-inline-size: 0;

  /* the card itself is the focus affordance — mute the global outline
     and the tailwindcss/forms focus ring (a box-shadow) */
  &:focus {
    box-shadow: none;
    outline: none;
  }

  &::placeholder {
    color: var(--color-text-subtle);
  }
}

.search-palette__esc {
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 5px;
  color: var(--color-text-subtle);
  cursor: pointer;
  flex-shrink: 0;
  font-family: inherit;
  font-size: 0.6875rem;
  padding: 2px 6px;

  @media (pointer: coarse) {
    display: none;
  }
}

.search-palette__body {
  padding: 16px 18px 20px;
}

.search-palette__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-block-start: 10px;
}

.search-palette__chip {
  border: 1px solid var(--color-border);
  border-radius: 999px;
  color: var(--color-text-muted);
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 5px 13px;
  text-decoration: none;

  &:hover {
    border-color: color-mix(in oklch, var(--color-accent-brand) 50%, transparent);
    color: var(--color-accent-brand);
  }
}

.search-palette__hint {
  color: var(--color-text-subtle);
  font-size: 0.84375rem;
  line-height: 1.55;
  margin: 18px 0 0;
}

