@use "../kit-deps" as *;
@use "typography" as *;

.table {
	width: 100%;
	text-align: left;
	border: $border-width-base solid $border-color-muted;
	border-collapse: collapse;
	background: $surface-panel-muted;

	.table-caption {
		text-align: left;
		font-size: $font-size-lg;
		background: $color-primary;
		width: max-content;
		color: $color-black;
		padding: $space-1 $space-3;
		margin-bottom: 0;
		font-weight: $font-weight-bold;
		text-transform: uppercase;
	}

	&.table-empty {
		width: 100%;

		.is-empty {
			width: 100%;
			padding: $space-4;
			font-size: $font-size-sm;
			color: $color-text-dark;
			text-align: left;
		}
	}

	.table-row {
		th,
		td {
			padding: $space-3 $space-5;
			font-size: $font-size-sm;
			vertical-align: middle;
			border-bottom: $border-width-base solid rgba($color-text-light, 0.08);
		}

		th {
			color: $color-primary;
			background: rgba($color-text-light, 0.04);
			text-transform: uppercase;
			letter-spacing: $letter-spacing-wide;
		}
	}

	.table-head {
		border-bottom: $border-width-base solid $color-primary;
	}

	.table-body {
		.table-row {
			transition-duration: $motion-base;
			transition-timing-function: $motion-ease;
			transition-property: background, color;

			td {
				transition-duration: $motion-base;
				transition-timing-function: $motion-ease;
				transition-property: color, background;
			}

			@include hover_touch {
				background: rgba($color-secondary, 0.08);

				td:first-child {
					color: $color-secondary;
				}
			}
		}
	}

	.table-foot {
		th,
		td {
			padding-top: $space-4;
		}
	}

	&.table-compact {
		.table-caption {
			font-size: $font-size-md;
		}

		.table-row {
			th,
			td {
				padding: $space-2 $space-3;
				font-size: $font-size-xs;
			}
		}

		.table-cell-mono {
			color: $color-text-medium;
			font-family: $font-family-code;
			letter-spacing: $letter-spacing-normal;
		}

		.table-cell-actions {
			width: 1%;
			white-space: nowrap;
		}
	}
}

.table-wrapper {
	width: 100%;
  overflow-x: auto;
}
