@import "./../styles/index.scss";

.thread-item-container{
  width: calc(100% - 10px);
  display: flex;
  flex-direction: row;
  border-bottom: 1px solid transparent;
  cursor: pointer;
  padding: 5px;
  align-items: center;
  font-size: 12px;
  height: 36px;
  position: relative;

  &:hover{
    box-shadow: 1px 2px 4px 0 rgba(0, 5, 14, 0.14);
    z-index: 1;
    width: calc(100% - 7px);

    .thread-item-content {
      .thread-item-details{
        visibility: hidden;
      }

      .thread-item-date{
        visibility: hidden;
      }
    }

    .thread-label-option{
      display: flex;
    }
  }

  &.thread-item-read{
    font-weight: 300;
  }

  &.thread-item-unread{
    font-weight: 500;

    > .thread-item-content
    > .thread-item-labels {

      .thread-item-subject,
      .thread-item-recipients {
        font-weight: 700;
      }

      .thread-preview {
        font-weight: 600;
      }
    }
  }

  .thread-item-content {
    align-items: center;
    color: inherit;
    display: flex;
    height: 100%;
    text-decoration: none;
    width: 100%;

    > div{
      display: flex;
    }

    .thread-item-icon-option{
      align-items: center;
      flex-shrink: 0;
      justify-content: center;
      height: 100%;
      padding: 1px 13px 0 15px;
      width: 21px;

      &.show-avatar{
        .thread-letters{
          display: flex;
        }
      }

      &.show-option{
        .checkmark-container{
          display: flex;
        }
      }
      
      .checkmark-container{
        display: none;
        margin-left: 3px;
        margin-right: 4px;

        .checkmark-checked:after{
          top: 1px;
        }
      }

      .thread-letters{
        border-radius: 50%;
        color: white;
        display: none;
        width: 21px;
        height: 21px;
        justify-content: center;
        align-items: center;
        font-size: 9px;
        font-weight: normal;
      }
    }

    .thread-item-recipients{
      flex-shrink: 0;
      padding-right: 10px;
      width: 150px;

      span{
        overflow: hidden;
        text-overflow: ellipsis;
      }

      .thread-item-emails-size{
        border-radius: 8px;
        display: inline-table;
        height: 16px;
        margin-left: 4px;
        text-align: center;
        width: 21px;
        
        span{
          font-size: 11px;
          font-weight: 600;
        }
      }
    }

    .thread-item-status{
      padding-right: 10px;
      width: 17px;

      i{
        font-size: 13px;

        &.status-sent, &.status-delivered, &.status-sending{
          color: #d5d5d5;
        }

        &.status-opened{
          color: #0091ff;
        }
      }

      .fake-icon-warning {
        background-image: url(../#{$_PATH_TO_IMAGES}/resend-warning.svg);
        background-repeat: no-repeat;
        background-size: contain;
        width: 16px;
        height: 16px;
      }
    }

    .thread-item-labels{
      align-items: center;
      flex-direction: row;
      justify-content: flex-start;
      flex-wrap: nowrap;
      width: calc(100% - 358px);

      .thread-label{
        display: flex;
        font-size: 10px;
        margin-right: 8px;
      
        > div{
          &:nth-child(1){
            padding: 3px 10px;
            background-color: #ffbb63;
            border-radius: 10px;
            color: white;
            max-width: 92px;
            text-align: center;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
            font-weight: 600;
          }
      
          &:nth-child(2){
            padding: 4px;
            margin-left: 4px;
            border-radius: 50%;
            height: 12px;
            width: 12px;
            font-weight: 600;
          }
        }
      }

      .thread-item-subject{
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-weight: 600;
      }

      .thread-preview{
        flex: 1 0;
        margin-right: 10px;
        overflow: hidden;
        text-overflow: ellipsis;
        text-align: left;
        white-space: nowrap;

        &.thread-preview-unsent, 
        &.thread-preview-empty {
          color: #a2a2a2;
          transform: scale(1) rotate(0deg) translate(0px, 0px) skew(-11deg, 0deg);
        }
      } 
    }

    .thread-item-details{
      align-items: center;
      flex-shrink: 0;
      justify-content: flex-end;
      width: 38px;

      i{
        color: #d5d5d5;

        &.icon-attach{
          font-size: 19px;
          transform: rotate(-90deg);
        }

        &.icon-secure{
          font-size: 14px;
        }

        &:nth-child(2){
          margin-left: 3px;
        }
      }
    }

    .thread-item-date{
      color: #6a707e;
      width: 80px;
      flex-shrink: 0;
      justify-content: center;
    }
  }

  .thread-label-option{
    align-items: center;
    color: #d5d5d5;
    display: none;
    height: 100%;
    justify-content: space-around;
    padding-right: 10px;
    position: absolute;
    right: 0;
  
    > div{
      height: 31px;
      width: 31px;
      display: flex;
      align-items: center;
      justify-content: center;
      border-radius: 50%;
      margin-right: 9px;
      border: solid 1px rgba(128, 128, 128, 0);
  
      i{
        font-size: 19px;
      }
  
      &.thread-label-mark{
        i{
          color: #ffdf32 !important;
        }
      }
    }
  }

  span{
    white-space: pre;
  }

  .match-string{
    background-color: #fdfbea;
  }
}

.thread-icons{
  display: flex;
}

.thread-menu{
  position: absolute;
  top: 0;
  right: 0;
  background-color: white;
  width: 150px;
  box-shadow: 0px 0px 15px 0px rgba(163,163,163,0.43);

  ul{
    list-style-type: none;
    padding: 0px;
  }

  li{
    padding: 10px;
    padding-left: 30px;
    font-weight: normal;
    color: black;

    &:hover{
      background-color: #d5d5d5;
    }
  }
}

.thread-overlay{
  position: fixed;
  height: 100%;
  width: 100%;
  top: 0;
  left: 0;
  z-index: 1;
}

.labels-tooltip{
  box-shadow: 0 0 5px 0 rgba(0, 0, 3, 0.13) !important;
  display: flex !important;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 262px !important;
  padding: 7px 10px !important;
  opacity: 1 !important;

  .innerLabel{
    background-color: rgb(255, 187, 99);
    color: white;
    max-width: 92px;
    text-align: center;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 10px;
    overflow: hidden;
    font-size: 10px;
    margin: 3px 3px;
  }

  &:after{
    visibility: hidden !important;
  }
}

.place-bottom{
  .tooltip-tip{
    width: 40px;
    height: 15px;
    position: absolute;
    top: 3px;
    left: 50%;
    transform: translateX(-50%) translateY(-100%);
    overflow: hidden;
  
    &:after{
      content: "";
      height: 15px;
      width: 15px;
      left: 50%;
      transform: translateX(-50%) translateY(60%) rotate(45deg);
      box-shadow: 0 0 5px 0 rgba(0, 0, 3, 0.13);
      position: absolute;
    }
  }
}

.place-top{
  .tooltip-tip{
    width: 40px;
    height: 15px;
    position: absolute;
    bottom: 0.1px;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
    overflow: hidden;
  
    &:after{
      content: "";
      height: 10px;
      width: 10px;
      left: 50%;
      transform: translateX(-50%) translateY(-60%) rotate(45deg);
      box-shadow: 0 0 5px 0 rgba(0, 0, 3, 0.13);
      position: absolute;
    }
  }
}

/* THEME
   ----------------------------- */
@mixin themable($_THEME, $_BACKGROUND_COLOR_THREAD_ITEM_UNREAD, $_BACKGROUND_COLOR_THREAD_ITEM_READ, $_BACKGROUND_COLOR_THREAD_ITEM_CHECKED, $_BACKGROUND_COLOR_THREAD_ITEM_HOVER, $_BACKGROUND_COLOR_THREAD_ITEM_BUTTON_OPTION, $_COLOR_ICON_THREAD_ITEM_BUTTON_OPTION, $_COLOR_TEXT_THREAD_ITEM_RECIPIENT, $_BACKGROUND_COLOR_THREAD_ITEM_EMAILS_SIZE, $_COLOR_TEXT_THREAD_ITEM_EMAILS_SIZE, $_COLOR_TEXT_THREAD_ITEM_SUBJECT, $_BORDER_COLOR_THREAD_ITEM, $_COLOR_TEXT_THREAD_ITEM_CONTENT, $_BACKGROUND_COLOR_THREAD_ITEM_LABELS, $_COLOR_TEXT_THREAD_ITEM_LABELS){
  [data-theme^=#{$_THEME}],
  [data-theme] [data-theme^=#{$_THEME}] {
    .thread-item-container{
      border-bottom-color: $_BORDER_COLOR_THREAD_ITEM;

      &.thread-item-unread{
        background-color: $_BACKGROUND_COLOR_THREAD_ITEM_UNREAD;
      }

      &.thread-item-read{
        background-color:$_BACKGROUND_COLOR_THREAD_ITEM_READ;
      }

      &.thread-item-checked{
        background-color: $_BACKGROUND_COLOR_THREAD_ITEM_CHECKED; 
      }

      &:hover{
        background-color: $_BACKGROUND_COLOR_THREAD_ITEM_HOVER;
      }

      .thread-item-content{
        .thread-item-recipients{
          span{
            color: $_COLOR_TEXT_THREAD_ITEM_RECIPIENT;
          }
          
          .draft-status{
            color: #dd4040;
          }

          .thread-item-emails-size{
            background-color: $_BACKGROUND_COLOR_THREAD_ITEM_EMAILS_SIZE;

            span{
              color: $_COLOR_TEXT_THREAD_ITEM_EMAILS_SIZE;
            }
          }
        }

        .thread-item-labels{
          .thread-label{
            > div{
              &:nth-child(2){
                background-color: $_BACKGROUND_COLOR_THREAD_ITEM_LABELS;
                color: $_COLOR_TEXT_THREAD_ITEM_LABELS;
              }
            }
          }

          .thread-item-subject{
            color: $_COLOR_TEXT_THREAD_ITEM_SUBJECT;
          }

          .thread-preview{
            color: $_COLOR_TEXT_THREAD_ITEM_CONTENT;
          }
        }
      }

      .thread-label-option{    
        > div{
          background-color: $_BACKGROUND_COLOR_THREAD_ITEM_BUTTON_OPTION;

          i{
            color: $_COLOR_ICON_THREAD_ITEM_BUTTON_OPTION;
          }
        }
      }
    }
  }
}
  
@include themable($_THEME_LIGHT, $_BACKGROUND_COLOR_THREAD_ITEM_UNREAD_LIGHT, $_BACKGROUND_COLOR_THREAD_ITEM_READ_LIGHT, $_BACKGROUND_COLOR_THREAD_ITEM_CHECKED_LIGHT, $_BACKGROUND_COLOR_THREAD_ITEM_HOVER_LIGHT, $_BACKGROUND_COLOR_THREAD_ITEM_BUTTON_OPTION_LIGHT, $_COLOR_ICON_THREAD_ITEM_BUTTON_OPTION_LIGHT, $_COLOR_TEXT_THREAD_ITEM_RECIPIENT_LIGHT, $_BACKGROUND_COLOR_THREAD_ITEM_EMAILS_SIZE_LIGHT, $_COLOR_TEXT_THREAD_ITEM_EMAILS_SIZE_LIGHT, $_COLOR_TEXT_THREAD_ITEM_SUBJECT_LIGHT, $_BORDER_COLOR_THREAD_ITEM_LIGHT, $_COLOR_TEXT_THREAD_ITEM_CONTENT_LIGHT, $_BACKGROUND_COLOR_THREAD_ITEM_LABELS_LIGHT, $_COLOR_TEXT_THREAD_ITEM_LABELS_LIGHT);
@include themable($_THEME_DARK, $_BACKGROUND_COLOR_THREAD_ITEM_UNREAD_DARK, $_BACKGROUND_COLOR_THREAD_ITEM_READ_DARK, $_BACKGROUND_COLOR_THREAD_ITEM_CHECKED_DARK, $_BACKGROUND_COLOR_THREAD_ITEM_HOVER_DARK, $_BACKGROUND_COLOR_THREAD_ITEM_BUTTON_OPTION_DARK, $_COLOR_ICON_THREAD_ITEM_BUTTON_OPTION_DARK, $_COLOR_TEXT_THREAD_ITEM_RECIPIENT_DARK, $_BACKGROUND_COLOR_THREAD_ITEM_EMAILS_SIZE_DARK, $_COLOR_TEXT_THREAD_ITEM_EMAILS_SIZE_DARK, $_COLOR_TEXT_THREAD_ITEM_SUBJECT_DARK, $_BORDER_COLOR_THREAD_ITEM_DARK, $_COLOR_TEXT_THREAD_ITEM_CONTENT_DARK, $_BACKGROUND_COLOR_THREAD_ITEM_LABELS_DARK, $_COLOR_TEXT_THREAD_ITEM_LABELS_DARK);