/* Catalog product tables, styled after the approved Figma layout
   ("Таблицы 1280px — согласованная версия, тонкие разделители").
   Markup comes from the Bitrix visual editor, so everything is driven by
   generic table selectors plus classes added by /local/js/catalog-table.js */

.catalog-table {
	--ct-head-bg: #1f4a7a;
	--ct-head-line: rgba(255, 255, 255, 0.18);
	--ct-line: #e4e8ed;
	--ct-group-bg: #eff3f9;
	--ct-muted: #7b828c;
	--ct-text: #111;
	--ct-accent: #006eb7;
	--ct-radius: 0.625em;

	max-width: 100%;
	font-size: 1em;
	line-height: 1.35;
	color: var(--ct-text);
}

.catalog-table a {
	color: var(--ct-accent);
}

.catalog-table img {
	max-width: 100%;
	height: auto;
}

/* Horizontal scrolling belongs to the table only, never to text blocks. */
.catalog-table__scroll {
	overflow-x: auto;
	overflow-y: hidden;
	max-width: 100%;
	padding-bottom: 0.75em;
	margin-bottom: 0.5em;
}

.catalog-table__scroll::-webkit-scrollbar {
	height: 0.375em;
}

.catalog-table__scroll::-webkit-scrollbar-track {
	background: #e9ecef;
	border-radius: 1em;
}

.catalog-table__scroll::-webkit-scrollbar-thumb {
	background: var(--ct-accent);
	border-radius: 1em;
}

.catalog-table__scroll {
	scrollbar-width: thin;
	scrollbar-color: var(--ct-accent) #e9ecef;
}

.catalog-table table.ct {
	border-collapse: separate;
	border-spacing: 0;
	width: 100%;
	border: 0;
	background: #fff;
	font-size: 0.875em;
}

.catalog-table table.ct td,
.catalog-table table.ct th {
	border: 0;
	border-bottom: 1px solid var(--ct-line);
	border-right: 1px solid var(--ct-line);
	padding: 0.85em 1em;
	vertical-align: middle;
	text-align: center;
	font-weight: 400;
	background: #fff;
}

.catalog-table table.ct td p,
.catalog-table table.ct th p {
	margin: 0;
	padding: 0;
	text-align: inherit;
}

.catalog-table table.ct td:last-child,
.catalog-table table.ct th:last-child {
	border-right: 0;
}

.catalog-table table.ct tr:last-child > td {
	border-bottom: 0;
}

/* Values stay on one line so the table scrolls instead of wrapping. */
.catalog-table table.ct--wide td:nth-child(n + 3) {
	white-space: nowrap;
}

/* Few columns means long descriptive text, which reads better left aligned. */
.catalog-table table.ct:not(.ct--wide) td,
.catalog-table table.ct:not(.ct--wide) th,
.catalog-table table.ct:not(.ct--wide) tr.ct__head > td,
.catalog-table table.ct:not(.ct--wide) tr.ct__head > th {
	text-align: left;
}

/* Grade name column: only on body rows of named-grade tables.
   Compact composition tables (Co / Cr / Mo …) stay evenly centered. */
.catalog-table table.ct--grades tr:not(.ct__head):not(.ct__head-top):not(.ct__group) > td:first-child,
.catalog-table table.ct--grades tr:not(.ct__head):not(.ct__head-top):not(.ct__group) > th:first-child {
	text-align: left;
	font-weight: 600;
	min-width: 11em;
}

/* Second column: equivalents / form, muted */
.catalog-table table.ct--muted2 tr:not(.ct__head):not(.ct__group) > td:nth-child(2) {
	text-align: left;
	color: var(--ct-muted);
	min-width: 8em;
}

.catalog-table table.ct--empty {
	display: none;
}

/* Header */
.catalog-table table.ct tr.ct__head > td,
.catalog-table table.ct tr.ct__head > th,
.catalog-table table.ct tr.ct__head-top > td {
	background: var(--ct-head-bg);
	color: #fff;
	font-weight: 600;
	font-size: 0.9285em;
	text-align: center;
	border-bottom: 0;
	border-right: 1px solid var(--ct-head-line);
	padding: 0.8em 1em;
	white-space: nowrap;
}

.catalog-table table.ct tr.ct__head *,
.catalog-table table.ct tr.ct__head-top * {
	color: inherit;
	background: transparent;
}

.catalog-table table.ct tr.ct__head > td,
.catalog-table table.ct tr.ct__head > th,
.catalog-table table.ct tr.ct__head > td:first-child,
.catalog-table table.ct tr.ct__head > th:first-child,
.catalog-table table.ct tr.ct__head > td[colspan],
.catalog-table table.ct tr.ct__head > td[rowspan] {
	text-align: center;
}

.catalog-table table.ct--grades tr.ct__head > td:first-child,
.catalog-table table.ct--grades tr.ct__head > th:first-child {
	text-align: left;
}

.catalog-table table.ct tr.ct__head-top > td {
	text-align: center;
	border-right: 0;
}

.catalog-table table.ct tr.ct__head-top:first-child > td:first-child {
	border-top-left-radius: var(--ct-radius);
	border-top-right-radius: var(--ct-radius);
}

.catalog-table table.ct tr.ct__head:first-child > td:first-child,
.catalog-table table.ct tr.ct__head:first-child > th:first-child {
	border-top-left-radius: var(--ct-radius);
}

.catalog-table table.ct tr.ct__head:first-child > td:last-child,
.catalog-table table.ct tr.ct__head:first-child > th:last-child {
	border-top-right-radius: var(--ct-radius);
}

/* Section rows ("Стали", "Жаропрочные сплавы", ...) */
/* Second header line ("max", "Не более") spans the value columns */
.catalog-table table.ct tr.ct__head > td[colspan] {
	text-align: center;
}

.catalog-table table.ct tr.ct__group > td {
	background: var(--ct-group-bg);
	text-align: left;
	font-weight: 600;
	padding: 0.7em 1em;
	border-right: 0;
	cursor: pointer;
	-webkit-user-select: none;
	user-select: none;
}

/* Keeps the section title visible while the table scrolls sideways. */
.catalog-table .ct__group-inner {
	display: inline-flex;
	align-items: center;
	gap: 0.6em;
	position: sticky;
	left: 1em;
}

.catalog-table .ct__group-arrow {
	flex-shrink: 0;
	width: 0.9em;
	height: 0.9em;
	color: var(--ct-accent);
	transition: transform 0.2s;
}

.catalog-table tr.ct__group.is-collapsed .ct__group-arrow {
	transform: rotate(-90deg);
}

.catalog-table .ct__group-count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 1.6em;
	height: 1.6em;
	padding: 0 0.4em;
	border-radius: 1em;
	background: var(--ct-accent);
	color: #fff;
	font-size: 0.78em;
	font-weight: 600;
}

/* Sticky first column while scrolling sideways */
.catalog-table table.ct--sticky tr:not(.ct__group):not(.ct__head-top) > td:first-child,
.catalog-table table.ct--sticky tr:not(.ct__group):not(.ct__head-top) > th:first-child {
	position: sticky;
	left: 0;
	z-index: 2;
}

.catalog-table table.ct--sticky.is-scrolled tr:not(.ct__group):not(.ct__head-top) > td:first-child,
.catalog-table table.ct--sticky.is-scrolled tr:not(.ct__group):not(.ct__head-top) > th:first-child {
	box-shadow: 8px 0 12px -8px rgba(0, 0, 0, 0.18);
}

@media screen and (max-width: 992px) {
	.catalog-table table.ct {
		font-size: 0.8125em;
	}

	.catalog-table table.ct td,
	.catalog-table table.ct th {
		padding: 0.7em 0.75em;
	}

	.catalog-table table.ct--grades tr:not(.ct__head):not(.ct__head-top):not(.ct__group) > td:first-child,
	.catalog-table table.ct--grades tr:not(.ct__head):not(.ct__head-top):not(.ct__group) > th:first-child {
		min-width: 9em;
	}
}
