/* Message List */
// a.k.a. notifications in the menu

// main list
.message-list {
  width: 29em;
  border: solid $borders_color;
  padding: 2px $base_margin;

  // padding and margins to account for scrollbar
  &:ltr { margin-left: 0; margin-right: 0; padding-right: $base_padding + 2px; border-right-width: 1px; }
  &:rtl { margin-right: 0; margin-left: 0; padding-left: $base_padding + 2px; border-left-width: 1px; }

  .message-list-placeholder {
    @extend %title_2;
    color: transparentize($insensitive_fg_color, .5);

    // icon size and color
    > StIcon {
      icon-size: 96px; // non-em asset size
      margin-bottom: $base_margin * 3;
      -st-icon-style: symbolic;
    }
  }
}

.message-list-sections {
  // to account for scrollbar
  &:ltr { margin-right: $base_margin; }
  &:rtl { margin-left: $base_margin; }
}

.message-list-section,
.message-list-sections,
.message-list-section-list {
  spacing: $base_padding * 2;
}

// do-not-disturb + clear button
.message-list-controls {
  // NOTE: remove the padding if notification_bubble could remove margin for drop shadow
  padding: $base_padding * 2;
  padding-bottom: $base_padding;
  spacing: $base_padding;
  @extend %heading;

  .dnd-button {
    // We need this because the focus outline isn't inset like for the buttons
    // so the dnd button would grow when it gets focus if we didn't change only
    // its color when focusing.
    border-width: 2px;
    border-color: transparent;
    border-radius: 32px;
    border-style: solid;

    &:focus {
      border-color: transparentize($selected_bg_color, 0.4);
    }
  }
}

// message bubbles
.message {
  @include card;
  padding: 0;
  margin: 0;

  &:ltr { padding-right: -2px; }
  &:rtl { padding-left: -2px; }

  // message header
  .message-header {
    padding: 0 $scaled_padding;
    margin: $base_padding;
    margin-bottom: 0;
    spacing: $base_padding;
    color: $insensitive_fg_color;

    // header source icon
    .message-source-icon {
      icon-size: $scalable_icon_size; // 16px
      -st-icon-style: symbolic;
    }

    // box that contains the source icon, source name and timestamp of the message
    .message-header-content {
      spacing: $base_padding;
      min-height: to_em(24px);
      padding-bottom: $base_padding;

      // header source title
      .message-source-title {
        font-weight: bold;
      }

      // Time label
      .event-time {
        @extend %caption;
        color: $insensitive_fg_color;
        // Add bottom padding to align the app name with the time horizontally
        padding-bottom: to_em(1px);

        &:ltr { text-align: right; }
        &:rtl { text-align: left; }
      }
    }

    // buttons in the message header
    .message-expand-button,
    .message-close-button {
      @extend .icon-button;
      color: $fg_color;
      background-color: transparentize($fg_color, .9);
      padding: 4px;
      border: none;

      &:hover { background-color: transparentize($fg_color, .81);}
      &:active,
      &:active:hover { background-color: transparentize($fg_color, .76);}
      &:insensitive { background-color: transparentize($fg_color, .93);}
    }

    .message-expand-button {
      padding: 4px;

      &:ltr { margin-right: $base_padding; }
      &:rtl { margin-left: $base_padding; }
    }
  }

  // container for message contents
  .message-box {
    padding: $base_padding;
    margin: $base_padding;
    margin-top: 0;
    spacing: $base_padding;

    // icon of the message
    .message-icon {
      &:ltr { margin-right: $base_padding; }
      &:rtl { margin-left: $base_padding; }

      // icon size and color
      icon-size: $base_icon_size * 3; // 48px
      -st-icon-style: symbolic;

      &.message-themed-icon {
        border-radius: $circular_radius; // is circular
        background-color: transparentize($fg_color, 0.8);
        icon-size: $base_icon_size;
        min-width: $base_icon_size * 3;
        min-height: $base_icon_size * 3;
      }
    }

    // If the header isn't displayed we need more top margin
    &:first-child {
      margin-top: $base_padding * 2;
    }

    // text of the message
    .message-content {
      spacing: $base_margin;

      // message title
      .message-title {
        font-weight: bold;
      }
    }
  }
}

// URLs in messages
.url-highlighter {
  link-color: $link_color;
}

/* Media Controls */
.message-media-control {
  padding: 0 $base_padding * 3;
  border-radius: $base_border_radius;
  color: $fg_color;
  border: none;

  // colors are lightened since the media controls are in a card
  &:hover {
    background-color: $hover_bg_color;
    color: $fg_color;
  }

  &:active {
    background-color: $active_bg_color;
    color: $fg_color;
  }

  &:insensitive {
    color: lighten($insensitive_fg_color, 5%);
  }

  & StIcon { icon-size: $base_icon_size; }
}

.media-message {
  // album-art
  .message-icon {
    border-radius: $base_border_radius !important;

    &.message-themed-icon {
      icon-size: $large_icon_size !important; // 32px
    }
  }
}
