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

.message-list {
  width: if($compact == 'true', 25.5em, 29em);
  text-shadow: none;
  border: solid $border;
  padding: 0;

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

  .message-list-placeholder {
    @extend %title_2;
    spacing: $base_spacing * 2;
    color: $text-secondary-disabled;

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

.message-list-sections {
  margin: 0; // to account for scrollbar
  padding-bottom: $base_padding;

  // to account for scrollbar
  &:ltr { margin-right: 0; }
  &:rtl { margin-left: 0; }
}

.message-list-section,
.message-list-sections,
.message-list-section-list {
  spacing: $base_spacing;
}

// do-not-disturb + clear button
.message-list-controls {
  margin: ($base_margin * 2) ($base_margin * 4) 0;
  // NOTE: remove the padding if notification_bubble could remove margin for drop shadow
  padding: $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($primary, 0.4);
    }
  }
}

// message bubbles
.message {
  padding: 0;
  margin: $base_spacing / 2;
  border-radius: $window_radius;

  .popup-menu & {
    border-radius: $base_radius;
    @extend %popover_bubble;

    .notification-button {
      &:first-child:ltr {
        border-radius: 0 0 0 $base_radius;
      }
    
      &:last-child:ltr {
        border-radius: 0 0 $base_radius;
      }
    
      &:first-child:rtl {
        border-radius: 0 0 $base_radius;
      }
    
      &:last-child:rtl {
        border-radius: 0 0 0 $base_radius;
      }
    
      &:first-child:last-child {
        border-radius: 0 0 $base_radius $base_radius;
      }
    }
  }

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

    // 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;
        // Add bottom padding to align the app name with the time horizontally
        padding-bottom: to_em(1px);
        color: $text-disabled;

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

    // buttons in the message header
    .message-expand-button,
    .message-close-button {
      @extend .icon-button;
      color: $text;
      background-color: $fill;
      padding: 4px;
      border: none;

      &, &:hover, &:active {
        color: $text;
      }
  
      &:hover, &:focus { background-color: $divider; }
      &:active, &:active:hover { background-color: $track; }
      &:insensitive { background-color: $fill;}
    }

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

      &: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
        icon-size: $base_icon_size;
        min-width: $base_icon_size * 3;
        min-height: $base_icon_size * 3;
        color: $text-disabled;
        background-color: $divider;
      }
    }

    // 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;
}

.message-media-control {
  margin: 4px $base_padding;
  padding: $base_padding * 2;
  border-radius: $circular_radius;
  border: none;
  color: $text-secondary;

  &:hover, &:focus { background-color: $divider; }
  &:active { background-color: $track; }

  &:hover, &:focus, &:active {
    color: $text;
  }

  &:insensitive {
    color: $text-disabled;
  }

  StIcon { icon-size: $base_icon_size; }
}

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

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