// ----- begin NEW CSS RULES for semantic html restructuring and a11y remediation.
// The legacy styles will be integrated here or deleted during a11y remediation.
.dol-form-page {
  margin-top: 4rem;

  h2 {
    font-size: 3.4rem;
  }

  h3 {
    font-size: 2.4rem;
    margin-bottom: 0;
  }

  hr {
    margin-top: 2rem;
    margin-bottom: 2rem;
    border: 0;
    border-top: 1px solid #aeb0b5;

    + .dol-form-question-block {
      &:not(:first-of-type) {
        margin-top: 2rem;
      }
      margin-top: 2rem;
    }
  }

  .em-block {
    background-color: $color-gray-lightest;
    padding: 2rem;

    table thead th {
      background-color: darken($form-em-grey, 10%);
    }
  }

  // Remove bottom margins for address layout
  .usa-input-grid-medium,
  .usa-input-grid-small {
    input,
    select {
      margin-bottom: 0;
    }
  }

  .form-spaced-div {
    margin-top: 40px;
  }

}

// Section title and global Help toggle
.dol-form-section-title {
  @include clearfix();

  h2 {
    margin: 0;
  }
  .dol-help-link {
    vertical-align: middle;
  }
  + .dol-help-text {
    margin-top: 10px;
  }
}

.wioa-input {
  width: 33.33%;
  float: left;
  margin-bottom: 20px;
}

.dol-form-section-help {
  ul {
    padding: 0;
    margin: 0;

    li {
      list-style-type: none;
      display: inline-block;
      margin-top: 1.5rem;

      &:first-of-type {
        &:before {
          content: '';
          display: inline-block;
          width: 20px;
          height: 20px;
          margin-right: 7px;
          vertical-align: middle;
          background: url('../images/dol-help-blue.png') center center;
          background: url('../images/dol-help-blue.svg') center center;
          background-size: contain;
        }
      }

      + li {
        padding-left: 1.5rem;
      }

      a {
        cursor: pointer;
      }
    }
  }
}

dol-form-section-sub-title {
  @include clearfix();
  float:left;
  margin-top: 4rem;
  display: block;
}



@media (min-width: 50em) {
  .dol-form-section-title {
    h2 {
      float: left;
    }
  }

  .dol-form-section-help {
    float: right;
  }
}

// Sub-section fieldset
.dol-form-sub-section {
  &:first-of-type {
    > legend {
      h3 {
        margin-top: 0;
      }
    }
    .dol-legend-h3-help {
      margin-top: 0;
    }
  }
}

// Form questions
.dol-form-question-block {
  &:not(:first-of-type) {
    margin-top: 4rem;
  }

  &.margintop {
    margin-top: 40px;
  }
  .underlabel {
    margin-top: 0px;

    &.checkbox-indent {
      margin-left: 3rem;
      margin-top: -5px;
      margin-bottom: 20px;
    }
  }
  input[type="checkbox"], input[type="radio"] {
    margin: 0;
    left: -4px;
    height: 24px;
    width: 24px;
  }
}
fieldset.dol-form-question-block {
  margin-top: 4rem;
}

.dol-form-question-text {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 20px;
}

label.dol-form-question-text {
  margin-top: 0;
  max-width: 60rem;
}

.dol-form-question-subtext {
  margin: -0.5em 0 20px 0;
}

// Help button
button.dol-help-link {
  display: inline-block;
  width: 20px;
  height: 20px;
  vertical-align: 2px;
  margin: 0 0 0 4px;
  padding: 0;
  cursor: pointer;
  background: url('../images/dol-help-blue.png') center center;
  background: url('../images/dol-help-blue.svg') center center;
  background-size: contain;
  text-indent: -9999px;

  &:hover {
    opacity: 0.8;
    background-color: transparent;
  }
}
.dol-form-question-help {
  margin-bottom: 20px;
  max-width: 60rem;
  label {
    display: inline;
  }
}
.dol-plain-label-help {
  margin-top: 3rem;
  max-width: 60rem;
  label {
    display: inline;
  }
  + .dol-help-text {
    margin-top: 10px;
  }
}
fieldset > div:first-of-type {
  > .dol-plain-label-help {
    margin-top: 0;
  }
}
.dol-legend-help {
  margin-bottom: 20px;
  max-width: 60rem;
}
.dol-legend-h3-help {
  margin-top: 2.1em;
  h3 {
    display: inline;
  }
  + .dol-help-text {
    margin-top: 10px;
  }
}

//Help text
.dol-help-text {
  font-size: 1.7rem;
  font-weight: 400;
  background-color: $help-em-color;
  padding: 1.5rem 2rem;
  margin: 0 0 20px 0;
  display: none;

  p {
    &:first-of-type {
      margin-top: 0;
    }

    &:last-of-type {
      margin-bottom: 0;
    }
  }

  &.show {
    display: block;
  }
}

// Checkbox and Radio lists with help buttons
.dol-list-help {
  input[type="checkbox"] + label, input[type="radio"] + label {
      display: inline-block;
  }
}

// Legend that looks like a plain label (instead of form question)
fieldset.dol-legend-plain {
  margin-top: 3rem;

  legend {
    font-size: 1.7rem;
    font-weight: normal;
    margin-bottom: 10px;
  }
}

// Example text
input.dol-side-example, div.dol-side-example {
  display: inline-block;

  + .dol-example-text {
    display: inline-block;
    color: #666;
    margin-left: 1.5rem;
  }
}
.usa-date-of-birth.dol-side-example {
  vertical-align: middle;

  + .dol-example-text {
    position: relative;
    top: 10px;
    margin-left: 0;
  }
}

// Form input sizing
input.phoneno {
  max-width: 18.2rem;
}

input.ein,
input.certificateno {
  max-width: 15.4rem;
}

input.other {
  max-width: 25rem;
}

input.numeric2 {
  max-width: 5rem;
}

input.numeric3 {
  max-width: 6.6rem;
}

input.numeric5 {
  max-width: 8.4rem;
}

input.numeric7 {
  max-width: 10rem;
}

input.wage-rate {
  max-width: 8.4rem;
}

input.wage-rate-ext {
  max-width: 11.2rem;
}

input.email {
  max-width: 32rem;
}

input.sidelabeled {
  display: inline-block;

  & + label,
  & + span {
    display: inline-block;
    margin-top: 0px;
  }
}

label.example,
span.example {
  color: #666;
  margin-left: 1.5rem;
}

// Limit the width of text in the form per USWDS recommendation
// Within the form, increase the default width b/c the default font size is larger
.dol-form-page ul,
.dol-form-page ol,
.dol-form-question-block label,
.dol-form-question-text,
.dol-form-question-subtext,
.dol-help-text,
.dol-form-page .usa-input-error-message {
  max-width: 60rem;
}

h4#helpfulLinksHeader {
  margin-top: 0;
}

// Custom form tabs (as seen in Wage Data section)
.form-tabbed-section {
  @include clearfix;

  margin-top: 40px;

  .form-tab {
    @include span(6 of 12);

    border-top: 0.6rem solid transparent;
    padding: 1.4rem 2rem 2rem 2rem;
    font-size: 1.6rem;
    font-weight: 700;
    cursor: pointer;
    margin-right: 0px;

    &:not(:first-of-type) {
      border-left: 1px solid #aeb0b5;
    }

    &.active {
      border-top: 0.6rem solid $color-primary;
    }

    &:not(.active) {
      border-bottom: 1px solid #aeb0b5;
      background-color: $color-gray-lightest;

      &:hover {
        background-color: darken($color-gray-lightest, 5%);
      }
    }

    .circle {
      display: inline-block;
      font-size: 1.2rem;
      width: 2rem;
      height: 2rem;
      border-radius: 50%;
      background-color: $color-gray-darker;
      color: $color-white;
      text-align: center;
      vertical-align: middle;
      padding-top: 0.15rem;
      margin-right: 0.7rem;
    }
  }

  a.form-tab {
    color: #000000;
    text-decoration: none;

    &:visited, &:hover {
      color: #000000;
      text-decoration: none;
    }
  }
}



@media (max-width: 37.5em) {
  .form-tabbed-section {
    .form-tab {
      span {
        display: none;
      }
    }
  }
}

.dol-form-question-group {
  &:not(:first-of-type),
  &.force-margin {
    margin-top: 40px;
  }
}

// Work Sites and Employees
.dol-worksite-title {
  padding: 1.5rem 2.5rem;
  background-color: #333;
  color: #ffffff;

  h4 {
    font-size: 2.4rem;
    font-weight: normal;
    margin: 0;
  }

  h3 {
    margin: 0 0 10px 0;

    + h4 {
      font-size: 2.0rem;
    }
  }

}

.dol-worksite-employee-help {
  @extend .clearer;
  padding: 2.5rem;
  background-color: #ebebeb;
  p {
    margin: 0 0 10px 0;
  }
  .dol-left-column {
    margin-bottom: 20px;
  }
}

@media (min-width: 940px) {
  .dol-worksite-employee-help {
    .dol-left-column {
      float: left;
      width: 48%;
      margin: 0;
    }
    .dol-help-callout {
      float: right;
      width: 48%;
    }
  }
}

.dol-add-employee-footer {
  margin-top: 30px;
}

// List of instructions for Employee section
.dol-help-employee-info {
  background: $color-gray-lightest;
  padding: 2.5rem;

  dl {
    max-width: 100%;
    padding: 0;
    margin: 0;

    > div {
      list-style-type: none;
      border-bottom: 1px solid #aeb0b5;
      padding: 1.5rem 0;

      dt {
        font-weight: 700;
      }

      dt, dd {
        margin: 0;
        line-height: 1.5;
      }

      p {
        &:last-of-type {
          margin-bottom: 0;
        }
        &:first-of-type {
          margin-top: 0;
        }
      }

      &:first-of-type {
        padding-top: 0;
      }

      &:last-of-type {
        border: 0;
        padding-bottom: 0;
      }
    }
  }
}

@media (min-width: 37.5em) {

  .dol-help-employee-info {
    dl {
      display: table;

      > div {
        display: table-row;
        border: 0;
        padding: 0;

        dt, dd {
          display: table-cell;
          padding: 2rem;
          border-bottom: 1px solid #aeb0b5;
        }

        dt {
          min-width: 20rem;
          display: table-cell;
        }

        &:first-of-type {
          dt, dd {
            padding-top: 0;
          }
        }

        &:last-of-type {
          dt, dd {
            padding-bottom: 0;
            border: 0;
          }
        }
      }
    }
  }
}

.dol-employees-data-container {
  margin-top: 20px;
}

dl.dol-employee-example-data {
  margin: 0;
  padding: 0;
  list-style: none;

  dt {
    margin: 0 0 8px 0;
    font-weight: normal;
  }
  dd {
    margin: 0 0 28px 0;
    font-weight: bold;
  }
}
#exampleFirstFocus {
  &:focus {
    outline: none;
  }
}

// ----- BEGIN LEGACY CSS RULES -----------------------------------------------------------
// There may be duplicates with the new styles above,
// but some of these legacy styles are still in use.

.form-content,
.form-page-full {
  h2 {
    font-size: 3.4rem;
  }

  h3 {
    font-size: 2.4rem;
  }

  .form-question-text {
    font-size: 2rem;
  }
}

@include nested(12) {
  .form-page {
    @include span(12);
  }

  .form-page,
  .form-page-full {
    margin-top: 4rem;

    // Limit the width of text in the form per USWDS recommendation
    // Within the form, increase the default width b/c the default font size is larger
    .form-question-block label,
    .form-question-text,
    .form-question-subtext {
      max-width: 60rem;
    }

    p {
      &:first-of-type {
        margin-top: 0;
      }
    }

    & > h3:first-of-type {
      margin-top: 0px;
    }

    ul.compact-list {
      margin-top: 0;

      li {
        margin-bottom: 0;
      }
    }

    .form-question-block {
      &:not(:first-of-type) {
        margin-top: 4rem;
      }

      &.margintop {
        margin-top: 40px;
      }

      .form-question-text {
        margin-bottom: 20px;
        font-weight: 700;

        .form-question-subtext {
          font-weight: 400;
          margin-top: 5px;
        }
      }

      .form-question-subtext {
        margin-top: -15px;
        margin-bottom: 20px;
      }
    }


    hr + .form-question-block {
      &:not(:first-of-type) {
        margin-top: 2rem;
      }
      margin-top: 2rem;
    }

    .form-question-group {
      &:not(:first-of-type),
      &.force-margin {
        margin-top: 40px;
      }
    }

    .form-spaced-div {
      margin-top: 40px;
    }

    .compact-spaced {
      margin-top: 0px;
    }

    .city-field {
      max-width: 20rem;
    }

    .state-field {
      max-width: 5rem;
    }

    .zip-field {
      max-width: 10rem;
    }


    h2.form-section-header {
      font-size: 20px;
      font-weight: bold;
    }

    // These wage data table style rules may go away after
    // the wage data table is updated with Data-Tables functionality
    .wage-data-table {
      font-size: 12px;

      td,
      th {
        background-color: darken($form-em-grey, 10%);
        padding: 2 !important;
        border: none;
        max-width: 89px;
      }

      thead tr {
        border-bottom: 1px solid $text-color;
      }

      input {
        font-size: 12px !important;
        height: 2.4rem;

        &.wage-rate {
          padding: 2px;
          max-width: 5rem;
        }
      }

      input[type='radio'] + label {
        margin-top: 2px;
      }
      input[type='radio'] + label::before {
        height: 0.8rem;
        width: 0.8rem;
        line-height: 0.8rem;
      }
    }

    .full-width-label {
      max-width: none;
    }



    .wage-data-table li > input[type='radio'] {
      width: auto;
    }
  }

  table {
    border: 1px solid $text-color;

    th,
    td {
      background-color: transparent;
    }

    thead th,
    thead td {
      background-color: $color-gray-light;
    }

    td.button-column {
      white-space: nowrap;
    }

    tr {
      background-color: #fff;
    }

    tr.greyed {
      background-color: $form-em-grey;
    }

    .expanding-row {
      *:focus {
        outline: none;
        box-shadow: none !important;
      }

      .arrow-expander {
        display: inline-block;
        width: 16px;
        height: 16px;
        background-image: url('../images/arrow-down.png');
        background-size: contain;
        vertical-align: middle;
        margin-right: 5px;
      }

      &.expanded {
        .arrow-expander {
          @include transform(scaleY(-1));
        }
      }
    }

    .subtable {
      display: table;
      width: 100%;
      font-size: 14px;

      & > div {
        display: table-cell;
        padding: 10px 5px;
        font-weight: 700;

        &:not(:last-of-type) {
          border-right: 1px solid $text-color;
        }

        & > div {
          margin-top: 4px;
          font-weight: 400;
        }
      }
    }

    &.expandable-table {
      tr {
        td:first-of-type {
          width: 1px;
        }
      }
    }

    div.usa-input-error {
      margin-left: 8px;
    }
  }

  table .expanding-row th,
  table .expanding-row td {
    border-bottom: none;
  }

  table .expanded-row {
    display: none;

    &.show {
      display: table-row;
    }
  }

  table .expanded-row th,
  table .expanded-row td {
    border: none;
    padding-left: 20px;
    padding-right: 20px;

    & > div {
      border-top: 1px solid $text-color;
      padding: 8px 2px;
    }
  }

  .form-content {
    div.usa-alert-error {
      @include clearfix;

      div.usa-alert-body {
        @include span(8);
      }
    }
  }
}



.submission-success {
  text-align: center;
}



@media (min-width: 37.5em) {
  .form-tabbed-section {
    .form-tab {
      font-size: 2.4rem;

      .circle {
        font-size: 1.7rem;
        width: 3rem;
        height: 3rem;
        padding-top: 0.3rem;
      }
    }
  }
}

@media (min-width: 50em) {
  .dol-help-employee-example {
    .dol-view-small {
      display: none;
    }

    .dol-view-large {
      display: block;
    }
  }
}
