@import '../../../../styles/common';
@import '../../../../styles/vendor/bootstrap_foundation-sites';

/* XXX add a margin when MailMessage is followed by MailMessage */
.m-instant-message + .s-mail-message {
  margin-top: 2rem;
}

.s-mail-message {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto;
  grid-template-areas:
    'details'
    'info'
    'container'
    'actions';
  margin-bottom: 1rem;
  background-color: #fff;

  &__info {
    grid-area: info;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    padding: 1rem;
    background-color: #eee;

    &--super {
      background-color: #edfffc;
    }

    &--good {
      background-color: #edfffc;
    }

    &--bad {
      background-color: #edfffc;
    }

    &--ugly {
      background-color: #fff4f7;
    }
  }

  &__tags {
    margin-top: $co-component__spacing;
  }

  &__participants,
  &__tags {
    display: none;
  }

  &__details {
    grid-area: details;
  }

  &__container {
    grid-area: container;
  }

  &__details,
  &__container {
    overflow: hidden;
  }

  &__encrypted {
    float: right;
    color: map_get($privacy-palette, 'super');
    font-size: 1rem;
    font-weight: normal;
    text-align: right;
  }

  &__content,
  &__subject {
    padding: $co-component__spacing;
    border-bottom: 1px solid #f9f9f9;
    color: #515151;
  }

  &__content {
    padding-bottom: 3rem;
  }

  &__actions {
    grid-area: actions;
    background-color: $co-color__bg__action;
    font-size: 0.88rem;
    text-align: right;
  }

  // XXX: to remove when attachments decryption is available
  &__encrypted-attachments-info {
    margin-right: 1rem;
    margin-left: 1rem;
  }

  @include breakpoint(medium) {
    grid-template-columns: 13rem 1fr;
    grid-template-rows: $co-component__height auto $co-component__height;
    grid-template-areas:
      'info details'
      'info container'
      'info actions';

    &__info {
      float: left;
      flex-direction: column;
      order: -1;
      width: 13rem;
      padding: 3rem 1.5rem;
    }

    &__details {
      align-self: center;
    }

    &__participants,
    &__tags {
      display: block;
    }

    &__participants-from,
    &__participants-to {
      overflow: hidden;
      text-overflow: ellipsis;
      font-size: $co-font__size--small;

      a,
      a:visited {
        color: #515151;
        font-weight: 600;
      }
    }

    &__content,
    &__subject {
      margin-right: 6rem;
      margin-left: 6rem;
    }

    &__actions {
      padding: 0 6rem;
    }
  }
}
