@import '../../core/src/style/variables';

h3 {
  margin: 0.8em 0;
}

.tariff-icon {
  wpt-icon {
    color: $button-hover-orange;
    position: relative;
    padding: 4px 5px;
    z-index: 0;
  }
}

.header-wrapper {
  display: flex;
  @media screen and (min-width: 601px) {
    flex-direction: row;
  }
  @media screen and (max-width: 600px) {
    flex-direction: column;
  }  
  width: 100%;
  overflow: hidden;
  scroll-behavior: smooth;
  margin-bottom: 15px;
  font-size: 1.2rem;

  .alternatives-header {
    display: flex;
    @media screen and (min-width: 601px) {
      flex-direction: row;
    }
    @media screen and (max-width: 600px) {
      flex-direction: column;
    }  
    width: 100%;
    min-width: 100%;
    &-item {
      flex-basis: auto;
      margin-right: 1rem;
      &.cpn {
        width: 30%;
        max-width: 30%;
      }
      &.qty {
        width: 30%;
        max-width: 30%;
      }
      &.stock {
        width: 40%;
        max-width: 40%;
      }
      .data-sheet {
        a {
          color: $lochmara;
          padding-right: 5px;
        }
      }
      div {
        display: flex;
        padding: 5px;
        min-height: 25px;
        white-space: nowrap;
        span {
          margin-right: 5px;
        }
      }
    }
  }
  .category {
    display: flex;
    flex-direction: row;
    min-width: 100%;
    width: 100%;
    .content {
      margin-left: 10px;
      div {
        padding: 5px;
      }
    }
  }
  .scroll {
    margin: 3px 0;
    padding: 0 2px;
    
    button {
      height: 100%;
      border: 0;
      padding: 0;
      background: $lightergrey;
    }
    wpt-icon {
      width: 20px;
      height: 15px;
      &.left {
        transform: rotate(270deg);
      }
      &.right {
        transform: rotate(90deg);
      }
    }
  }
}

.filter-wrapper {
  padding: 10px 0;
  bom-filter-grouped-multiselect {
    padding: 6px;
    display: inline-block;
    width: 30%;
    min-width: 200px;
    margin-right: 2em;
    margin-left: -6px;
  }

  button {
    line-height: inherit;
    min-height: inherit;
    text-transform: capitalize;
    text-decoration: underline;
    font-weight: normal;
    padding: 0;
  }
}

wpt-dialog-content.alternativesModal {
  margin: 0 0 15px;
  padding: 0;
  border: 1px solid $middarkgrey;
  overflow-x: hidden;
  max-height: 32vh;

  div.list-wrapper-compact {
    max-width: 100%;
    display: flex;
    align-items: flex-start;
    position: relative;
    min-height: 100px;

    #list-loader {
      position: relative;
      top: 100px;
    }

    wpt-table.firstLevelTable {
      wpt-header-row {
        position: -webkit-sticky;
        position: sticky;
        left: 0;
        right: 0;
        top: 0;
        z-index: 99;
      }

      wpt-cell {
        height: 120px;
        min-height: 0px;
      }

      > wpt-row {
        border-style: solid;
        border-color: $lightergrey;
        border-width: 1px;

        > wpt-cell:not(.wpt-column-alternates) {
          background-color: $evenlightergrey;
          max-height: 150px;
        }
      }
    }

    .fixed-columns-table,
    .variable-columns-table {
      box-sizing: border-box;
      position: relative;
      wpt-header-row,
      wpt-row {
        padding: 0;
      }

      wpt-header-row {
        background-color: #dedede;
        color: #000;
        min-height: 38px;
        .wpt-header-cell,
        .wpt-sort-header-button {
          color: black;
          font-size: 0.86em;
          font-weight: 700;
          text-transform: capitalize;
        }
      }

      wpt-row {
        flex-wrap: wrap;
        align-items: flex-start;
        overflow: hidden;
      }

      wpt-row:nth-child(odd) {
        background-color: #eee;
      }

      wpt-cell,
      wpt-header-cell {
        flex: 1 1 auto;
        padding: 0 10px;
      }

      wpt-cell {
        position: relative;
        padding: 15px 10px;
        box-sizing: border-box;
        height: 200px;
        overflow: unset;
        &.wpt-column-alternates {
          padding: 0;
          height: auto;
          width: 100%;
        }
      }
    }
  }

  .list-wrapper-compact {

    .fixed-columns-table {
      flex: 2 1 500px;
      max-width: 60%;

      wpt-cell {
        padding: 12px 10px;
      }

      .blue-tag {
        color: $lochmara;
        text-decoration: underline;
        cursor: pointer;
        font-size: 0.85em;
      }

      .wpt-column {
        &-select,
        &-status,
        &-thumbnail,
        &-userUploadedData {
          display: none;
          wpt-header-cell,
          wpt-cell {
            display: none;
          }
        }
        &-partNumber {
          flex: 3 0 188px;
          max-width: 35%;
        }
        &-price {
          flex: 2 0 155px;
          max-width: 25%;
          button.ListItem-buyingOptions {
            display: none;
          }
        }
        &-quantity {
          flex: 2 0 100px;
          max-width: 20%;
          text-align: left;
          font-weight: normal;

          .unbold {
            font-weight: $font-normal;
          }

          .add-button {
            background-color: $blue;
            color: $white;
            font-size: 1.28em;
            border: none;
            min-width: 15px;
            width: 30px;
            padding: 0;
            min-height: 35px;
            height: 35px;

            &:hover {
              background-color: $button-hover-blue;
            }

            &.disabled {
              background-color: $grey;

              &:hover {
                background-color: $middarkgrey;
              }
            }
          }

          .ListItem-rowTotalCost-price {
            font-weight: bold;
            margin-top: 5px;
          }

          .ListItem-rowTotalCost-priceForNotice {
            font-size: 10px;
            color: #0069AA;
            display: block;
          }

          input,
          button {
            width: 100%;
            display: block;
          }

          input {
            padding: 1px;
            height: 35px;
            text-align: center;
            margin-bottom: 10px;
            border: 1px solid $middarkgrey;
          }

          .add-more-sign {
            font-size: 0.8em;
            font-weight: $font-bold;
          }
        }
        &-stock {
          flex: 2 0 100;
          max-width: 20%;

          stock {
            font-size: 0.85em;
          }
        }
        &-alternates {
          wpt-cell {
            display: none;
          }
        }
      }
    }

    .variable-columns-table {
      position: relative;
      min-width: 0px;
      width: 900px;
      max-width: 40%;

      .wpt-column {
        &-Note,
        &-Reference-Designator-s- {
          display: none;
          wpt-header-cell,
          wpt-cell {
            display: none;
          }
        }

        &-pipeline,
        &-description {
          max-width: 50%;
        }
        &-alternates {
          width: 100%;
        }
      }
    }
  }
}

.alternativeModal-buttons {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  align-items: flex-start;
  float: right;
  width: auto;
  button {
    margin-right: 1rem;
    width: 110px;
    &:nth-child(2) {
      margin-right: 0;
      min-width: 170px;
      width: fit-content;
    }
  }
}

:host {
  wpt-dialog-content.alternativesModal
    div.list-wrapper-compact
    wpt-table.fixed-columns-table {
    div.wrapper-cpn span.blue-tag {
      color: inherit;
      text-decoration: inherit;
    }
    button.ListItem-buyingOptions {
      display: none;
    }
  }
}

.previous-table-wrapper{
  .previous-part-table{
    border: 1px solid $middarkgrey;
    display: block;
    position: relative;
    overflow-x: auto;
    overflow-y: hidden;
    wpt-header-cell {
      padding: 0 10px;
      min-height: 40px;
      display: grid;
      align-items: center;
      min-width: 15rem;
    }
    wpt-row {
      padding: 0;
      position: relative;
      top: 1.5rem;
      height: 11rem;
    }
    wpt-header-row {
      position: absolute;
      padding: 0;
      min-height: 40px;
      z-index: 99;
      background-color: $lightergrey;
      color: $black;
      .wpt-header-cell,
      .wpt-sort-header-button {
        color: black;
        font-size: 1.2rem;
        font-weight: 700;
      }
    }
    wpt-cell{
      display: flex;
      flex-wrap: nowrap;
      flex-direction: row;
      align-content: stretch;
      justify-content: flex-start;
      padding: 10px;
      min-width: 15rem;
      min-height: 6rem;
      align-items: center;
        &.wpt-column{
          &-Part-Number {
            overflow-wrap: anywhere;
            wpt-checkbox {
              padding-right: 1rem;
            }
        }
      }
    }
  }
}

.list-no-results {
  width: 100%;
  font-size: 24px;
  font-weight: bold;
  text-align: center;
  padding: 10px;
  margin: 0;
}
