frontend/app/assets/stylesheets/archivesspace/form.scss
.form-horizontal {
  // Increase spacing between groups
  .form-group {
    margin-bottom: 8px;

    // fix styling of inline-help when next to a checkbox
    .checkbox {
      .help-inline {
        margin-left: 20px;
      }
    }
  }
}

.form-context .form-overlay {
  opacity: 0.2;
}

#archives_form_overlay {
  .unlock-notice {
    position: absolute;
    top: 10%;
    width: 98%;
    z-index: 101;
    text-align: center;
    left: 2%;
  }
  .form-overlay {
    z-index: 100;
    margin-left: 15px;
  }
}

fieldset {
  width: 100%;
}

/* custom controls-accordion for radio driven accordion */
.controls-accordion .accordion-group {
  border: none;
}

.controls-accordion .accordion-group:first-child {
  margin-top: 5px;
}

.form-group {
  margin: 0 !important;
  padding: 4px 0;
  .accordion {
    margin-bottom: 0;
    .accordion-body {
      margin-left: -180px;
      .accordion-inner {
        background-color: #fafafa;
        border-bottom: 1px solid #e5e5e5;
      }
    }
  }
  em {
    color: #525252;
    font-style: normal;
  }

  .note-outline-level {
    min-height: 100px;

    .note-outline-empty-level {
      color: #aaa;
      display: block;
      margin-top: 10px;
    }
  }

  .note-outline-levels {
    .subrecord-form {
      @include box-shadow(none);

      margin: 0;
    }
    .subrecord-form-fields {
      background-color: #f6f6f6 !important;
      margin-bottom: 8px;
    }
    .subrecord-form-heading {
      overflow: hidden;
    }
    .subrecord-form-inline {
      margin-top: 8px;
      margin-bottom: 0;
    }
    .note_outline_level_btns {
      position: absolute;
      top: 5px;
      right: 40px;
    }
    .subrecord-form-heading {
      min-height: 5px;
    }
  }
  .checkbox input {
    margin-left: 0;
  }
}

form .form-group {
  &.conditionally-required {
    > .control-label {
      align-self: flex-start;
      background-image: asset-url('archivesspace/conditionally_required.png');
      background-repeat: no-repeat;
      background-position: right center;
      padding-right: 16px;
    }
  }
  &.conditionally-required.error {
    > .control-label {
      align-self: flex-start;
      background-image: asset-url('archivesspace/required_loud.png');
    }
  }
  &.required {
    > .control-label {
      align-self: flex-start;
      font-weight: bold;
      background-image: asset-url('archivesspace/required_quiet.png');
      background-repeat: no-repeat;
      background-position: right center;
      padding-right: 16px;
    }
  }
  &.required.error {
    > .control-label {
      background-image: asset-url('archivesspace/required_loud.png');
    }
  }

  .control-label {
    &.has-tooltip {
      border-bottom: 1px dotted #eee;
    }
  }
}

.form-group.active {
  border-radius: 4px;
  background-color: #fafcff;
}

.inline-subform {
  margin: 4px 0;
  border-top: 1px solid #e5e5e5;
  background-color: #fafafa;
  border-bottom: 1px solid #e5e5e5;
}

.form-group .inline-subform {
  margin-left: -180px;
}

/* identifier fields */
.identifier-fields input {
  width: auto;
  margin-right: 4px;
}

.form-horizontal .form-actions {
  padding-left: 20px;
}

.form-horizontal .form-actions .btn-cancel {
  float: right;
}

#save_and_finish_editing {
  margin-left: 4px;
  float: right;
}

.record-pane h3 {
  background-color: #f6f6f6;
  @include vertical(#f3f3f3, #ededed);

  border-bottom: 1px solid #ddd;
  padding-left: 10px;
  line-height: 1.4;
  overflow: auto;
}

.modal section h3 .btn.ml-auto {
  margin: 6px 6px 6px 0;
  font-weight: normal;
}

.subrecord-form.error {
  > .subrecord-form-heading {
    color: #b94a48;
  }
}

.record-pane section section h4 {
  background-color: #f6f6f6;

  @include vertical(#f3f3f3, #ededed);

  border-bottom: 1px solid #ddd;
  padding-left: 10px;
  line-height: 36px;
}

#new_subject .terms-container .row {
  margin-bottom: 5px;

  .form-group {
    padding: 0;
  }
}

.inputs-fill-it-up input,
.inputs-fill-it-up select {
  width: 100%;
}

.subrecord-form-section {
  .subrecord-form-heading-label {
    .has-tooltip {
      cursor: pointer;
      border-bottom: 1px dotted var(--secondary);
    }
  }
}

/* AGENT NAME Form styles */
.subrecord-form-dummy,
.subrecord-form {
  clear: both;
  margin: 20px 0;
  background-color: #fafafa;
  @include box-shadow(1px 1px 3px rgba(0, 0, 0, 0.25));

  .subrecord-form-heading {
    background-color: #f6f6f6;

    @include vertical(#f3f3f3, #ededed);

    padding: 0 10px;
    min-height: 1.4em;
    margin: 0;
    border-bottom: 1px solid #ddd;
    @include border-radius(4px 4px 0 0);

    .btn-group.ml-auto {
      margin: 6px 6px 6px 0;
    }

    .subrecord-form-heading-label {
      &.has-tooltip {
        cursor: pointer;
        border-bottom: 1px dotted var(--secondary);
      }
    }
  }

  &.required > .subrecord-form-heading {
    background-image: asset-url('archivesspace/required_quiet.png');
    background-repeat: no-repeat;
    background-position: 5px center;
    padding-left: 22px;
  }
  &.required.error > .subrecord-form-heading {
    background-image: asset-url('archivesspace/required_loud.png');
  }
  &.conditionally-required > .subrecord-form-heading {
    background-image: asset-url('archivesspace/conditionally_required.png');
    background-repeat: no-repeat;
    background-position: 5px center;
    padding-left: 22px;
  }
  &.conditionally-required.error > .subrecord-form-heading {
    background-image: asset-url('archivesspace/required_loud.png');
  }

  .subrecord-form-fields .subrecord-form {
    .subrecord-form-heading {
      line-height: 30px;
    }
  }

  .subrecord-form-container {
    margin: 0 10px;
    padding: 0 0 10px;

    .alert {
      margin: 10px 0 0;
    }

    .subrecord-form-removal-confirmation,
    .subrecord-form-remove {
      .btn-group .btn {
        z-index: 10;
      }
    }

    .subrecord-form-fields {
      background-color: #fff;
      border: 1px solid #ddd;
      @include border-radius(4px);

      margin-top: 10px;
      padding: 10px;

      > .subrecord-form-heading {
        line-height: 36px;
      }
    }
  }

  .subrecord-form {
    margin: 10px 0;
  }

  .instance-container-or-digital-object {
    margin: 0 10px;

    .instance-type-nil,
    .instance-type-digital-object,
    .instance-type-digital-object-link,
    .instance-type-with-container {
      display: none;
    }
  }

  .subrecord-form-inline {
    margin-bottom: 8px;
  }

  .chronology_item_list {
    input {
      width: 80%;
      margin: 10px;
    }
  }
}

.sdl-subrecord-form {
  padding-bottom: 10px;

  .subrecord-form-fields {
    margin-left: 40px;
  }
}

form .subrecord-form .subrecord-form-container .subrecord-form-fields {
  padding: 0;
}

form #terms .subrecord-form-fields {
  padding: 10px;
}

ul.subrecord-form-list {
  margin: 0;
  -webkit-padding-start: 0;
  > li {
    list-style: none;
    position: relative;
  }
  .sortable-placeholder {
    border: 1px dashed #ccc;
    margin: 10px 0;
  }
  .ui-sortable-helper {
    .subrecord-form-fields {
      margin: 0;
    }
  }
  .drag-handle {
    position: absolute;
    left: 0.5rem;
    top: 0.25rem;
    display: flex;
    align-items: start;
    cursor: move;
  }

  .sort-enabled > .subrecord-form-fields > .subrecord-form-heading,
  .sort-enabled > .subrecord-form-inline {
    padding-left: 40px;
  }
}

.alert pre {
  background-color: transparent;
  border: none;
}

.dropdown-menu.subrecord-selector {
  li {
    padding: 10px;
  }
  .alert {
    margin: 0;
  }
  .form-actions {
    margin: 0;
  }
}

.controls textarea {
  width: 90%;
}

.form-messages {
  position: relative;

  .linked-to-field {
    cursor: pointer;
    .icon-chevron-down {
      vertical-align: top;
      @include opacity(25);

      margin-left: 5px;
    }
    &:hover {
      .icon-chevron-down {
        @include opacity(50);
      }
    }
  }
}

.btn-inline-form {
  &.btn {
    padding: 0;
    background-color: transparent;
    margin: 0;
    border: none;
  }

  display: inline-block;
  form {
    margin: 0;
    padding: 0;

    > div {
      display: inline;
    }
  }

  &:last-child {
    .btn {
      @include border-radius(0 4px 4px 0);
    }
  }

  &:first-child {
    .btn {
      @include border-radius(4px 0 0 4px);
    }
  }

  &:last-child:first-child {
    .btn {
      @include border-radius(4px);
    }
  }
}

.CodeMirror {
  // #font {
  //   @include shorthand($baseFontSize,normal,$baseLineHeight);
  // }
  position: relative;
  margin-bottom: 9px;
  font-size: $baseFontSize;
  line-height: $baseLineHeight;
  color: $gray;
  @include border-radius(4px);

  background-color: $inputBackground;
  border: 1px solid $input-border;
  @include box-shadow(inset 0 1px 1px rgba(0, 0, 0, 0.075));

  overflow: visible;

  .CodeMirror-scroll {
    height: 100px;
    overflow: auto;
  }

  .mixed-content-wrapper {
    font-size: 0.9em;
    z-index: 10;
    display: none;
    font-family: $baseFontFamily;
    .arrow {
      left: 25%;
    }
  }

  .mixed-content-help {
    background-color: #f6f6f6;
    text-shadow: 1px 1px 1px white;
    padding: 0 10px;
    font-size: 0.9em;
    border-top: 1px solid #ccc;
    font-family: $baseFontFamily;
  }

  // ANW-1821 Rectify Bootstrap v4's deprecation of internal popover styles
  // with the lack up upgrading CodeMirror (and our legacy Codemirror's
  // reliance on BS popover styles).
  .popover {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1060;
    display: none;
    max-width: 276px;
    padding: 1px;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 14px;
    font-weight: normal;
    line-height: 1.4286;
    text-align: left;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid #ccc;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    -webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
    white-space: normal;
  }
  .popover.top {
    margin-top: -10px;
  }
  .popover.right {
    margin-left: 10px;
  }
  .popover.bottom {
    margin-top: 10px;
  }
  .popover.left {
    margin-left: -10px;
  }
  .popover-title {
    margin: 0;
    padding: 8px 14px;
    font-size: 14px;
    background-color: #f7f7f7;
    border-bottom: 1px solid #ebebeb;
    border-radius: 5px 5px 0 0;
  }
  .popover-content {
    padding: 9px 14px;
  }
  .popover > .arrow,
  .popover > .arrow::after {
    position: absolute;
    display: block;
    width: 0;
    height: 0;
    border-color: transparent;
    border-style: solid;
  }
  .popover > .arrow {
    border-width: 11px;
  }
  .popover > .arrow::after {
    border-width: 10px;
    content: '';
  }
  .popover.top > .arrow {
    left: 50%;
    margin-left: -11px;
    border-bottom-width: 0;
    border-top-color: #999;
    border-top-color: rgba(0, 0, 0, 0.25);
    bottom: -11px;
  }
  .popover.top > .arrow::after {
    content: ' ';
    bottom: 1px;
    margin-left: -10px;
    border-bottom-width: 0;
    border-top-color: #fff;
  }
  .popover.right > .arrow {
    top: 50%;
    left: -11px;
    margin-top: -11px;
    border-left-width: 0;
    border-right-color: #999;
    border-right-color: rgba(0, 0, 0, 0.25);
  }
  .popover.right > .arrow::after {
    content: ' ';
    left: 1px;
    bottom: -10px;
    border-left-width: 0;
    border-right-color: #fff;
  }
  .popover.bottom > .arrow {
    left: 50%;
    margin-left: -11px;
    border-top-width: 0;
    border-bottom-color: #999;
    border-bottom-color: rgba(0, 0, 0, 0.25);
    top: -11px;
  }
  .popover.bottom > .arrow::after {
    content: ' ';
    top: 1px;
    margin-left: -10px;
    border-top-width: 0;
    border-bottom-color: #fff;
  }
  .popover.left > .arrow {
    top: 50%;
    right: -11px;
    margin-top: -11px;
    border-right-width: 0;
    border-left-color: #999;
    border-left-color: rgba(0, 0, 0, 0.25);
  }
  .popover.left > .arrow::after {
    content: ' ';
    right: 1px;
    border-right-width: 0;
    border-left-color: #fff;
    bottom: -10px;
  }
}

.content-list {
  .drag-handle.inline {
    top: 0.5rem !important;
  }

  .add-content-item-btn {
    margin-top: 5px;
  }

  .subrecord-form-fields {
    background-color: #f6f6f6 !important;

    > .CodeMirror {
      border: none;
      border-top: 1px solid $input-border;
      margin: 35px 0 0 0;
      @include border-radius(0);
    }
  }
}

.CodeMirror-completions {
  position: absolute;
  border: 1px solid #ccc;
  border: 1px solid rgba(0, 0, 0, 0.2);
  @include box-shadow(0 5px 10px rgba(0, 0, 0, 0.2));
}

/* Filter fields */
.text-filter-field {
  width: 80%;
}

.content-list .CodeMirror {
  clear: both;
}

.group-member-control-group {
  .member-toolbar {
    float: left;
    background-color: #f3f3f3;
    padding: 4px;
    width: 300px;
    @include border-radius(4px 4px 0 0);

    border: 1px solid $input-border;
    border-bottom: none;

    #new-member {
      padding: 2px 4px;
    }
  }
  #group_member_usernames_ {
    clear: both;
    display: block;
    width: 310px;
    @include border-radius(0 0 4px 4px);
  }
}

.subrecord-add-as-you-go-actions {
  @include transition(
    opacity linear 0.4s 1s,
    height linear 0.4s 1s,
    padding linear 0.4s 1s
  );

  text-align: center;
  width: 100%;
  @include opacity(0);

  height: 30px;
  overflow: hidden;
  border-top: 1px solid transparent;

  a {
    @include transition(background-color linear 0.1s);

    font-size: 30px;
    display: inline-block;
    text-shadow: 0 1px 1px #666;
    opacity: 1;
    color: #525252;
    height: 30px;
    line-height: 30px;
    text-decoration: none;

    &.has-label {
      font-size: 14px;
      color: #525252;
      text-shadow: 0 1px 1px #fff;
    }

    &:hover,
    &:focus {
      @include transition(background-color linear 0.1s);

      background-color: $btnBackgroundHighlight;

      @include vertical($btnBackground, $btnBackgroundHighlight);
    }

    &:active {
      background-image: none;
      outline: 0;
      background-color: #eee;
      @include box-shadow(
        inset 0 1px 2px rgba(0, 0, 0, 0.15),
        0 1px 2px rgba(0, 0, 0, 0.05)
      );
    }
  }
}

.subrecord-form:hover .subrecord-add-as-you-go-actions,
.focus .subrecord-add-as-you-go-actions {
  @include transition(
    opacity linear 0.2s,
    height linear 0.2s,
    padding linear 0.2s
  );
  @include opacity(100);

  border-top: 1px solid #eee;
}

.subrecord-form-fields > .selected-container > .subrecord-form-fields {
  border-left: none;
  border-right: none;
  border-bottom: none;
  @include border-radius(0 0 4px 4px);

  > .subrecord-form-heading {
    @include border-radius(0);
  }
}

// make date help appear inline

.date-field {
  float: left;
}

.help-inline {
  color: #525252;
  white-space: nowrap;
}

label {
  font-weight: normal;
}

.identifier-display {
  .identifier-display-part {
    border: 1px solid #f6f6f6;
    background-color: #fcfcfc;
    padding: 4px;
    margin-right: 4px;
    min-width: 60px;
    float: left;
    height: $baseLineHeight;
    line-height: $baseLineHeight;
  }
}

.label-only .identifier-display-part {
  margin-top: -6px;
}

.audit-display-compact {
  padding: 4px;
  margin-right: 4px;
  min-width: 60px;
  float: left;
}

.audit-display-wide {
  margin: 0 auto;
  padding: 4px;
  display: flex;
  justify-content: center;
  line-height: $baseLineHeight;
  border: 1px solid #f6f6f6;
  background-color: #f1f1f1;
}

.transfer-form,
.merge-form,
.add-event-form {
  padding: 10px;

  .controls {
    /* margin-left: 0; */
    clear: both;
  }
  // .control-label {
  //   /* width: 100%; */

  //   /* text-align: left; */

  //   /* margin-left: 0; */
  // }
  form {
    margin: 0;
  }
  fieldset {
    width: 300px;
    padding: 10px;
    #template {
      display: none;
    }
  }
  .form-actions {
    margin: 0;
  }
}

/* fix typeahead not displaying above modal blockout */
.typeahead.dropdown-menu {
  z-index: 1099;
}

.subrecord-form {
  .subrecord-summary-view {
    display: none;
  }

  .collapse-subrecord-toggle {
    margin: 6px 6px 0 0;
    .collapse {
      display: inline;
      visibility: visible;
    }

    .expand {
      display: none;
    }
  }
  .collapsed {
    .subrecord-form-heading,
    .subrecord-form-container {
      display: none;
    }
    .collapse-subrecord-toggle {
      .collapse {
        display: none;
      }
      .expand {
        display: inline;
      }
    }
    .subrecord-summary-view {
      cursor: pointer;
      display: block;
      background-color: #fafafa;
      padding: 0.5em 40px;

      &:hover {
        background-color: #f3f3f3;
      }

      .subrecord-summary-title {
        font-weight: bold;
      }
    }
  }
}

// Name form styles
.is-authorized-label,
.is-display-name-label,
.is-primary-label,
.is-representative-label {
  display: none;
}
.authorized-name {
  .is-authorized-label {
    display: inline;
  }
  .btn-authorized-name-toggle {
    display: none;
  }
}
.display-name {
  .is-display-name-label {
    display: inline;
  }
  .btn-display-name-toggle {
    display: none;
  }
}
.primary-id {
  .is-primary-label {
    display: inline;
  }
  .btn-primary-id-toggle {
    display: none;
  }
}

.is-representative-toggle {
  border-style: outset;
  border-color: #878787;
}
.is-representative {
  .is-representative-label {
    display: inline;
    border-style: outset;
    border-color: #337ab7;
    cursor: pointer;
  }
  .is-representative-toggle {
    display: none;
  }
}

// four part id controls
.form-group {
  .id_0,
  .id_1,
  .id_2,
  .id_3 {
    display: inline;
  }
}

// checkbox lists
ul.checkbox-list {
  padding-left: 0;

  .checkbox {
    padding-top: 3px;
  }

  .checkbox input {
    margin-left: 0;
    margin-right: 7px;
    position: static;
  }

  .checkbox label {
    padding-left: 10px;
  }
}

.note-content-raw {
  white-space: pre-line;
}

.js-tooltip {
  display: none;
  background-color: #333;
  color: #fff !important;
  padding: 5px;
  position: absolute;
  border-radius: 5px;
  font-size: 12px;
  top: -5px;
  left: -47px;
  width: 175px;
}

.js-tooltip::after {
  content: '';
  display: block;
  position: absolute;
  left: 175px;
  bottom: 8px;
  width: 0;
  height: 0;
  border-bottom: 6px solid transparent;
  border-left: 6px solid #333;
  border-top: 6px solid transparent;
  border-right: 6px solid transparent;
}

div.btn-with-tooltip {
  max-width: fit-content;
  display: inline;
}
