// Each block of fields is a .filter (Location, Lender, Borrower, etc.)

.filter {

  .column( 12 );
  background-color: @light_field10;
  // "border-bottom" only declaration did not extend full width of well
  border: 1px solid @light_field;
  border-top-color: initial;
  border-top-style: initial;
  border-top-width: 0px;
  border-right-color: initial;
  border-right-style: initial;
  border-right-width: 0px;
  border-bottom-color: rgb(208, 208, 206);
  border-bottom-style: solid;
  border-bottom-width: 1px;
  border-left-color: initial;
  border-left-style: initial;
  border-left-width: 0px;


  &:nth-child( even ) {
    background-color: @light_field20;
  }

  &:last-child {
    border-bottom-color: initial;
    border-bottom-style: initial;
    border-bottom-width: 0px;
  }

  .title {
    padding: 20px 0;
    &:hover {
      cursor: pointer;
    }
  }

  .intro {
    padding-top: 10px;
    .column( 11 );
  }
  
  h3 {
    text-transform: uppercase;
    color: @pacific;
    display: inline-block;
    padding-left: 15px;
    font-size: 1em;

    i {
      padding-right: 10px;
      font-size: 1em;
      position: relative;
    }

  }

  .desc {
    margin-left: 15px;
    margin-top: 15px;
  }

  // Show a plus icon when the filter is closed.

  &.closed {
    i.cf-icon-minus-round:before {
      content: "\e109";
    }
  }

  &.footer {
    .need-more {
      width: 90%;
      margin-bottom: 20px;
      float: left;
      display: inline-block;
    }
  }

  // The fields are displayed in an unordered list

  .fields {
    padding: 0;
    animation: fadein .2s;
    -moz-animation: fadein .2s;
    -webkit-animation: fadein .2s;
    -o-animation: fadein .2s;
  }

  // Closed fields should be hidden

  &.closed {
    .fields,
    .control {
      display: none;
    }
  }

  // Fields are the individual filters

  .field {
    
    list-style-type: none;
    margin-bottom: 1em;

    &> label {
      width: 90%;
      margin: 0 15px;
      display: inline-block;
      vertical-align: top;
      .avenir-next-demi;
    }

  }

  .widget {
    width: 80%;
    margin: 0 15px;
    display: inline-block;
    label {
      display: block;
      //margin-bottom: 10px;
      padding-left: 23px;
      text-indent: -25px;
    }
    input[type=checkbox],
    input[type=radio] {
        width: 14px;
        height: 15px;
        padding: 0;
        margin: 0 8px 0 0;
        vertical-align: bottom;
        position: relative;
        top: -1px;
        *overflow: hidden;
    }

  }

  &.location {
    .spinning {
      height: 30px;
      width: 196px;
      top: auto;
      bottom: 0;
    }
  }

  .location-set {
    padding-bottom: 20px;
    border-bottom: 1px solid #ccc;
    &:last-child {
      border: 0;
    }
  }

  li.location-separator {
    .avenir-next-demi;
    font-style: italic;
    display: block;
    text-align: center;
    margin-bottom: 15px;
  }

  .loan_amount_000s,
  .applicant_income_000s {
    input {
      width: 70px;
      margin: 0 5px;
    }
  }

  // Some controls

  .control {
    margin: 0 0 30px 66px;
    display: block;
    .avenir-next-demi;
    animation: fadein .8s;
    -moz-animation: fadein .8s;
    -webkit-animation: fadein .8s;
    -o-animation: fadein .8s;
  }

  .next-steps {
    padding: 30px;
  }

  select {
    width: 100%;
  }

}

.help {
  font-size: 1em;
  height: 30px;
  display: inline-block;
  color: @pacific;
  cursor: pointer;
  vertical-align: top;
  text-align: left;
  i {
    font-size: 1em;
    position: relative;
    top: 5px;
    display: block;
  }
}

.filesize {
  margin-top: 1em;
  p {
    padding: 0;
    margin-top: .7em;
    margin-right: .8em;
  }
}

// Disabled fields

.disabled {
  color: @light_field;
  font-style: italic;
  label,
  input {
    font-style: italic !important;
  }
  button {
    .opacity( .5 );
    &:hover {
      background-color: @pacific;
      cursor: not-allowed;
    }
  }
}

.explanation .data-minicon,
.intro .data-minicon,
.preview .data-minicon {
  float: left;
  position: relative;
  bottom: 5px;
  margin-right: 15px;
}

// Viewport adjustments

@media only screen and ( min-width: 768px ) {

  .filter {

    .intro {
      
      padding: 15px 15px 30px 15px;
      p {
        margin: 0;
      }
      .start-over {
        font-size: .875em;
        margin-left: 10px;
      }
    }

    h3 {
      padding-left: 30px;
    }

    .desc {
      display: inline-block;
      font-size: 1em;
      margin-left: 20px;
      margin-top: 0;
    }

    .next-steps {
      a.action-arrow {
        margin-top: 34px;
      }
    }

    .widget {
      width: 35%;
    }

    .field {
      &> label {
        width: 25%;
        text-align: right;
      }
    }

    .field.applicant_sex,
    .field.co_applicant_sex {
      .widget {
        width: 47%;
      }
    }

    // The location section has totally different formatting

    &.location {

      li.field {
        margin-bottom: .25em;
        position: relative;
        &> label {
          padding-bottom: .25em;
        }
      }

      li.location-separator {
        display: inline-block;
        margin: 0 35px 0 -5px;
      }

      li.field.state_code,
      li.field.county_code,
      li.field.census_tract_number {
        width: 30%;
        display: inline-block;
        &> label {
          width: 83%;
          margin: 0;
          text-align: left;
        }
        .widget {
          width: 83%;
          margin: 0;
          margin-right: 5%;
        }
      }

      li.field.county_code,
      li.field.census_tract_number {
        display: block;
      }

      li.field.msamd {
        width: 50%;
        display: inline-block;
        &> label {
          width: 100%;
          margin: 0;
          text-align: left;
        }
        .widget {
          width: 90%;
          margin: 0 15px 0 0;
        }
      }

    }

    .help {
      position: static;
    }

  }

  .filter.year {
    .fields {
      margin: 30px 0;
    }
    label {
      width: 20%;
      text-align: left;
      margin-left: 30px;
    }
  }

  .widget {
    width: 55%;
   &.checkbox-inline {
      label {
        width: 40%;
        display: inline-block;
        margin-right: 19px;
        &:last-child {
          margin-right: 0
        }
      }
    }
    &.inline {
      label {
        display: inline-block;
        margin-right: 19px;
        &:last-child {
          margin-right: 0
        }

      }
      input[type=checkbox] {
        //width: 20px;
      }
    }
  }

  #location-sets {
    margin-left: 66px;
    margin-right: 66px;
  }

  .filter.footer {
    .need-more {
      width: 63%;
    }
    .insight {
      float: right;
    }
  }

}
