/*
 * Citizen
 *
 * SkinStyles for Extension:SemanticMediaWiki
 * Module: smw.tableprinter.datatable
 * Version: 4.1.1 (8c09283)
 *
 * Date: 2023-07-16
*/

.smw-datatable {
	margin-top: var( --space-md );
	margin-bottom: var( --space-md );
}

.smw-datatable table.dataTable {
	margin-bottom: var( --space-md );
}

.smw-datatable table.dataTable.no-footer {
	border-bottom-color: var( --border-color-base );
}

.smw-datatable table.dataTable tfoot td {
	border-top-color: var( --border-color-base );
	// padding: 10px 18px 10px 10px;
	border-bottom-color: var( --border-color-base );
}

.smw-datatable table.dataTable.compact tfoot th,
.smw-datatable table.dataTable.compact tfoot td {
	border-top-color: var( --border-color-base );
	// padding: 4px;
	border-bottom-color: var( --border-color-base );
}

.smw-datatable table.dataTable thead th,
.smw-datatable table.dataTable thead td,
.smw-datatable table.data.smw-datatable table.compact thead th,
.smw-datatable table.data.smw-datatable table.compact thead td,
.smw-datatable table.data.smw-datatable table.no-footer {
	border-bottom-color: var( --border-color-base );
}

.smw-datatable table.dataTable thead th,
.smw-datatable table.dataTable thead td,
.smw-datatable table.data.smw-datatable table.compact thead th,
.smw-datatable table.data.smw-datatable table.compact thead td {
	border-top: 0; // already covered by wikitable styles
}

.smw-datatable .dataTables_wrapper select,
.smw-datatable .dataTables_wrapper .dataTables_filter input {
	color: var( --color-emphasized );
	border: var( --border-width-base ) solid var( --border-color-base );
}

.smw-datatable .dataTables_wrapper .dataTables_paginate .paginate_button {
	font-weight: var( --font-weight-medium ) !important;
	color: var( --color-emphasized ) !important;
	border-color: var( --border-color-base );
	border-radius: var( --border-radius-base ) !important;
	transition: none !important;
}

.smw-datatable .dataTables_wrapper .dataTables_paginate .paginate_button.current,
.smw-datatable .dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
	color: var( --color-emphasized ) !important;
	pointer-events: none;
	background: var( --background-color-progressive-subtle );
	border-color: transparent;
}

.smw-datatable .dataTables_wrapper .dataTables_paginate .paginate_button:hover {
	background: var( --background-color-button-quiet--hover );
	border-color: transparent;
}

.smw-datatable .dataTables_wrapper select:focus,
.smw-datatable .dataTables_wrapper select:active,
.smw-datatable .dataTables_wrapper .dataTables_filter input:focus,
.smw-datatable .dataTables_wrapper .dataTables_filter input:active {
	border-color: var( --color-progressive );
}

.smw-datatable-toolbar .smw-dropdown {
	button {
		border-color: var( --border-color-base );
	}
}

/* Sync with ext.cargo.datatables */
table.dataTable {
	max-width: 100%;
	overflow: auto;
	font-size: var( --font-size-small );
}

table.dataTable thead th,
table.dataTable tfoot th {
	font-weight: var( --font-weight-semi-bold );
}

table.dataTable thead th,
table.dataTable thead td {
	padding: var( --space-xs ) var( --space-sm );
	font-size: var( --font-size-x-small );
	font-weight: var( --font-weight-normal );
	color: var( --color-subtle );
	text-align: start;
	letter-spacing: 0.05em;
	border-bottom-color: var( --border-color-base );
}

table.dataTable tfoot th,
table.dataTable tfoot td {
	border-top-color: var( --border-color-base );
}

table.dataTable thead .sorting,
table.dataTable thead .sorting_asc,
table.dataTable thead .sorting_desc {
	&:hover {
		background-color: var( --background-color-button-quiet--hover );
	}

	&:active {
		background-color: var( --background-color-button-quiet--active );
	}
}

table.dataTable thead .sorting,
table.dataTable thead .sorting_asc,
table.dataTable thead .sorting_desc,
table.dataTable thead .sorting_asc_disabled,
table.dataTable thead .sorting_desc_disabled {
	// 19px is the icon size
	padding-right: ~'calc( 19px + var( --space-sm ) )';
	background-position-x: ~'calc( 100% - var( --space-xs ) )';
}

table.dataTable tbody tr {
	background-color: var( --color-surface-0 );
}

table.dataTable tbody tr.selected {
	background-color: var( --background-color-button-quiet--hover );
}

table.dataTable tbody th,
table.dataTable tbody td {
	padding: var( --space-xs ) var( --space-sm );
}

table.dataTable.row-border tbody th,
table.dataTable.row-border tbody td,
table.dataTable.display tbody th,
table.dataTable.display tbody td {
	border-top-color: var( --border-color-base );
}

table.dataTable.cell-border tbody th,
table.dataTable.cell-border tbody td {
	border-top-color: var( --border-color-base );
	border-right-color: var( --border-color-base );
}

table.dataTable.cell-border tbody tr th:first-child,
table.dataTable.cell-border tbody tr td:first-child {
	border-left-color: var( --border-color-base );
}

table.dataTable.stripe tbody tr.odd,
table.dataTable.display tbody tr.odd {
	background-color: var( --color-surface-2 );
}

table.dataTable.stripe tbody tr.odd.selected,
table.dataTable.display tbody tr.odd.selected {
	background-color: var( --background-color-button-quiet--hover );
}

table.dataTable.hover tbody tr:hover,
table.dataTable.display tbody tr:hover,
table.dataTable.hover tbody tr:hover.selected,
table.dataTable.display tbody tr:hover.selected {
	background-color: var( --background-color-button-quiet--hover );
}

table.dataTable.order-column tbody tr > .sorting_1,
table.dataTable.order-column tbody tr > .sorting_2,
table.dataTable.order-column tbody tr > .sorting_3,
table.dataTable.display tbody tr > .sorting_1,
table.dataTable.display tbody tr > .sorting_2,
table.dataTable.display tbody tr > .sorting_3 {
	background-color: var( --color-surface-3 );
}

table.dataTable.order-column tbody tr.selected > .sorting_1,
table.dataTable.order-column tbody tr.selected > .sorting_2,
table.dataTable.order-column tbody tr.selected > .sorting_3,
table.dataTable.display tbody tr.selected > .sorting_1,
table.dataTable.display tbody tr.selected > .sorting_2,
table.dataTable.display tbody tr.selected > .sorting_3 {
	background-color: var( --color-surface-3 );
}

table.dataTable.display tbody tr.odd > .sorting_1,
table.dataTable.order-column.stripe tbody tr.odd > .sorting_1 {
	background-color: var( --color-surface-3 );
}

table.dataTable.display tbody tr.odd > .sorting_2,
table.dataTable.order-column.stripe tbody tr.odd > .sorting_2 {
	background-color: var( --color-surface-3 );
}

table.dataTable.display tbody tr.odd > .sorting_3,
table.dataTable.order-column.stripe tbody tr.odd > .sorting_3 {
	background-color: var( --color-surface-3 );
}

table.dataTable.display tbody tr.odd.selected > .sorting_1,
table.dataTable.order-column.stripe tbody tr.odd.selected > .sorting_1 {
	background-color: var( --color-surface-3 );
}

table.dataTable.display tbody tr.odd.selected > .sorting_2,
table.dataTable.order-column.stripe tbody tr.odd.selected > .sorting_2 {
	background-color: var( --color-surface-3 );
}

table.dataTable.display tbody tr.odd.selected > .sorting_3,
table.dataTable.order-column.stripe tbody tr.odd.selected > .sorting_3 {
	background-color: var( --color-surface-3 );
}

table.dataTable.display tbody tr.even > .sorting_1,
table.dataTable.order-column.stripe tbody tr.even > .sorting_1 {
	background-color: var( --color-surface-3 );
}

table.dataTable.display tbody tr.even > .sorting_2,
table.dataTable.order-column.stripe tbody tr.even > .sorting_2 {
	background-color: var( --color-surface-3 );
}

table.dataTable.display tbody tr.even > .sorting_3,
table.dataTable.order-column.stripe tbody tr.even > .sorting_3 {
	background-color: var( --color-surface-3 );
}

table.dataTable.display tbody tr.even.selected > .sorting_1,
table.dataTable.order-column.stripe tbody tr.even.selected > .sorting_1 {
	background-color: var( --color-surface-3 );
}

table.dataTable.display tbody tr.even.selected > .sorting_2,
table.dataTable.order-column.stripe tbody tr.even.selected > .sorting_2 {
	background-color: var( --color-surface-3 );
}

table.dataTable.display tbody tr.even.selected > .sorting_3,
table.dataTable.order-column.stripe tbody tr.even.selected > .sorting_3 {
	background-color: var( --color-surface-3 );
}

table.dataTable.display tbody tr:hover > .sorting_1,
table.dataTable.order-column.hover tbody tr:hover > .sorting_1 {
	background-color: var( --color-surface-3 );
}

table.dataTable.display tbody tr:hover > .sorting_2,
table.dataTable.order-column.hover tbody tr:hover > .sorting_2 {
	background-color: var( --color-surface-3 );
}

table.dataTable.display tbody tr:hover > .sorting_3,
table.dataTable.order-column.hover tbody tr:hover > .sorting_3 {
	background-color: var( --color-surface-3 );
}

table.dataTable.display tbody tr:hover.selected > .sorting_1,
table.dataTable.order-column.hover tbody tr:hover.selected > .sorting_1 {
	background-color: var( --color-surface-3 );
}

table.dataTable.display tbody tr:hover.selected > .sorting_2,
table.dataTable.order-column.hover tbody tr:hover.selected > .sorting_2 {
	background-color: var( --color-surface-3 );
}

table.dataTable.display tbody tr:hover.selected > .sorting_3,
table.dataTable.order-column.hover tbody tr:hover.selected > .sorting_3 {
	background-color: var( --color-surface-3 );
}

table.dataTable.no-footer {
	border-bottom-color: var( --border-color-base );
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
	font-weight: var( --font-weight-medium );
	color: var( --color-emphasized ) !important;
	border-radius: var( --border-radius-base );
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
	color: var( --color-emphasized ) !important;
	background: var( --background-color-progressive-subtle );
	border-color: transparent;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:active {
	color: var( --color-subtle ) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
	color: var( --color-emphasized ) !important;
	background: var( --background-color-button-quiet--hover );
	border-color: transparent;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:active {
	background: var( --background-color-button-quiet--active );
	box-shadow: none;
}

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_processing,
.dataTables_wrapper .dataTables_paginate {
	font-size: var( --font-size-small );
	color: var( --color-base );
}

.dataTables_wrapper .dataTables_filter + .dataTable {
	// Add top border as divider if there are filter on top
	border-top: var( --border-width-base ) solid var( --border-color-base );
}
