@import (reference) "../../flex";
@import (reference) "../../const";
@import (reference) "~@atlaskit/util-shared-styles/src/borders";
@import (reference) "~@atlaskit/util-shared-styles/src/grid";
@import (reference) "~@atlaskit/util-shared-styles/src/colors";

.ScriptList {
  .flex-column;

  > .scriptRow {
    margin: 2px;

    &:not(:first-child) {
      margin-top: 10px;
    }
  }
}

.scriptTitle() {
  h3 {
    margin-top: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .errorCount {
    margin-left: 5px;
    margin-right: 5px;
  }
}

.scriptDescription {
  color: @ak-color-N300;
  background-color: white;

  padding: @ak-grid-size;

  margin: 5px;

  .ScriptBody & {
    margin: 15px 15px 0;
  }

  border: 1px solid @border-color;
  border-radius: @ak-border-radius;

  white-space: pre-line;
}

.scriptRow {
  .flex-column;

  background-color: white;
  border: 1px solid @border-color;
  border-radius: @ak-border-radius;

  padding: 3px 0 0;

  &.focused {
    animation-name: focus-blink;
    animation-duration: 3s;
  }

  &.withTemplate {
    >.ScriptBody {
      >.editor {
        .scriptChangelogs {
          max-height: 700px;
        }
      }
    }
  }

  >.title {
    margin-left: 8px;
    margin-right: 3px;
    padding-bottom: 3px;

    .scriptTitle();
  }

  >.children {
    .flex-column;

    margin-left: 8px;
    margin-right: 8px;
  }

  > .ScriptBody {
    background-color: #f1f2f6;
    border-top: 1px solid @border-color;

    >.editor {
      .Editor {
        margin: 15px;

        .CodeEditor {
          border-radius: @ak-border-radius;
          border: 1px solid @border-color;
          overflow: hidden;
        }
      }

      .scriptChangelogs {
        margin: 15px;

        .flex-none;

        max-height: 321px;
        overflow-y: auto;
        overflow-x: hidden;
      }
    }

    >.executions {
      .flex-none;

      margin: 0 15px 15px;
    }
  }
}


.scriptChangelog {
  .flex-column;

  cursor: pointer;

  &:last-child {
    margin-bottom: 5px;

    &:after {
      margin-bottom: 0;
      border-bottom: none;
    }
  }

  &:after {
    content: '';
    width: 100%;
    margin-top: 3px;
    margin-bottom: 3px;
    border-bottom: 1px solid @border-color;
  }

  .changelogContent {
    border-radius: @ak-border-radius;
    padding-top: 1px;
    padding-left: 3px;

    &:hover {
      background-color: @ak-color-N30A;
    }

    &.active {
      background-color: @ak-color-N30A;
    }

    .changelogSecondary {
      color: @ak-color-N300;
    }

    .author {
      margin-left: 2px;

      font-weight: 500;
      color: @ak-color-N500;

      text-overflow: ellipsis;
      white-space: nowrap;
      overflow: hidden;
    }

    .date {
      color: @ak-color-N500
    }

    strong {
      color: @ak-color-N600;
    }
  }
}

.scriptParams {
  .flex-column;

  .item {
    .flex-row;

    .label {
      .flex-none;

      margin-top: 3px;
      width: 100px;
      margin-right: 10px;
      text-align: right;
    }
    .value {
      padding: 4px 0 4px 0;
    }
  }
}

@-webkit-keyframes focus-blink {
  0% {
    border-color: @ak-color-B100;
    background-color: @ak-color-B50;
  }

}
