/* ==========================================================================
   Shoufei Spectrum — catalog, product table, gallery modal, product page
   Requires the theme's carbon.css (loaded before this file).
   ========================================================================== */

.catalog-layout {
	display: grid;
	grid-template-columns: 1fr;
	gap: 2rem;
	max-width: 99rem;
	margin: 3rem auto 0;
	padding: 2.5rem 1.5rem 5rem;
}

@media (min-width: 1056px) {
	.catalog-layout {
		grid-template-columns: 16rem 1fr;
		padding-left: 4rem;
		padding-right: 4rem;
	}
}

/* ---- Sidebar tree ---- */

.catalog-sidebar-title {
	margin: 0 0 0.75rem;
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.32px;
	text-transform: uppercase;
	color: var(--cds-gray-60, #6f6f6f);
}

.catalog-tree-level {
	margin: 0;
	padding: 0;
	list-style: none;
}

.catalog-tree-level .catalog-tree-level {
	padding-left: 1rem;
}

.catalog-tree li {
	border-bottom: 1px solid var(--cds-gray-20, #e0e0e0);
}

.catalog-tree li li {
	border-bottom: 0;
}

.catalog-tree a {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 0.5rem;
	padding: 0.625rem 0.5rem;
	font-size: 0.875rem;
	color: var(--cds-gray-100, #161616);
}

.catalog-tree .catalog-tree-level a {
	color: var(--cds-gray-70, #525252);
	font-weight: 400;
}

.catalog-tree > .catalog-tree-level > li > a {
	font-weight: 600;
}

.catalog-tree a:hover {
	background: var(--cds-gray-10, #f4f4f4);
}

.catalog-tree li.is-active > a {
	color: var(--cds-blue-60, #0f62fe);
	box-shadow: inset 3px 0 0 var(--cds-blue-60, #0f62fe);
	background: var(--cds-gray-10, #f4f4f4);
}

.tree-count {
	font-family: 'IBM Plex Mono', monospace;
	font-size: 0.6875rem;
	color: var(--cds-gray-50, #8d8d8d);
}

/* ---- Breadcrumb & titles ---- */

.cds-breadcrumb {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem;
	margin-bottom: 1.5rem;
	font-size: 0.875rem;
}

.cds-breadcrumb a {
	color: var(--cds-blue-60, #0f62fe);
}

.cds-breadcrumb .sep {
	color: var(--cds-gray-50, #8d8d8d);
}

.catalog-title {
	margin: 0 0 1.5rem;
	font-size: clamp(1.75rem, 3.4vw, 2.625rem);
	font-weight: 400;
}

.catalog-subtitle {
	margin: 0 0 1.25rem;
	font-size: clamp(1.25rem, 2.2vw, 1.75rem);
	font-weight: 400;
}

/* ---- Subcategory tiles ---- */

.subcat-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
	gap: 1px;
	background: var(--cds-gray-20, #e0e0e0);
	border: 1px solid var(--cds-gray-20, #e0e0e0);
}

.subcat-tile {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	min-height: 5rem;
	padding: 1.25rem 1.5rem;
	background: var(--cds-gray-10, #f4f4f4);
	color: var(--cds-gray-100, #161616);
	font-size: 0.9375rem;
	font-weight: 500;
	transition: background 150ms;
}

.subcat-tile:hover {
	background: var(--cds-gray-20, #e0e0e0);
}

.subcat-tile .count,
.subcat-tile .tile-sub {
	font-family: 'IBM Plex Mono', monospace;
	font-size: 0.75rem;
	font-weight: 400;
	color: var(--cds-gray-60, #6f6f6f);
}

/* ---- Product table ---- */

.table-scroll {
	overflow-x: auto;
	border: 1px solid var(--cds-gray-20, #e0e0e0);
}

.product-table {
	width: 100%;
	min-width: 960px;
	border-collapse: collapse;
	font-size: 0.875rem;
}

.product-table th {
	background: var(--cds-gray-10, #f4f4f4);
	padding: 0.75rem 1rem 0.5rem;
	border-bottom: 1px solid var(--cds-gray-30, #c6c6c6);
	text-align: left;
	vertical-align: top;
	white-space: nowrap;
}

.col-label {
	display: block;
	font-weight: 600;
}

.col-unit {
	display: block;
	margin-top: 2px;
	font-family: 'IBM Plex Mono', monospace;
	font-size: 0.6875rem;
	font-weight: 400;
	color: var(--cds-gray-60, #6f6f6f);
}

.product-table td {
    width: 1%;
    white-space: nowrap;
	padding: 0.625rem 1rem;
	border-bottom: 1px solid var(--cds-gray-20, #e0e0e0);
	vertical-align: middle;
}

.product-table tbody tr:hover {
	background: var(--cds-gray-10, #f4f4f4);
}

.cell-img { width: 72px; }

.table-thumb {
	display: block;
	width: 64px;
	height: 64px;
	padding: 0;
	border: 1px solid var(--cds-gray-20, #e0e0e0);
	background: #161616;
	cursor: zoom-in;
}

.table-thumb:hover {
	border-color: var(--cds-blue-60, #0f62fe);
}

.table-thumb img {
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.cell-partnumber a {
	font-weight: 600;
}

.cell-desc {
	max-width: 240px;
	color: var(--cds-gray-70, #525252);
}

.cell-num {
	font-family: 'IBM Plex Mono', monospace;
	font-size: 0.8125rem;
	white-space: nowrap;
}

/* ---- Filter row ---- */

.filter-cell {
	padding-top: 0.25rem;
}

.filter-input,
.filter-range-input {
	height: 2rem;
	padding: 0 0.5rem;
	font-size: 0.8125rem;
	background: #fff;
	border: 1px solid var(--cds-gray-30, #c6c6c6);
}

.filter-input { width: 100%; }
.filter-range-input { width: 4.5rem; text-align: right; }
.filter-range { white-space: nowrap; color: var(--cds-gray-50, #8d8d8d); }

/* Custom select */

.cds-select {
	position: relative;
	min-width: 9rem;
}

.cds-select-toggle {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 0.5rem;
	width: 100%;
	height: 2rem;
	padding: 0 0.5rem;
	font-size: 0.8125rem;
	background: #fff;
	border: 1px solid var(--cds-gray-30, #c6c6c6);
	cursor: pointer;
}

.cds-select-panel {
	position: absolute;
	z-index: 60;
	top: calc(100% + 2px);
	left: 0;
	min-width: 100%;
	max-height: 16rem;
	overflow-y: auto;
	background: #fff;
	border: 1px solid var(--cds-gray-30, #c6c6c6);
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
}

.cds-select-search {
	position: sticky;
	top: 0;
	padding: 0.375rem;
	background: #fff;
	border-bottom: 1px solid var(--cds-gray-20, #e0e0e0);
}

.cds-select-search input {
	width: 100%;
	height: 1.75rem;
	padding: 0 0.5rem;
	font-size: 0.8125rem;
	border: 1px solid var(--cds-gray-30, #c6c6c6);
}

.cds-select-option {
	display: block;
	width: 100%;
	padding: 0.5rem 0.625rem;
	font-size: 0.8125rem;
	background: none;
	border: 0;
	cursor: pointer;
	text-align: left;
	white-space: nowrap;
}

.cds-select-option:hover {
	background: var(--cds-gray-10, #f4f4f4);
}

.cds-select-option.is-selected {
	color: var(--cds-blue-60, #0f62fe);
	font-weight: 600;
}

.moq-note {
	margin-top: 0.75rem;
	font-size: 0.8125rem;
	color: var(--cds-gray-60, #6f6f6f);
}

.empty-state {
	padding: 4rem 1.5rem;
	text-align: center;
	background: var(--cds-gray-10, #f4f4f4);
}

.empty-state h3 { margin: 0 0 0.5rem; }
.empty-state p { margin: 0; color: var(--cds-gray-60, #6f6f6f); font-size: 0.875rem; }

/* ---- Gallery modal ---- */

.gallery-overlay {
	position: fixed;
	inset: 0;
	z-index: 10000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 2rem;
	background: rgba(22, 22, 22, 0.7);
}

.gallery-overlay[hidden] { display: none; }

.gallery-dialog {
	width: min(720px, 100%);
	background: #fff;
	box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
}

.gallery-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0.75rem 1rem;
	border-bottom: 1px solid var(--cds-gray-20, #e0e0e0);
}

.gallery-title { font-weight: 600; }

.gallery-close {
	width: 2.5rem;
	height: 2.5rem;
	border: 0;
	background: none;
	font-size: 1.5rem;
	cursor: pointer;
}

.gallery-close:hover { background: var(--cds-gray-10, #f4f4f4); }

.gallery-stage {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	height: 420px;
	background: #161616;
}

.gallery-image {
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
}

.gallery-arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 3rem;
	height: 3rem;
	background: rgba(255, 255, 255, 0.12);
	border: 0;
	color: #fff;
	font-size: 1.75rem;
	cursor: pointer;
}

.gallery-arrow:hover { background: var(--cds-blue-60, #0f62fe); }
.gallery-arrow--prev { left: 0; }
.gallery-arrow--next { right: 0; }

.gallery-thumbs {
	display: flex;
	gap: 0.5rem;
	padding: 0.75rem 1rem;
	border-top: 1px solid var(--cds-gray-20, #e0e0e0);
	overflow-x: auto;
}

.gallery-thumb {
	width: 64px;
	height: 64px;
	padding: 0;
	border: 2px solid transparent;
	background: #161616;
	cursor: pointer;
	flex-shrink: 0;
}

.gallery-thumb img {
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.gallery-thumb.is-active {
	border-color: var(--cds-blue-60, #0f62fe);
}

/* ---- Single product page ---- */

.product-page {
	max-width: 99rem;
	margin: 3rem auto 0;
	padding: 2.5rem 1.5rem 5rem;
}

@media (min-width: 1056px) {
	.product-page { padding-left: 4rem; padding-right: 4rem; }
}

.product-hero {
	display: grid;
	grid-template-columns: 1fr;
	gap: 2.5rem;
	margin-bottom: 4rem;
}

@media (min-width: 900px) {
	.product-hero { grid-template-columns: 1fr 1fr; }
}

.product-gallery-main {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 420px;
	background: #161616;
	cursor: zoom-in;
}

.product-gallery-main img {
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
}

.product-thumbs {
	display: flex;
	gap: 0.5rem;
	margin-top: 0.75rem;
}

.product-info .product-title {
	margin: 0 0 0.75rem;
	font-size: clamp(1.75rem, 3vw, 2.625rem);
	font-weight: 400;
}

.product-info .short-desc {
	color: var(--cds-gray-70, #525252);
	line-height: 1.6;
}

.attr-list {
	border-top: 1px solid var(--cds-gray-20, #e0e0e0);
	margin: 1.5rem 0;
}

.attr-row {
	display: flex;
	justify-content: space-between;
	gap: 1rem;
	padding: 0.625rem 0;
	border-bottom: 1px solid var(--cds-gray-20, #e0e0e0);
	font-size: 0.875rem;
}

.attr-row .attr-label { color: var(--cds-gray-60, #6f6f6f); }
.attr-row .attr-value { font-family: 'IBM Plex Mono', monospace; font-size: 0.8125rem; }

.product-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	margin-top: 1.25rem;
}

.cds-btn-tertiary {
	background: transparent;
	color: var(--cds-blue-60, #0f62fe);
	border-color: var(--cds-blue-60, #0f62fe);
}

.cds-btn-tertiary:hover {
	background: var(--cds-blue-60, #0f62fe);
	color: #fff;
}

.spec-table {
	width: 100%;
	max-width: 56rem;
	border-collapse: collapse;
	font-size: 0.875rem;
}

.spec-table th,
.spec-table td {
	padding: 0.75rem 1rem;
	border-bottom: 1px solid var(--cds-gray-20, #e0e0e0);
	text-align: left;
}

.spec-table th {
	width: 40%;
	background: var(--cds-gray-10, #f4f4f4);
	font-weight: 600;
}

.spec-table td {
	font-family: 'IBM Plex Mono', monospace;
	font-size: 0.8125rem;
	color: var(--cds-gray-70, #525252);
}

.section-gap { margin-bottom: 3rem; }

/* Hide default WooCommerce bits we replace */
.single-product .product_meta,
.woocommerce-result-count,
.woocommerce-products-header { display: none; }
