/*
Theme Name: Supermarkt
Description: Thema voor de supermarkt e-commerce site (WooCommerce).
Version: 0.1.0
Text Domain: supermarkt
*/

:root {
	--sm-primary: #1f7a3d;
	--sm-text: #222;
	--sm-header-bg: #fff;
	--sm-catbar-bg: #1f7a3d;
	--sm-catbar-text: #fff;
	--sm-topbar-bg: #14532d;
	--sm-topbar-text: #fff;
	--sm-footer-bg: #f4f4f4;
	--sm-footer-text: #222;
	--sm-border: #ddd;
	--sm-cols: 4;
	--sm-img-h: 200px;
	--sm-img-fit: contain;
	--sm-card-border: #e5e5e5;
	--sm-title-size: 16px;
	--sm-title-lines: 2;
	--sm-width: 1200px;
	--sm-radius: 4px;
	--sm-font: system-ui, -apple-system, "Segoe UI", sans-serif;
}

body {
	font-family: var(--sm-font);
	margin: 0;
	color: var(--sm-text);
}

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

.sm-container {
	max-width: var(--sm-width);
	margin: 0 auto;
	padding: 1rem;
}

/* Header: merk links, horizontaal menu, winkelwagen rechts */
.sm-header {
	background: var(--sm-header-bg);
	border-bottom: 1px solid #e5e5e5;
}

.sm-header__logo {
	display: block;
	max-height: 48px;
	width: auto;
}

.sm-header__inner {
	display: flex;
	align-items: center;
	gap: 1.5rem;
	max-width: var(--sm-width);
	margin: 0 auto;
	padding: 0.75rem 1rem;
}

.sm-header__brand {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-size: 1.25rem;
	font-weight: 700;
	color: var(--sm-primary);
	text-decoration: none;
}

.sm-icon {
	width: 1.5rem;
	height: 1.5rem;
}

.sm-header__nav {
	flex: 1 1 auto;
}

.sm-menu {
	display: flex;
	flex-wrap: wrap;
	gap: 1.25rem;
	list-style: none;
	margin: 0;
	padding: 0;
}

.sm-menu a {
	color: #222;
	text-decoration: none;
	font-weight: 600;
}

.sm-menu a:hover,
.sm-menu .current-menu-item > a {
	color: var(--sm-primary);
}

.sm-header__cart {
	position: relative;
	display: flex;
	color: #222;
}

.sm-header__count {
	position: absolute;
	top: -0.5rem;
	right: -0.6rem;
	min-width: 1.1rem;
	padding: 0 0.25rem;
	border-radius: 999px;
	background: var(--sm-primary);
	color: #fff;
	font-size: 0.7rem;
	line-height: 1.1rem;
	text-align: center;
}

/* Categoriebalk (horizontaal scrollbaar) */
.sm-catbar {
	background: var(--sm-catbar-bg);
	position: sticky;
	top: 0;
	z-index: 50;
}

.sm-catbar__wrap {
	position: relative;
	max-width: var(--sm-width);
	margin: 0 auto;
}

.sm-catbar__scroll {
	display: flex;
	gap: 0.25rem;
	padding: 0 1rem;
	overflow-x: auto;
	white-space: nowrap;
	scroll-snap-type: x proximity;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none; /* Geen horizontale scrollbalk. */
	-ms-overflow-style: none;
}

.sm-catbar__scroll::-webkit-scrollbar {
	display: none;
}

/* Pijlen: geen achtergrond, kleur gelijk aan de categorietekst. */
.sm-catbar__arrow {
	position: absolute;
	top: 0;
	bottom: 0;
	z-index: 2;
	display: flex;
	align-items: center;
	padding: 0 0.25rem;
	border: 0;
	background: transparent;
	color: var(--sm-catbar-text);
	cursor: pointer;
}

.sm-catbar__arrow[hidden] {
	display: none;
}

.sm-catbar__arrow--left {
	left: 0;
}

.sm-catbar__arrow--right {
	right: 0;
}

.sm-catbar__item {
	flex: 0 0 auto;
	scroll-snap-align: start;
	padding: 0.8rem 1rem;
	color: var(--sm-catbar-text);
	text-decoration: none;
	font-weight: 600;
	border-bottom: 3px solid transparent;
}

.sm-catbar__item:hover,
.sm-catbar__item.is-active {
	background: rgba(255, 255, 255, 0.12);
	border-bottom-color: var(--sm-catbar-text);
}

/* Winkellayout met zijbalk */
.sm-shop {
	display: grid;
	grid-template-columns: 260px minmax(0, 1fr);
	gap: 2rem;
	align-items: start;
}

.sm-sidebar__block {
	margin-bottom: 1.5rem;
}

.sm-sidebar__title {
	font-size: 1rem;
	margin: 0 0 0.5rem;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: #555;
}

.sm-subcats,
.sm-brandlist {
	list-style: none;
	margin: 0;
	padding: 0;
}

.sm-subcats .sm-subcats {
	margin-left: 1rem;
	border-left: 2px solid #e5e5e5;
	padding-left: 0.5rem;
}

.sm-subcats__link {
	display: block;
	padding: 0.3rem 0;
	color: #222;
	text-decoration: none;
}

.sm-subcats__link:hover {
	color: var(--sm-primary);
}

.sm-subcats__link.is-current {
	font-weight: 700;
	color: var(--sm-primary);
}

.sm-subcats__link.is-open {
	font-weight: 600;
}

.sm-brandlist {
	max-height: 360px;
	overflow-y: auto;
}

.sm-brandlist__item {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.25rem 0;
	color: #222;
	text-decoration: none;
}

.sm-brandlist__box {
	flex: 0 0 auto;
	width: 1rem;
	height: 1rem;
	border: 2px solid #999;
	border-radius: var(--sm-radius);
}

.sm-brandlist__item.is-selected .sm-brandlist__box {
	background: var(--sm-primary);
	border-color: var(--sm-primary);
}

.sm-brandlist__name {
	flex: 1 1 auto;
}

.sm-brandlist__count {
	color: #888;
	font-size: 0.85em;
}

.sm-sidebar__reset {
	display: inline-block;
	margin-bottom: 0.5rem;
	font-size: 0.9em;
}

/* Mededelingenbalk */
.sm-topbar {
	background: var(--sm-topbar-bg);
	color: var(--sm-topbar-text);
	text-align: center;
	padding: 0.4rem 1rem;
	font-size: 0.9rem;
}

/* Sticky header: topbar + header + categoriebalk blijven samen bovenaan */
.sm-masthead {
	display: contents;
}

.sm-sticky-header .sm-masthead {
	display: block;
	position: sticky;
	top: 0;
	z-index: 60;
}

.admin-bar.sm-sticky-header .sm-masthead {
	top: 32px;
}

.sm-sticky-header .sm-catbar {
	position: static;
}

.screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

/* Zoekbalk in header */
.sm-header__search {
	display: flex;
	flex: 0 1 280px;
}

.sm-header__search input[type="search"] {
	flex: 1 1 auto;
	min-width: 0;
	padding: 0.45rem 0.7rem;
	border: 1px solid var(--sm-border);
	border-right: 0;
	border-radius: var(--sm-radius) 0 0 var(--sm-radius);
}

.sm-header__search button,
.sm-button {
	padding: 0.45rem 0.9rem;
	border: 0;
	background: var(--sm-primary);
	color: #fff;
	font-weight: 600;
	cursor: pointer;
	text-decoration: none;
}

.sm-header__search button {
	border-radius: 0 var(--sm-radius) var(--sm-radius) 0;
}

.sm-button {
	display: inline-block;
	padding: 0.7rem 1.4rem;
	border-radius: var(--sm-radius);
}

/* Homepage */
.sm-banner {
	display: flex;
	align-items: center;
	min-height: 260px;
	margin-bottom: 2rem;
	padding: 2rem;
	border-radius: var(--sm-radius);
	background: var(--sm-primary) center / cover no-repeat;
	color: #fff;
}

.sm-banner.has-image .sm-banner__body {
	padding: 1.25rem;
	border-radius: var(--sm-radius);
	background: rgba(0, 0, 0, 0.45);
}

.sm-banner__title {
	margin: 0 0 0.5rem;
	font-size: 2rem;
}

.sm-banner__text {
	margin: 0 0 1rem;
	font-size: 1.1rem;
}

.sm-banner .sm-button {
	background: #fff;
	color: var(--sm-primary);
}

.sm-home-section {
	margin-bottom: 2.5rem;
}

.sm-home-section__title {
	margin: 0 0 1rem;
}

.sm-cattiles {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
	gap: 1rem;
}

.sm-cattile {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.5rem;
	padding: 1rem;
	border: 1px solid var(--sm-border);
	border-radius: var(--sm-radius);
	color: var(--sm-text);
	font-weight: 600;
	text-align: center;
	text-decoration: none;
}

.sm-cattile:hover {
	border-color: var(--sm-primary);
	color: var(--sm-primary);
}

.sm-cattile img {
	width: 100%;
	max-height: 90px;
	object-fit: contain;
}

/* Productraster: aantal kolommen instelbaar */
.woocommerce ul.products,
.woocommerce ul.products[class*="columns-"] {
	display: grid;
	grid-template-columns: repeat(var(--sm-cols), minmax(0, 1fr));
	gap: 1.25rem;
	margin: 0 0 1.5rem;
	padding: 0;
	list-style: none;
}

.woocommerce ul.products::before,
.woocommerce ul.products::after {
	display: none;
}

.woocommerce ul.products li.product,
.woocommerce ul.products[class*="columns-"] li.product {
	float: none;
	width: auto;
	margin: 0;
}

/* Prijsweergave (selectors zijn bewust specifieker dan die van WooCommerce) */
body.sm-price-accent ul.products li.product .price,
body.sm-price-accent div.product p.price,
body.sm-price-accent div.product span.price {
	color: var(--sm-primary);
	font-size: 1.15rem;
	font-weight: 700;
}

body.sm-price-accent ul.products li.product .price del {
	font-size: 0.85rem;
	font-weight: 400;
	opacity: 0.6;
}

/* Productkaarten: allemaal even hoog, afbeelding in vast vak */
body ul.products.products li.product.product {
	display: flex;
	flex-direction: column;
	box-sizing: border-box;
	text-align: left;
}

body ul.products.products li.product.product a.woocommerce-LoopProduct-link {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
}

body ul.products.products li.product.product a img {
	display: block;
	width: 100%;
	height: var(--sm-img-h);
	margin: 0 0 0.75rem;
	object-fit: var(--sm-img-fit);
	background: #fff;
}

body ul.products.products li.product.product .woocommerce-loop-product__title {
	margin: 0 0 0.4rem;
	padding: 0;
	color: var(--sm-title-color, var(--sm-text));
	font-size: var(--sm-title-size);
	font-weight: 600;
	line-height: 1.3;
	min-height: calc(var(--sm-title-lines) * 1.3em);
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: var(--sm-title-lines);
	overflow: hidden;
}

body ul.products.products li.product.product .price {
	margin-top: auto;
}

body ul.products.products li.product.product .button {
	margin-top: 0.75rem;
	text-align: center;
}

body.sm-card-border ul.products.products li.product.product {
	padding: 0.75rem;
	border: 1px solid var(--sm-card-border);
	border-radius: var(--sm-radius);
	background: #fff;
}

/* Knoppen (o.a. "In winkelwagen") */
body a.button.button.button,
body button.button.button.button,
body input.button.button.button {
	background: var(--sm-btn-bg, var(--sm-primary));
	color: var(--sm-btn-text, #fff);
	border: 0;
	border-radius: var(--sm-radius);
	font-weight: 600;
	line-height: 1.2;
	padding: 0.6em 1em;
}

body a.button.button.button:hover,
body button.button.button.button:hover,
body input.button.button.button:hover {
	background: var(--sm-btn-hover, var(--sm-btn-bg, var(--sm-primary)));
	color: var(--sm-btn-text, #fff);
	filter: var(--sm-btn-hover-filter, brightness(0.88));
}

body.sm-btn-small a.button.button.button,
body.sm-btn-small button.button.button.button {
	font-size: 0.8rem;
	padding: 0.4em 0.7em;
}

body.sm-btn-large a.button.button.button,
body.sm-btn-large button.button.button.button {
	font-size: 1.1rem;
	padding: 0.8em 1.4em;
}

body.sm-btn-block ul.products li.product a.button.button.button {
	display: block;
	width: 100%;
	box-sizing: border-box;
}

/* Productpagina: inhoud, verpakking en scores */
.sm-facts {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem 1.25rem;
	margin: 0 0 1rem;
	padding: 0;
	list-style: none;
}

.sm-facts__label {
	color: #666;
}

.sm-facts__value {
	font-weight: 600;
}

.sm-scores {
	display: flex;
	flex-wrap: wrap;
	gap: 1rem 1.5rem;
	margin: 0 0 1.25rem;
}

.sm-score__name {
	display: block;
	margin-bottom: 0.2rem;
	color: #666;
	font-size: 0.8rem;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.sm-score__svg {
	display: block;
	width: var(--sm-badge-w, 160px);
	max-width: 100%;
	height: auto;
}

/* Breedte van afbeelding en samenvatting op de productpagina (desktop) */
@media (min-width: 769px) {
	.woocommerce div.product div.images.woocommerce-product-gallery {
		width: var(--sm-single-img-w, 48%);
	}

	.woocommerce div.product div.summary.entry-summary {
		width: var(--sm-summary-w, 48%);
	}
}

/* Voedingswaardentabel */
.sm-nutrition {
	width: 100%;
	max-width: 520px;
	border-collapse: collapse;
}

.sm-nutrition th,
.sm-nutrition td {
	padding: 0.45rem 0.75rem;
	border-bottom: 1px solid var(--sm-border);
	text-align: left;
}

.sm-nutrition thead th {
	background: var(--sm-footer-bg);
}

.sm-nutrition tbody th {
	font-weight: 600;
}

.sm-nutrition td {
	text-align: right;
	white-space: nowrap;
}

.sm-nutrition thead th:last-child {
	text-align: right;
}

.sm-nutrition tr.is-sub th {
	padding-left: 1.75rem;
	font-weight: 400;
	color: #555;
}

/* Zijbalk met kaders (optie) */
.sm-sidebar-boxed .sm-sidebar__block {
	padding: 1rem;
	border: 1px solid var(--sm-border);
	border-radius: var(--sm-radius);
	background: #fff;
}

/* Footer */
.sm-footer {
	margin-top: 3rem;
	background: var(--sm-footer-bg);
	color: var(--sm-footer-text);
}

.sm-footer__inner {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 2rem;
	max-width: var(--sm-width);
	margin: 0 auto;
	padding: 2rem 1rem 1rem;
}

.sm-footer__inner:empty {
	display: none;
}

.sm-footer__title {
	margin: 0 0 0.5rem;
	font-size: 1rem;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.sm-footer a {
	color: inherit;
}

.sm-footer__bottom {
	max-width: var(--sm-width);
	margin: 0 auto;
	padding: 1rem;
	font-size: 0.9rem;
	opacity: 0.8;
}

.sm-footer__bottom p {
	margin: 0;
}

@media (max-width: 800px) {
	/* Header: merk en winkelwagen op één regel, menu eronder horizontaal scrollbaar */
	.sm-header__inner {
		flex-wrap: wrap;
		gap: 0.75rem 1rem;
	}

	.sm-header__brand {
		flex: 1 1 auto;
	}

	.sm-header__nav {
		order: 3;
		flex: 1 1 100%;
		overflow-x: auto;
	}

	.sm-menu {
		flex-wrap: nowrap;
		white-space: nowrap;
	}

	.sm-shop {
		grid-template-columns: 1fr;
	}

	.woocommerce ul.products,
	.woocommerce ul.products[class*="columns-"] {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.sm-header__search {
		order: 2;
		flex: 1 1 100%;
	}

	.sm-header__nav {
		order: 3;
	}

	.sm-brandlist {
		max-height: 200px;
	}
}
