%table {
  tr {
    th, td {
      font-family: get("font.family");
      vertical-align: middle;

      input {
        margin: 0;
      }

      &:first-child {
        .custom-checkbox {
          display: flex;
          align-items: center;
          justify-content: center;
          margin-right: 0 !important;

          input {
            margin-right: 0;
          }

          label {
            display: none;
          }
        }
      }
    }

    th {
      position: relative;
      background-color: #{get("element.table.header.background-color")};
      color: var(#{get("element.table.header.color")});
      border: 0;
      font-weight: #{get("element.table.header.font-weight")};
      border-radius: 0;
      padding: size(get("element.table.size.small.header.padding.top")) size(get("element.table.size.small.header.padding.right")) size(get("element.table.size.small.header.padding.bottom")) size(get("element.table.size.small.header.padding.left"));
      font-size: size(get("element.table.header.font-size"));
      line-height: size(get("element.table.header.line-height"));
      height: size(get("element.table.size.small.min-height"));
      box-sizing: border-box;
    }

    td {
      font-weight: normal;
      color: var(#{get("font.color.name")}-#{get("font.color.value")});
      border: size(1px) solid transparent;
      border-right: size(1px) solid var(--basic-400);
      padding: size(get("element.table.size.small.body.padding.top")) size(get("element.table.size.small.body.padding.right")) size(get("element.table.size.small.body.padding.bottom")) size(get("element.table.size.small.body.padding.left"));
      font-size: size(get("element.table.font.size"));
      line-height: size(get("element.table.font.line-height"));
      height: size(get("element.table.size.small.min-height"));
      box-sizing: border-box;

      &:last-of-type {
        border-right: 0;
      }
    }

    &:nth-of-type(1) {
      th {
        position: sticky;
        z-index: 2;
      }
    }

    &:nth-of-type(2) {
      th {
        background-color: #{get("element.table.filter.background-color")};
      }
    }

    @if (get("element.table.striped.status")) {
      @if (get("element.table.striped.reverse")) {
        &:nth-child(even) {
          background-color: var(--white);
        }

        &:nth-child(odd) {
          background-color: var(--basic-300);
        }
      }

      @else {
        &:nth-child(even) {
          background-color: var(--basic-300);
        }

        &:nth-child(odd) {
          background-color: var(--white);
        }
      }
    }

    &.selected {
      background-color: var(--primary-300);

      > td {
        border-right-color: var(--primary-300);
      }
    }

    &:last-child {
      td {
        border-bottom: 0;
      }
    }
  }

  tbody {
    tr {
      &:hover {
        > td, > th {
          background-color: rgba(var(--primary-100-rgb), 0.7);
          border-right-color: rgba(var(--primary-100-rgb), 0.1);
        }
      }
    }
  }
}

%table-variation {
  @each $color, $value in get("color.list") {
    &.#{"" + $color} {
      // background-color: if($color=="basic", var(--basic-600), var(--#{$color}));
      background-color: transparent;

      &:hover, &:focus, &:active {
        background-color: transparent;
        box-shadow: none;
      }

      table {
        th {
          background-color: #{get("element.table.header.background-color")};
          color: #{get("element.table.header.color")} !important;
        }
      }
    }
  }

  @each $size, $value in get("size") {
    &.#{"" + $size} {
      height: auto;

      table {
        th {
          padding: size(get("element.table.size."+#{$size}+".header.padding.top")) size(get("element.table.size."+#{$size}+".header.padding.right"));
          box-sizing: border-box;
        }

        td {
          padding: size(get("element.table.size."+#{$size}+".body.padding.top")) size(get("element.table.size."+#{$size}+".body.padding.right"));
          height: size(get("element.table.size."+#{$size}+".min-height"));
          box-sizing: border-box;
        }
      }
    }
  }
}

%table-header {
  background-color: var(--basic-600);
  position: relative;
  border-radius: 0;

  table {
    tr {
      th {
        background-color: #{get("element.table.header.background-color")};
        color: var(#{get("element.table.header.color")});
        font-weight: #{get("element.table.header.font-weight")};
        // border-right: size(1px) solid var(--primary-700);
        border-radius: 0;
        padding: size(get("element.table.size.small.header.padding.top")) size(get("element.table.size.small.header.padding.right"));
        font-size: size(get("element.table.header.font-size"));
        line-height: size(get("element.table.header.line-height"));
        height: size(get("element.table.size.small.min-height"));
        position: relative;

        .t-link {
          line-height: inherit;
        }

        .t-filterCellBtn {
          line-height: inherit;
          font-size: size(get("element.table.icon.font-size"));

          &::before {
            font-size: size(get("element.table.icon.font-size"));
          }
        }

        span.t-link {
          font-weight: 800;
        }
      }
    }
  }

  .t-grid-header-options {
    // Filtre alanı için kapatıldı
    // display: none;
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;

    .t-filterCancelBtn {
      margin-left: 0;
      display: flex;
      width: 100%;
      height: 100%;
      align-items: center;
      justify-content: center;

      &::before {
        font-size: size(get("element.table.icon.font-size"));
      }
    }
  }

  .t-grid-header-wrap {
    // Filtre alanı için kapatıldı
    // margin-right: 0 !important;
  }
}

%table-content {
  table {
    tr {
      td {
        font-weight: normal;
        color: var(#{get("font.color.name")}-#{get("font.color.value")});
        border-right: size(1px) solid var(--basic-500);
        border-left: transparent;
        padding: size(get("element.table.size.small.body.padding.top")) size(get("element.table.size.small.body.padding.right"));
        font-size: size(get("element.table.font.size"));
        line-height: size(get("element.table.font.line-height"));
        height: size(get("element.table.size.small.min-height"));

        &:last-of-type {
          border-right: 0;
        }
      }

      &:hover {
        td {
          background-color: var(--primary-100);
        }
      }

      &.t-activeRow {
        td {
          background-color: var(--primary-300) !important;
        }
      }

      &.t-activeRowNoFocus {
        td {
          background-color: var(--primary-200) !important;
        }
      }

      &:last-child {
        td {
          border-bottom: 0;
        }
      }
    }

    &.table-striped {
      tr:nth-of-type(odd) {
        background-color: var(--basic-300);
      }
    }
  }
}
