/**
 * APS Product Table
 *
 * Colours are exposed as custom properties on .aps-pt so the palette can be
 * overridden from the theme or Elementor without editing this file.
 */

.aps-pt {
	--aps-pt-navy: #071d3a;
	--aps-pt-teal: #0f9b8e;
	--aps-pt-border: #dae3ea;
	--aps-pt-head-bg: #f6f8fa;
	--aps-pt-row-hover: #f9fbfd;
	--aps-pt-text: #071d3a;
	--aps-pt-muted: #071d3a;
	--aps-pt-radius: 6px;
	--aps-pt-placeholder: #6b7b8c;

	color: var(--aps-pt-text);
	font-size: 14px;
}

/* ---------- Search ---------- */

.aps-pt__search {
	position: relative;
	margin-bottom: 20px;
}

.aps-pt .aps-pt__search-input {
	width: 100% !important;
	margin: 0 !important;
	padding: 1rem !important;
	padding-right: 3.25rem !important;
	border: 1px solid #dae3ea !important;
	border-radius: 6px !important;
	background-color: #fff !important;
	background-image: none !important;
	color: #6b7b8c !important;
	font-family: inherit !important;
	font-size: 14px !important;
	line-height: 1.4 !important;
	height: auto !important;
	min-height: 0 !important;
	box-shadow: none !important;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
	-webkit-appearance: none !important;
	appearance: none !important;
}

.aps-pt .aps-pt__search-input::placeholder {
	color: #6b7b8c !important;
	opacity: 1 !important;
}

.aps-pt .aps-pt__search-input:focus {
	outline: none !important;
	border-color: var(--aps-pt-teal) !important;
	box-shadow: 0 0 0 3px rgba(15, 155, 142, 0.12) !important;
}

/* Magnifier on the right of the field. */
.aps-pt__search::after {
	content: "";
	position: absolute;
	top: 50%;
	right: 1rem;
	width: 22px;
	height: 22px;
	transform: translateY(-50%);
	pointer-events: none;
	background-repeat: no-repeat;
	background-position: center;
	background-size: contain;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23071d3a' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E");
}

/* Hide the browser's native clear button so it doesn't sit under the icon. */
.aps-pt__search-input::-webkit-search-decoration,
.aps-pt__search-input::-webkit-search-cancel-button {
	-webkit-appearance: none;
}

/* ---------- Table ---------- */

.aps-pt__table-wrap {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: thin;
}

.aps-pt__table {
	width: 100%;
	border: 0;
	border-collapse: separate;
	border-spacing: 0;
	table-layout: fixed;
}

.aps-pt__th,
.aps-pt__td {
	padding: 16px 20px;
	text-align: left;
	vertical-align: middle;
	word-break: break-word;
}

/* Column widths, mirroring the catalogue design. */
.aps-pt__th--name,
.aps-pt__td--name {
	width: 28%;
}

.aps-pt__th--sku,
.aps-pt__td--sku {
	width: 24%;
}

.aps-pt__th--cas,
.aps-pt__td--cas {
	width: 22%;
}

.aps-pt__th--category,
.aps-pt__td--category {
	width: 26%;
}

/* ---------- Header ---------- */

.aps-pt__th {
	background-color: var(--aps-pt-head-bg);
	border: 0;
	border-bottom: 1px solid var(--aps-pt-border);
	font-size: 14px;
	font-weight: 600;
	color: var(--aps-pt-navy);
	white-space: nowrap;
}

.aps-pt .aps-pt__sort,
.aps-pt .aps-pt__sort:hover,
.aps-pt .aps-pt__sort:focus,
.aps-pt .aps-pt__sort:active {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	width: 100%;
	min-height: 0 !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 none !important;
	border-radius: 0 !important;
	background: none !important;
	background-color: transparent !important;
	box-shadow: none !important;
	color: var(--aps-pt-navy) !important;
	font-family: inherit;
	font-size: inherit;
	font-weight: inherit;
	line-height: inherit;
	letter-spacing: inherit;
	text-transform: none;
	text-decoration: none;
	text-align: left;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
}

.aps-pt .aps-pt__sort.is-sorted {
	color: var(--aps-pt-teal) !important;
}

.aps-pt__sort:focus-visible {
	outline: 2px solid var(--aps-pt-teal);
	outline-offset: 3px;
	border-radius: 2px;
}

.aps-pt__sort-icon {
	flex: none;
	width: 10px;
	height: 14px;
	background-repeat: no-repeat;
	background-position: center;
	background-size: contain;
	opacity: 0.45;
	transition: opacity 0.15s ease;
	/* Neutral state: both arrows. */
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 14' fill='none' stroke='%23071d3a' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 1.5v11'/%3E%3Cpath d='M2 4.5L5 1.5l3 3'/%3E%3Cpath d='M2 9.5l3 3 3-3'/%3E%3C/svg%3E");
}

.aps-pt__sort:hover .aps-pt__sort-icon {
	opacity: 0.8;
}

.aps-pt__sort.is-sorted {
	color: var(--aps-pt-teal);
}

.aps-pt__sort.is-sorted .aps-pt__sort-icon {
	opacity: 1;
}

.aps-pt__sort.is-asc .aps-pt__sort-icon {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 14' fill='none' stroke='%230f9b8e' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5v-11'/%3E%3Cpath d='M1.5 5L5 1.5 8.5 5'/%3E%3C/svg%3E");
}

.aps-pt__sort.is-desc .aps-pt__sort-icon {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 14' fill='none' stroke='%230f9b8e' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 1.5v11'/%3E%3Cpath d='M1.5 9L5 12.5 8.5 9'/%3E%3C/svg%3E");
}

/* ---------- Rows ---------- */

.aps-pt__td {
	border: 0;
	border-bottom: 1px solid var(--aps-pt-border);
}

.aps-pt__row:hover .aps-pt__td {
	background-color: var(--aps-pt-row-hover);
}

.aps-pt__td {
	font-size: 14px;
	color: var(--aps-pt-text);
}

.aps-pt__td--name {
	font-weight: 600;
}

.aps-pt__link {
	color: var(--aps-pt-navy);
	text-decoration: none;
	transition: color 0.15s ease;
}

.aps-pt__link:hover,
.aps-pt__link:focus {
	color: var(--aps-pt-teal);
	text-decoration: underline;
	text-underline-offset: 3px;
}

/* ---------- Empty state ---------- */

.aps-pt__no-results,
.aps-pt-empty {
	margin: 24px 0;
	padding: 28px 20px;
	border: 1px solid var(--aps-pt-border);
	border-radius: var(--aps-pt-radius);
	background-color: var(--aps-pt-head-bg);
	color: var(--aps-pt-muted);
	text-align: center;
}

/* ---------- Pagination ---------- */

.aps-pt__pagination {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-wrap: wrap;
	gap: 6px;
	margin-top: 24px;
}

.aps-pt__page-numbers {
	display: inline-flex;
	flex-wrap: wrap;
	gap: 6px;
}

.aps-pt .aps-pt__pagination button {
	margin: 0 !important;
	min-width: 38px !important;
	height: 38px !important;
	padding: 0 12px !important;
	border: 1px solid var(--aps-pt-border) !important;
	border-radius: 4px !important;
	background-color: #fff !important;
	background-image: none !important;
	color: var(--aps-pt-navy) !important;
	font-family: inherit !important;
	font-size: 14px !important;
	font-weight: 500 !important;
	line-height: 1 !important;
	letter-spacing: normal !important;
	text-transform: none !important;
	text-decoration: none !important;
	box-shadow: none !important;
	cursor: pointer;
	transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
	-webkit-appearance: none !important;
	appearance: none !important;
}

.aps-pt .aps-pt__pagination button:hover:not(:disabled):not(.is-current) {
	border-color: var(--aps-pt-teal) !important;
	color: var(--aps-pt-teal) !important;
}

.aps-pt__pagination button:focus-visible {
	outline: 2px solid var(--aps-pt-teal);
	outline-offset: 2px;
}

.aps-pt .aps-pt__pagination button:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

.aps-pt .aps-pt__page-number.is-current,
.aps-pt .aps-pt__page-number.is-current:hover,
.aps-pt .aps-pt__page-number.is-current:focus {
	background-color: var(--aps-pt-teal) !important;
	border-color: var(--aps-pt-teal) !important;
	color: #fff !important;
	font-weight: 600 !important;
	cursor: default;
}

.aps-pt__pagination[hidden],
.aps-pt__no-results[hidden] {
	display: none;
}

/* ---------- Mobile: keep the table, scroll it sideways ---------- */

@media (max-width: 767px) {
	/* Fixed layout would squeeze the columns; auto lets them keep their
	   natural width so the wrapper scrolls instead of the text wrapping. */
	.aps-pt__table {
		table-layout: auto;
		min-width: 640px;
	}

	.aps-pt__th,
	.aps-pt__td {
		padding: 14px 16px;
		white-space: nowrap;
	}

	/* The percentage widths only make sense in the fixed layout above. */
	.aps-pt__th--name,
	.aps-pt__td--name,
	.aps-pt__th--sku,
	.aps-pt__td--sku,
	.aps-pt__th--cas,
	.aps-pt__td--cas,
	.aps-pt__th--category,
	.aps-pt__td--category {
		width: auto;
	}
}

/* ---------- Accessibility helper ---------- */

.aps-pt .screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}
