.page-diamond-rates-section {
  & {
    --theme-color: var(--theme_color, #e60012);

    overflow: unset;
    margin-top: 0 !important;
  }

  /* Keep common-style-area on the section while preserving the migrated JP table layout. */

  & .tablelist {
    display: none;
    width: 100%;
    margin: 0 auto 4rem;

    &.active {
      display: table-row-group;
    }
  }

  & .tab-selectbox {
    display: none;
    width: 100%;

    &.active {
      display: block;
    }
  }

  & .selectbox-5 {
    display: none;
  }

  & .diamond-price-list-area {
    margin-top: 5cqw;
    padding-top: 5cqw;
    background-color: #faf1dd;
    --diamond-rate-cream: #faf1dd;
    --diamond-rate-gray: #555;
    --diamond-rate-red: var(--theme-color, #e60012);
    --diamond-rate-head-padding: clamp(7px, 0.95cqw, 7px);
    --diamond-rate-head-font-size: clamp(14px, 1.9cqw, 14px);
    --diamond-rate-head-line-height: clamp(16.8px, 2.28cqw, 16.8px);
    --diamond-rate-select-font-size: clamp(12px, 1.63cqw, 12px);
    --diamond-rate-select-padding-y: clamp(4.8px, 0.65cqw, 4.8px);
    --diamond-rate-select-padding-start: clamp(4.8px, 0.65cqw, 4.8px);
    --diamond-rate-select-padding-end: clamp(14.6px, 1.98cqw, 14.6px);
    --diamond-rate-table-container-padding-top: clamp(10px, 1.36cqw, 10px);
    --diamond-rate-table-offset-top: clamp(8px, 1.09cqw, 8px);
    --diamond-rate-head-border-width: 3px;
    --diamond-rate-head-height: calc(var(--diamond-rate-head-line-height) + var(--diamond-rate-head-padding) + var(--diamond-rate-head-padding) + var(--diamond-rate-head-border-width));
    --diamond-rate-body-row-height: 56px;
    --diamond-rate-body-height: 560px;
    --diamond-rate-table-margin-top: clamp(1.6px, 0.22cqw, 1.6px);
    --diamond-rate-vertical-font-size: clamp(14px, 1.9cqw, 14px);
    --diamond-rate-vertical-padding-y: clamp(10px, 1.36cqw, 10px);
    font-size: 16px;

    & .jewelry-souba-box {
      margin: 0;
    }

    & *,
    & *::before,
    & *::after {
      box-sizing: border-box;
      --f-cq-calc: initial;
    }

    & .carat-select-container {
      position: relative;
      width: 100%;
      margin: 28px auto 30px;
    }

    & .scroll-box {
      position: absolute;
      top: 10%;
      left: 50%;
      z-index: 1000;
      display: none;
      width: 70%;
      max-height: 300px;
      margin-top: 5px;
      padding: 2% 0;
      overflow-x: hidden;
      overflow-y: scroll;
      -ms-overflow-style: auto;
      scrollbar-color: #9a9a9a #fff;
      scrollbar-width: auto;
      background-color: #000000bd;
      border: 1px solid #ccc;
      border-radius: 5px;
      box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
      transform: translateX(-50%);

      &::-webkit-scrollbar {
        width: 14px;
      }

      &::-webkit-scrollbar-track {
        background-color: #fff;
      }

      &::-webkit-scrollbar-thumb {
        background-color: #9a9a9a;
        border: 3px solid #fff;
        border-radius: 10px;
      }

      & .f-area {
        position: relative;
        z-index: 1;
        display: block;
        width: 100%;
        height: auto;
        max-height: none;
        margin: 0;
        padding: 0;
        overflow: visible;
        opacity: 1;
      }

      & .slick-list,
      & .slick-track {
        display: block;
        width: auto !important;
        height: auto !important;
        overflow: visible;
        transform: none !important;
      }

      & .f-area > .diamond-rate-tab {
        display: block !important;
        visibility: visible !important;
        clear: both;
        float: none !important;
        height: auto !important;
        min-height: 0 !important;
        color: #fff !important;
        font-size: 16px !important;
        line-height: 1.2 !important;
        background-color: transparent;
        border: 0 !important;
        border-bottom: 1px solid #999998 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        opacity: 1 !important;
      }
    }

    & .carat-select-container.is-open .scroll-box {
      height: 300px !important;
    }
  }

  & .jewelry-souba-box-table-attend {
    padding: 3.5cqw !important;

    & .attend-list {
      margin: 0;
    }

    & .attend-list-title {
      font-weight: bold;
    }

    & .attend-list-item {
      position: relative;
      margin: 0;
      padding-left: 1em;

      &::before {
        position: absolute;
        left: 0;
        content: "※";
      }
    }
  }

  & .diamond-price-list-top-text {
    width: 90%;
    margin: 0 auto;
    font-size: 24px !important;
    font-weight: 700;
    line-height: 1.4;
    text-align: center;
  }

  & .carat-select {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 90%;
    max-width: 507px;
    margin: auto;
    padding: 15px 48px 15px 15px;
    font-size: 26px !important;
    font-weight: 700;
    line-height: 1.4;
    cursor: pointer;
    background-color: #fff;
    border-radius: 5px;

    &::after {
      position: absolute;
      top: 50%;
      right: 12px;
      z-index: 1;
      display: block;
      width: 24px;
      height: 24px;
      content: "";
      background-color: var(--diamond-rate-red);
      border-radius: 50%;
      transform: translateY(-50%);
    }

    &::before {
      position: absolute;
      top: 50%;
      right: 20px;
      z-index: 2;
      display: block;
      width: 7px;
      height: 7px;
      content: "";
      border-right: 2px solid #fff;
      border-bottom: 2px solid #fff;
      transform: translateY(-50%) rotate(45deg);
      transition: transform 0.2s;
    }
  }

  & .carat-select-container.is-open .carat-select::before {
    transform: translateY(-50%) rotate(-135deg);
  }

  & .scroll-box .diamond-rate-tab {
    position: relative;
    display: block !important;
    float: none !important;
    width: auto !important;
    min-height: auto;
    margin: 0 0.75rem;
    padding: 15px 15px 15px 40px !important;
    color: #fff;
    font-size: 16px !important;
    font-weight: 700;
    line-height: 1.2;
    text-align: justify;
    cursor: pointer;
    border: 0 !important;
    border-bottom: 1px solid #999998 !important;
    border-radius: 0 !important;
    outline: 0 !important;
    box-shadow: none !important;
    transition: background-color 0.2s;

    &:hover {
      background-color: #ffffff21;
    }

    &.active {
      background: #e6001200;
    }

    &.is-placeholder::before,
    &.active::before {
      position: absolute;
      top: 12px;
      left: 15px;
      display: block;
      width: 10px;
      height: 20px;
      content: "";
      border-right: 2px solid #fff;
      border-bottom: 2px solid #fff;
      transform: rotate(45deg);
    }
  }

  & .jewelry-category-time.text--center {
    margin: 0 0 46px;
    font-size: 24px !important;
    line-height: 1.5;
  }

  & .diamond-price-table-container {
    position: relative;
    padding-top: var(--diamond-rate-table-container-padding-top);
    padding-left: 40px;
    overflow: visible !important;
    border-radius: 0 !important;

    & .d-table table {
      margin-top: var(--diamond-rate-table-margin-top) !important;
    }
  }

  & .clarity-cut-overlay {
    position: absolute;
    top: 0;
    left: 40px;
    z-index: 3;
    display: flex;
    width: calc(100% - 40px);
    font-size: min(2vw, 12.5px) !important;
    line-height: 1;

    & > div {
      box-sizing: border-box;
      padding: 3px 20px;
      color: #fff;
      text-align: center;
      border-radius: 5px;
    }

    & .clarity {
      flex-shrink: 0;
      width: 111px;
      margin-right: 0;
      background-color: var(--diamond-rate-red);
    }

    & .cut {
      flex-grow: 1;
      background-color: var(--diamond-rate-gray);
    }
  }

  & .table-overlay-wrapper {
    position: relative;
    top: var(--diamond-rate-table-offset-top);
  }

  & .clarity-labels-overlay {
    display: none;

    & .label {
      position: absolute;
      display: flex;
      align-items: center;
      justify-content: center;
      box-sizing: border-box;
      height: 53px;
      margin-bottom: 0;
      color: #fff;
      font-size: 14px !important;
      font-weight: bold;
      line-height: 1;
      background-color: var(--diamond-rate-gray);
      border: 3px solid var(--diamond-rate-cream);
    }
  }

  & .vertical-bar {
    position: absolute;
    top: calc(var(--diamond-rate-table-container-padding-top) + var(--diamond-rate-table-offset-top) + var(--diamond-rate-table-margin-top) + var(--diamond-rate-head-height));
    left: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    width: 30px;
    height: var(--diamond-rate-body-height);
    padding: var(--diamond-rate-vertical-padding-y) 0;
    color: #fff;
    font-size: var(--diamond-rate-vertical-font-size) !important;
    line-height: 1.2;
    background-color: var(--diamond-rate-gray);
    border-radius: 5px;

    & .text,
    & .high,
    & .low {
      font-size: var(--diamond-rate-vertical-font-size) !important;
      font-weight: bold;
      line-height: 1.2;
      letter-spacing: 2px;
      writing-mode: vertical-rl;
    }
  }

  & .jewelry-souba-box-table-scroll {
    display: inline-block;
    max-width: 100%;
    max-height: 100%;
    padding: 0;
    overflow: unset;
    border-radius: 0 !important;
  }

  & .d-table {
    width: 100% !important;
    max-width: 737px;
    overflow: auto hidden;
    -ms-overflow-style: none;
    scrollbar-width: none;
    cursor: auto;
    touch-action: pan-x pan-y;
    -webkit-overflow-scrolling: touch;

    &::-webkit-scrollbar {
      display: none;
    }

    & select:focus {
      outline: none;
      border: none;
      box-shadow: none;
    }
  }

  & .diamond-table-scrollbar {
    position: relative;
    width: 100%;
    max-width: 737px;
    height: 14px;
    margin-top: 14px;
    overflow: hidden;
    cursor: pointer;
    background-color: #fff;
    border-radius: 5em;
  }

  & .diamond-table-scrollbar-thumb {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background-color: var(--diamond-rate-red);
    border-radius: 5em;
    will-change: transform, width;
  }

  & .jewelry-souba-box-table {
    padding: 0 5%;

    & table {
      width: 777px;
      min-width: 777px;
      margin-top: 0;
      overflow: visible;
      border-collapse: separate;
      border-spacing: 0;
      table-layout: fixed;
      border-radius: 0 !important;

      & tr,
      & th,
      & td,
      & .table-item {
        border-radius: 0 !important;
        user-select: text;
      }

      & thead th {
        box-sizing: border-box;
        width: 111px;
        min-width: 111px;
        padding: var(--diamond-rate-head-padding) !important;
        color: #fff;
        font-size: var(--diamond-rate-head-font-size) !important;
        font-weight: bold;
        line-height: 1.2;
        text-align: center;
        vertical-align: middle;
        background-color: var(--diamond-rate-gray);
        border-bottom: solid 3px var(--diamond-rate-cream);

        & + th {
          border-left: solid 3px var(--diamond-rate-cream);
        }

        &.table-head-emphasis {
          position: -webkit-sticky;
          position: sticky;
          top: 0;
          left: 0;
          z-index: 20;
          width: 111px;
          min-width: 111px;
          overflow: hidden;
          padding: var(--diamond-rate-head-padding) !important;
          background-color: var(--diamond-rate-red);
          border-radius: 0 !important;
        }

        &:last-child {
          border-radius: 0 !important;
        }
      }

      & .table-items {
        & td:first-child {
          opacity: 1;
        }

        & .table-item {
          box-sizing: border-box;
          width: 111px;
          min-width: 111px;
          height: var(--diamond-rate-body-row-height);
          color: #000;
          font-size: 14px !important;
          line-height: 1.2;
          text-align: center;
          vertical-align: middle;
          background-color: #fff;
          border: 3px solid var(--diamond-rate-cream);
          border-radius: 0 !important;
        }

        & td.table-item.color {
          position: -webkit-sticky !important;
          position: sticky !important;
          left: 0 !important;
          z-index: 70 !important;
          overflow: hidden;
          color: #fff;
          background-color: var(--diamond-rate-gray) !important;
          background-clip: padding-box;
          box-shadow: inset 0 0 0 999px var(--diamond-rate-gray);
          border: 1px solid var(--diamond-rate-cream);
        }
      }
    }
  }

  & .d-table table thead th.table-head-emphasis {
    position: -webkit-sticky !important;
    position: sticky !important;
    left: 0 !important;
    z-index: 20 !important;
    overflow: hidden;
    background-color: var(--diamond-rate-red) !important;
    background-clip: padding-box;
    box-shadow: inset 0 0 0 999px var(--diamond-rate-red);
    will-change: transform;

    & .selectbox-5.active,
    & .tab-selectbox.active {
      position: relative;
      z-index: 2;
    }

    & .tab-selectbox.active {
      width: 100%;
      min-width: 0;
      padding-top: 0;
      padding-bottom: 0;
      background-color: var(--diamond-rate-red);
    }
  }

  & .selectbox-5.active {
    position: relative;
    display: inline-flex;
    align-items: center;
    width: 100%;
    border-radius: 0 !important;

    & select {
      width: 100%;
      min-width: 0;
      max-width: 100%;
      padding: var(--diamond-rate-select-padding-y) var(--diamond-rate-select-padding-end) var(--diamond-rate-select-padding-y) var(--diamond-rate-select-padding-start);
      color: #fff;
      font-size: var(--diamond-rate-select-font-size) !important;
      font-weight: bold;
      line-height: 1.2;
      cursor: pointer;
      appearance: none;
      background-color: var(--diamond-rate-red);
      border: none;
      border-radius: 0 !important;
    }

    &::after {
      position: absolute;
      right: 15px;
      width: 10px;
      height: 7px;
      pointer-events: none;
      content: "";
      background-color: transparent;
      clip-path: polygon(0 0, 100% 0, 50% 100%);
    }
  }

  & .table-head-emphasis {
    &::before {
      position: absolute;
      top: 50%;
      right: 7px;
      z-index: 30;
      display: block;
      width: 15px;
      height: 15px;
      pointer-events: none;
      content: "";
      background-color: #fff;
      border-radius: 50%;
      transform: translateY(-50%);
    }

    &::after {
      position: absolute;
      top: 50%;
      right: 11px;
      z-index: 31;
      display: block;
      width: 7px;
      height: 7px;
      pointer-events: none;
      content: "";
      border-right: 2px solid var(--diamond-rate-red);
      border-bottom: 2px solid var(--diamond-rate-red);
      transform: translateY(-50%) rotate(45deg);
    }
  }

  & td.color {
    position: -webkit-sticky;
    position: sticky;
    left: 0 !important;
    z-index: 70 !important;
    box-sizing: border-box;
    width: 111px;
    min-width: 111px;
    padding-top: 14px;
    padding-bottom: 14px;
    color: #fff;
    font-size: 14px !important;
    font-weight: bold;
    line-height: 1.2;
    text-align: center;
    background-color: var(--diamond-rate-gray) !important;
    background-clip: padding-box;
    box-shadow: inset 0 0 0 999px var(--diamond-rate-gray);
    border: 1px solid var(--diamond-rate-cream);
    border-radius: 0 !important;
    opacity: 1 !important;
  }

  & .d-table table {
    & thead th:first-child {
      position: -webkit-sticky !important;
      position: sticky !important;
      left: 0 !important;
      z-index: 80 !important;
      overflow: hidden;
      background-color: var(--diamond-rate-red) !important;
      background-clip: padding-box;
      box-shadow: inset 0 0 0 999px var(--diamond-rate-red);
    }

    & tbody td:first-child {
      position: -webkit-sticky !important;
      position: sticky !important;
      left: 0 !important;
      z-index: 70 !important;
      overflow: hidden;
      background-color: var(--diamond-rate-gray) !important;
      background-clip: padding-box;
      box-shadow: inset 0 0 0 999px var(--diamond-rate-gray);
    }
  }

  & td.price {
    box-sizing: border-box;
    width: 111px;
    min-width: 111px;
    height: var(--diamond-rate-body-row-height);
    color: #000;
    font-size: 14px !important;
    line-height: 1.2;
    text-align: center;
    vertical-align: middle;
    background-color: #fff;
    border: 3px solid var(--diamond-rate-cream);
    border-radius: 0 !important;
  }

  & td.price::before,
  & .table-item.price::before {
    font-size: 68.75%;
    font-weight: normal;
    content: "HKD";
  }

  & td.price::after,
  & .table-item.price::after {
    content: none;
  }
}

@media (max-width: 767px) {
  .page-diamond-rates-section {
    & .diamond-price-list-area {
      --diamond-rate-head-font-size: clamp(12px, 1.63cqw, 12px);
      --diamond-rate-head-line-height: clamp(14.4px, 1.95cqw, 14.4px);
      --diamond-rate-body-row-height: 40px;
      --diamond-rate-body-height: 400px;

      padding-top: 32px;

      & .carat-select-container {
        margin: 22px auto 24px;
      }
    }

    & .diamond-price-list-top-text {
      font-size: 18px !important;
    }

    & .carat-select {
      padding: 13px 44px 13px 14px;
      font-size: 20px !important;
    }

    & .jewelry-category-time.text--center {
      margin-bottom: 32px;
      font-size: 18px !important;
    }

    & .jewelry-souba-box-table {
      & table {
        width: 777px;
        min-width: 777px;

        & thead th,
        & .table-items .table-item {
          width: 111px;
          min-width: 111px;
        }

        & thead th.table-head-emphasis {
          width: 111px;
          min-width: 111px;
        }

        & thead th {
          font-size: 12px !important;
        }

        & .table-items .table-item {
          height: 40px;
        }
      }
    }

    & .clarity-cut-overlay {
      font-size: 12px !important;
    }

    & td.price,
    & td.color,
    & .clarity-labels-overlay .label {
      font-size: 12px !important;
    }
  }
}
