@import "_mixins.scss";
@import "_variables.scss";
$scheme: nth($schemes,1);
/*========================================================
                      Contact Form
=========================================================*/

$input-height: 52px;

$rd-general: (
        offset-top: 0px,
        styles: (
                font-family: $default-font,
                font-size: 16px,
                padding: 14px 18px,
                line-height: 26px,
                color: #878787,
                background: #f5f5f5,
                border: none
        )
);

$rd-input: (
        autofill-color: #2D2D2D,
        styles: (
                border-bottom: 1px solid #bfbfbf
        )
);

$rd-textarea: (
        styles: (
                height: 430px
        )
);

$rd-validation: (
        styles: (
                background: map-get($scheme, default),
        ),
        hover: (
                background: darken(map-get($scheme, default),10%)
        ),
);

$rd-placeholder: (
        styles: (
                color: map-get($scheme, default),
                opacity: 1
        ),
        animation-set: fade-left,
);

$rd-progress: (
        styles: (
                background: #DA7B77,
                color: #fff
        )
);

$rd-controls: (
        offset-top: 40px,
        styles: (
                word-spacing: 10px,
                text-align: left,

        )
);

@mixin set($declarations) {
  @each $property, $value in $declarations { #{$property}: $value }
}

/* MF
========================================================*/
.mailform {
  position: relative;
  text-align: left;
  margin-left: auto;
  margin-right: auto;

  fieldset {
    border: none;
    margin-top: 15px;
  }

  * {
    @include box-sizing(border-box);
  }
}

.mailform label {
  position: relative;
  display: block;
  width: 100%;
  margin-top: map-get($rd-general, offset-top);

  &:first-child {
    margin-top: 0;
  }

  input, select, textarea {
    display: block;
    width: 100%;
    margin: 0;
    -webkit-appearance: none;
    outline: none;
    @if variable_exists(rd-general) {
      @include set(map-get($rd-general, styles))
    }

    @if variable_exists(rd-placeholder) {
      &:-moz-placeholder {
        @include set(map-get($rd-placeholder, styles));
      }

      &::-webkit-input-placeholder {
        @include set(map-get($rd-placeholder, styles));
      }

      &::-moz-placeholder {
        @include set(map-get($rd-placeholder, styles));
      }

      &:-ms-input-placeholder {
        @include set(map-get($rd-placeholder, styles));
      }
    }
  }

  &.grid_12 {
    margin-top: 30px;
  }

  textarea {
    resize: vertical;
    overflow: auto;
    @if variable_exists(rd-textarea) {
      @include set(map-get($rd-textarea, styles));
    }
    @media (max-width: 767px) {
        height: 320px;
    }
  }

  
}

/* MF Input
========================================================*/
@if variable_exists(rd-input) {
  .mfInput {
    @if variable_exists(rd-icon) {
      @each $property, $value in map-get($rd-icon, icons) {
        input[name='#{$property}'] ~ .mfIcon,
        select[name='#{$property}'] ~ .mfIcon,
        textarea[name='#{$property}'] ~ .mfIcon {
          @if $value == none {
            display: none;
          } @else {
            span:before {
              content: $value;
            }
          }
        }
      }
    }
    input:-webkit-autofill ~ .mfIcon span,
    textarea:-webkit-autofill ~ .mfIcon span {
      &:before {
        color: map-get($rd-input, autofill-color);
      }
    }
  }
}

/* MF Controls
========================================================*/
@if variable_exists(rd-controls) {
  .mfControls {
    margin-top: map-get($rd-controls, offset-top);
    @include set(map-get($rd-controls, styles));

    > * {
      word-spacing: normal;
      margin-bottom: 5px;
      min-width: 200px;
      width: auto;
      font-family: inherit;
      font-size: 17px;
      letter-spacing: -0.5px;
      @include transition(0.3s all ease);
      @media (max-width: 767px) {
          width: 100%;
      }
    }
  }
}

/* Mail Form PlaceHolder
========================================================*/
@mixin placeholder-fade-up() {
  *:-webkit-autofill ~ & {
    opacity: 1;
    @include transform(translateY(-30%));
    font-size: 14px;
  }

  &.state-1 {
    opacity: 1;
    @include transform(translateY(-30%));
    font-size: 14px;
  }
}

@mixin placeholder-fade-left() {
  *:-webkit-autofill ~ & {
    opacity: 1;
    @include transform(translateX(-100%));
  }

  &.state-1 {
    opacity: .4;
    @include transform(translateX(-100%));
  }

  @media (max-width: 1365px) {
    .container > .mailform &,
    .grid_12 & {
      @include placeholder-fade-up;
    }
  }

  @media (max-width: 979px) {
    .grid_10 & {
      @include placeholder-fade-up();
    }
  }

  @media (max-width: 767px) {
    @include placeholder-fade-up();
  }
}

@if variable_exists(rd-placeholder) {
  .mfPlaceHolder {
    @include transition(.3s all ease);
    font: inherit;
    cursor: text;
    position: absolute;
    left: 0;
    top: 0;
    padding: map-get(map-get($rd-general, styles), padding);
    line-height: map-get(map-get($rd-general, styles), line-height);
    @include set(map-get($rd-placeholder, styles));

    @if (map-get($rd-placeholder, animation-set) == 'fade-left') {
      @include placeholder-fade-up();
    }
  }
}

/* Mail Form Validation
  ========================================================*/
@if variable_exists(rd-validation) {
  .mfValidation {
    @include transform-origin(0% 50%);
    @include transition(.3s all ease);
    @include animation(notifanim-fo .4s cubic-bezier(.55, 0, .1, 1) forwards);
    @include box-shadow(2px 2px 2px 0 rgba(#000, 0.2));
    @include set(map-get($rd-validation, styles));

    position: absolute;
    width: 210px;
    margin-left: -105px;
    padding: 10px;
    height: 40px;
    line-height: 20px;
    opacity: 0;
    visibility: hidden;
    cursor: pointer;
    bottom: -50px;
    right: 0px;
    font-weight: 300;
    font-size: 12px;
    color: #FFF;
    z-index: 999;

    &:hover {
      @include set(map-get($rd-validation, hover));
    }

    @if map-has-key(map-get($rd-validation, styles), background) {
      &:before {
        content: '';
        position: absolute;
        bottom: 100%;
        right: 10%;
        @include triangle(top, 8px, 5px, map-get(map-get($rd-validation, styles), background));
      }
    }
    @if map-has-key(map-get($rd-validation, hover), background) {
      &:hover {
        &:before {
          @include triangle(top, 8px, 5px, map-get(map-get($rd-validation, hover), background));
        }
      }
    }

    &.error {
      @include transform(scale(1));
      opacity: 1;
      visibility: visible;
      @include animation(notifanim .4s cubic-bezier(.55, 0, .1, 1) forwards);
    }

    @media (max-width: 767px) {
      text-align: right;
      top: auto;
      left: auto;
      top: -20px;
      right: 0;
      background: none;
      padding: 0;
      margin: 0 0 3px;
      min-height: 0;
      color: #DA7B77;
      @include box-shadow(none);
      &:before {
        display: none;
      }

      &:hover{
        background: none;
        right: 5px;
      }
    }
  }
}

@include keyframes(notifanim-fo) {
  0% {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
  }

  20% {
    opacity: 1;
    transform: scale(1.1);
  }

  99% {
    visibility: hidden;
  }

  100% {
    visibility: hidden;
    transform: scale(.3);
    opacity: 0;
  }
}

@include keyframes(notifanim) {
  0% {
    opacity: 0;
    visibility: hidden;
    transform: scale(.3);
  }

  1% {
    visibility: visible;
  }

  50% {
    transform: scale(1);
  }

  75% {
    transform: scale(.9);
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}



/* Mail Form Date Picker
========================================================*/
@if variable_exists(rd-datepicker) {
  .mfDatePicker {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 15px;
    padding: 10px 15px;
    opacity: 0;
    z-index: 1;
    visibility: hidden;
    @include box-shadow(3px 3px 3px 0 rgba(#000, .3));
    @include transition(.5s all ease-in-out);
    @include animation(dropd-anim-fo .4s ease-in-out forwards);
    @include set(map-get($rd-datepicker, styles));

    @if map-has-key(map-get($rd-datepicker, styles), background) {
      border: 1px solid darken(map-get(map-get($rd-datepicker, styles), background), 50%);
      &:before {
        content: '';
        position: absolute;
        bottom: 100%;
        left: 15px;
        @include triangle(top, 12px, 6px, map-get(map-get($rd-datepicker, styles), background));
      }
    }

    table {
      text-align: center;
      border-collapse: separate;
      border-spacing: 3px;
      font-size: 12px;

      th {
        font-weight: 700;
        text-transform: uppercase;
        font-size: 14px;
      }

      td {
        width: 30px;
        height: 30px;
        line-height: 30px;
        text-align: center;
        -webkit-border-radius: 50%;
        -moz-border-radius: 50%;
        border-radius: 50%;
        cursor: pointer;
        @include transition(.3s all ease);

        @if map-has-key($rd-datepicker, item) {
          @include set(map-get(map-get($rd-datepicker, item), styles));
          &:hover {
            @include set(map-get(map-get($rd-datepicker, item), hover));
          }

          &.dp-offset {
            @include set(map-get(map-get($rd-datepicker, item), offset));
          }

          &.dp-today {
            @include set(map-get(map-get($rd-datepicker, item), today));
          }

          &.dp-selected {
            @include set(map-get(map-get($rd-datepicker, item), selected));
          }
        }
      }
    }

    &_next, &_prev {
      font: 400 22px 'material-design';
      line-height: inherit;
      text-align: center;
      color: map-get(map-get(map-get($rd-datepicker, item), today), background);
      cursor: pointer;

      &:hover {
        color: map-get(map-get(map-get($rd-datepicker, item), selected), background);
      }
    }

    &_panel {
      text-align: center;
      padding: 0 2px;
      line-height: 30px;
    }

    &_next {
      float: right;

      &:before {
        content: '\e0c2';
      }
    }

    &_prev {
      float: left;

      &:before {
        content: '\e0c3';
      }
    }

    &_panel + table {
      margin-top: 5px;
    }

    &.open {
      @include animation(dropd-anim .5s ease-in-out forwards);
      opacity: 1;
      visibility: visible;
    }
  }
}

/* Mail Form Icon
========================================================*/
@mixin mfIcon-preset-1($state0, $state1, $stage2) {
  .mfIcon {
    span {
      &:before {
        content: $state0;
      }

      &:after {
        content: $state1;
        @include transform(scale(0) rotate(-180deg));
        @include animation(zoom-out .4s ease-in-out 1 forwards);
      }
    }
  }

  .mfIcon.state-1 {
    &:after {
      content: "";
      position: absolute;
      bottom: -1px;
      width: 0;
      height: 1px;
      background: #fff;
      @include animation(line 1.2s .4s infinite);
    }

    span {
      &:before {
        @include transform(scale(0) rotate(90deg));
      }

      &:after {
        @include transform(scale(1) rotate(-35deg));
        @include animation(#{zoom-in-state-1 .4s ease-in-out 1 forwards, anim-1 1.2s .3s infinite, anim-2 .6s .3s infinite});
      }
    }
  }

  .mfIcon.state-2 {
    span {
      &:before {
        content: $stage2;
        @include transform(scale(0) rotate(90deg));
      }

      &:after {
        @include transform(scale(1) rotate(-210deg));
        @include animation(#{zoom-in-state-2 .4s ease-in-out 1 forwards, anim-3 .6s .4s infinite});
      }
    }
  }

  @include keyframes(anim-1) {
    0% {
      left: 50%;
    }

    100% {
      left: 90%;
    }
  }

  @include keyframes(anim-2) {
    0% {
      transform: rotate(-35deg);
    }

    25% {
      transform: rotate(-30deg);
    }

    50% {
      transform: rotate(-35deg);
    }

    75% {
      transform: rotate(-30deg);
    }

    100% {
      transform: rotate(-35deg);
    }
  }

  @include keyframes(anim-3) {
    0% {
      transform: rotate(150deg);
      left: 50%;
    }

    50% {
      transform: rotate(150deg);
      left: 90%;
    }

    100% {
      transform: rotate(150deg);
      left: 50%;
    }
  }

  @include keyframes(zoom-out) {
    0% {
      transform: scale(1) rotate(-35deg);
    }

    100% {
      transform: scale(0) rotate(-180deg);
    }
  }

  @include keyframes(zoom-in-state-1) {
    0% {
      transform: scale(0) rotate(-180deg);
    }

    100% {
      transform: scale(1) rotate(-35deg);
    }
  }

  @include keyframes(zoom-in-state-2) {
    0% {
      transform: scale(0) rotate(-35deg);
    }

    100% {
      left: 50%;
      transform: scale(1) rotate(150deg);
    }
  }

  @include keyframes(line) {
    0% {
      left: 40%;
    }

    100% {
      left: 40%;
      width: 40%;
    }
  }
}

@if variable_exists(rd-icon) {
  .mfIcon {
    position: absolute;
    text-align: center;
    @include set(map-get($rd-icon, styles));

    span {
      &:before, &:after {
        position: absolute;
        left: 50%;
        top: 50%;
        margin-top: -10px;
        margin-left: -10px;
        @include transition(.4s all ease-in-out);
      }
    }
  }

  @include mfIcon-preset-1('\e0d8', '\e060', '\e060');
}

/* Mail Form Submit
========================================================*/
@if variable_exists(rd-progress) {
  .mfProgress {
    position: relative;
    .cnt, .loader {
      @include transition(.4s all ease-in-out);
    }

    .loader {
      opacity: 0;
      text-align: center;
      letter-spacing: 10px;
      @include transform(scale(1.2));

      &, &:before, &:after {
        position: absolute;
        left: 0;
        bottom: 0;
        top: 0;
        right: 0;
        margin: auto;
      }

      &:before {
        content: '';
        width: 20px;
        height: 20px;
        background-color: #fff;
        border-radius: 50%;
      }

      &:after {
        content: '';
        width: 30px;
        height: 50px;
        color: #fff;
        font: 400 30px $fa;
        line-height: 50px;
        @include transition(.4s all ease-in-out);
        @include transform(scale(0) rotate(-60deg));
      }
    }

    &.sending,
    &.fail,
    &.success {
      .cnt {
        @include transform(scale(1.2));
        opacity: 0;
      }

      .loader {
        opacity: 1;
        @include transform(scale(1));
      }
    }

    &.fail,
    &.success {
      .loader {
        &:before {
          @include animation(fout .4s ease-in-out 1 forwards);
          opacity: 0;
        }

        &:after {
          @include transform(scale(1) rotate(0deg));
        }
      }
    }

    &.sending {
      .loader {
        &:before {
          @include animation(motion 3s cubic-bezier(0.77, 0, 0.175, 1) infinite);
        }
      }
    }

    &.fail {
      .loader {
        &:after {
          content: '\f06a';
        }
      }
    }

    &.success {
      .loader {
        &:after {
          content: '\f058';
        }
      }
    }
  }

  .mfProgress {
    .msg {
      @include transform-origin(0% 50%);
      @include transition(.3s all ease);
      @include animation(notifanim-fo .4s ease-in-out forwards);
      @include box-sizing(border-box);
      @include box-shadow(2px 2px 2px 0 rgba(#000, 0.5));
      position: absolute;
      padding: 15px;
      border-radius: map-get(map-get($rd-general, styles), border-radius);
      font-size: map-get(map-get($rd-general, styles), font-size);
      line-height: 20px;
      opacity: 0;
      visibility: hidden;
      top: 0;
      left: 100%;
      width: 400px;
      margin-left: 20px;
      margin-top: 0;
      // font-size: 14px;
      @include transform-origin(50% 100%);
      @include set(map-get($rd-progress, styles));

      &:before {
        content: '';
        position: absolute;
        margin-top: -6px;
        top: 50%;
        right: 100%;
        @include triangle(left, 6px, 12px, #111);
        @include transition(.4s all ease-in-out);
      }

      @media (max-width: 767px) {
          width: 230px;
          top: 100%;
          left: 50%;
          margin-top: 20px;
          margin-left: -115px;

          &:before {
            right: 50%;
            top: auto;
            bottom: 100%;
            margin-right: -6px;
            @include triangle(top, 12px, 6px, #111);
          }
      }
    }

    &.fail,
    &.success {
      .msg {
        transform: scale(1);
        opacity: 1;
        visibility: visible;
        @include animation(notifanim .4s ease-in-out forwards);
      }
    }

    &.fail {
      .msg {
        background: #F44336;

        &:before {
          @include triangle(left, 6px, 12px, #F44336);
          @media (max-width: 767px) {
              @include triangle(top, 12px, 6px, #F44336);
          }
        }
      }
    }

    &.success {
      .msg {
        background: #2E7D32;

        &:before {
          @include triangle(top, 12px, 6px, #2E7D32);
          @media (max-width: 767px) {
              
          }
        }
      }
    }
  }

  @include keyframes(fout) {
    0% {
      transform: scale(1) translateX(0);
    }

    100% {
      transform: scale(0) translateX(0);
    }
  }

  @include keyframes(motion) {
    0% {
      transform: translateX(0) scale(1);
    }
    25% {
      transform: translateX(-50px) scale(0.3);
    }
    50% {
      transform: translateX(0) scale(1);
    }
    75% {
      transform: translateX(50px) scale(0.3);
    }
    100% {
      transform: translateX(0) scale(1);
    }
  }
}

/* Mail Form Select
========================================================*/
@if variable_exists(rd-select) {
  .mfSelect {
    position: relative;

    .dropdown {
      position: absolute;
      top: 100%;
      left: 0;
      width: 100%;
      padding-top: 5px;
      padding-bottom: 5px;
      margin-top: 15px;
      max-height: 300px;
      opacity: 0;
      visibility: hidden;
      @include box-sizing(border-box);
      border: 1px solid #888;
      @include box-shadow(3px 3px 3px 0 rgba(#000, .3));
      @include transition(.5s all ease-in-out);
      @include animation(dropd-anim-fo .4s ease-in-out forwards);
      font-family: map-get(map-get($rd-general, styles), font-family);
      font-weight: map-get(map-get($rd-general, styles), font-weight);
      line-height: map-get(map-get($rd-general, styles), line-height);
      border: map-get(map-get($rd-general, styles), border);
      border-radius: map-get(map-get($rd-general, styles), border-radius);
      outline: none;
      -webkit-appearance: none;
      @include set(map-get($rd-select, styles));

      .option {
        position: relative;
        z-index: 1;
        text-transform: uppercase;
        cursor: pointer;
        padding: 10px 15px;
        overflow: hidden;
        @include transition(.4s all ease-in-out);
        @include transition-delay(.2s);

        &.selected {
          background: #ececec;
        }

        &:after {
          content: '';
          position: absolute;
          left: 0;
          top: 0;
          width: 0;
          height: 0;
          -webkit-border-radius: 50%;
          -moz-border-radius: 50%;
          border-radius: 50%;
          background: #4C3469;
          opacity: 0;
          z-index: -1;
          @include transition(.4s all ease-in-out);
          transform: translate(-20%, -50%);
        }

        &:before {
          content: '\e18e';
          position: absolute;
          display: inline-block;
          left: 15px;
          color: #FFF;
          font: 400 20px 'material-design';
          line-height: inherit;
          @include transition(.4s all ease-in-out);
          transform: scale(0) rotate(-60deg);
        }

        &:hover {
          color: #FFF;
          padding-left: 40px;
          @include transition-delay(0s);

          &:before {
            @include transition-delay(.15s);
            transform: scale(1) rotate(0deg);
          }

          &:after {
            width: 500px;
            height: 500px;
            opacity: 1;
          }
        }
      }

      &:before {
        content: '';
        position: absolute;
        bottom: 100%;
        left: 15px;
        @include triangle(top, 12px, 6px, #fff);
      }
    }

    .value {
      cursor: pointer;
      @include box-sizing(border-box);
      @include transition(.4s all ease-in-out);
      @include set(map-get($rd-general, styles));

      &:before, &:after {
        position: absolute;
        right: 12px;
        top: ($input-height - 24) /2;
        width: 24px;
        height: 24px;
        font: 400 20px 'material-design';
        line-height: 24px;
        color: #FFF;
        text-align: center;
        @include transition(.4s all ease);
      }

      &:before {
        content: '\e151';
        transform: rotate(-90deg) scale(1);
      }

      &:after {
        content: '\e07b';
        font-size: 24px;
        transform: rotate(-180deg) scale(0);
      }

      &:hover {
        background: #FFF;
        color: #2D2D2D;
        @include box-shadow(3px 3px 3px rgba(#000, .25));

        &:before, &:after {
          color: #2D2D2D;
        }
      }
    }

    &.show {
      .dropdown {
        @include animation(dropd-anim .5s ease-in-out forwards);
        opacity: 1;
        z-index: 1;
        visibility: visible;
      }

      .value {
        background: #FFF;
        color: #2D2D2D;
        @include box-shadow(3px 3px 3px rgba(#000, .25));

        &:before, &:after {
          color: #2D2D2D;
        }

        &:before {
          transform: rotate(0deg) scale(0);
        }

        &:after {
          transform: rotate(0deg) scale(1);
        }
      }
    }
  }
}

@include keyframes(dropd-anim-fo) {
  0% {
    opacity: 1;
    transform: translateY(0);
  }

  20% {
    opacity: 1;
    transform: translateY(-5px);
  }

  100% {
    transform: translateY(30px);
    opacity: 0;
  }
}

@include keyframes(dropd-anim) {
  0% {
    opacity: 0;
    transform: translateY(30px);
  }

  50% {
    transform: translateY(0);
  }

  75% {
    transform: translateY(5px);
  }

  100% {
    transform: translateY(0);
    opacity: 1;
  }
}