@use "global/acms-common" as acms;
@use "global/common" as global;

/* ------------------------------
　　お問い合わせ
------------------------------ */

/* ステップ
------------------------------ */
.form-step {
  display: flex;
  margin: 0 0 25px;
  padding: 0;

  /* カウンターの設定 */
  counter-reset: mailStep;
}

.form-step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 0 10px;
  color: global.$color-text;
  font-weight: bold;
  list-style: none;

  @include acms.font-size(16);

  &::before {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    margin: 0 0 10px;
    color: global.$color-primary;
    line-height: 1.7;
    background: global.$color-gray10;
    border-radius: 50%;
    content: counter(mailStep);

    /* カウンターの設定 */
    counter-increment: mailStep;
  }

  &.is-current {
    &::before {
      color: global.$color-text-inverse;
      background: global.$color-primary;
    }
  }

  &:not(:last-child) {
    margin: 0 20px 0 0;
  }
}

@media screen and (min-width: acms.$breakpoint-md-min){
  .form-step-item {
    flex-direction: row;
    justify-content: center;
    padding: 18px 0 14px;

    @include acms.font-size(22);

    &::before {
      width: 38px;
      height: 38px;
      margin: 0 10px 0 0;

      @include acms.font-size(24);
    }

    &:not(:last-child) {
      margin: 0 30px 0 0;
    }
  }
}

@media screen and (max-width: acms.$breakpoint-md-max){
  .form-step {
    justify-content: center;
  }
}


/* フォームレイアウト
------------------------------ */
.form-group-list {
  display: flex;
  flex-wrap: wrap;
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;

  &.is-confirm {
    padding: 0 10px;
  }
}

.form-group-inner {
  display: flex;
  flex-wrap: wrap;
  width: 100%;
  margin: 0;
  padding: 0;
}

.form-group {
  display: flex;
  flex-wrap: wrap;
  width: 100%;
  margin: 0 0 30px;
  padding: 0;
}

.form-label {
  display: block;
  box-sizing: border-box;
  width: 100%;
  margin: 0 0 10px;
  font-weight: bold;
  text-align: left;
}

.form-control {
  display: block;
  box-sizing: border-box;
  width: 100%;
  line-height: 1.7;
}

.form-button-group {
  .button {
    margin: 0;
  }
}

@media screen and (min-width: acms.$breakpoint-md-min){
  .form-label {
    vertical-align: top;
  }
}

.form-button-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 30px 0 0;
}



@media screen and (min-width: acms.$breakpoint-sm-min){
  .form-button-group {
    flex-direction: row;
    margin: 40px 0 0;
  }

  .form-button:not(:last-child) {
    margin: 0 20px 0 0;
  }
}

@media screen and (max-width: acms.$breakpoint-sm-max){
  .form-button {
    width: 100%;
    margin: 0 0 15px;

    .button {
      width: 100%;
    }
  }

  .form-button-return {
    order: 1;
  }
}


/* ラベル
------------------------------ */
.label-required {
  margin: 0 0 0 5px;
  padding: 2px 8px;
  color: #FFF;
  vertical-align: middle;
  background: global.$color-error;
  border-radius: 3px;

  @include acms.font-size(12);

  &:first-child {
    margin: 0 5px 0 0;
  }
}

@media screen and (min-width: acms.$breakpoint-md-min){
  .label-required {
    margin: 0 0 0 10px;

    &:first-child {
      margin: 0 10px 0 0;
    }
  }
}

.label-optional {
  margin: 0 0 0 5px;
  padding: 2px 8px;
  color: global.$color-text;
  vertical-align: middle;
  background: global.$color-gray40;
  border-radius: 3px;

  @include acms.font-size(12);

  &:first-child {
    margin: 0 5px 0 0;
  }
}

@media screen and (min-width: acms.$breakpoint-md-min){
  .label-optional {
    margin: 0 0 0 10px;

    &:first-child {
      margin: 0 10px 0 0;
    }
  }
}


/* フォーム要素
------------------------------ */
.form-group {
  select {
    &[required]:required {
      border: global.$border-width-sm solid global.$color-error;
    }

    &.focused:invalid {
      border: global.$border-width-sm solid global.$color-error;
    }

    &[required]:valid {
      border: global.$border-width-sm solid global.$color-gray40;
    }
  }

  input,
  textarea {
    &[required]:required {
      background: global.$color-gray10;
    }

    &.focused:invalid,
    &.invalid{
      background: global.$color-gray10;
      border-color: global.$color-error;
      box-shadow: global.$box-shadow-error, acms.$acms-form-box-shadow;
    }

    &[required]:valid {
      background: global.$color-gray10;
    }
  }

  // 入力欄をスマホのサイズのままにする
  input[type="text"],
  input[type="password"],
  input[type="datetime"],
  input[type="datetime-local"],
  input[type="date"],
  input[type="month"],
  input[type="time"],
  input[type="week"],
  input[type="number"],
  input[type="email"],
  input[type="url"],
  input[type="search"],
  input[type="tel"]{
    @include acms.font-size(16);

    box-sizing: border-box;
    padding: 11px 15px;
    line-height: 1.5;
    border-radius: global.$border-radius-sm;
  }

  textarea {
    @include acms.font-size(16);

    box-sizing: border-box;
    padding: 11px 15px;
    border-radius: global.$border-radius-sm;
  }

  select {
    box-sizing: border-box;
    min-height: 48px;
    padding: 9px  44px 9px 15px;
    vertical-align: top;
    background-color: global.$color-gray10;

    @include acms.font-size(16);

    border-radius: global.$border-radius-sm;
  }
}

@media screen and (min-width: acms.$breakpoint-md-min){
  .form-group {
    input[type="text"],
    input[type="password"],
    input[type="datetime"],
    input[type="datetime-local"],
    input[type="date"],
    input[type="month"],
    input[type="time"],
    input[type="week"],
    input[type="number"],
    input[type="email"],
    input[type="url"],
    input[type="search"],
    input[type="tel"] {
      padding: 11px  15px;
    }

    textarea {
      padding: 11px 15px;
    }

  }
}

.form-checkbox-only {
  display: block;
  margin: 0;
  padding: 16px 15px 12px;
  background: global.$color-gray20;
  border-radius: 3px;

  &:hover {
    background: global.$color-gray30;
  }
}

.form-checkbox-only-label {
  vertical-align: middle;

  a:link,
  a:hover,
  a:visited,
  a:active,
  a:focus {
    text-decoration: none;
    border-bottom: 1px dashed;
  }
}


/* 検索フォーム
------------------------------ */

.form-search {
  .form-search-action {
    display: flex;
    width: 100%;

    .button {
      margin-left: -1px;
      border-top-left-radius: 0;
      border-bottom-left-radius: 0;
    }
  }

  input.form-search-input {
    flex: 1 1 auto;
    box-sizing: border-box;
    height: 48px;
    padding: 10px;
    background: global.$color-gray10;
    border: global.$border-width-sm solid global.$color-gray40;
    border-radius: 4px;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    transition: background-color .25s ease;
    appearance: none;

    @include acms.font-size(16);

    &:hover {
      background: global.$color-white;
      border-color: global.$color-gray50;
    }

    &:focus {
      background: global.$color-white;
      border-color: acms.$acms-form-focus-border-color;
      outline: none;
      box-shadow: acms.$acms-form-focus-box-shadow, acms.$acms-form-box-shadow;
    }
  }

  .form-search-side-button {
    display: flex;
    white-space: nowrap;
  }

  .form-search-button {
    padding: 12px 15px;
  }

  @media screen and (min-width: acms.$breakpoint-md-min){
    input.form-search-input {
      height: 60px;
      padding: 15px 20px;

      @include acms.font-size(22);
    }

    .form-search-button {
      width: 100px;
    }

  }
}


/* ヘルパーテキスト
------------------------------ */
.form-helper-text {
  margin: 10px 0;

  @include acms.font-size(14);

  color: global.$color-text-side;
}


/* バリデーター
------------------------------ */
.form-group {
  .valid-mark {
    display: none;
  }

  .valid-mark.valid {
    display: inline;
    float: right;
    color: #5cb85c;
  }

  .invalid {
    border-color: global.$color-error;
  }
}

.form-error-text {
  margin: 10px 0;
  color: global.$color-error;

  @include acms.font-size(14);

  .form-helper-text + .validator-result-0 & {
    margin-top: 0;
  }
}

.transaction-notice-, .v-result-, .v-result-1, .validator-result-, .validator-result-1 {
  display: none;
}


/* メッセージ
------------------------------ */
.form-message {
  margin: 0 0 40px;
}

.form-message-back {
  text-align: center;
}


@media screen and (min-width: acms.$breakpoint-md-min){
  .form-message {
    margin: 0 0 60px;
  }
}
