//Table checked 20200815
$table-transpose-short: 38px;
$table-transpose-high: 95px;
$table-transpose-higher: 180px;
$table-transpose-extra-high: 300px;

/* Table Styles */

.table-wrapper {
  margin-left: 5px;
  margin-right: 5px;
  margin-bottom: 50px;
  position: relative;
  width: fit-content;
  max-width: 100%;
  @include desktop-minus {
    margin-left: 8px;
  }
  .mh-table {
    box-shadow: 0px 5px 10px rgba(0, 0, 0, 0.1);
    border-bottom: 5px;
  }
  &.narrow-table .mh-table {
    @include desktop-minus {
      display: table;
      width: 100%;
    }
    &:before {
      display: none;
    }
  }
  &:after {
    content: "製表：";
    display: block;
    font-size: 12px;
    background: url('https://blogassets.moneyhero.com.hk/wp-content/uploads/sites/3/2019/12/03182322/MH-h-logo-color.png');
    height: 22px;
    width: 140px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: right center;
    right: -8px;
    position: absolute;
    bottom: -35px;
  }
}

/* Dragging Hint */

html:lang(zh-HK) .table-wrapper:before {
  @include desktop-minus {
    content: "向右拖曳查看更多 >";
    display: block;
    text-align: right;
    font-size: 12px;
    padding: 0 0 10px;
  }
}
.table-wrapper.scrollable:before {
  content: "向右拖曳查看更多 >";
  display: block;
  text-align: right;
  font-size: 12px;
  padding: 0 0 10px;
}
.mh-table {
  font-size: 12px;
  line-height: 150%;
  font-weight: normal;
  border: none;
  border-collapse: collapse;
  width: 100%;
  max-width: 100%;
  white-space: normal;
  background-color: white;
  @include desktop-minus {
    display: block;
    width: 100%;
    overflow-x: scroll;
  }
  tr:nth-child(even) {
    background: #f8f8f8;
  }
  td, th {
    text-align: center;
    padding: point(1);
  }
  td {
    border-right: 1px solid #f8f8f8;
    font-size: 12px;
    &>ul {
      margin: 0 auto;
      text-align: left;
      display: inline-grid;
    }
    &>ol {
      margin: 0 auto;
      text-align: left;
      display: inline-grid;
    }
  }
  thead {
    th {
      color: #ffffff;
      background: mhcolor(blue);
      text-transform: initial;
    }
    td {
      background: #0f4f73;
      color: #ffffff;
      font-size: 14px;
      @include desktop-minus {
        text-align: left;
        padding-left: 18px;
      }
    }
  }
  img {
    vertical-align: top;
  }
  a {
    text-decoration: underline;
    font-weight: bold;
  }
  &.mouse-hover {
    * {
      transition: ease 0.2s;
    }
    tbody tr:hover td {
      background: rgba(119, 170, 67, 0.2);
      color: black;
      @include desktop-plus {
        border-color: transparent;
      }
    }
    @include desktop-minus {
      &.transpose tbody tr:hover td:nth-child(even) {
        background: rgba(229, 239, 220, 0.25);
      }
      &.transpose tbody tr:hover td:nth-child(odd) {
        background: rgba(119, 170, 67, 0.2);
      }
    }
  }
  &.transpose {
    @include desktop-minus {
      display: block;
      width: 100%;
      overflow-x: visible;
      thead {
        float: left;
        th:nth-child(odd) {
          color: #ffffff;
          background: #155072;
        }
        th {
          width: 75px;
          text-align: left;
          border-bottom: 1px solid #f7f7f9;
        }
        th:last-child {
          border-bottom: none;
        }
      }
      thead, tbody, thead th {
        display: block;
      }
      tbody {
        width: auto;
        position: relative;
        overflow-x: auto;
        tr {
          display: table-cell;
          td {
            display: block;
            text-align: center;
            &:nth-child(odd) {
              background: #f8f8f8;
              border-right: 1px solid #e6e4e4;
            }
            &:nth-child(even) {
              border-right: 1px solid #e6e4e4;
            }
          }
        }
        tr:nth-child(odd) {
          background: none;
        }
        tr:nth-child(even) {
          background: transparent;
        }
      }
      td, th {
        padding: 10px 0.625em 0.625em 0.625em;
        height: 58px;
        vertical-align: middle;
        box-sizing: border-box;
        overflow-x: hidden;
        overflow-y: auto;
        width: 150px;
        line-height: 150%;
        font-size: 13px;
        text-overflow: clip;
        white-space: normal;
      }
      .mo-high {
        /* To be depreciated */
        height: 300px;
      }
      .mo-mid {
        /* To be depreciated */
        height: 180px;
      }
      .mo-short {
        /* To be depreciated */
        height: 100px;
      }
      &.td1short td:nth-child(1), &.td1short th:nth-child(1) {
        height: $table-transpose-short;
      }
      &.td2short td:nth-child(2), &.td2short th:nth-child(2) {
        height: $table-transpose-short;
      }
      &.td3short td:nth-child(3), &.td3short th:nth-child(3) {
        height: $table-transpose-short;
      }
      &.td4short td:nth-child(4), &.td4short th:nth-child(4) {
        height: $table-transpose-short;
      }
      &.td5short td:nth-child(5), &.td5short th:nth-child(5) {
        height: $table-transpose-short;
      }
      &.td6short td:nth-child(6), &.td6short th:nth-child(6) {
        height: $table-transpose-short;
      }
      &.td7short td:nth-child(7), &.td7short th:nth-child(7) {
        height: $table-transpose-short;
      }
      &.td8short td:nth-child(8), &.td8short th:nth-child(8) {
        height: $table-transpose-short;
      }
      &.td9short td:nth-child(9), &.td9short th:nth-child(9) {
        height: $table-transpose-short;
      }
      &.td10short td:nth-child(10), &.td10short th:nth-child(10) {
        height: $table-transpose-short;
      }
      &.td1high td:nth-child(1), &.td1high th:nth-child(1) {
        height: $table-transpose-high;
      }
      &.td2high td:nth-child(2), &.td2high th:nth-child(2) {
        height: $table-transpose-high;
      }
      &.td3high td:nth-child(3), &.td3high th:nth-child(3) {
        height: $table-transpose-high;
      }
      &.td4high td:nth-child(4), &.td4high th:nth-child(4) {
        height: $table-transpose-high;
      }
      &.td5high td:nth-child(5), &.td5high th:nth-child(5) {
        height: $table-transpose-high;
      }
      &.td6high td:nth-child(6), &.td6high th:nth-child(6) {
        height: $table-transpose-high;
      }
      &.td7high td:nth-child(7), &.td7high th:nth-child(7) {
        height: $table-transpose-high;
      }
      &.td8high td:nth-child(8), &.td8high th:nth-child(8) {
        height: $table-transpose-high;
      }
      &.td9high td:nth-child(9), &.td9high th:nth-child(9) {
        height: $table-transpose-high;
      }
      &.td10high td:nth-child(10), &.td10high th:nth-child(10) {
        height: $table-transpose-high;
      }
      &.td1higher td:nth-child(1), &.td1higher th:nth-child(1) {
        height: $table-transpose-higher;
      }
      &.td2higher td:nth-child(2), &.td2higher th:nth-child(2) {
        height: $table-transpose-higher;
      }
      &.td3higher td:nth-child(3), &.td3higher th:nth-child(3) {
        height: $table-transpose-higher;
      }
      &.td4higher td:nth-child(4), &.td4higher th:nth-child(4) {
        height: $table-transpose-higher;
      }
      &.td5higher td:nth-child(5), &.td5higher th:nth-child(5) {
        height: $table-transpose-higher;
      }
      &.td6higher td:nth-child(6), &.td6higher th:nth-child(6) {
        height: $table-transpose-higher;
      }
      &.td7higher td:nth-child(7), &.td7higher th:nth-child(7) {
        height: $table-transpose-higher;
      }
      &.td8higher td:nth-child(8), &.td8higher th:nth-child(8) {
        height: $table-transpose-higher;
      }
      &.td9higher td:nth-child(9), &.td9higher th:nth-child(9) {
        height: $table-transpose-higher;
      }
      &.td10higher td:nth-child(10), &.td10higher th:nth-child(10) {
        height: $table-transpose-higher;
      }
      &.td1extra-high td:nth-child(1), &.td1extra-high th:nth-child(1) {
        height: $table-transpose-extra-high;
      }
      &.td2extra-high td:nth-child(2), &.td2extra-high th:nth-child(2) {
        height: $table-transpose-extra-high;
      }
      &.td3extra-high td:nth-child(3), &.td3extra-high th:nth-child(3) {
        height: $table-transpose-extra-high;
      }
      &.td4extra-high td:nth-child(4), &.td4extra-high th:nth-child(4) {
        height: $table-transpose-extra-high;
      }
      &.td5extra-high td:nth-child(5), &.td5extra-high th:nth-child(5) {
        height: $table-transpose-extra-high;
      }
      &.td6extra-high td:nth-child(6), &.td6extra-high th:nth-child(6) {
        height: $table-transpose-extra-high;
      }
      &.td7extra-high td:nth-child(7), &.td7extra-high th:nth-child(7) {
        height: $table-transpose-extra-high;
      }
      &.td8extra-high td:nth-child(8), &.td8extra-high th:nth-child(8) {
        height: $table-transpose-extra-high;
      }
      &.td9extra-high td:nth-child(9), &.td9extra-high th:nth-child(9) {
        height: $table-transpose-extra-high;
      }
      &.td10extra-high td:nth-child(10), &.td10extra-high th:nth-child(10) {
        height: $table-transpose-extra-high;
      }
    }
  }
  &.sticky {
    overflow-y: scroll;
    max-height: 480px;
    display: block;
    &:after {
      content: " 拖曳查看更多";
      font-family: IcoFont,'opensans','SF Pro HK','SF Pro Display','SF Pro Icons','Noto Sans HK','PingFang HK','Segoe UI','SegoeUI','Microsoft JhengHei','微軟正黑體','Helvetica Neue','Helvetica',Arial,sans-serif;
      display: flex;
      width: calc(100% - 5px);
      height: 50px;
      background: linear-gradient( 0deg, rgba(248, 248, 248, 1) 0%, rgba(248, 248, 248, 0.8) 50%, rgba(248, 248, 248, 0) 90%);
      position: absolute;
      bottom: 0;
      color: grey;
      font-size: 13px;
      letter-spacing: 2px;
      vertical-align: text-bottom;
      justify-content: center;
      align-items: flex-end;
    }
    th {
      position: sticky;
      top: 0;
    }
    tfoot td {
      width: 999px;
      background: #f8f8f8;
      height: 50px;
    }
    @include desktop-plus {
      &::-webkit-scrollbar {
        width: 5px;
        height: 5px;
      }
      &::-webkit-scrollbar-track {
        box-shadow: inset 0 0 1px rgba(0, 0, 0, 0.3);
        -webkit-box-shadow: inset 0 0 1px rgba(0, 0, 0, 0.3);
      }
      &::-webkit-scrollbar-thumb {
        border-radius: 10px;
        background: lightgrey;
      }
    }
  }
  &.alt-color-tbody {
    tr {
      background: none;
    }
    tbody:nth-child(odd) {
      background: #f8f8f8;
    }
    tbody:nth-child(even) {
      background: white;
    }
    &.mouse-hover tbody:hover td {
      background: rgba(119, 170, 67, 0.2);
      color: black;
    }
  }
  &.left-col-head td:not([colspan]):first-child {
    font-weight: bold;
    color: black;
    font-size: 14px;
    border-right: 2px dotted #dddddd;
  }
}
button {
  &.expand-table {
    margin: -50px auto 20px auto;
    display: block;
    border: none;
    z-index: 999;
    color: #666;
    background: #f8f8f8;
    padding: 10px 50px;
    border-radius: 0 0 20px 20px;
    transition: 0.5s all ease;
    @include desktop-minus {
      margin: -50px 0 20px 8px;
    }
    &:focus {
      outline-width: 0;
    }
    &:hover {
      background: rgba(119, 170, 67, 0.2);
    }
    &.closed {
      &:after {
        content: "展開";
      }
      span {
        display: none;
      }
    }
  }
}
input {
  &.searchable-input {
    width: 100%;
    font-size: 14px;
    padding: 12px 20px 12px 10px;
    border: none;
    border-bottom: 1px solid #ddd;
    margin-bottom: 12px;
    font-family: "icofont";
    border-radius: 0;
    color: mhcolor(black);
    &:focus {
      outline: none;
      background: #fafafa;
    }
    &:placeholder {
      /* Chrome, Firefox, Opera, Safari 10.1+ */
      color: #993366;
      opacity: 1;
      /* Firefox */
    }
    &:-ms-input-placeholder {
      /* Internet Explorer 10-11 */
      color: #993366;
    }
    &::-ms-input-placeholder {
      /* Microsoft Edge */
      color: #993366;
    }
  }
}