@import "../../../../assets/scss/variables";
@import "../../../../assets/scss/mixins";

.ftm-td--wrapper {
  background-color: var(--table-bg-color);
  border-radius: 8px;

  .ftm-td--header {
    grid-gap: 1em;
    align-items: center;
    display: grid;
    grid-template-columns: 1fr auto;
    padding: 0.5em 1em;
    position: relative;

    h2 {
      color: var(--table-txt-color);
    }

    .ftm-td--trust-toggle {
      background-color: var(--table-bg-color);
      border: none;
      border-radius: 3px;
      height: 2.5em;
      padding: 0.4em;
      width: 2.5em;

      &:before {
        color: var(--how-icon-color-mobile);
        font-size: 2em;
      }
    }

    @media (min-width: $breakpoint-md) {
      .ftm-td--trust-toggle {
        display: none;
      }
    }

    .ftm-td--how-rate {
      background-color: transparent;
      padding: 0;
      pointer-events: all;
      position: static;
      flex-wrap: wrap;
      overflow: visible;
      text-align: right;
      display: none;

      .ftm-td--trust-content {
        background-color: var(--table-bg-color);
        border-radius: 3px;
        display: grid;
        grid-template-rows: 1fr;
        max-height: 100%;
        position: relative;

        .ftm-td--trust-content-hide {
          background-color: #fff;
          border-radius: 50%;
          color: #333;
          font-size: 1.75em;
          font-weight: 700;
          height: 1.25em;
          line-height: 1.25;
          padding: 0;
          position: absolute;
          right: -0.25em;
          top: -0.25em;
          width: 1.25em;
          z-index: 25;

          &:before {
            content: "X";
          }
        }
        @media (min-width: $breakpoint-md) {
          .ftm-td--trust-content-hide {
            display: none;
          }
        }
      }

      @media (min-width: $breakpoint-md) {
        .ftm-td--trust-content {
          display: flex;
        }
      }

      @media (max-width: $breakpoint-md) {
        &.show {
          background-color: rgba(0, 0, 0, 0.7);
          bottom: 0;
          display: none;
          left: 0;
          padding: calc(100px + 1em) 1em 1em;
          place-items: center;
          pointer-events: none;
          position: fixed;
          right: 0;
          top: 0;
          z-index: 20;
        }
      }

      &.active {
        display: block;
        pointer-events: all;
      }

      .ftm-td--how-text {
        color: var(--how-txt-color);
        font-size: 1.25em;
        font-weight: 700;
        margin: 0;
        line-height: 1.9em;
        margin-left: 1em;
        text-align: left;
      }

      .trust-factor {
        background-color: var(--how-bg-color);
        border-radius: 3px;
        height: 2.3em;
        padding: 0.2em;
        width: 2.3em;
        grid-template-columns: 1fr;
        margin-top: 0;
        grid-gap: 1em;
        display: grid;
        color: var(--how-icon-color);
        text-align: center;
        margin-left: 1em;

        &:before {
          border-left: 6px solid transparent;
          border-right: 7px solid transparent;
          border-top: 14px solid var(--table-bg-color);
          bottom: calc(100% - -0.82em);
          content: "";
          display: none;
          position: absolute;
          transform: translateX(calc(1.25em - 9.5px));
        }

        p {
          span {
            font-size: 16px;
            line-height: 24px;
            display: block;
            font-weight: bold;
          }
        }

        @media (min-width: $breakpoint-md) {
          &:hover::before {
            display: block;
          }

          &:hover p {
            display: block;
          }

          p {
            bottom: calc(100% + 0.9em);
            display: none;
            max-width: 100%;
            padding: 0.5em;
            position: absolute;
            right: 0;
            width: 25em;
            background-color: var(--table-bg-color);
            text-align: left;
            font-size: 14px;
            z-index: 999;
            line-height: 19px;
          }
        }
        i:hover {
          transform: scale(1.4);
          transition: transform 0.2s;
        }

        i:before {
          color: #fff;
          font-size: 1.4em;
          line-height: 1.4em;
        }

        @media (max-width: $breakpoint-md) {
          i:before {
            font-size: 2em;
          }
        }
      }

      @media (max-width: $breakpoint-md) {
        .trust-factor {
          background-color: unset;
          height: auto;
          width: fit-content;
          grid-template-columns: 0fr 1fr;
          text-align: left;
          margin-right: 1em;
        }
      }
    }

    @media (min-width: $breakpoint-md) {
      .ftm-td--how-rate {
        display: flex;
      }
    }
  }

  .ftm-td--footer {
    a {
      margin-top: 10px;
      background-color: var(--see-bg-color);
      color: var(--see-txt-color);
      display: block;
      font-size: 0.875em;
      font-weight: 700;
      padding: 0.5em;
      text-align: center;

      &:hover {
        background-color: var(--see-bg-hv-color);
        color: var(--see-txt-color-hover);
        text-decoration: none;
      }
    }
  }

  .ftm-td--body-wrapper {
    .ftm-td-body-header {
      display: flex;
      gap: 0.5em;
      list-style: none;
      margin: 0;
      overflow-x: auto;
      padding: 0 1em;

      div {
        background-color: var(--tab-bg-color);
        border-radius: 5px 5px 0 0;
        color: var(--tab-txt-color);
        cursor: pointer;
        display: block;
        font-size: 0.875em;
        font-weight: 700;
        padding: 1em;
        text-align: center;
        text-transform: uppercase;

        &.active {
          background-color: var(--current-tab-bg-color);
          color: var(--current-tab-txt-color);

          &:hover {
            background-color: var(--current-tab-bg-color);
          }
        }

        &:hover {
          background-color: var(--tab-bg-color-hover);
        }
      }
    }

    div[class^="ftm-td--sites-"] {
      background-color: var(--current-tab-bg-color);
      border-bottom-right-radius: 8px;
      padding: 1em;
      border-left: 3px solid var(--table-bg-color);
      border-right: 3px solid var(--table-bg-color);
      border-bottom-left-radius: 8px;
      border-bottom: 3px solid var(--table-bg-color);
      display: none;

      &.active {
        display: block;
      }

      .ftm-td-site {
        grid-template-columns: 1fr 1fr;
        background-color: #fff;
        border: 3px solid var(--records-bg-color);
        color: #333;
        display: grid;
        font-size: 1rem;
        grid-auto-flow: dense;
        position: relative;

        &:not(:first-child) {
          margin-top: 1rem;
        }

        &:first-child {
          border-color: var(--first-bg-color);

          .ftm-td-site--rank {
            background-color: var(--first-bg-color);
            color: var(--first-txt-color);
          }
        }

        a {
          height: 100%;
          position: absolute;
          width: 100%;
          z-index: 10;
        }

        .ftm-td-site--rank {
          font-size: 1.1em;
          height: 2em;
          width: 2em;
          background-color: var(--rank-bg-color);
          color: var(--rank-txt-color);
          display: grid;
          font-weight: 700;
          left: -3px;
          place-content: center;
          place-items: center;
          position: absolute;
          top: -3px;
        }

        @media (min-width: $breakpoint-md) {
          .ftm-td-site--rank {
            font-size: 1.5em;
            height: 2em;
            width: 2em;
          }
        }

        .ftm-td-site--logo {
          display: grid;
          place-items: center;
          text-align: center;
          padding: 1em 0.5em;

          img {
            height: 5em;
            -o-object-fit: contain;
            object-fit: contain;
            width: 100%;
          }
        }

        .ftm-td-site--free-trial {
          display: grid;
          font-weight: 700;
          place-content: center;
          place-items: center;
          text-align: center;

          p {
            line-height: 1.1;
            margin: 0;
            font-size: 1.875em;
            &:first-child {
              text-transform: uppercase;
              font-size: 1em;
            }
          }
        }

        @media (min-width: $breakpoint-md) {
          .ftm-td-site--free-trial {
            border-left: 1px solid #d6d6d6;
            border-top: 1px solid #d6d6d6;
            grid-column: 3 / span 2;
            grid-row: 2;
            padding: 1em 2em;
          }
        }

        .ftm-td-site--rating {
          grid-gap: 0.5em;
          border-top: 1px solid #d6d6d6;
          display: grid;
          padding: 1em;
          place-content: center;
          place-items: center;
          text-align: center;

          .ftm-td-site--rating-star {
            display: inline-block;
            height: 19px;
            position: relative;
            width: 97px;

            .rating-star--over {
              width: var(--rating-score);
              z-index: 1;
            }

            .rating-star--under {
              filter: grayscale(1);
              width: 100%;
            }

            .rating-star--under {
              background-image: url("../images/star.png");
              background-position: 0;
              background-size: 20px;
              height: 100%;
              left: 0;
              position: absolute;
              top: 0;
            }

            .rating-star--over {
              background-image: url("../images/star.png");
              background-position: 0;
              background-size: 20px;
              height: 100%;
              left: 0;
              position: absolute;
              top: 0;
            }
          }
        }

        @media (min-width: $breakpoint-md) {
          .ftm-td-site--rating {
            border-left: 1px solid #d6d6d6;
            border-top: none;
            grid-column: 5;
          }
        }

        .ftm-td-site--link-wrapper {
          grid-gap: 1em;
          border-top: 1px solid #d6d6d6;
          display: grid;
          padding: 1em;
          place-content: center stretch;
          place-items: center;
          text-align: center;

          a.ftm-td-site--visit {
            color: var(--visit-txt-color);
            background-color: var(--visit-bg-color);
            border-bottom: 3px solid var(--visit-bg-border-color);
            border-radius: 10px;
            display: block;
            font-size: 1.125em;
            font-weight: 700;
            padding: 0.75em;
            text-align: center;
            text-decoration: none;
            width: 100%;
            z-index: 15;
            position: relative;

            &:hover {
              background: var(--visit-bg-color-hover);
              border-bottom-color: var(--visit-bg-border-color-hover);
              color: var(--visit-txt-color-hover);
            }
          }
          a.ftm-td-site--visit-review {
            color: #15365a;
            font-size: 0.75em;
            font-weight: 500;
            position: relative;
            text-align: center;
            text-decoration: underline;
            text-transform: uppercase;
            z-index: 15;

            &:hover {
              text-decoration: none;
            }
          }
        }

        @media (min-width: $breakpoint-md) {
          .ftm-td-site--link-wrapper {
            border-left: 1px solid #d6d6d6;
            border-top: none;
            grid-column: 5;
          }
        }

        .ftm-td-site--pros {
          border-top: 1px solid #d6d6d6;
          grid-column: span 2;
          padding: 1em 0.5em;
          font-size: 0.875em;

          .ftm-td-site--pro-list {
            list-style: none;
            margin: 0;
            padding: 0;

            li {
              line-height: 1.6em;
              background-position: left 0.45em;
              background-repeat: no-repeat;
              background-size: 1em;
              padding: 0.1em 0 0.1em 2em;
              text-indent: -20px;

              &:before {
                color: var(--pros-icon-color);
              }
            }
          }
        }

        @media (min-width: $breakpoint-md) {
          .ftm-td-site--pros {
            border-top: none;
            grid-column: 2 / span 2;
            padding: 1em 0.5em;
          }
        }

        .ftm-td-site--cons {
          font-size: 0.875em;
          grid-column: span 2;
          padding: 1em 0.5em;

          .ftm-td-site--con-list {
            list-style: none;
            margin: 0;
            padding: 0;

            li {
              background-position: left 0.45em;
              line-height: 1.6em;
              background-repeat: no-repeat;
              background-size: 1em;
              padding: 0.1em 0 0.1em 2em;
              text-indent: -20px;

              &:before {
                color: var(--cons-icon-color);
              }
            }
          }
        }

        @media (min-width: $breakpoint-md) {
          .ftm-td-site--cons {
            grid-column: 4;
            padding: 1em 0.5em;
          }
        }

        .ftm-td-site--memberships {
          border-top: 1px solid #d6d6d6;
          grid-gap: 0.5em 2em;
          align-content: center;
          border-top: 1px solid #d6d6d6;
          display: grid;
          grid-column: span 2;
          grid-template-columns: 1fr;
          padding: 1em;

          > p {
            font-weight: bold;
            text-align: center;
          }

          p {
            color: #333;
            font-family: Helvetica, sans-serif;
            font-size: 16px;
            line-height: 24px;
            margin: 0;
          }

          .ftm-td-site-membership-details {
            font-size: 1em;
            grid-row: 1 / span 3;

            p {
              color: #333;
              font-family: Helvetica, sans-serif;
              font-size: 16px;
              line-height: 24px;
            }
          }
        }

        @media (min-width: $breakpoint-md) {
          .ftm-td-site--memberships {
            grid-column: span 2;
            grid-template-columns: fit-content(50%) 1fr;
          }
        }
      }

      @media (min-width: $breakpoint-md) {
        .ftm-td-site {
          grid-template-columns: 20% 1fr 5% 1fr 20%;
        }
      }
    }
  }
}
