/**
 * Shop view toggle — listing pages only.
 * Astra-like: plain icons (no button chrome), borderless ordering.
 * Colors: Elementor kit tokens with safe fallbacks.
 */

:root {
	--wooweb-shop-accent: var(--e-global-color-primary, currentColor);
	--wooweb-shop-text: var(--e-global-color-text, #333);
	--wooweb-shop-muted: color-mix(in srgb, var(--wooweb-shop-text) 55%, transparent);
	--wooweb-shop-border: color-mix(in srgb, var(--wooweb-shop-text) 18%, transparent);
	--wooweb-shop-surface: #fff;
	--wooweb-shop-bar-h: 56px;
	--wooweb-shop-thumb: 140px;
}

/* —— Toolbar —— */
.wooweb-shop-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem 1rem;
	margin-bottom: 1.25rem;
	width: 100%;
}

.wooweb-shop-toolbar .woocommerce-result-count {
	float: none;
	margin: 0;
	flex: 1 1 auto;
}

.wooweb-shop-controls {
	display: inline-flex;
	flex-wrap: nowrap;
	align-items: center;
	gap: 0.65rem;
	margin-left: auto;
}

.wooweb-shop-controls .woocommerce-ordering {
	float: none;
	margin: 0;
}

/* Borderless ordering (Astra-like) */
.wooweb-shop-toolbar .woocommerce-ordering select,
.wooweb-shop-mobile-bar .woocommerce-ordering select {
	border: none !important;
	border-radius: 0;
	background: transparent;
	box-shadow: none !important;
	outline: none;
	padding-left: 0;
	padding-right: 1.5rem;
	color: var(--wooweb-shop-text);
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
}

.wooweb-shop-toolbar .woocommerce-ordering select:focus,
.wooweb-shop-mobile-bar .woocommerce-ordering select:focus {
	outline: none;
	box-shadow: none !important;
}

/* —— View icons: glyphs only, no button chrome —— */
.wooweb-shop-view {
	display: inline-flex !important;
	flex-direction: row;
	flex-wrap: nowrap;
	align-items: center;
	gap: 0.5rem;
	flex-shrink: 0;
}

button.wooweb-shop-view__btn,
.wooweb-shop-view__btn {
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: auto;
	height: auto;
	min-width: 1.5rem;
	min-height: 1.5rem;
	margin: 0;
	padding: 0.15rem;
	border: none !important;
	border-radius: 0;
	background: transparent !important;
	background-color: transparent !important;
	box-shadow: none !important;
	color: var(--wooweb-shop-text) !important;
	opacity: 0.85;
	cursor: pointer;
	line-height: 0;
	text-decoration: none;
	appearance: none;
	-webkit-appearance: none;
}

button.wooweb-shop-view__btn svg,
.wooweb-shop-view__btn svg {
	display: block;
	width: 1.25rem;
	height: 1.25rem;
	fill: currentColor;
	pointer-events: none;
}

button.wooweb-shop-view__btn[aria-pressed="true"],
.wooweb-shop-view__btn[aria-pressed="true"] {
	background: transparent !important;
	background-color: transparent !important;
	border: none !important;
	color: var(--wooweb-shop-accent) !important;
	opacity: 1;
}

button.wooweb-shop-view__btn:hover,
.wooweb-shop-view__btn:hover {
	background: transparent !important;
	color: var(--wooweb-shop-accent) !important;
	opacity: 1;
}

button.wooweb-shop-view__btn:focus-visible,
.wooweb-shop-view__btn:focus-visible {
	outline: 2px solid var(--wooweb-shop-accent);
	outline-offset: 3px;
}

/* —— Excerpt: list only —— */
.wooweb-product-excerpt {
	display: none;
	margin: 0.35rem 0 0;
	font-size: 0.875em;
	line-height: 1.45;
	opacity: 0.65;
	color: var(--wooweb-shop-text);
}

body.wooweb-view-list .wooweb-product-excerpt {
	display: block;
}

/* —— List layout —— */
body.wooweb-view-list ul.products {
	display: block;
}

body.wooweb-view-list ul.products::before,
body.wooweb-view-list ul.products::after {
	display: none !important;
	content: none !important;
}

body.wooweb-view-list ul.products li.product {
	display: grid;
	grid-template-columns: var(--wooweb-shop-thumb) minmax(0, 1fr);
	column-gap: 1rem;
	row-gap: 0.35rem;
	align-items: start;
	float: none !important;
	clear: both !important;
	width: 100% !important;
	max-width: none !important;
	margin: 0 0 1.25rem !important;
	padding: 0;
	text-align: left;
}

body.wooweb-view-list ul.products li.product > a.woocommerce-LoopProduct-link,
body.wooweb-view-list ul.products li.product > a.woocommerce-loop-product__link {
	display: contents;
}

body.wooweb-view-list ul.products li.product img {
	grid-column: 1;
	grid-row: 1 / span 8;
	width: var(--wooweb-shop-thumb);
	max-width: 100%;
	height: auto;
	margin: 0;
	object-fit: cover;
}

body.wooweb-view-list ul.products li.product .onsale {
	grid-column: 1;
	grid-row: 1;
	justify-self: start;
	z-index: 1;
}

body.wooweb-view-list ul.products li.product .woocommerce-loop-product__title,
body.wooweb-view-list ul.products li.product .price,
body.wooweb-view-list ul.products li.product .star-rating,
body.wooweb-view-list ul.products li.product .button,
body.wooweb-view-list ul.products li.product .added_to_cart,
body.wooweb-view-list ul.products li.product .wooweb-product-excerpt {
	grid-column: 2;
	width: auto;
	max-width: 100%;
	margin-left: 0;
	margin-right: 0;
}

body.wooweb-view-list ul.products li.product .button {
	display: inline-flex;
	width: auto;
	margin-top: 0.25rem;
}

@media (min-width: 600px) {
	body.wooweb-view-list {
		--wooweb-shop-thumb: 180px;
	}
}

/* —— Mobile bottom bar —— */
.wooweb-shop-mobile-bar {
	display: none;
}

@media (max-width: 921px) {
	.wooweb-shop-toolbar .wooweb-shop-controls {
		display: none;
	}

	.wooweb-shop-mobile-bar[hidden] {
		display: none !important;
	}

	.wooweb-shop-mobile-bar:not([hidden]) {
		display: flex;
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		z-index: 90;
		align-items: center;
		justify-content: space-between;
		gap: 0.75rem;
		min-height: var(--wooweb-shop-bar-h);
		padding: 0.5rem 1rem;
		padding-bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px));
		background: var(--wooweb-shop-surface);
		border-top: 1px solid var(--wooweb-shop-border);
		box-shadow: 0 -4px 16px color-mix(in srgb, var(--wooweb-shop-text) 8%, transparent);
	}

	.wooweb-shop-mobile-bar__order {
		flex: 1 1 auto;
		min-width: 0;
	}

	.wooweb-shop-mobile-bar__order .woocommerce-ordering {
		margin: 0;
		width: 100%;
	}

	.wooweb-shop-mobile-bar__order select {
		max-width: 100%;
		width: 100%;
	}

	.wooweb-shop-mobile-bar .wooweb-shop-view {
		flex: 0 0 auto;
	}

	body.woocommerce.archive,
	body.post-type-archive-product,
	body.tax-product_cat,
	body.tax-product_tag {
		padding-bottom: calc(var(--wooweb-shop-bar-h) + 1rem + env(safe-area-inset-bottom, 0px));
	}
}

@media (min-width: 922px) {
	.wooweb-shop-mobile-bar {
		display: none !important;
	}
}
