:root {
  --color-black: rgb(33, 37, 42);
  --color-blue: rgb(10, 132, 255);
  --color-blue-dark: rgb(0, 102, 225);
  --color-dark-border: rgb(54, 57, 89);
  --color-green: rgb(18, 188, 0);
  --color-green-dark: rgb(0, 158, 0);
  --color-red: rgb(215, 0, 34);
  --color-red-dark: rgb(185, 0, 4);
  --color-white: rgb(255, 255, 255);
}

html {
  height: 100%;
}

body {
  margin: 0;
  height: 100%;
  font-family: Verdana, sans-serif;
  font-size: 16px;
  background: var(--color-white);
  color: var(--color-black);
  overflow-x: hidden;
}

a {
  color: var(--color-blue);
  text-decoration: none;
  transition: color ease 250ms;

  &:hover {
    color: var(--color-blue-dark);
  }
}

hr {
  margin: 20px 0;
  height: 1px;
  border: 0;
  background-color: var(--color-dark-border);
}

label {
  cursor: pointer;

  &.deprecated {
    color: rgba(19, 69, 99, .4);
  }
}

label + .sub-options:not(.disabled), input:checked + label + .sub-options-wrapper {
  margin-top: 10px;
}

input[type='text'], input[type='url'], input[type='number'], textarea {
  box-sizing: border-box;
  width: calc(100% - 50px);
  border: 2px solid var(--color-dark-border);
  border-radius: 2px;
  outline: 0;
  transition: border ease 250ms;
}

input[type='text'], input[type='url'], input[type='number'] {
  padding: 0 10px;
  height: 30px;
}

input[type='number'] {
  padding-right: 3px;
}

textarea {
  padding: 10px;
  height: 100px;
  font-family: inherit;
  font-size: 13px;
}

input[type='text'].mandatory-style,
input[type='text'].invalid-preference-style,
input[type='text'].invalid-version-pattern-style,
input[type='url'].mandatory-style,
input[type='url'].invalid-url-style,
input[type='number']:invalid,
textarea.invalid-json-style {
  border-color: var(--color-red);
}

input[type='text']:not(.mandatory-style, .invalid-preference-style, .invalid-version-pattern-style),
input[type='text']:not(.invalid-json-style),
input[type='url']:not(.mandatory-style, .invalid-url-style),
input[type='number']:not(:invalid),
select {
  &:focus {
    border-color: var(--color-blue-dark);
  }
}

.input {
  position: relative;

  + .input {
    > input, > textarea {
      margin-top: 2px;
    }

    .mandatory-label,
    .invalid-preference-label,
    .invalid-url-label,
    .invalid-version-pattern-label,
    .invalid-json-label {
      top: 6px;
    }
  }
}

.position-relative {
  position: relative;
}

.options-block-container {
  &:not(:has(.policy-container:not(.hidden))) {
    display: none;
  }
}

.mandatory-label, .invalid-url-label, .invalid-version-pattern-label, .invalid-preference-label, .invalid-json-label {
  position: absolute;
  top: 4px;
  right: 54px;
  padding: 2px 5px;
  height: 18px;
  font-size: 14px;
  background: var(--color-red);
  color: var(--color-white);
}

.select-wrapper {
  display: block;
  position: relative;
  width: calc(100% - 50px);
  height: 30px;
  overflow: hidden;
  border-radius: 2px;

  &:not(.disabled) {
    margin: 5px 0;
  }

  &::after {
    content: '\25BC';
    position: absolute;
    top: 0;
    bottom: 0;
    right: 0;
    padding: 2px 12px;
    border: 2px solid var(--color-dark-border);
    background: var(--color-blue);
    color: var(--color-white);
    pointer-events: none;
    transition: .25s all ease;
  }

  .mandatory-label {
    right: 46px;
  }
}

select {
  margin: 0;
  width: 100%;
  height: 100%;
  border: 2px solid var(--color-dark-border);
  outline: 0;
  background-color: var(--color-white);
  box-shadow: none;
  cursor: pointer;

  &.mandatory-style {
    border-color: var(--color-red);
  }
}

option {
  padding: 5px;
}

.checkbox {
  position: relative;
  margin-bottom: 5px;
  padding-left: 30px;
  padding-top: 3px;
}

.primary-checkbox, .property-checkbox {
  position: absolute;
  left: -9999px;
  opacity: 0;

  &:checked {
    + label::before {
      top: -1px;
      left: -3px;
      width: 8px;
      height: 17px;
      transform: rotate(40deg);
      border: 2px solid transparent;
      border-right-color: var(--color-green);
      border-bottom-color: var(--color-green);
      transform-origin: 100% 100%;
      backface-visibility: hidden;
    }
  }

  + label::before {
    content: '';
    position: absolute;
    z-index: 0;
    top: 0;
    left: 0;
    margin-top: 2px;
    width: 18px;
    height: 18px;
    border: 2px solid var(--color-dark-border);
    border-radius: 2px;
    cursor: pointer;
    transition: all 250ms ease;
  }
}

.property-checkbox + label {
  font-size: 14px;
}

.lock-checkbox {
  position: absolute;
  left: -9999px;
  opacity: 0;

  &:checked {
    + label {
      color: var(--color-green);

      &::before {
        background-image: url('../images/locked.svg');
      }
    }
  }

  + label {
    display: block;
    position: relative;
    margin-top: 2px;
    padding-left: 25px;
    height: 24px;
    font-size: small;
    color: var(--color-blue);
    transition: color ease 250ms;

    &::before {
      content: '';
      position: absolute;
      z-index: 0;
      top: 0;
      left: 0;
      margin-top: -4px;
      width: 24px;
      height: 24px;
      background: url('../images/unlocked.svg') center center / 24px 24px no-repeat transparent;
      cursor: pointer;
    }

    &:hover {
      color: var(--color-blue-dark);
    }
  }
}

.object {
  > .label {
    font-weight: 700;
  }

  .lock-checkbox {
    + label {
      padding-left: 20px;

      &::before {
        left: -5px;
      }
    }
  }

  .array {
    + .checkbox {
      margin-top: 10px;
      margin-bottom: 5px;
    }
  }
}

button {
  position: relative;
  padding: 8px 15px;
  transform: perspective(1px) translateZ(0);
  font-size: 16px;
  border: none;
  border-radius: 2px;
  background: var(--color-blue);
  color: var(--color-white);
  cursor: pointer;
  transition: color ease 500ms;

  &::before {
    content: '';
    position: absolute;
    z-index: -1;
    inset: 0;
    transform: scaleX(0);
    border-radius: 2px;
    background: var(--color-blue-dark);
    transform-origin: 0 50%;
    transition-property: transform;
    transition-duration: 500ms;
    transition-timing-function: ease-out;
  }

  &:hover::before {
    transform: scaleX(1);
    transition-timing-function: cubic-bezier(.52, 1.64, .37, .66);
  }
}

.hidden {
  display: none;
}

.disabled {
  height: 0;
  overflow: hidden;
}

.excluded {
  opacity: .2;
}

.disabled-link {
  cursor: not-allowed;
  opacity: .2;
}

.action-img {
  width: 24px;
  height: 24px;
  vertical-align: middle;
  pointer-events: none;
}

.array-action + .array-action {
  margin-left: -3px;
}

.sub-options {
  position: relative;

  + .sub-options {
    margin-top: 2px;
  }

  > .checkbox {
    padding-top: 2px;
  }
}

.sub-sub-options {
  padding-left: 50px;
}

.extra-options > .label {
  font-weight: 700;

  &.post-extra {
    margin-top: 20px;
    margin-bottom: 10px;
  }

  .policy-container:has([data-type='nested-object']) & {
    font-weight: 400;
  }
}

input[data-type='array'] ~ .sub-options, .object-array > div, .object-list > div {
  position: relative;
}

input[data-type='array'] ~ .sub-options + .sub-options,
input[data-type='json-array'] ~ .sub-options-wrapper .sub-options + .sub-options,
input[data-type='key-object-list'] ~ .sub-options-wrapper .sub-options + .sub-options,
input[data-type='key-value-pairs'] ~ .sub-options + .sub-options,
.object-array > div:not(:nth-child(1), :nth-child(2)),
.object-list > div:not(:nth-child(1), :nth-child(2)) {
  margin-top: 30px;
}

input[data-type='nested-object'] {
  ~ .extra-options .input {
    margin-top: 15px;
    margin-bottom: 15px;
  }

  ~ .sub-options-wrapper .sub-options + .sub-options {
    margin-top: 30px;
  }
}

input[data-type='array'] ~ .sub-options,
input[data-type='json-array'] ~ .sub-options-wrapper,
input[data-type='key-object-list'] ~ .sub-options-wrapper,
input[data-type='key-value-pairs'] ~ .sub-options,
input[data-type='nested-object'] ~ .sub-options-wrapper,
.object-array,
.object-list,
.key-value-pairs {
  .array-action {
    position: absolute;
    top: 3px;

    &[data-action='remove'] {
      right: 26px;
    }

    &[data-action='add'] {
      right: 5px;
    }
  }
}

.object-list .label {
  padding-right: 50px;
}

.object-list, .key-value-pairs {
  .sub-options + .sub-options {
    margin-top: 30px;
  }
}

.label {
  margin-top: 10px;
  margin-bottom: 5px;
  max-width: calc(100% - 50px);
  font-size: 14px;
}

.select-label {
  display: block;
  margin-top: 10px;
  margin-bottom: 5px;
  font-size: 14px;

  + select {
    margin-bottom: 5px;
  }
}

#header {
  position: fixed;
  z-index: 10;
  top: 0;
  left: 0;
  right: 0;
  height: 100px;
  background: var(--color-white);
  border-bottom: 1px solid var(--color-dark-border);
  transition: height 250ms ease-in-out;
}

#logo {
  display: block;
  width: 467px;
  height: 100px;
  background: url('../images/logo-large.png') 25px center / 442px 70px no-repeat transparent;
}

#main {
  display: flex;
  box-sizing: border-box;
  padding: 100px 0 70px;
  width: 100%;
  height: 100%;

  &::after {
    content: '';
    display: table;
    clear: both;
  }
}

#generator-form, #secondary-section {
  flex-grow: 1;
  flex-basis: 0;
  padding: 0 25px;
  height: 100%;
  overflow: auto;
}

#generator-form {
  padding-right: 20px;
}

#secondary-section {
  padding-left: 20px;
}

#footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0 20px;
  height: 64px;
  line-height: 64px;
  font-size: 14px;
  border-top: 1px solid var(--color-dark-border);
  background: var(--color-white);

  a {
    display: block;
    padding-left: 40px;
    background-image: url('../images/sh-at.png');
    background-repeat: no-repeat;
    background-size: 32px 32px;
    background-position: center left;
    color: var(--color-black);
    text-decoration: none;
  }
}

.additional-note, .deprecation-note, .versions-info {
  margin-top: 4px;
  font-size: small;
  color: rgba(19, 69, 99, .8);
}

.info-link {
  margin-top: 2px;
  font-size: small;
}

.additional-note img, .deprecation-note img, .info-link img {
  position: relative;
  top: -1px;
  margin-right: 2px;
  width: 24px;
  height: 24px;
  vertical-align: middle;
}

.versions-info img {
  position: relative;
  top: -1px;
  left: 2px;
  margin-right: 6px;
  width: 20px;
  height: 20px;
  vertical-align: middle;
  opacity: .5;
}

.modal-dialog {
  display: flex;
  align-items: center;
  justify-content: center;
  position: fixed;
  z-index: 200;
  inset: 0;
  transform: scale(.7);
  opacity: 0;
  transition: all 300ms;
  pointer-events: none;

  &.visible {
    transform: scale(1);
    opacity: 1;
    pointer-events: all;

    ~ .modal-dialog-bg {
      opacity: 1;
      visibility: visible;
    }
  }

  ~ .modal-dialog-bg {
    position: fixed;
    z-index: 100;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    visibility: hidden;
    background: rgba(0, 0, 0, .8);
    opacity: 0;
    transition: all 300ms;
  }

  > div {
    width: 550px;
    max-width: 98%;
    max-height: 90vh;
    border-width: 0;
    border-radius: 5px;
    background-color: var(--color-white);
    box-shadow: 0 10px 20px 0 rgba(0, 0, 0, .3);
    overflow: auto;
  }

  header {
    padding: 10px 15px;
    background-color: var(--color-blue);
    color: var(--color-white);
  }

  section {
    padding: 30px 15px;
  }

  input {
    width: 100%;
  }

  aside {
    padding: 15px;
    background-color: rgb(240, 240, 240);
    text-align: right;
  }

  button[disabled] {
    cursor: not-allowed;
    opacity: .5;

    &::before {
      display: none;
    }
  }

  .primary-action {
    background-color: var(--color-green);

    &::before {
      background: var(--color-green-dark);
    }
  }

  .secondary-action {
    margin-right: 5px;
    background-color: var(--color-red);

    &::before {
      background: var(--color-red-dark);
    }
  }
}

#action-links .icon {
  margin-bottom: 5px;
}

.icon {
  display: inline-block;

  &.hidden {
    display: none;
  }

  img {
    margin-right: 5px;
    width: 24px;
    height: 24px;
    vertical-align: middle;
  }

  span {
    font-size: 14px;
    color: var(--color-black);
  }
}

.trash-icon {
  position: relative;
  top: -1px;
}

.file-input-wrapper {
  margin-top: 20px;
}

#import-configuration {
  margin-bottom: 5px;

  img {
    transform: rotate(180deg);
  }
}

#list-configurations {
  margin-bottom: 10px;
}

#no-saved-configurations {
  font-size: 14px;
}

#list-configurations-table {
  width: 100%;
  border-collapse: collapse;

  th, td {
    padding: 10px 0;
    border-bottom: 1px solid rgb(150, 150, 150);
    text-align: left;
  }

  td:first-child {
    padding-right: 10px;
    max-width: 230px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .time {
    width: 220px;
  }

  .actions {
    width: 90px;
    text-align: right;
  }

  .icon img {
    opacity: .5;
    transition: opacity ease 250ms;

    &:hover {
      opacity: 1;
    }
  }
}

#filter-wrapper {
  position: absolute;
  top: 30px;
  right: 20px;
  width: 36px;
  height: 36px;

  &.open #filter {
    padding-right: 40px;
  }

  &:not(.open) #filter {
    cursor: pointer;
  }

  &.in {
    animation-name: expand;

    #filter-style-helper {
      &::before {
        animation-name: beforeAnimation;
      }

      &::after {
        animation-name: afterAnimation;
      }
    }
  }

  &.close {
    animation-name: expand;

    #filter-style-helper {
      &::before {
        animation-name: beforeAnimation;
      }

      &::after {
        animation-name: afterAnimation;
      }
    }
  }

  &.open {
    width: 250px;

    #filter-style-helper {
      z-index: 3;

      &::before {
        top: 9px;
        right: 13px;
        width: 20px;
        opacity: 1;
      }

      &::after {
        bottom: 10px;
        right: 15px;
        width: 20px;
      }
    }
  }

  label {
    position: absolute;
    text-indent: -9999px;
    color: transparent;
  }
}

#filter {
  position: relative;
  z-index: 2;
  box-sizing: border-box;
  padding: 7px 15px;
  width: 100%;
  height: auto;
  font-size: 14px;
  border: 3px solid var(--color-dark-border);
  border-radius: 25px;
  background: none;
  color: var(--color-black);

  &:focus {
    outline: 0;
    border-color: var(--color-blue);
  }
}

#filter-style-helper {
  position: absolute;
  z-index: 1;
  top: 1px;
  right: 0;
  width: 36px;
  height: 36px;
  cursor: pointer;

  &::before, &::after {
    content: '';
    position: absolute;
    width: 13px;
    height: 3px;
    background-color: var(--color-dark-border);
    border-radius: 3px;
    transform-origin: 100% 100%;
  }

  &::before {
    top: -3px;
    right: -3px;
    transform: rotate(-45deg);
    opacity: 0;
  }

  &::after{
    bottom: -3px;
    right: -3px;
    transform: rotate(45deg);
  }
}

#filter-wrapper,
#filter-wrapper #filter-style-helper,
#filter-wrapper #filter-style-helper::before,
#filter-wrapper #filter-style-helper::after {
  animation-duration: 1200ms;
  animation-fill-mode: forwards;
}

#filter-wrapper.close,
#filter-wrapper.close #filter-style-helper,
#filter-wrapper.close #filter-style-helper::before,
#filter-wrapper.close #filter-style-helper::after {
  animation-direction: reverse;
}

@keyframes expand {
  20% {
    width: 36px;
  }

  45% {
    width: 250px;
  }

  100% {
    width: 250px;
  }
}

@keyframes beforeAnimation {
  50% {
    opacity: 0;
  }

  55% {
    top: -4px;
    right: -3px;
    width: 13px;
    opacity: 1;
  }

  65% {
    top: 6px;
    right: 10px;
    width: 30px;
  }

  80% {
    top: 9px;
    right: 13px;
    width: 20px;
  }

  100% {
    top: 9px;
    right: 13px;
    width: 20px;
    opacity: 1;
  }
}

@keyframes afterAnimation {
  10% {
    bottom: -10px;
    right: -10px;
    width: 24px;
  }

  15%{
    opacity: 1;
  }

  35% {
    bottom: -3px;
    right: -3px;
    width: 13px;
    opacity: 0;
  }

  25% {
    opacity: 0;
  }

  64% {
    opacity: 0;
  }

  65% {
    bottom: -2px;
    right: -3px;
    width: 13px;
    opacity: 1;
  }

  75% {
    bottom: 4px;
    right: 10px;
    width: 30px;
  }

  90% {
    bottom: 10px;
    right: 15px;
    width: 20px;
  }

  100% {
    bottom: 10px;
    right: 15px;
    width: 20px;
  }
}

@media screen and (max-width: 1199px) {
  html, body {
    height: auto;
  }

  #main {
    flex-direction: column;
  }

  #generator-form, #secondary-section {
    flex-basis: auto;
  }

  #import-configuration {
    margin-bottom: 15px;
  }
}

@media screen and (max-width: 729px) {
  #filter-wrapper {
    display: none;
  }
}

@media screen and (max-width: 359px) {
  button {
    padding: 8px;
  }

  .modal-dialog .secondary-action {
    margin-right: 0;
  }
}
