/* ==========================================================================
   Custom Shop Grid — styles
   ========================================================================== */

.csg-shop-wrapper {
	margin: 0 auto;
	padding: 32px 16px 64px;
	color: var(--color-text);
	box-sizing: border-box;
}

.csg-shop-wrapper *,
.csg-shop-wrapper *::before,
.csg-shop-wrapper *::after {
	box-sizing: border-box;
}

.csg-title {
	text-align: center;
	font-size: 32px;
	font-weight: 700;
	color: var(--color-text-heading);
	margin: 0 0 28px;
}

.csg-layout {
	display: flex;
	gap: 24px;
	align-items: flex-start;
}

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

.csg-sidebar {
	width: 280px;
	flex: 0 0 280px;
}

.csg-filters-toggle {
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: space-between;
	background: var(--color-accent-pink);
	color: var(--color-white);
	border: none;
	border-radius: 6px;
	padding: 12px 18px;
	font-size: 15px;
	font-weight: 700;
	letter-spacing: 1px;
	cursor: pointer;
}


.csg-filters-toggle svg {
	width: 18px;
	height: 18px;
	transition: transform 0.2s ease;
	flex-shrink: 0;
}

.csg-filters-label-show {
	display: none;
}

.csg-shop-wrapper.csg-filters-collapsed .csg-filters-label-hide {
	display: none;
}

.csg-shop-wrapper.csg-filters-collapsed .csg-filters-label-show {
	display: inline;
}

.csg-shop-wrapper.csg-filters-collapsed .csg-filters-toggle svg {
	transform: rotate(180deg);
}

.csg-filters-panel {
	background: var(--color-bg-panel);
	border-radius: 6px;
	margin-top: 4px;
	padding: 20px 18px;
}

.csg-shop-wrapper.csg-filters-collapsed .csg-filters-panel {
	display: none;
}

.csg-filter-group {
	border-bottom: 1px solid var(--color-divider);
	padding-bottom: 18px;
	margin-bottom: 18px;
}

.csg-filter-group:last-of-type {
	border-bottom: none;
	margin-bottom: 12px;
	padding-bottom: 0;
}

.csg-filter-title {
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 1.5px;
	text-transform: uppercase;
	color: var(--color-text-heading);
	margin: 0 0 12px;
}

/* Category tree ----------------------------------------------------- */

.csg-cat-tree {
	font-size: 14px;
}

.csg-cat-node > .csg-cat-row {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 6px 0;
	cursor: pointer;
	color: var(--color-text-heading);
	user-select: none;
}

.csg-cat-tree > .csg-cat-node > .csg-cat-row {
	font-weight: 700;
	text-transform: uppercase;
	font-size: 13px;
	letter-spacing: 0.5px;
}

.csg-cat-tree .csg-cat-node .csg-cat-node > .csg-cat-row {
	font-weight: 600;
	font-size: 13.5px;
	padding-left: 4px;
}

.csg-cat-tree .csg-cat-node .csg-cat-node .csg-cat-node > .csg-cat-row {
	font-weight: 400;
	text-transform: none;
	font-size: 14px;
	padding-left: 22px;
	color: var(--color-gray-500);
}

.csg-cat-row:hover .csg-cat-label,
.csg-cat-row.active .csg-cat-label {
	color: var(--color-brand-green);
}

.csg-cat-toggle {
	display: inline-flex;
	width: 14px;
	height: 14px;
	flex-shrink: 0;
	transition: transform 0.15s ease;
}

.csg-cat-toggle svg {
	width: 100%;
	height: 100%;
}

.csg-cat-node:not(.expanded) > .csg-cat-children {
	display: none;
}

.csg-cat-node.expanded > .csg-cat-row > .csg-cat-toggle {
	transform: rotate(180deg);
}

.csg-cat-children {
	padding-left: 14px;
}

.csg-cat-node.leaf > .csg-cat-row {
	padding-left: 22px;
}

.csg-cat-tree > .csg-cat-node.leaf > .csg-cat-row {
	padding-left: 0;
	text-transform: none;
	font-weight: 400;
	font-size: 14px;
}

/* Brand filter -------------------------------------------------------- */

.csg-brand-search {
	position: relative;
	margin-bottom: 12px;
}

.csg-brand-search-input {
	width: 100%;
	border: none;
	border-bottom: 2px solid var(--color-brand-green);
	background: transparent;
	padding: 6px 28px 8px 0;
	font-size: 14px;
	color: var(--color-text);
	outline: none;
}

.csg-brand-search-input::placeholder {
	color: var(--color-gray-400);
	font-style: italic;
}

.csg-search-icon {
	position: absolute;
	right: 0;
	top: 50%;
	transform: translateY(-60%);
	width: 18px;
	height: 18px;
	color: var(--color-brand-green);
	pointer-events: none;
}

.csg-brand-list {
	max-height: 230px;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding-right: 4px;
}

.csg-brand-list::-webkit-scrollbar {
	width: 6px;
}

.csg-brand-list::-webkit-scrollbar-thumb {
	background: var(--color-slate-300);
	border-radius: 3px;
}

.csg-brand-item {
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: 14px;
	color: var(--color-text-heading);
	cursor: pointer;
	padding: 3px 0;
}

.csg-brand-item input[type="checkbox"] {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
}

.csg-checkbox-box {
	width: 17px;
	height: 17px;
	flex-shrink: 0;
	border: 1.5px solid var(--color-gray-300);
	border-radius: 3px;
	background: var(--color-white);
	position: relative;
	transition: background 0.15s ease, border-color 0.15s ease;
}

.csg-brand-item input[type="checkbox"]:checked + .csg-checkbox-box {
	background: var(--color-brand-green);
	border-color: var(--color-brand-green);
}

.csg-brand-item input[type="checkbox"]:checked + .csg-checkbox-box::after {
	content: "";
	position: absolute;
	left: 5px;
	top: 1px;
	width: 5px;
	height: 9px;
	border: solid var(--color-white);
	border-width: 0 2px 2px 0;
	transform: rotate(45deg);
}

.csg-brand-item.csg-hidden {
	display: none;
}

/* "En promotion uniquement" checkbox — same look as brand checkboxes */
.csg-sale-item {
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: 14px;
	color: var(--color-text-heading);
	cursor: pointer;
	padding: 3px 0;
}

.csg-sale-item input[type="checkbox"] {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
}

.csg-sale-item input[type="checkbox"]:checked + .csg-checkbox-box {
	background: var(--color-brand-green);
	border-color: var(--color-brand-green);
}

.csg-sale-item input[type="checkbox"]:checked + .csg-checkbox-box::after {
	content: "";
	position: absolute;
	left: 5px;
	top: 1px;
	width: 5px;
	height: 9px;
	border: solid var(--color-white);
	border-width: 0 2px 2px 0;
	transform: rotate(45deg);
}

/* Separator between pinned/checked brands and the rest of the list */
.csg-brand-separator {
	height: 1px;
	background: var(--color-divider);
	margin: 6px 0;
	flex-shrink: 0;
}

/* Checked (non-locked) brand items get a subtle highlight when pinned at top */
.csg-brand-item:has(input:checked:not([data-locked])) {
	background: var(--color-bg-peach);
	border-radius: 3px;
	padding: 3px 4px;
	margin: 0 -4px;
}

/* Locked brand (pre-selected in brand mode) — always checked, not clickable */
.csg-brand-item.csg-brand-locked {
	opacity: 0.75;
	cursor: default;
	pointer-events: none;
}

.csg-brand-item.csg-brand-locked .csg-checkbox-box {
	background: var(--color-brand-green);
	border-color: var(--color-brand-green);
}

.csg-brand-item.csg-brand-locked .csg-checkbox-box::after {
	content: "";
	position: absolute;
	left: 5px;
	top: 1px;
	width: 5px;
	height: 9px;
	border: solid var(--color-white);
	border-width: 0 2px 2px 0;
	transform: rotate(45deg);
}

/* Price filter -------------------------------------------------------- */

.csg-price-slider {
	position: relative;
	height: 28px;
	margin-bottom: 6px;
}

.csg-slider-track,
.csg-slider-range {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	height: 4px;
	border-radius: 2px;
}

.csg-slider-track {
	left: 0;
	right: 0;
	background: var(--color-slate-300);
}

.csg-slider-range {
	background: var(--color-brand-green);
}

.csg-range {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	margin: 0;
	height: 28px;
	background: none;
	pointer-events: none;
	-webkit-appearance: none;
	appearance: none;
}

.csg-range::-webkit-slider-thumb {
	pointer-events: all;
	-webkit-appearance: none;
	appearance: none;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: var(--color-brand-green);
	border: 3px solid var(--color-white);
	box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
	cursor: pointer;
	margin-top: 3px;
}

.csg-range::-moz-range-thumb {
	pointer-events: all;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: var(--color-brand-green);
	border: 3px solid var(--color-white);
	box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
	cursor: pointer;
}

.csg-range::-webkit-slider-runnable-track,
.csg-range::-moz-range-track {
	background: transparent;
	border: none;
}

.csg-price-values {
	display: flex;
	justify-content: space-between;
	font-size: 14px;
	color: var(--color-text-heading);
}

/* Reset filters --------------------------------------------------------- */

.csg-reset-filters {
	width: 100%;
	background: transparent;
	border: 1.5px solid var(--color-brand-green);
	color: var(--color-brand-green);
	font-weight: 600;
	font-size: 13px;
	letter-spacing: 0.5px;
	border-radius: 6px;
	padding: 10px 12px;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease;
}

.csg-reset-filters:hover {
	background: var(--color-brand-green);
	color: var(--color-white);
}

/* --------------------------------------------------------------------
   Main column: toolbar + grid
   -------------------------------------------------------------------- */

.csg-main {
	flex: 1 1 auto;
	min-width: 0;
}

.csg-toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 18px;
	gap: 12px;
	flex-wrap: wrap;
}

.csg-results-count {
	font-size: 14px;
	color: var(--color-text-muted);
}

.csg-sort {
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: 15px;
	font-weight: 700;
	color: var(--color-text-heading);
	margin-left: auto;
}

.csg-orderby {
	border: 1px solid var(--color-border);
	border-radius: 6px;
	padding: 10px 14px;
	font-size: 14px;
	color: var(--color-text);
	background: var(--color-white);
	min-width: 200px;
	cursor: pointer;
}

/* Product grid ----------------------------------------------------------- */

.csg-product-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 10px;
	min-height: 200px;
	position: relative;
}

.csg-loading,
.csg-no-products {
	grid-column: 1 / -1;
	text-align: center;
	padding: 60px 0;
	color: var(--color-text-muted);
	font-size: 15px;
}

.csg-product-grid.csg-is-loading {
	opacity: 0.5;
	pointer-events: none;
}

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

.csg-pagination {
	display: flex;
	justify-content: center;
	gap: 6px;
	margin-top: 32px;
}

.csg-page-btn {
	min-width: 36px;
	height: 36px;
	padding: 0 10px;
	border: 1px solid var(--color-border);
	background: var(--color-white);
	border-radius: 6px;
	font-size: 14px;
	cursor: pointer;
	color: var(--color-text);
}

.csg-page-btn.active {
	background: var(--color-brand-green);
	border-color: var(--color-brand-green);
	color: var(--color-white);
}

.csg-page-btn:hover:not(.active) {
	border-color: var(--color-brand-green);
	color: var(--color-brand-green);
}

/* --------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------- */

@media (max-width: 1100px) {
	.csg-product-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

/* --------------------------------------------------------------------
   Collapsed filters
   -------------------------------------------------------------------- */

.csg-shop-wrapper.csg-filters-collapsed .csg-sidebar {
	display: none;
}

.csg-shop-wrapper.csg-filters-collapsed .csg-main {
	width: 100%;
	flex: 1 1 100%;
}

.csg-shop-wrapper.csg-filters-collapsed .csg-toolbar .csg-filters-toggle {
	width: auto;
	flex-shrink: 0;
	padding: 12px 18px;
	order: -1;
}

.csg-shop-wrapper.csg-filters-collapsed .csg-product-grid {
	grid-template-columns: repeat(5, 1fr);
}

@media (max-width: 1300px) {
	.csg-shop-wrapper.csg-filters-collapsed .csg-product-grid {
		grid-template-columns: repeat(4, 1fr);
	}
}

@media (max-width: 1100px) {
	.csg-shop-wrapper.csg-filters-collapsed .csg-product-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 860px) {
	.csg-layout {
		flex-direction: column;
	}

	.csg-sidebar {
		width: 100%;
		flex: 1 1 auto;
	}

	.csg-product-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 520px) {
	.csg-product-grid {
		grid-template-columns: repeat(1, 1fr);
	}

	.csg-title {
		font-size: 24px;
	}

	.csg-sort {
		width: 100%;
		justify-content: space-between;
	}

	.csg-orderby {
		min-width: 0;
		flex: 1;
	}
}

/* SEO/accessibility enhancements: category rows and pagination are real links. */
.csg-cat-row {
    text-decoration: none;
}

.csg-term-description {
    max-width: 900px;
    margin: -12px auto 28px;
    line-height: 1.65;
}

.csg-pagination .csg-page-btn {
    text-decoration: none;
}

/* --------------------------------------------------------------------
   Uniform product-card media + vertical alignment (shop/archive only)
   --------------------------------------------------------------------
   Product source images can have different intrinsic aspect ratios.
   Reserve the same square media box for every card and fit the image
   inside it without cropping. Keep card actions aligned at the bottom.
*/
.csg-product-grid .product-image-link {
	display: block;
	width: 100%;
}

.csg-product-grid .product-image {
	width: 100%;
	aspect-ratio: 1 / 1;
	max-height: none;
	overflow: hidden;
}

.csg-product-grid .product-image img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	max-height: none;
	object-fit: contain;
	object-position: center;
}

.csg-product-grid .product-card {
	height: 100%;
}

.csg-product-grid .product-info {
	flex: 1 1 auto;
}

.csg-product-grid .product-price {
	margin-top: auto;
	padding-top: 16px;
}

/* --------------------------------------------------------------------
   Compact archive pagination
   -------------------------------------------------------------------- */
.csg-pagination {
	align-items: center;
	flex-wrap: wrap;
}

.csg-pagination .csg-page-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	text-decoration: none;
	line-height: 1;
}

.csg-pagination .csg-page-nav {
	gap: 7px;
	min-width: auto;
	padding-inline: 13px;
	white-space: nowrap;
}

.csg-pagination .csg-page-btn.is-disabled {
	opacity: 0.45;
	cursor: default;
	pointer-events: none;
}

.csg-pagination-ellipsis {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 24px;
	height: 36px;
	color: var(--color-text-muted);
	user-select: none;
}

@media (max-width: 520px) {
	.csg-pagination {
		gap: 4px;
	}

	.csg-pagination .csg-page-btn {
		min-width: 34px;
		height: 34px;
		padding-inline: 8px;
	}

	.csg-pagination .csg-page-nav .csg-page-label {
		display: none;
	}

	.csg-pagination .csg-page-nav {
		padding-inline: 8px;
	}
}
