// TODO: Remove after updating all timeline lists to use the c8y-list group component
.timeline-list {
  margin: 0;
  padding: 0;
  list-style: none;
  .timeline-item-date {
    margin-right: 35px;
    width: 40px;
    color: @component-color-default;
    font-size: 10px;
    line-height: 1;
  }
  > div,
  > li {
    position: relative;
    &::before {
      position: absolute;
      top: 0;
      bottom: 1px;
      left: 53px;
      border: 1px dotted @component-border-color;
      content: '';
      transition: top 0.35s linear;
    }
    &.expanded::before {
      transition: none; 
    }
    &:first-child {
      &::before {
        top: 50%;
      }
    }
    &:last-child {
      &::before {
        bottom: 50%;
      }
    }
    &:after {
      position: absolute;
      top: 50%;
      left: 48px;
      z-index: 10;
      margin: -6px 0 0;
      width: 12px;
      height: 12px;
      border-radius: 50%;
      background-color: @component-color-disabled;
      content: '';
      transition: background 0.5s linear;

      .box-shadow(inset 0 1px 2px fade(black, 30%));
    }
    &.active {
      &:after {
        background-color: @component-color-accent;
      }
      .timeline-item-content {
        border-color: @component-color-accent;
        .list-item-actions {
          &:before {
            display: inline-block;
            margin-top: calc(@margin-base + 2);
            margin-right: @margin-base;
            padding: 0.2em 0.6em 0;
            border-radius: 10px;
            background-color: @component-color-accent;
            color: @palette-high;
            content: attr(data-active);
            font-weight: bold;
            font-size: 12px;
          }
          .dropdown {
            display: none;
          }
        }
        &:before {
          left: -13px;
          margin-top: -13px;
          border-width: 13px 13px 13px 0;
          border-color: transparent @component-color-accent transparent transparent;
        }
        &:after {
          left: -10px;
        }
      }
    }
  }
  .timeline-item-content {
    position: relative;
    flex: 1 1 0%;
    margin-top: 0;
    margin-bottom: @margin-base;
    padding: @margin-base @component-padding;
    min-height: 40px;
    border: 2px solid @component-background-default;
    background: @component-background-default;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
    color: @component-color-default;
    transition: background 0.5s linear, border 0.5s linear;

    overflow-wrap: break-word;
    &:before {
      position: absolute;
      top: 50%;
      left: -12px;
      margin-top: -10px;
      width: 0;
      height: 0;
      border-width: 10px 10px 10px 0;
      border-style: solid;
      border-color: transparent fade(@black, 5%) transparent transparent;
      content: '';
    }
    &:after {
      position: absolute;
      top: 50%;
      left: -11px;
      margin-top: -10px;
      width: 0;
      height: 0;
      border-width: 10px 10px 10px 0;
      border-style: solid;
      border-color: transparent @component-background-default transparent transparent;
      content: '';
      transition: border 0.5s linear;
    }
    .list-item-icon {
      align-self: flex-start;
    }
    .list-item-icon,
    .list-item-icon [class^='dlt-c8y-icon-'],
    .list-item-icon [class*=' dlt-c8y-icon-'] {
      font-size: 20px;
    }
    .list-item-body {
      flex: 1;
      word-break: break-all; //this is added because of IE11
    }

    .collapse,
    .collapsing {
      flex: 1 1 100%;
      order: 11000;
      min-width: 100%;
      width: auto;
    }
  }
  .expanded {
    background: transparent;
    .timeline-item-date {
      font-weight: bold;
    }
    &:after {
      background-color: @component-color-accent;
    }
    .timeline-item-content {
      border-color: @component-background-expanded;
      background-color: @component-background-expanded;
      color: @component-color-expanded;

      &:after {
        border-color: transparent @component-background-expanded transparent transparent;
        background-color: transparent;
      }
    }
  }
  &.list-condensed {
    .timeline-item-content {
      margin: 0 0 @margin-4;
      border-width: 0 0 0 2px;
    }
  }
}

@media (min-width: @screen-sm-min) {
  .timeline-list {
    .timeline-item-date {
      width: 60px;
    }
    > li,
    > div {
      &::before {
        left: 73px;
      }
      &::after {
        left: 68px;
      }
    }
  }
}

.timeline-list-item {
  &.ng-enter {
    opacity: 0;
    transition: background 1s linear 0.5s, opacity 0.5s linear;
    &.ng-enter-active {
      opacity: 1;
    }
    &:after {
      background-color: @component-realtime-added;
    }
    .timeline-item-content {
      border-color: @component-realtime-added;
      background-color: @component-realtime-added;
      &:after {
        border-color: transparent @component-realtime-added transparent transparent;
      }
    }
  }
}
