/**
 * Happy Box Builder – Frontend
 * Farben orientieren sich am Konzept: Creme, Beige, Braun, Pistaziengrün.
 */

.happy-box {
	--hb-ink: #2e2420;
	--hb-ink-2: #6b5d54;
	--hb-rule: #e2d8ca;
	--hb-surface: #fff;
	--hb-surface-2: #f7f3ec;
	--hb-accent: #6e8a4a;
	--hb-accent-soft: #eaf0df;

	margin: 0 0 28px;
	color: var(--hb-ink);
}

.happy-box__intro {
	margin: 0 0 20px;
	color: var(--hb-ink-2);
	line-height: 1.6;
}

/* ---- Status ---- */

.happy-box__status {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	padding: 16px 18px;
	background: var(--hb-surface-2);
	border: 1px solid var(--hb-rule);
	border-radius: 6px;
	margin-bottom: 12px;
}

.happy-box__counter,
.happy-box__price {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 110px;
}

.happy-box__price {
	margin-left: auto;
	text-align: right;
}

.happy-box__count,
.happy-box__total {
	font-size: 20px;
	font-weight: 700;
	line-height: 1.2;
	font-variant-numeric: tabular-nums;
}

.happy-box__counter--free .happy-box__count {
	color: var(--hb-accent);
}

.happy-box__label {
	font-size: 12px;
	letter-spacing: 0.04em;
	color: var(--hb-ink-2);
}

/* ---- Hinweis ---- */

.happy-box__hint {
	padding: 10px 14px;
	border-radius: 4px;
	background: var(--hb-surface-2);
	border-left: 3px solid var(--hb-rule);
	font-size: 14px;
	color: var(--hb-ink-2);
	margin-bottom: 20px;
}

.happy-box__hint.is-done {
	background: var(--hb-accent-soft);
	border-left-color: var(--hb-accent);
	color: var(--hb-accent);
	font-weight: 700;
}

/* ---- Sortenraster ---- */

.happy-box__grid {
	display: grid;
	grid-template-columns: repeat( auto-fill, minmax( 150px, 1fr ) );
	gap: 14px;
}

.happy-box__item {
	display: flex;
	flex-direction: column;
	background: var(--hb-surface);
	border: 1px solid var(--hb-rule);
	border-radius: 6px;
	overflow: hidden;
	transition: border-color 0.15s, box-shadow 0.15s;
}

.happy-box__item.is-active {
	border-color: var(--hb-accent);
	box-shadow: 0 0 0 1px var(--hb-accent);
}

.happy-box__img {
	width: 100%;
	aspect-ratio: 1 / 1;
	object-fit: cover;
	display: block;
	background: var(--hb-surface-2);
}

.happy-box__img--empty {
	background: var(--hb-surface-2);
}

.happy-box__body {
	padding: 10px 12px 8px;
	flex: 1;
}

.happy-box__name {
	margin: 0;
	font-size: 14px;
	line-height: 1.3;
	font-weight: 600;
}

.happy-box__surcharge {
	display: inline-block;
	margin-top: 5px;
	font-size: 11.5px;
	font-weight: 700;
	padding: 2px 7px;
	border-radius: 3px;
	background: var(--hb-accent-soft);
	color: var(--hb-accent);
}

/* ---- Stepper ---- */

.happy-box__stepper {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 8px 10px;
	border-top: 1px solid var(--hb-rule);
	background: var(--hb-surface-2);
}

.happy-box__btn {
	width: 30px;
	height: 30px;
	flex: none;
	border: 1px solid var(--hb-rule);
	background: var(--hb-surface);
	border-radius: 4px;
	font-size: 17px;
	line-height: 1;
	cursor: pointer;
	color: var(--hb-ink);
	transition: background 0.12s, border-color 0.12s;
}

.happy-box__btn:hover:not( :disabled ) {
	border-color: var(--hb-accent);
	background: var(--hb-accent-soft);
}

.happy-box__btn:focus-visible {
	outline: 2px solid var(--hb-accent);
	outline-offset: 2px;
}

.happy-box__btn:disabled {
	opacity: 0.35;
	cursor: not-allowed;
}

.happy-box__qty {
	font-weight: 700;
	font-size: 15px;
	font-variant-numeric: tabular-nums;
	min-width: 20px;
	text-align: center;
}

/* ---- Hinweis im Warenkorb ---- */

.happy-box-notice {
	margin-bottom: 20px;
}

@media ( prefers-reduced-motion: reduce ) {
	.happy-box__item,
	.happy-box__btn {
		transition: none;
	}
}

/* Einleitungstext oben auf der Box-Seite */
.happy-box__lead {
	margin: 0 0 20px;
	padding: 16px 18px;
	background: #f7f3ec;
	border-left: 3px solid #6e8a4a;
	border-radius: 0 4px 4px 0;
	font-size: 15.5px;
	line-height: 1.6;
	color: #2e2420;
}

/* === Theme-Overrides: Astra formatiert button-Elemente sehr stark === */
.happy-box .happy-box__stepper .happy-box__btn,
.happy-box button.happy-box__btn {
	width: 38px !important;
	height: 38px !important;
	min-width: 38px !important;
	padding: 0 !important;
	margin: 0 !important;
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	background: #fff !important;
	border: 1.5px solid #d8cdbb !important;
	border-radius: 6px !important;
	color: #2e2420 !important;
	font-size: 20px !important;
	font-weight: 700 !important;
	line-height: 1 !important;
	text-transform: none !important;
	letter-spacing: 0 !important;
	box-shadow: none !important;
	cursor: pointer;
}

.happy-box .happy-box__btn:hover:not(:disabled),
.happy-box button.happy-box__btn:hover:not(:disabled) {
	background: #eaf0df !important;
	border-color: #6e8a4a !important;
	color: #6e8a4a !important;
}

.happy-box .happy-box__btn:disabled,
.happy-box button.happy-box__btn:disabled {
	opacity: .35 !important;
	cursor: not-allowed;
}

.happy-box .happy-box__stepper {
	display: flex !important;
	align-items: center !important;
	justify-content: space-between !important;
	gap: 10px !important;
	padding: 10px 12px !important;
	border-top: 1px solid #e2d8ca;
	background: #faf7f2;
}

.happy-box .happy-box__qty {
	font-weight: 700 !important;
	font-size: 16px !important;
	min-width: 24px;
	text-align: center;
	color: #2e2420;
}

/* Tabs ebenfalls gegen Theme-Styles absichern */
.happy-tabs .happy-tabs__tab,
button.happy-tabs__tab {
	background: #fff !important;
	border: 1.5px solid #e2d8ca !important;
	border-radius: 6px !important;
	color: #2e2420 !important;
	padding: 12px 14px !important;
	text-transform: none !important;
	letter-spacing: 0 !important;
	box-shadow: none !important;
	line-height: 1.3 !important;
}

.happy-tabs .happy-tabs__tab.is-active,
button.happy-tabs__tab.is-active {
	border-color: #6e8a4a !important;
	background: #eaf0df !important;
	box-shadow: 0 0 0 1px #6e8a4a !important;
}

/* === Mobile: kompaktere Produktkacheln === */
@media (max-width: 768px) {

	/* Button nicht umbrechen lassen */
	.woocommerce ul.products li.product .button,
	.woocommerce ul.products li.product a.button,
	.woocommerce ul.products li.product .added_to_cart {
		padding: 9px 14px !important;
		font-size: 13px !important;
		line-height: 1.25 !important;
		white-space: nowrap !important;
		width: auto !important;
		display: inline-block !important;
		margin-top: 6px !important;
	}

	/* Produkttitel und Preis enger setzen */
	.woocommerce ul.products li.product .woocommerce-loop-product__title {
		font-size: 14px !important;
		line-height: 1.3 !important;
		margin-bottom: 4px !important;
	}

	.woocommerce ul.products li.product .price {
		font-size: 14px !important;
		margin-bottom: 4px !important;
	}

	/* Versandkosten-Hinweis kleiner */
	.woocommerce ul.products li.product .wc-gzd-additional-info,
	.woocommerce ul.products li.product .shipping-costs-info {
		font-size: 11px !important;
		line-height: 1.3 !important;
		margin-bottom: 2px !important;
	}
}

/* Sehr schmale Geraete */
@media (max-width: 420px) {
	.woocommerce ul.products li.product .button,
	.woocommerce ul.products li.product a.button {
		padding: 8px 10px !important;
		font-size: 12px !important;
	}
}

/* === Wunsch-Feld === */
.happy-wish {
	margin: 0 0 20px;
	padding: 16px 18px;
	background: #f7f3ec;
	border: 1px solid #e2d8ca;
	border-radius: 6px;
}
.happy-wish__label {
	display: block;
	font-weight: 700;
	font-size: 15px;
	margin-bottom: 8px;
	color: #2e2420;
}
.happy-wish__input {
	width: 100% !important;
	padding: 10px 12px !important;
	border: 1px solid #d8cdbb !important;
	border-radius: 4px !important;
	font-family: inherit !important;
	font-size: 14px !important;
	line-height: 1.5 !important;
	background: #fff !important;
	resize: vertical;
}
.happy-wish__input:focus {
	border-color: #6e8a4a !important;
	outline: 2px solid rgba(110,138,74,.25);
	outline-offset: 0;
}
.happy-wish__hint {
	margin: 8px 0 0 !important;
	font-size: 13px;
	color: #6b5d54;
}

/* === Kontakt-Hinweise === */
.happy-contact__line {
	margin: 12px 0 0 !important;
	padding: 10px 14px;
	background: #f7f3ec;
	border-radius: 4px;
	font-size: 14px;
	color: #6b5d54;
}
.happy-contact__line a {
	font-weight: 700;
	color: #6e8a4a;
	text-decoration: underline;
}
.happy-contact__list {
	list-style: none;
	padding: 0;
	margin: 0 0 20px;
}
.happy-contact__list li {
	padding: 7px 0;
	border-bottom: 1px solid #e2d8ca;
}
.happy-contact__list li:last-child { border-bottom: 0; }

/* === Lebensmittelangaben === */
.happy-food__withdrawal {
	margin: 10px 0 0 !important;
	padding: 10px 14px;
	background: #f7e7e0;
	border-left: 3px solid #b5654a;
	border-radius: 0 4px 4px 0;
	font-size: 13px;
	line-height: 1.5;
	color: #6b5d54;
}
.happy-food__table {
	width: 100%;
	border-collapse: collapse;
	margin-bottom: 18px;
}
.happy-food__table th {
	text-align: left;
	vertical-align: top;
	padding: 10px 16px 10px 0;
	width: 32%;
	font-weight: 700;
	border-bottom: 1px solid #e2d8ca;
}
.happy-food__table td {
	padding: 10px 0;
	border-bottom: 1px solid #e2d8ca;
}
.happy-food__hint {
	font-size: 13.5px;
	color: #6b5d54;
	line-height: 1.6;
}

.happy-food__draft {
	padding: 10px 14px;
	margin-bottom: 14px;
	background: #f7e7e0;
	border-left: 3px solid #b5654a;
	border-radius: 0 4px 4px 0;
	font-size: 13px;
	line-height: 1.5;
	color: #6b5d54;
}

/* ===== Abstaende auf der Produktseite ordnen ===== */

.woocommerce div.product .summary > * {
	margin-bottom: 14px;
}

/* Titel und Preis enger zusammen */
.woocommerce div.product .product_title {
	margin-bottom: 8px !important;
}

.woocommerce div.product p.price,
.woocommerce div.product span.price {
	margin: 0 0 6px !important;
}

/* Mindestbestellung direkt unter den Preis */
.happy-price-total {
	margin: 0 0 16px !important;
}

/* Kurzbeschreibung */
.woocommerce-product-details__short-description {
	margin: 0 0 18px !important;
}

.woocommerce-product-details__short-description p:last-child {
	margin-bottom: 0;
}

/* Einleitungstext der Box */
.happy-box__lead {
	margin: 0 0 18px !important;
}

/* Groessen-Tabs */
.happy-tabs {
	margin: 0 0 18px !important;
}

/* Varianten-Tabelle kompakter */
.woocommerce div.product form.cart .variations {
	margin-bottom: 14px !important;
}

.woocommerce div.product form.cart .variations td,
.woocommerce div.product form.cart .variations th {
	padding: 0 0 6px !important;
	line-height: 1.4;
}

.woocommerce div.product form.cart .reset_variations {
	margin: 0 0 8px;
	font-size: 13px;
}

/* Konfigurator-Block */
.happy-box {
	margin: 0 0 20px !important;
}

.happy-box__status {
	margin-bottom: 10px !important;
}

.happy-box__hint {
	margin-bottom: 16px !important;
}

/* Wunschfeld */
.happy-wish {
	margin: 0 0 18px !important;
}

/* Warenkorb-Bereich */
.woocommerce div.product form.cart {
	margin-bottom: 16px !important;
}

.woocommerce div.product form.cart .button {
	margin-top: 4px;
}

/* Hinweise darunter */
.happy-contact__line,
.happy-food__withdrawal,
.happy-pickup-hint,
.happy-min-qty {
	margin: 0 0 12px !important;
}

/* Produkt-Meta */
.woocommerce div.product .product_meta {
	margin: 14px 0 0 !important;
	padding-top: 14px;
	border-top: 1px solid var(--hmc-line, #F2D0D6);
	font-size: 14px;
}

/* Tabs unten */
.woocommerce div.product .woocommerce-tabs {
	margin-top: 36px;
}

.woocommerce div.product .woocommerce-tabs ul.tabs {
	margin-bottom: 18px !important;
	padding-left: 0 !important;
}
