@import "../theme/variable";
@import "../theme/mixins";
@import "typography";

.table-scroll-container {
  position: relative;
  padding-top: 35px;
  overflow: hidden;
}
.table-scroll-area {
  height: 100%;
  overflow-x: auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: auto;
}

table.mat-mdc-table {
  &.qms-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
    margin-top: -16px;
    background-color: transparent;
    font-family: Open Sans;
    overflow-x: auto;
    overflow-y: auto;
    margin-bottom: 0;
    border: none;

    .mat-mdc-row {
      font-family: inherit;
    }

    .mat-mdc-header-cell {
      font-size: 14px;
      font-weight: 600;
      color: theme-apply($ws-text-secondary);
      vertical-align: middle;

      .mat-mdc-checkbox.qms-group-options {
        padding: 5px;
      }
    }

    .mat-mdc-header-row {
      height: unset;
    }

    th {
      border: none !important;
      min-width: 40px;
    }

    .th-title {
      position: absolute;
      top: 0;
    }

    td {
      border-top: 1px solid theme-apply($disabled);
    }

    &.border-left {
      border-left: 1px solid theme-apply($disabled);
    }

    .border-right {
      border-right: 1px solid theme-apply($disabled);
    }

    td.mat-mdc-cell {
      // padding: 10px 0 10px 0;
      border-bottom: 1px solid theme-apply($other-divider);
      border-top: 1px solid theme-apply($other-divider);
      color: theme-apply($ws-text-primary);
      font-weight: 400;
    }

    td.mat-mdc-cell:first-child {
      border-left: 1px solid theme-apply($other-divider);
      border-bottom-left-radius: 4px;
      border-top-left-radius: 4px;

      .mat-mdc-checkbox.qms-group-options {
        border-right: 1px solid theme-apply($other-divider);
        border-radius: 0px;
        padding: 5px 15px 5px 5px;
      }
    }

    td.mat-mdc-cell:last-child {
      border-right: 1px solid theme-apply($other-divider);
      border-bottom-right-radius: 4px;
      border-top-right-radius: 4px;
    }

    th.mat-mdc-header-cell:last-of-type,
    td.mat-mdc-cell:last-of-type,
    td.mat-mdc-footer-cell:last-of-type {
      padding-right: 0;
    }

    th.mat-mdc-header-cell:first-of-type,
    td.mat-mdc-cell:first-of-type,
    td.mat-mdc-footer-cell:first-of-type {
      padding-left: 0;
    }
  }
}

table.mat-mdc-table {
  &.qms-expandable-table {
    width: 100%;
    margin-top: -16px;
    padding-right: 5px;
    background-color: transparent;
    font-family: Open Sans;
    overflow-x: auto;
    overflow-y: auto;
    margin-bottom: 0;
    border: none;

    .mat-mdc-header-row {
      height: unset;
    }

    th.mat-mdc-header-cell:first-of-type {
      padding-left: 16px;
    }

    .mat-mdc-header-cell {
      font-size: 14px;
      font-weight: 600;
      color: #5a5a5a;
      vertical-align: middle;
    }

    th {
      border: none !important;
      min-width: 40px;
    }

    .th-title {
      position: absolute;
      top: 0;
    }

    .mat-mdc-header-cell {
      font-size: 14px;
      font-weight: 600;
      color: #5a5a5a;
      vertical-align: middle;
    }

    tr.qms-detail-row {
      height: 0;
    }

    tr.mat-mdc-row {
      padding: 8px 0 8px 20px;
      border-radius: 4px;
      margin-top: 8px;
      min-height: 40px;
      font-size: 14px;
      line-height: 20px;
      font-family: Open Sans;
      font-weight: 400;
      color: #323232;
      align-items: stretch;
      cursor: pointer;
      transition: background 0.2s;

      &.qms-element-row:hover {
        background: rgba(0, 0, 0, 0.08);

        td.mat-mdc-cell {
          background-color: transparent;
        }
      }

      &.qms-element-row:active {
        background: rgba(40, 115, 223, 0.24);

        td.mat-mdc-cell {
          background-color: transparent;
        }
      }
    }

    .qms-element-row td.mat-mdc-cell:first-child {
      border-left: 1px solid #e0e0e0;
      border-bottom-left-radius: 4px;
      border-top-left-radius: 4px;
    }

    .qms-element-row td.mat-mdc-cell:last-child {
      border-right: 1px solid #e0e0e0;
      border-bottom-right-radius: 4px;
      border-top-right-radius: 4px;
    }

    td.mat-mdc-cell {
      color: #242424;
      font-weight: 400;
      background: #fff;
    }

    .qms-element-row td {
      border-bottom-width: 0;
    }

    tr.spacer:first-child {
      height: 16px;
    }

    tr.mat-mdc-row.spacer td.mat-mdc-cell {
      background-color: transparent;
    }

    tr.qms-expanded-row td.mat-mdc-cell {
      border-bottom: 1px solid #ddd;
    }
  }
}

table.mat-mdc-table.qms-table.qms-expanded-table {
  border-spacing: 0;
}

tr.qms-detail-row {
  &:not(.child-row) {
    &:hover {
      background: rgba(0, 0, 0, 0.08);
      cursor: pointer;
    }
  }
}

tr.qms-detail-row.toggle-row {
  height: 37px;
}

table.mat-mdc-table.qms-table
  td.mat-mdc-cell.mat-column-expandedChildrenTemplate {
  padding: 0;
  border: none;
}

tr.mat-mdc-row.hidden {
  display: none;
}

table.mat-mdc-table.qms-table tr.spacer {
  height: 8px;
  border: none;
  background: transparent;

  td.mat-mdc-cell {
    border: none;
  }
}

table.mat-mdc-table.qms-table {
  td.mat-column-detailTemplate,
  td.mat-column-toggleGroupTemplate,
  td.mat-column-detailChildTemplate {
    border-top: none !important;
    border-top-right-radius: 0 !important;
    border-top-left-radius: 0 !important;
  }
}

div.expand-children-row {
  padding-top: 16px;
}

.qms-collapse-group {
  display: flex;
  align-items: center;
  vertical-align: super;
  color: theme-apply($primary);

  .qms-text-collapse {
    font-weight: 600;
    font-size: 12px;
    line-height: 16px;
  }
}

table.mat-mdc-table.qms-table tr.expanded-row td.mat-mdc-cell:first-child {
  border-left: 4px solid theme-apply($primary-light-32-opacity);
}

table.mat-mdc-table.qms-table td.mat-mdc-cell.mat-column-toggleGroupTemplate {
  background-color: theme-apply($background-area);
  cursor: pointer;
  border-left: 4px solid theme-apply($primary-light-32-opacity);
}
