/**
 * @file field_ui_add_field.module.css
 */

.add-field-container {
  --thumb-size: 72px;
  --color-focus: #26a769;
  --color-gray: #232429;
  --input-fg-color: var(--color-gray);
  --color-blue: #003ecc;
  --color-red: #dc2323;
  --details-box-shadow: 0 2px 4px rgb(0, 0, 0, 0.1);
}

.field-ui-new-storage-wrapper {
  margin-bottom: 0.75rem;
}

.group-field-options-wrapper {
  margin-block: 1.5em;
}

.add-field-container,
.group-field-options {
  display: grid;
  gap: 0.75rem 1.25rem;
  margin-block: 0.625rem;

  @media (min-width: 45rem) {
    grid-template-columns: repeat(2, 1fr);
  }
}

.add-field-container {
  @media (min-width: 75rem) {
    grid-template-columns: repeat(3, 1fr);
  }
}

.field-option {
  display: grid;
  grid-template-columns: var(--thumb-size) auto;
  align-items: center;
  padding: 0.25rem;
  padding-inline-end: 0.75rem;
  text-decoration: none;
  color: unset;
  border: 1px solid #919297;
  gap: 0.75rem;
  border-radius: 4px;
  &:hover {
    color: unset;
  }
}

.group-field-options {
  display: table;
  min-width: 100%;
}

.field-option__item {
  display: grid;
  grid-template-rows: auto 2fr;
  grid-template-columns: auto 1.1875rem;
  align-items: center;
  width: 100%;
  margin: 0;
  column-gap: 1.25rem;
  padding-block: 0.25rem;

  > *:not(input) {
    grid-column: 1;
  }

  > input {
    grid-row: 1 / -1;
    grid-column: 2;
  }
}

.field-option__thumb {
  height: 100%;
  min-height: var(--thumb-size);
  background-color: #f3f4f9;
}

.subfield-option {
  margin-block: 0.625rem;
  padding: 1rem;
  padding-inline-end: 2rem;
  border: 1px solid #d3d4d9;
  border-radius: 4px;

  .field-option-radio {
    margin-inline-end: 0.4375rem;
  }

  .item-list ul {
    margin-inline: 0;
  }
  .item-list {
    padding-left: 1.4rem;
  }
}

.field-option,
.subfield-option {
  cursor: pointer;
  &.focus {
    outline: 3px solid var(--color-focus);
    outline-offset: 2px;
  }
  &.hover {
    border-color: var(--color-gray);
    box-shadow:
      inset 0 0 0 1px var(--color-gray),
      var(--details-box-shadow);
  }
  &:not(.selected, .error):hover .form-boolean {
    border-color: var(--input-fg-color);
    box-shadow: inset 0 0 0 1px var(--input-fg-color);
  }
  &.selected {
    border-color: var(--color-blue);
    box-shadow:
      inset 0 0 0 2px var(--color-blue),
      var(--details-box-shadow);
  }
  &.error {
    border-color: var(--color-red);
    box-shadow:
      inset 0 0 0 1px var(--color-red),
      var(--details-box-shadow);
  }
  & .form-item__label.has-error {
    color: currentColor;
  }
}
