/**
 ** IMPORTANT:
 **   Track revisions in repo:Rocket.Chat.Custom_Content
 **/


/*
 * Hide SA Logo space
 *
 * There is space for the SA logo in the bottom-left corner.
 * It adds nothing to the UX, so I've removed the logo HTML
 * and am hiding the empty space.
 */
.rcx-sidebar-footer { display: none }



/*
 * AR-3288 Hide Profile configuration page, accessible in two ways:
 *
 * 1. RC Sidebar > Avatar button > Account: Profile
 * 2. Account Sidebar (when viewing any /account/* page) > Profile
 *
 * n.b. That page just says "You are not authorized to view this page."
 */
nav.rcx-sidebar--main div[role=presentation] label[data-key=profile],
a.rcx-sidebar-item[href="/account/profile"] {
  display: none !important;
}



/*
 * Hide "Move to Team" button
 *
 * The Room Information panel shows a "Move to Team" button
 * (between the "Edit" and "3-dots" buttons) to users with
 * `edit-room` permission.
 *
 * We are not using Teams, no teams exist to which to move
 * the room to, and nobody has `create-team` permission.
 * The button is thus useless.  Avoid confusion by hiding
 * the UI for it.
 *
 * The button can be stand-alone or buried in the 3-dots menu.
 * In the 3-dots menu, it is preceded by a divider/separator.
 */
button[aria-label="Move to Team"],
div[role=presentation]:has(label[data-key=move_channel_team]),
hr[role=separator]:has(+ div[role=presentation] label[data-key=move_channel_team]) {
    display: none;
}


/*
 * Hide certain "Edit Room" fields which shouldn’t be configured manually.
 *
 * For those with `edit-room` permission, the Edit Room panel
 *   (/group/market-philosophy/channel-settings > Edit)
 * shows the following fields:
 *
 *   0. Avatar              HIDE
 *   1. Name                HIDE
 *   2. Topic
 *   3. Announcement
 *   4. Description         HIDE
 *   5. Private             HIDE
 *   6. Read Only
 *   6b. Allow Reacting (dynamically added to DOM if 6 is checked)
 *   7. Archived
 *   8. Hide System Messages (toggle + droplist)
 *
 * Structure:
 * - Fields 1-5 are wrapped in a `fieldset`
 * - Fields 6-8 are wrapped in a `div fieldset`
 *
 * Some of these fields have individual, configurable
 * permissions (e.g. archive-room) but most are editable
 * by anyone with `edit-room`.  If changed, many will be
 * overwritten at the next sync.
 *
 * The HTML classes and ids don‘t offer much to
 * uniquely select these elements, so we have to be
 * creative.  The Avatar has the most distinctive
 * attributes, so we first select it and then select
 * the other elements relative to it.
**/
div[aria-labelledby=contextualbarTitle][role=dialog]
  form
  > div:first-child:has(figure.rcx-avatar + div button i.rcx-icon--name-upload) {
 /* ^^^ Match the "Avatar" div */
  &,
  ~ fieldset > div:has(input[name="roomName"]),
  ~ fieldset > div:has(textarea[name="roomDescription"]),
  ~ fieldset > div:has(input[name="roomType"]), /* Private */
  ~ div fieldset div:has(input[name="archived"]),
  ~ div fieldset div:has(input[name="hideSysMes"]) {
    display: none !important;
    background-color: mediumpurple;   /* debug */
  }
}


/*
 * AR-2832 Show more information on Link Preview cards
 *
 * Instead of truncating the title and description to a meager
 * **one** line, show **multiple** lines, ellipsizing
 * the final line if the limit is passed.
 * Both the height clipping and the ellipse logic are provided
 * by `-webkit-line-clamp`.
 *
 * SRC: https://css-tricks.com/line-clampin/#aa-the-standardized-way
 * n.b. Despite the `-webkit-` prefixes, these are
 * the **officially standardized** names, not browser-specific!
 */
div.messages-container-main {
  div.rcx-box.rcx-box--full.rcx-message-block {
    .rcx-message-generic-preview__title,
    .rcx-message-generic-preview__description {
      white-space: normal;           /* Override RC's nowrap */
      display: -webkit-box;          /* Pre-req for clamping */
      -webkit-box-orient: vertical;  /* ditto */
      overflow: hidden;
    }
    .rcx-message-generic-preview__title {
      -webkit-line-clamp: 3;
    }
    .rcx-message-generic-preview__description {
      -webkit-line-clamp: 6;
    }
  }
}

