@keyframes expandMaxHeight {
  0% {
    max-height: 0;
  }

  99% {
    max-height: 100vh;
  }

  100% {
    max-height: none;
  }
}

@keyframes collapseMaxHeight {
  0% {
    max-height: 100vh;
  }

  100% {
    max-height: 0;
  }
}

.settings {
  // border-top for each item except the top one
  border-top: 1px solid $border-color;

  &:first-of-type {
    margin-top: 10px;
    padding-top: 0;
    border: 0;
  }

  + div .settings:first-of-type {
    margin-top: 0;
    border-top: 1px solid $border-color;
  }

  &.animating {
    overflow: hidden;
  }
}

.settings-header {
  position: relative;
  padding: 24px 110px 0 0;

  h4 {
    margin-top: 0;
  }

  .settings-title {
    cursor: pointer;
  }

  button {
    position: absolute;
    top: 20px;
    right: 6px;
    min-width: 80px;
  }
}

.settings-content {
  max-height: 1px;
  overflow-y: hidden;
  padding-right: 110px;
  animation: collapseMaxHeight 300ms ease-out;
  // Keep the section from expanding when we scroll over it
  pointer-events: none;

  .settings.expanded & {
    max-height: none;
    overflow-y: visible;
    animation: expandMaxHeight 300ms ease-in;
    // Reset and allow clicks again when expanded
    pointer-events: auto;
  }

  .settings.no-animate & {
    animation: none;
  }

  @media(max-width: map-get($grid-breakpoints, md)-1) {
    padding-right: 20px;
  }

  &::before {
    content: ' ';
    display: block;
    height: 1px;
    overflow: hidden;
    margin-bottom: 4px;
  }

  &::after {
    content: ' ';
    display: block;
    height: 1px;
    overflow: hidden;
    margin-top: 20px;
  }

  .sub-section {
    margin-bottom: 32px;
    padding: 16px;
    border: 1px solid $border-color;
    background-color: $gray-light;
  }

  .bs-callout,
  .form-check:first-child,
  .form-check .form-text.text-muted,
  .form-check + .form-text.text-muted {
    margin-top: 0;
  }

  .form-check .form-text.text-muted {
    margin-bottom: $grid-size;
  }
}

.settings-list-icon {
  color: $gl-text-color-secondary;
  font-size: $default-icon-size;
  line-height: 42px;
}

.settings-message {
  padding: 5px;
  line-height: 1.3;
  color: $gray-900;
  background-color: $orange-50;
  border: 1px solid $orange-200;
  border-radius: $border-radius-base;
}

.warning-title {
  color: $gray-900;
}

.danger-title {
  color: $red-500;
}

.integration-settings-form {
  .card.card-body,
  .info-well {
    padding: $gl-padding / 2;
    box-shadow: none;
  }

  .svg-container {
    max-width: 150px;
  }
}

.visibility-level-setting {
  .option-title {
    font-weight: $gl-font-weight-normal;
    display: inline-block;
    color: $gl-text-color;
    vertical-align: top;
  }

  .option-description,
  .option-disabled-reason {
    color: $project-option-descr-color;
  }

  .option-disabled-reason {
    display: none;
  }

  .disabled {
    svg {
      opacity: 0.5;
    }

    .option-description {
      display: none;
    }

    .option-disabled-reason {
      display: block;
    }
  }
}

.prometheus-metrics-monitoring {
  .card {
    .card-toggle {
      width: 14px;
    }

    .badge.badge-pill {
      font-size: 12px;
      line-height: 12px;
    }

    .card-header .label-count {
      color: $white;
      background: $common-gray-dark;
    }

    .card-body {
      padding: 0;
    }

    .flash-container {
      margin-bottom: 0;
      cursor: default;

      .flash-notice {
        border-radius: 0;
      }
    }
  }

  .custom-monitored-metrics {
    .card-header {
      display: flex;
      align-items: center;
    }

    .custom-metric {
      display: flex;
      align-items: center;
    }

    .custom-metric-link-bold {
      font-weight: $gl-font-weight-bold;
      text-decoration: none;
    }
  }

  .loading-metrics .metrics-load-spinner {
    color: $gray-700;
  }

  .metrics-list {
    margin-bottom: 0;

    li {
      padding: $gl-padding;

      .badge.badge-pill {
        margin-left: 5px;
        background: $badge-bg;
      }

      /* Ensure we don't add border if there's only single li */
      + li {
        border-top: 1px solid $border-color;
      }
    }
  }
}

.saml-settings.info-well {
  .form-control[readonly] {
    background: $white;
  }
}

.doorkeeper-authorize {
  max-width: px-to-rem(500px);
}

.created-deploy-token-container {
  .deploy-token-field {
    width: 90%;
    display: inline;
  }

  .btn-clipboard {
    background-color: $white;
    border: 1px solid $gray-100;
  }

  .deploy-token-help-block {
    display: block;
    margin-bottom: 0;
  }
}

.push-pull-table {
  margin-top: 1em;
}

.ci-variable-table,
.deploy-freeze-table,
.ci-secure-files-table {
  table {
    thead {
      border-bottom: 1px solid $white-normal;
    }

    tr {
      td,
      th {
        padding-left: 0;
      }

      th {
        background-color: transparent;
        font-weight: $gl-font-weight-bold;
        border: 0;
      }

      // When tables are "stacked", restore td padding
      @media(max-width: map-get($grid-breakpoints, lg)) {
        td {
          padding-left: $gl-spacing-scale-5;
        }
      }
    }
  }

  @media(max-width: map-get($grid-breakpoints, lg)-1) {
    .truncated-container {
      justify-content: flex-end;
    }
  }
}

.gl-md-flex-wrap-nowrap.gl-md-flex-wrap-nowrap {
  @include gl-media-breakpoint-up(md) {
    @include gl-flex-wrap-nowrap;
  }
}
