/* 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: 0; border-right-width: 0; }
  &:rtl { margin-right: 0; margin-left: $base_margin * 2; padding-left: 0; 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; // non-em asset size
      margin-bottom: $base_margin * 3;
      -st-icon-style: symbolic;
    }
  }
}

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

  -st-vfade-offset: 68px;

  .message {
    margin-bottom: $base_padding * 2 !important;
  }
}

// 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 {
      @if $gnome_version == 'default' {
        border-color: transparentize($primary, 0.4);
      } @else {
        border-color: st-transparentize($primary, 0.4);
      }
    }
  }
}

// message notification group
.message-notification-group {
  spacing: $base_padding * 2;

  .message-group-header {
    padding: $base_padding;
    .message-group-title {
      @extend %title_2;
      margin: 0 $base_margin;
    }
  }

  // close button
  .message-collapse-button {
    @extend .icon-button;
    padding: 4px !important;
    border: 4px transparent solid;
  }
}

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

  .popup-menu & {
    border-radius: $base_radius;
    color: $text-secondary;
    background-color: mix($text, $base, 5%) !important;

    &:hover {
      background-color: mix($text, $base, 10%) !important;
    }

    &:active {
      background-color: mix($text, $base, 15%) !important;
    }

    .notification-button { border-radius: $base_radius / 2; }
  }

  &:second-in-stack {
    background-color: mix($text, $base, 8%) !important;
    box-shadow: none;
  }

  &:lower-in-stack {
    background-color: mix($text, $base, 11%) !important;
    box-shadow: none;
  }

  // subtract side padding to accommodate the close button's border
  &:ltr { padding-right: $base_padding; }
  &:rtl { padding-left: $base_padding; }

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

    // remove side padding to accommodate the close button
    &:ltr { padding-right: 0; }
    &:rtl { padding-left: 0; }

    // header source icon
    .message-source-icon {
      icon-size: $base_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 - $base_padding * 2;
        min-height: $base_icon_size * 3 - $base_padding * 2;
        color: $text-disabled;
        background-color: $divider;
        padding: $base_padding;
      }
    }

    // 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;
    padding: 0;

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