/**
 * @file
 * The controls above the layout on a node's Layout tab: save/discard/revert,
 * the content preview toggle, content moderation and revision information.
 *
 * Layout Builder renders in the site theme, so these admin form controls
 * otherwise only get the site's front-end form styles: stacked buttons,
 * checkboxes above their labels, and fields capped at .form-item's 32em.
 */

.layout-builder-form {
  --lb-form-ink: #201850;
  --lb-form-line: #d6d7de;
  --lb-form-muted: #5f6270;
}

/* Each control row spans the page with the same gutter. */
.layout-builder-form > .form-actions,
.layout-builder-form > .field--name-moderation-state,
.layout-builder-form > .js-form-item {
  max-width: none;
  margin: 0;
  padding: 1rem 1.5rem;
}

/* Save, discard and revert in one row; the preview toggle at the far end. */
.layout-builder-form > .form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid var(--lb-form-line);
}

.layout-builder-form > .form-actions .js-show {
  order: 1;
  margin-left: auto;
}

.layout-builder-form > .form-actions .button {
  width: auto;
  margin: 0;
  padding: 0.55rem 1.1rem;
  border: 1px solid var(--lb-form-ink);
  border-radius: 4px;
  background: #fff;
  color: var(--lb-form-ink);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
}

.layout-builder-form > .form-actions .button:hover,
.layout-builder-form > .form-actions .button:focus-visible {
  background: #ecebf3;
}

.layout-builder-form > .form-actions .button--primary {
  background: var(--lb-form-ink);
  color: #fff;
}

.layout-builder-form > .form-actions .button--primary:hover,
.layout-builder-form > .form-actions .button--primary:focus-visible {
  background: #362b7a;
}

/* Checkboxes beside their labels, descriptions on the line below. */
.layout-builder-form .form-item:has(> .form-checkbox) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.5rem;
  margin: 0;
}

.layout-builder-form .form-item:has(> .form-checkbox) > .form-item__label {
  margin: 0;
  padding: 0;
  font-weight: 500;
}

.layout-builder-form .form-item:has(> .form-checkbox) > .form-item__description {
  flex-basis: 100%;
  margin: 0;
}

/* Content moderation: "Current state" and "Change to" side by side. */
.layout-builder-form > .field--name-moderation-state {
  border-bottom: 1px solid var(--lb-form-line);
}

.layout-builder-form > .field--name-moderation-state > .form-wrapper {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 2.5rem;
}

.layout-builder-form > .field--name-moderation-state .form-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: none;
  margin: 0;
}

.layout-builder-form > .field--name-moderation-state .form-item__label {
  margin: 0;
  padding: 0;
  font-weight: 600;
}

.layout-builder-form > .field--name-moderation-state .form-select {
  width: auto;
  min-width: 12rem;
  height: auto;
  padding: 0.45rem 2rem 0.45rem 0.65rem;
  border: 1px solid var(--lb-form-line);
  border-radius: 4px;
  /* The site's select styles remove the native arrow; draw one back. */
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23201850' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 0.65rem center;
  cursor: pointer;
}

/* Revision information: a bounded card instead of a squeezed column. */
.layout-builder-form .vertical-tabs {
  max-width: 48rem;
  border-color: var(--lb-form-line);
  border-radius: 4px;
  background: #fff;
}

.layout-builder-form .vertical-tabs__menu-item {
  border-color: var(--lb-form-line);
}

.layout-builder-form .vertical-tabs__pane {
  padding: 1rem 1.25rem;
}

.layout-builder-form .vertical-tabs__pane .form-item {
  max-width: none;
  margin: 0 0 1rem;
}

.layout-builder-form .vertical-tabs__pane .form-item__description {
  color: var(--lb-form-muted);
}

.layout-builder-form .vertical-tabs__pane .form-textarea {
  box-sizing: border-box;
  width: 100%;
  border: 1px solid var(--lb-form-line);
  border-radius: 4px;
}
