ux-timeline {
  .timeline {
    margin-top: 50px;
    padding: 0;
    list-style: none;
    position: relative;

    &:before {
      display: none; // prevent AngularJS styles showing
    }

    .timeline-connector {
      top: 0;
      bottom: 0;
      position: absolute;
      content: ' ';
      width: 2px;
      background-color: @timeline-color;
      left: 50%;
      margin-left: -1.5px;
    }

    .timeline-arrow {
      position: absolute;
      color: @timeline-color;
      left: 56px;
      bottom: -6px;
      transform: translateX(-0.5px);
    }

    ux-timeline-event {
      margin-bottom: 20px;
      position: relative;
      display: block;

      .timeline-footer {
        margin-top: 10px;
        padding: 10px 0;
      }

      .timeline-title {
        margin-top: 0;
      }

      .timeline-badge {
        &.critical {
          background-color: @timeline-badge-critical;
        }

        &.success {
          background-color: @timeline-badge-success;
        }

        &.warning {
          background-color: @timeline-badge-warning;
        }

        &.info,
        &.accent {
          background-color: @timeline-badge-accent;
        }

        &.primary {
          background-color: @timeline-badge-primary;
        }

        &.alternate1 {
          background-color: @timeline-badge-alternate1;
        }

        &.alternate2 {
          background-color: @timeline-badge-alternate2;
        }

        &.alternate3 {
          background-color: @timeline-badge-alternate3;
        }

        &.vibrant1 {
          background-color: @timeline-badge-vibrant1;
        }

        &.vibrant2 {
          background-color: @timeline-badge-vibrant2;
        }

        &.grey1 {
          background-color: @timeline-badge-grey1;
        }

        &.grey2 {
          background-color: @timeline-badge-grey2;
        }

        &.grey3 {
          background-color: @timeline-badge-grey3;
        }

        &.grey4 {
          background-color: @timeline-badge-grey4;
        }

        &.grey5 {
          background-color: @timeline-badge-grey5;
        }
      }

      > .timeline-panel {
        background-color: @timeline-panel-bg;
        float: left;
        border: 1px solid @timeline-panel-border;
        border-radius: 2px;
        padding: 12px;
        position: relative;
        box-shadow: @timeline-panel-shadow;
      }

      > .timeline-panel {
        &:before {
          position: absolute;
          top: 40px;
          right: -8px;
          display: inline-block;
          border-top: 8px solid transparent;
          border-left: 8px solid @timeline-panel-border;
          border-right: 0 solid @timeline-panel-border;
          border-bottom: 8px solid transparent;
          content: ' ';
        }
      }

      > .timeline-panel {
        &:after {
          position: absolute;
          top: 41px;
          right: -14px;
          display: inline-block;
          border-top: 7px solid transparent;
          border-left: 7px solid @timeline-panel-bg;
          border-right: 0 solid @timeline-panel-bg;
          border-bottom: 7px solid transparent;
          content: ' ';
        }
      }

      > .timeline-badge {
        color: @timeline-badge-color;
        width: 100px;
        max-width: 100px;
        max-height: 100px;
        line-height: 25px;
        font-size: 0.9em;
        text-align: center;
        position: absolute;
        top: 26px;
        left: 50%;
        margin-left: -25px;
        padding: 0 15px;
        background-color: @timeline-bg;
        z-index: 100;
        border-radius: 1.25em;
      }

      &:before,
      &:after {
        content: ' ';
        display: table;
      }

      &:after {
        clear: both;
      }
    }
  }

  ux-timeline-event {
    .timeline-badge {
      span {
        text-overflow: ellipsis;
        white-space: nowrap;
        display: block;
        overflow: hidden;
      }
    }
  }

  @media only screen and (min-width: 768px) {
    .timeline {
      .timeline-connector {
        left: 64px;
      }

      ux-timeline-event {
        .timeline-badge {
          left: 15px;
          margin-left: 0;
          top: 30px;
        }

        > .timeline-panel {
          width: ~'calc(100% - 135px)';
          float: right;

          &:before {
            border-left-width: 0;
            border-right-width: 8px;
            left: -8px;
            right: auto;
            top: 34px;
          }

          &:after {
            border-left-width: 0;
            border-right-width: 8px;
            right: auto;
            left: -7px;
            top: 35px;
          }
        }
      }
    }
  }

  @media only screen and (max-width: 767px) {
    .timeline {
      .timeline-connector {
        left: 64px;
      }

      ux-timeline-event {
        > .timeline-badge {
          left: 15px;
          margin-left: 0;
          top: 30px;
        }

        > .timeline-panel {
          float: right;

          &:before {
            border-left-width: 0;
            border-right-width: 8px;
            left: -8px;
            right: auto;
            top: 34px;
          }

          &:after {
            border-left-width: 0;
            border-right-width: 8px;
            right: auto;
            left: -7px;
            top: 35px;
          }
        }
      }
    }
  }
}
