.zpl-table {
  &-card {
    // Show size
    @apply md:hidden;

    // default
    @apply font-IRANYekanFaNum text-text bg-surface rounded-md overflow-hidden w-full mb-md p-md;
    @apply last:mb-0;

    &:not(.bordered) {
      @apply shadow-elevation-50;
      @apply dark:shadow-dark-elevation-50;
    }

    &.bordered {
      @apply border border-border-divider;
      @apply dark:border-border-dark-divider;
    }

    // dark
    @apply dark:bg-surface-dark dark:text-text-dark;

    &-header {
      @apply flex items-center justify-between mb-sm;

      > div {
        @apply first:text-b1;
      }

      &-left {
        @apply flex items-center gap-xs;
      }
    }

    &-row {
      // default
      @apply flex items-center gap-md justify-between py-sm border-b border-border-divider;

      // dark
      @apply dark:border-border-dark-divider;

      // last child
      @apply last:border-b-0 last:pb-0;

      > span {
        // default
        @apply first:text-text-soft first:text-b3 last:text-text last:text-b2;

        // dark
        @apply dark:first:text-text-dark-soft dark:last:text-text-dark;
      }
      .zpl-table-cell {
        div {
          @apply text-b2;
        }
      }
    }
    &-action {
      @apply flex justify-between items-center mt-xl;
    }
    &-status {
      @apply flex gap-2xs;
    }
  }

  &-box {
    // Show size

    @apply hidden md:block;

    // default
    @apply bg-surface rounded-md overflow-auto w-full;

    // dark
    @apply dark:bg-surface-dark;

    &:not(.bordered) {
      @apply shadow-elevation-50;
      @apply dark:shadow-dark-elevation-50;
    }

    &.bordered {
      @apply border border-border-divider;
      @apply dark:border-border-dark-divider;
    }
  }

  &-type-renderer {
    .custom {
      @apply flex items-center gap-sm;

      .text {
        @apply flex flex-col;

        .title {
          // default
          @apply text-text text-b2;

          // dark
          @apply dark:text-text-dark;

          &.td-disable {
            @apply text-text-disabled dark:text-text-dark-disabled;
          }
        }

        .sub {
          // default
          @apply text-text-soft text-ls-cp mt-2xs;

          // dark
          @apply dark:text-text-dark-soft;

          &.td-disable {
            @apply text-text-disabled dark:text-text-dark-disabled;
          }
        }
      }
    }

    .status {
      @apply flex gap-2xs;
    }

    .unit {
      @apply md:hidden;
    }
    .date {
      @apply whitespace-nowrap;
    }
    .td-disable {
      @apply text-text-disabled dark:text-text-dark-disabled;
    }
  }

  &-action {
    @apply flex mr-auto items-center gap-xs justify-end;
    .outside-action {
      @apply items-center gap-xs hidden;
      &.outside-show {
        @apply flex;
      }
    }
  }

  table {
    @apply w-full;
    tr {
      @apply relative;
      th {
        @apply whitespace-nowrap;
        .zpl-table-cell {
          @apply font-medium;
        }
      }
      td {
        .zpl-table-cell {
          @apply font-normal;
        }
      }
      th,
      td {
        .zpl-table-cell {
          // default
          @apply font-IRANYekanFaNum select-none p-md text-b2 text-text flex items-center gap-xs;

          // dark
          @apply dark:text-text-dark;

          &.can-sort {
            // default
            @apply cursor-pointer;

            .sort-icon {
              // default
              @apply w-xs text-icon;

              // dark
              @apply dark:text-icon-dark;
            }
          }
        }

        &.checkbox-holder {
          @apply w-[56px] p-md;
        }
      }
    }

    // Table Body
    > tbody > tr {
      // default
      @apply border-t border-border-divider;
      @apply hover:bg-surface-hover active:bg-surface-active focus:bg-surface-focus;
      &:hover {
        .outside-action {
          @apply flex;
        }
        .stick {
          @apply min-w-[150px];
        }
      }

      // dark
      @apply dark:border-border-dark-divider;
      @apply dark:hover:bg-surface-dark-hover dark:active:bg-surface-dark-active dark:focus:bg-surface-dark-focus;

      &.selected {
        // default
        @apply bg-primarySurface;

        // dark
        @apply dark:bg-primarySurface-dark;
      }
    }
  }

  .description {
    @apply text-b2;
  }

  .action-col {
    @apply pl-md;
    &.stick {
      @apply left-0 sticky #{!important};
      @apply min-w-[66px];
      & > div {
        @apply absolute top-0 left-0 bottom-0;
        @apply py-sm px-md #{!important};
        @apply shadow-elevation-50 bg-surface;
        @apply dark:shadow-dark-elevation-50 dark:bg-surface-dark;
      }
    }
    // &:not(&.stick) {
    //   .zpl-table-action {
    //     @apply w-[118px];
    //   }
    // }
  }

  .loading {
    // Show size
    @apply hidden md:table overflow-hidden;

    // default
    @apply bg-surface rounded-md w-full;

    // dark
    @apply dark:bg-surface-dark;

    &:not(.bordered) {
      @apply shadow-elevation-50;
      @apply dark:shadow-dark-elevation-50;
    }

    &.bordered {
      @apply border border-border-divider;
      @apply dark:border-border-dark-divider;
    }
    thead {
      th {
        @apply relative h-[56px] p-md;
      }
    }

    tbody {
      td {
        @apply relative h-[56px] p-md;
      }
    }
  }
}
