@use 'gjs_main_mixins';
@use 'gjs_vars';
@use 'gjs_category_general';

.#{gjs_vars.$sm-prefix} {
  &clear {
    cursor: pointer;
    width: 14px;
    min-width: 14px;
    height: 14px;
    margin-left: 3px;
  }

  &header {
    font-weight: lighter;
    padding: 10px;
  }

  // Sector
  &sector {
    clear: both;
    font-weight: lighter;
    text-align: left;

    &-title {
      @extend .#{gjs_vars.$app-prefix}category-title;
      display: flex;
      align-items: center;
    }

    &-caret {
      width: 17px;
      height: 17px;
      min-width: 17px;
      transform: rotate(-90deg);
    }

    &-label {
      margin-left: 5px;
    }

    &.#{gjs_vars.$sm-prefix}open {
      @extend .#{gjs_vars.$app-prefix}category-open;

      .#{gjs_vars.$sm-prefix}sector-caret {
        transform: none;
      }
    }
  }

  &properties {
    font-size: var(--gjs-font-size);
    padding: 10px 5px;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    box-sizing: border-box;
    width: 100%;
  }
  // Sector END

  &label {
    margin: 5px 5px 3px 0;
    display: flex;
    align-items: center;
  }
}

.#{gjs_vars.$sm-prefix}close-btn {
  display: block;
  font-size: 23px;
  position: absolute;
  cursor: pointer;
  right: 5px;
  top: 0;

  @include gjs_main_mixins.opacity(0.7);

  &:hover {
    @include gjs_main_mixins.opacity(0.9);
  }
}

/* ------------------Field-------------------- */

.#{gjs_vars.$sm-prefix}field {
  width: 100%;
  position: relative;

  input,
  select {
    background-color: transparent;
    color: gjs_vars.$mainLhlColor;
    border: none;
    width: 100%;
  }

  input {
    box-sizing: border-box;
  }

  select {
    position: relative;
    z-index: 1;

    @include gjs_main_mixins.appearance(none);

    &::-ms-expand {
      display: none;
    }
  }

  select:-moz-focusring {
    color: transparent;
    text-shadow: 0 0 0 var(--gjs-secondary-light-color);
  }

  input:focus,
  select:focus {
    outline: none;
  }

  .#{gjs_vars.$sm-prefix}unit {
    position: absolute;
    right: 10px;
    top: 3px;
    font-size: 10px;
    color: var(--gjs-secondary-light-color);
    cursor: pointer;
  }

  .#{gjs_vars.$clm-prefix}sel-arrow,
  .#{gjs_vars.$sm-prefix}int-arrows,
  .#{gjs_vars.$sm-prefix}sel-arrow {
    height: 100%;
    width: 9px;
    position: absolute;
    right: 0;
    top: 0;
    cursor: ns-resize;
  }

  .#{gjs_vars.$sm-prefix}sel-arrow {
    cursor: pointer;
  }

  .#{gjs_vars.$clm-prefix}d-s-arrow,
  .#{gjs_vars.$sm-prefix}d-arrow,
  .#{gjs_vars.$sm-prefix}d-s-arrow,
  .#{gjs_vars.$sm-prefix}u-arrow {
    position: absolute;
    height: 0;
    width: 0;
    border-left: 3px solid transparent;
    border-right: 4px solid transparent;
    cursor: pointer;
  }

  .#{gjs_vars.$sm-prefix}u-arrow {
    border-bottom: 4px solid var(--gjs-secondary-light-color);
    top: 4px;
  }

  .#{gjs_vars.$clm-prefix}d-s-arrow,
  .#{gjs_vars.$sm-prefix}d-arrow,
  .#{gjs_vars.$sm-prefix}d-s-arrow {
    border-top: 4px solid var(--gjs-secondary-light-color);
    bottom: 4px;
  }

  .#{gjs_vars.$clm-prefix}d-s-arrow,
  .#{gjs_vars.$sm-prefix}d-s-arrow {
    bottom: 7px;
  }

  &.#{gjs_vars.$sm-prefix}color,
  &.#{gjs_vars.$sm-prefix}input,
  &.#{gjs_vars.$sm-prefix}integer,
  &.#{gjs_vars.$sm-prefix}list,
  &.#{gjs_vars.$sm-prefix}select {
    background-color: var(--gjs-main-dark-color);
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 1px 1px 0 var(--gjs-main-light-color);
    color: var(--gjs-secondary-light-color);
    border-radius: 2px;
    box-sizing: border-box;
    padding: 0 5px;
  }

  &.#{gjs_vars.$sm-prefix}composite {
    border-radius: 2px;
  }

  &.#{gjs_vars.$sm-prefix}select {
    padding: 0;
  }

  &.#{gjs_vars.$sm-prefix}select select {
    height: 20px;
  }

  &.#{gjs_vars.$sm-prefix}select option {
    padding: 3px 0;
  }

  &.#{gjs_vars.$sm-prefix}composite {
    background-color: var(--gjs-secondary-dark-color);
    border: 1px solid rgba(0, 0, 0, 0.25);
  }

  &.#{gjs_vars.$sm-prefix}list {
    width: auto;
    padding: 0;
    overflow: hidden;
    float: left;

    input {
      display: none;
    }

    label {
      cursor: pointer;
      padding: 5px;
      display: block;
    }

    .#{gjs_vars.$sm-prefix}radio:checked + label {
      background-color: rgba(255, 255, 255, 0.2);
    }

    .#{gjs_vars.$sm-prefix}icon {
      background-repeat: no-repeat;
      background-position: center;
      text-shadow: none;
      line-height: normal;
      //padding: 5px 19px;
    }
  }

  &.#{gjs_vars.$sm-prefix}integer select {
    width: auto;
    padding: 0;
  }
}

/* ------------------END Field-------------------- */

.#{gjs_vars.$sm-prefix}list .#{gjs_vars.$sm-prefix}el {
  float: left;
  border-left: 1px solid var(--gjs-main-dark-color);

  &:first-child {
    border: none;
  }

  &:hover {
    background: var(--gjs-main-dark-color);
  }
}

/* ------------------Property-------------------- */

.#{gjs_vars.$sm-prefix} {
  &slider {
    .#{gjs_vars.$app-prefix}field-integer {
      flex: 1 1 65px;
    }
  }
}

.#{gjs_vars.$sm-prefix}property {
  box-sizing: border-box;
  float: left;
  width: 50%;
  margin-bottom: 5px;
  padding: 0 5px;

  &--full,
  &.#{gjs_vars.$sm-prefix}composite,
  &.#{gjs_vars.$sm-prefix}file,
  &.#{gjs_vars.$sm-prefix}list,
  &.#{gjs_vars.$sm-prefix}stack,
  &.#{gjs_vars.$sm-prefix}slider,
  &.#{gjs_vars.$sm-prefix}color {
    width: 100%;
  }

  .#{gjs_vars.$sm-prefix}btn {
    background-color: gjs_main_mixins.lighten-color(var(--gjs-main-dark-color), 13%);
    border-radius: 2px;
    box-shadow:
      1px 1px 0 gjs_main_mixins.lighten-color(var(--gjs-main-dark-color), 2%),
      1px 1px 0 gjs_main_mixins.lighten-color(var(--gjs-main-dark-color), 17%) inset;
    padding: 5px;
    position: relative;
    text-align: center;
    height: auto;
    width: 100%;
    cursor: pointer;
    color: var(--gjs-font-color);
    box-sizing: border-box;
    text-shadow: -1px -1px 0 var(--gjs-main-dark-color);
    border: none;

    @include gjs_main_mixins.opacity(0.85);
  }

  .#{gjs_vars.$sm-prefix}btn-c {
    box-sizing: border-box;
    float: left;
    width: 100%;
  }

  &__text-shadow .#{gjs_vars.$sm-prefix}layer-preview-cnt::after {
    color: #000;
    content: 'T';
    font-weight: 900;
    line-height: 17px;
    padding: 0 4px;
  }
}

.#{gjs_vars.$sm-prefix}preview-file {
  background-color: var(--gjs-light-border);
  border-radius: 2px;
  margin-top: 5px;
  position: relative;
  overflow: hidden;
  border: 1px solid gjs_main_mixins.darken-color(var(--gjs-light-border), 1%);
  padding: 3px 20px;

  &-cnt {
    background-size: auto 100%;
    background-repeat: no-repeat;
    background-position: center center;
    height: 50px;
  }

  &-close {
    @extend .#{gjs_vars.$sm-prefix}close-btn;

    top: -5px;
    width: 14px;
    height: 14px;
  }
}

// Layers

.#{gjs_vars.$sm-prefix}layers {
  margin-top: 5px;
  padding: 1px 3px;
  min-height: 30px;
}

.#{gjs_vars.$sm-prefix}layer {
  background-color: rgba(255, 255, 255, 0.055);
  border-radius: 2px;
  margin: 2px 0;
  padding: 7px;
  position: relative;

  &.#{gjs_vars.$sm-prefix}active {
    background-color: rgba(255, 255, 255, 0.12);
  }

  .#{gjs_vars.$sm-prefix}label-wrp {
    display: flex;
    align-items: center;
  }

  ##{gjs_vars.$sm-prefix}move {
    height: 14px;
    width: 14px;
    min-width: 14px;
    cursor: grab;
  }

  ##{gjs_vars.$sm-prefix}label {
    flex-grow: 1;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    margin: 0 5px;
  }

  &-preview {
    @extend .checker-bg;

    height: 15px;
    width: 15px;
    min-width: 15px;
    margin-right: 5px;
    border-radius: 2px;

    &-cnt {
      border-radius: 2px;
      background-color: white;
      height: 100%;
      width: 100%;
      background-size: cover !important;
    }
  }

  ##{gjs_vars.$sm-prefix}close-layer {
    display: block;
    cursor: pointer;
    height: 14px;
    width: 14px;
    min-width: 14px;

    @include gjs_main_mixins.opacity(0.5);

    &:hover {
      @include gjs_main_mixins.opacity(0.8);
    }
  }
}

/* ------------------END Property-------------------- */

.#{gjs_vars.$sm-prefix}stack .#{gjs_vars.$sm-prefix}properties {
  padding: 5px 0 0;
}

// Keep the border-radius UI in corner order while the underlying property
// list stays aligned with CSS shorthand semantics.
.#{gjs_vars.$sm-prefix}property__border-radius {
  .#{gjs_vars.$sm-prefix}property__border-bottom-right-radius {
    order: 4;
  }
}

.#{gjs_vars.$sm-prefix}stack ##{gjs_vars.$sm-prefix}add {
  @extend .#{gjs_vars.$app-prefix}color-main;

  background: none;
  border: none;
  cursor: pointer;
  outline: none;
  position: absolute;
  right: 0;
  top: -17px;
  opacity: 0.75;
  padding: 0;
  width: 18px;
  height: 18px;

  &:hover {
    @include gjs_main_mixins.opacity(1);
  }
}

.#{gjs_vars.$sm-prefix}colorp-c {
  @extend .#{gjs_vars.$app-prefix}bg-main;

  height: 100%;
  width: 20px;
  position: absolute;
  right: 0;
  top: 0;
  box-sizing: border-box;
  border-radius: 2px;
  padding: 2px;

  // adding reference to .gjs-field-colorp-c to match rendered CSS before removing the use of @imports
  .#{gjs_vars.$app-prefix}field-colorp-c,
  .#{gjs_vars.$app-prefix}checker-bg {
    height: 100%;
    width: 100%;
    border-radius: 1px;
  }
}

.#{gjs_vars.$sm-prefix}color-picker {
  background-color: var(--gjs-font-color);
  cursor: pointer;
  height: 16px;
  width: 100%;
  margin-top: -16px;
  box-shadow: 0 0 1px var(--gjs-main-dark-color);
  border-radius: 1px;
}

.#{gjs_vars.$sm-prefix}btn-upload ##{gjs_vars.$sm-prefix}upload {
  left: 0;
  top: 0;
  position: absolute;
  width: 100%;
  opacity: 0;
  cursor: pointer;
}

.#{gjs_vars.$sm-prefix}btn-upload ##{gjs_vars.$sm-prefix}label {
  padding: 2px 0;
}

.#{gjs_vars.$sm-prefix}layer > ##{gjs_vars.$sm-prefix}move {
  @include gjs_main_mixins.opacity(0.7);

  cursor: move;
  font-size: 12px;
  float: left;
  margin: 0 5px 0 0;

  &:hover {
    @include gjs_main_mixins.opacity(0.9);
  }
}
