/* Price-list table: filter bar + product rows.
 * Palette matches the MGOLD theme (gold/tan top bar, dark accents, cream rows).
 * Used both on the shop page and category/tag archives (rows rendered
 * inside the theme's own product loop) and in the standalone
 * [vmpl_latest_products] shortcode table.
 */

:root {
	--vmpl-gold: #c7a876;
	--vmpl-dark: #1f1c17;
	--vmpl-row-alt: #f7f3ec;
	--vmpl-border: #e6ddcc;
}

/* Archive: let rows take the full width of the theme's product-loop grid. */

body.vmpl-active ul.products {
	display: block !important;
	border-top: 1px solid var(--vmpl-border);
}

body.vmpl-active ul.products li.product.vmpl-row {
	display: flex !important;
	align-items: center !important;
	width: 100% !important;
	float: none !important;
	margin: 0 !important;
	padding: 1rem 1.5rem !important;
	list-style: none;
	border: none !important;
	border-bottom: 1px solid var(--vmpl-border) !important;
	box-shadow: none !important;
	text-align: left !important;
	background: transparent !important;
}

/* Filter bar */

.vmpl-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 2px;
	background: var(--vmpl-gold);
	margin: 0 0 2px;
}

/* The "Метал"/"Тип" category-nav group and the "Грамаж"/"Сортирай" GET form
   are two separate elements (see VMPL_Render::render_filters()), but stay
   visually flattened into one row of fields via display: contents. */
.vmpl-filters__categories,
.vmpl-filters__query {
	display: contents;
}

.vmpl-filters__field {
	position: relative;
	flex: 1 1 220px;
}

.vmpl-filters__field::after {
	content: "";
	position: absolute;
	right: 1.25rem;
	top: 50%;
	width: 0.55em;
	height: 0.55em;
	border-right: 2px solid var(--vmpl-dark);
	border-bottom: 2px solid var(--vmpl-dark);
	transform: translateY(-65%) rotate(45deg);
	pointer-events: none;
}

.vmpl-filters__select {
	width: 100%;
	appearance: none;
	-webkit-appearance: none;
	-moz-appearance: none;
	background: var(--vmpl-gold);
	color: var(--vmpl-dark);
	border: none;
	padding: 1rem 2.5rem 1rem 1.25rem;
	font-size: 1rem;
	font-weight: 600;
	cursor: pointer;
}

.vmpl-filters__select option {
	color: var(--vmpl-dark);
	background: #fff;
}

.vmpl-filters__submit {
	flex: 1 1 100%;
	padding: 0.75rem;
	border: none;
	background: var(--vmpl-dark);
	color: #fff;
	cursor: pointer;
}

/* No-JS fallback for the "Метал"/"Тип" category-nav <select>s (JS is what
   makes them navigate on change -- without it they're inert, so link lists
   take their place). */
.vmpl-filters__links {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem 1rem;
	list-style: none;
	margin: 0;
	padding: 1rem 1.25rem;
	background: var(--vmpl-gold);
}

.vmpl-filters__links a {
	color: var(--vmpl-dark);
	font-weight: 600;
	text-decoration: none;
}

.vmpl-filters__links a.is-active {
	text-decoration: underline;
}

/* Table */

.vmpl-table {
	display: flex;
	flex-direction: column;
	border-top: 1px solid var(--vmpl-border);
}

.vmpl-row {
	display: flex;
	align-items: center;
	gap: 1.5rem;
	padding: 1rem 1.5rem;
	border-bottom: 1px solid var(--vmpl-border);
}

.vmpl-row--alt {
	background: var(--vmpl-row-alt);
}

.vmpl-row__image {
	flex: 0 0 64px;
}

.vmpl-row__image img {
	display: block;
	width: 64px;
	height: 64px;
	object-fit: contain;
}

.vmpl-row__name {
	flex: 1 1 260px;
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.vmpl-row__name a {
	font-weight: 600;
	color: var(--vmpl-dark);
	text-decoration: none;
	font-size: var(--wp--preset--font-size--small);
}

.vmpl-row__name a:hover {
	text-decoration: underline;
}

.vmpl-row__weight,
.vmpl-row__price {
	flex: 0 0 140px;
	display: flex;
	flex-direction: column;
	text-align: right;
}

.vmpl-row__value {
	font-weight: 600;
	color: var(--vmpl-dark);
}

.vmpl-row__value--muted {
	color: #b3aa9c;
	font-weight: 400;
}

.vmpl-row__label {
	font-size: 0.75em;
	color: var(--vmpl-gold);
}

.vmpl-row__price--sell .vmpl-row__label,
.vmpl-row__price--buy .vmpl-row__label {
	font-size: 0.9em;
	color: var(--vmpl-gold);
}

.vmpl-row__status {
	flex: 0 0 32px;
	display: flex;
	justify-content: center;
	align-items: center;
}

.vmpl-empty {
	padding: 2rem 1.5rem;
}

/* Responsive */

@media (max-width: 768px) {
	.vmpl-row {
		display: grid;
		grid-template-columns: 1fr 140px;
		grid-template-areas:
			"image        status"
			"name         buy-value"
			"name         buy-label"
			"weight-value sell-value"
			"weight-label sell-label";
		align-items: center;
		row-gap: 0.35rem;
		column-gap: 1rem;
	}

	.vmpl-row__image {
		grid-area: image;
	}

	.vmpl-row__name {
		grid-area: name;
	}

	.vmpl-row__status {
		grid-area: status;
		justify-self: end;
	}

	/* Let the value/label spans become grid items in their own right, on
	   shared rows with their counterpart column -- so a value always lines
	   up with the other column's value (same for labels), regardless of
	   either span's own font size or content height. */
	.vmpl-row__weight,
	.vmpl-row__price--buy,
	.vmpl-row__price--sell {
		display: contents;
	}

	.vmpl-row__weight .vmpl-row__value {
		grid-area: weight-value;
		text-align: left;
	}

	.vmpl-row__weight .vmpl-row__label {
		grid-area: weight-label;
		text-align: left;
	}

	.vmpl-row__price--buy .vmpl-row__value {
		grid-area: buy-value;
		text-align: right;
	}

	.vmpl-row__price--buy .vmpl-row__label {
		grid-area: buy-label;
		text-align: right;
	}

	.vmpl-row__price--sell .vmpl-row__value {
		grid-area: sell-value;
		text-align: right;
	}

	.vmpl-row__price--sell .vmpl-row__label {
		grid-area: sell-label;
		text-align: right;
	}
}
