@import '../../../scss/styles.scss';

.global-edit {
  width: 100%;

  &__form {
    height: 100%;
  }

  &__main {
    width: calc(100% - #{base(15)});
    display: flex;
    flex-direction: column;
    min-height: 100%;
  }

  &__header {
    h1 {
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      margin: 0;
    }
    margin-bottom: base(1);
  }

  &__sub-header {
    margin-top: base(.25);
  }

  &__collection-actions {
    list-style: none;
    margin: 0;
    padding: base(1.5) 0 base(.5);
    display: flex;

    li {
      margin-right: base(.75);
    }
  }

  &__edit {
    background: white;
    padding: base(5) base(6) base(6);
    margin-bottom: base(1.5);
    flex-grow: 1;
    overflow-x: scroll;
  }

  &__sidebar-wrap {
    position: fixed;
    width: base(15);
    height: 100%;
    top: 0;
    right: 0;
    overflow: visible;
  }

  &__sidebar {
    width: 100%;
    height: 100%;
    overflow-y: auto;
  }

  &__sidebar-sticky-wrap {
    display: flex;
    flex-direction: column;
    min-height: 100%;
  }

  &__collection-actions,
  &__document-actions,
  &__meta,
  &__sidebar-fields {
    padding-left: base(1.5);
  }

  &__document-actions {
    @include blur-bg;
    position: sticky;
    top: 0;
    z-index: 2;
    padding-right: $baseline;
  }

  &__document-actions--with-preview {
    display: flex;

    > * {
      width: calc(50% - #{base(.5)});
    }

    > *:first-child {
      margin-right: base(.5);
    }

    > *:last-child {
      margin-left: base(.5);
    }

    .form-submit {
      .btn {
        width: 100%;
        padding-left: base(2);
        padding-right: base(2);
      }
    }
  }

  &__api-url {
    margin-bottom: base(1.5);
    padding-right: base(1.5);

    a {
      display: block;
      overflow: hidden;
      text-overflow: ellipsis;
    }
  }

  &__meta {
    margin: auto 0 $baseline;
    padding-top: $baseline;
    list-style: none;

    li {
      margin-bottom: base(.5);
    }
  }

  &__label {
    color: $color-gray;
  }

  &__collection-actions,
  &__api-url {
    a, button {
      cursor: pointer;
      font-weight: 600;
      text-decoration: none;

      &:hover {
        text-decoration: underline;
      }
    }
  }

  &--is-editing {
    .collection-edit__sidebar {
      padding-top: 0;
    }
  }

  @include large-break {
    &__edit {
      padding: base(3.5);
    }
  }

  @include mid-break {
    &__main {
      width: 100%;
      min-height: initial;
    }

    &__sidebar-wrap {
      position: static;
      width: 100%;
      height: initial;
    }

    &__form {
      display: block;
    }

    &__edit {
      padding: $baseline;
      margin-bottom: $baseline;
    }

    &__document-actions {
      position: fixed;
      bottom: 0;
      left: 0;
      right: 0;
      top: auto;
    }

    &__document-actions,
    &__meta,
    &__sidebar-fields {
      padding-left: $baseline;
    }

    &__api-url {
      margin-bottom: base(.5);
    }

    &__collection-actions {
      margin-top: base(.5);
      padding-left: $baseline;
      padding-bottom: 0;
      order: 1;

      li {
        margin: 0 base(.5) 0 0;
      }
    }

    &__sidebar {
      padding-bottom: base(4);
    }

    &__sidebar-sticky {
      height: auto;
    }
  }
}
