@use 'exports' as *;
@use '@lucca-front/scss/src/commons/utils/media';

.indexTable {
	@layer components {
		@include vars;
		@include component;
	}

	@layer mods {
		&.mod-selectable {
			@include selectable;
			@include selectableSelectedRow;
			@include selectableHoveredRow;
		}

		&:has(.mod-stack2, .mod-stack3),
		&.mod-stackable {
			@include stackable;
		}

		&.mod-stickyHeader {
			@include stickyHeader;
		}

		// Allow selection of mod-layoutFixed with or without breakpoints like mod-layoutFixedAtMediaMinXS or mod-layoutFixedAtMediaMaxL
		&[class*='mod-layoutFixed'] {
			@include layoutFixed;
		}

		.indexTable-head-row.mod-massSelection {
			@include massSelection;
		}

		.indexTable-head-row-cell,
		.indexTable-body-row-cell {
			&.mod-actions {
				@include actions;
			}
		}

		.indexTable-body-row-cell,
		.indexTable-foot-row-cell {
			&.mod-tfoot {
				@include tfoot;
			}
		}

		.indexTable-head-row-cell,
		.indexTable-body-row-cell,
		.indexTable-body-row-transparentCell,
		.indexTable-foot-row-cell {
			&.mod-alignEnd,
			&.mod-alignRight {
				@include alignEnd;
			}

			&.mod-alignCenter {
				@include alignCenter;
			}

			&.mod-alignStart,
			&.mod-alignLeft {
				@include alignStart;
			}
		}

		@include media.max('S') {
			&.mod-responsiveCardList {
				@include responsiveCardList;
			}

			&.mod-selectable.mod-responsiveCardList {
				@include selectableResponsiveCardList;
			}

			&.mod-stackable.mod-responsiveCardList {
				@include stackableResponsiveCardList;
			}

			&.mod-selectable.mod-stackable.mod-responsiveCardList {
				@include selectableStackableResponsiveCardList;
			}
		}

		&:not(:has(.indexTable-head[inert='inert'])) {
			@include focusedRow;
			@include hoveredRow;
		}

		@include openClosedRow;

		.indexTable-body-row {
			&:first-child {
				&:has(.indexTable-body-row-cellTitle-button.button[aria-expanded='false']) {
					~ .indexTable-body-row {
						@include rowsHidden;
					}
				}
			}
		}

		.indexTable-body-row-cellTitle-button.button {
			@include groupButton;
		}
	}
}

.indexTableWrapper {
	@layer mods {
		.pagination-scrolling .button:hover {
			@include paginationHover;
		}
	}
}
