/* FulfillIT Weight Bundle Builder */

.fwb {
	--fwb-line: rgba( 0, 0, 0, .12 );
	--fwb-soft: rgba( 0, 0, 0, .04 );
	--fwb-page: #fcfaf6;
	--fwb-accent: #5c9631;
	--fwb-green: #5c9631;
	--fwb-red: #b5423a;
	--fwb-white: #b9b2a6;
	--fwb-yellow: #c9a227;
	--fwb-gold: #b8860b;
	--fwb-warn-bg: #fdf3e3;
	--fwb-warn-line: #e0a33e;
	margin: 0 0 2em;
}

/* Stufenwahl */

.fwb__stages {
	display: flex;
	flex-wrap: wrap;
	gap: .5em;
	margin-bottom: 1em;
}

.fwb__stage {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: .1em;
	padding: .6em 1.1em;
	border: 1px solid var( --fwb-line );
	border-radius: 6px;
	background: transparent;
	cursor: pointer;
	line-height: 1.2;
}

.fwb__stage[aria-pressed="true"] {
	border-color: var( --fwb-accent );
	box-shadow: inset 0 0 0 1px var( --fwb-accent );
}

.fwb__stage-label {
	font-weight: 600;
}

.fwb__stage-price {
	font-size: .85em;
	opacity: .7;
}

/* Klebender Kopf: Fortschritt, Suche, Farbsprünge */

.fwb__sticky {
	position: sticky;
	top: 0;
	z-index: 20;
	padding: .75em 0 .6em;
	margin-bottom: .75em;
	background: var( --fwb-page );
	box-shadow: 0 6px 12px -10px rgba( 0, 0, 0, .5 );
}

.fwb__bar {
	height: 8px;
	border-radius: 4px;
	background: var( --fwb-soft );
	overflow: hidden;
}

.fwb__bar > span {
	display: block;
	height: 100%;
	width: 0;
	background: var( --fwb-accent );
	transition: width .18s ease;
}

.fwb__readout {
	margin: .45em 0 .7em;
	font-size: .95em;
	font-variant-numeric: tabular-nums;
}

.fwb.is-complete .fwb__readout {
	font-weight: 600;
	color: var( --fwb-accent );
}

.fwb__toolbar {
	display: flex;
	flex-wrap: wrap;
	gap: .6em;
	align-items: center;
}

.fwb__search {
	flex: 1 1 200px;
}

.fwb__search input {
	width: 100%;
	padding: .5em .75em;
	border: 1px solid var( --fwb-line );
	border-radius: 6px;
}

/* Farbsprünge */

.fwb__veins {
	display: flex;
	flex-wrap: wrap;
	gap: .3em;
}

.fwb__vein {
	display: inline-flex;
	align-items: center;
	gap: .4em;
	padding: .35em .8em;
	border: 1px solid var( --fwb-line );
	border-radius: 999px;
	background: transparent;
	font-size: .85em;
	cursor: pointer;
}

.fwb__vein::before {
	content: "";
	width: .55em;
	height: .55em;
	border-radius: 50%;
	background: var( --fwb-line );
}

.fwb__vein--green::before { background: var( --fwb-green ); }
.fwb__vein--red::before { background: var( --fwb-red ); }
.fwb__vein--white::before { background: var( --fwb-white ); }
.fwb__vein--yellow::before { background: var( --fwb-yellow ); }
.fwb__vein--gold::before { background: var( --fwb-gold ); }

/* Chips der Auswahl */

.fwb__chips {
	display: flex;
	flex-wrap: wrap;
	gap: .4em;
	margin-bottom: .8em;
}

.fwb__chips:empty {
	display: none;
}

.fwb__chip {
	display: inline-flex;
	align-items: center;
	gap: .35em;
	padding: .3em .6em;
	border: 1px solid rgba( 140, 176, 88, .55 );
	border-radius: 6px;
	background: rgba( 140, 176, 88, .16 );
	font-size: .85em;
	font-variant-numeric: tabular-nums;
	cursor: pointer;
}

.fwb__chip::after {
	content: " \00d7";
	opacity: .55;
}

/* Auffüllen und Leeren */

.fwb__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: .4em;
	margin-bottom: 1.2em;
	font-size: .9em;
}

.fwb__fillers {
	display: inline-flex;
	flex-wrap: wrap;
	gap: .3em;
}

.fwb__filler {
	padding: .35em .75em;
	border: 1px solid var( --fwb-line );
	border-radius: 6px;
	background: transparent;
	cursor: pointer;
	font-size: .95em;
}

.fwb__filler--green { border-left: 3px solid var( --fwb-green ); }
.fwb__filler--red { border-left: 3px solid var( --fwb-red ); }
.fwb__filler--white { border-left: 3px solid var( --fwb-white ); }
.fwb__filler--yellow { border-left: 3px solid var( --fwb-yellow ); }
.fwb__filler--gold { border-left: 3px solid var( --fwb-gold ); }

.fwb__reset {
	margin-left: auto;
	padding: .35em .75em;
	border: 0;
	background: transparent;
	color: inherit;
	opacity: .6;
	text-decoration: underline;
	cursor: pointer;
	font-size: .95em;
}

.fwb__reset:hover {
	opacity: 1;
}

/* Farbgruppen */

.fwb__group {
	margin-bottom: 1.75em;
}

.fwb__group[hidden] {
	display: none;
}

.fwb__group-title {
	display: flex;
	align-items: center;
	gap: .5em;
	margin: 0 0 .7em;
	padding-bottom: .35em;
	border-bottom: 2px solid var( --fwb-line );
	font-size: 1em;
	text-transform: uppercase;
	letter-spacing: .06em;
}

.fwb__group--green .fwb__group-title { border-bottom-color: var( --fwb-green ); }
.fwb__group--red .fwb__group-title { border-bottom-color: var( --fwb-red ); }
.fwb__group--white .fwb__group-title { border-bottom-color: var( --fwb-white ); }
.fwb__group--yellow .fwb__group-title { border-bottom-color: var( --fwb-yellow ); }
.fwb__group--gold .fwb__group-title { border-bottom-color: var( --fwb-gold ); }

.fwb__group-count {
	padding: .1em .5em;
	border-radius: 999px;
	background: var( --fwb-soft );
	font-size: .78em;
	font-weight: 400;
	letter-spacing: 0;
	opacity: .7;
}

/* Sortenkarten */

.fwb__cards {
	display: grid;
	grid-template-columns: repeat( auto-fill, minmax( 200px, 1fr ) );
	gap: .6em;
}

.fwb__card {
	display: flex;
	flex-direction: column;
	border: 1px solid var( --fwb-line );
	border-radius: 8px;
	overflow: hidden;
	background: transparent;
	transition: border-color .15s ease, box-shadow .15s ease;
}

.fwb__card[hidden] {
	display: none;
}

.fwb__card.is-active {
	border-color: var( --fwb-accent );
	box-shadow: inset 0 0 0 1px var( --fwb-accent );
	background: rgba( 140, 176, 88, .26 );
}

.fwb__card.is-active .fwb__card-head {
	background: rgba( 92, 150, 49, .32 );
	border-bottom-color: var( --fwb-accent );
}

.fwb__card.is-active .fwb__sizes {
	background: rgba( 92, 150, 49, .35 );
}

/* Nicht gewaehlte Groessen innerhalb einer aktiven Karte bleiben hell,
   damit der Stepper der gewaehlten Groesse trotzdem heraussticht. */
.fwb__card.is-active .fwb__size {
	background: rgba( 255, 255, 255, .72 );
}

.fwb__card-head {
	display: flex;
	align-items: center;
	gap: .55em;
	padding: .55em .65em;
	border-bottom: 1px solid var( --fwb-line );
	background: var( --fwb-soft );
	min-width: 0;
}

.fwb__card-head img {
	width: 36px;
	height: 36px;
	object-fit: cover;
	border-radius: 4px;
	flex: none;
}

.fwb__card-meta {
	display: flex;
	flex-direction: column;
	line-height: 1.15;
	min-width: 0;
}

.fwb__card-meta strong {
	font-size: .95em;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.fwb__card-meta small {
	font-size: .75em;
	opacity: .6;
	font-variant-numeric: tabular-nums;
}

/* Größen innerhalb der Karte */

.fwb__sizes {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 1px;
	background: var( --fwb-line );
	padding: 1px 0 0;
	margin-top: auto;
}

.fwb__size {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: .2em;
	padding: .45em .3em;
	background: var( --fwb-page );
	min-height: 66px;
	justify-content: center;
}

.fwb__size-label {
	font-size: .78em;
	opacity: .65;
	font-variant-numeric: tabular-nums;
}

/* Grundzustand: nur der Plus-Knopf */

.fwb__size-pick {
	width: 34px;
	height: 30px;
	padding: 0;
	border: 1px solid var( --fwb-line );
	border-radius: 6px;
	background: transparent;
	cursor: pointer;
	font-size: 1.05em;
	line-height: 1;
}

.fwb__size-pick:hover:not( :disabled ) {
	border-color: var( --fwb-accent );
	color: var( --fwb-accent );
}

.fwb__size-step {
	display: none;
	align-items: center;
	gap: .1em;
}

/* Gewählter Zustand: voller Stepper */

.fwb__size.is-active,
.fwb__card.is-active .fwb__size.is-active {
	background: #8cb058;
	box-shadow: inset 0 0 0 1px var( --fwb-accent );
	color: #fff;
}

.fwb__size.is-active .fwb__size-label {
	color: #fff;
}

.fwb__size.is-active .fwb__size-pick {
	display: none;
}

.fwb__size.is-active .fwb__size-step {
	display: flex;
}

.fwb__size.is-active .fwb__size-label {
	opacity: .9;
	font-weight: 600;
}

.fwb__size.is-blocked .fwb__size-pick {
	opacity: .25;
	cursor: not-allowed;
}

.fwb__size.is-empty .fwb__size-dash {
	opacity: .3;
	line-height: 30px;
}

.fwb__size.is-empty .fwb__size-label {
	opacity: .35;
}

.fwb__step {
	width: 26px;
	height: 26px;
	padding: 0;
	border: 1px solid var( --fwb-line );
	border-radius: 5px;
	background: var( --fwb-page );
	cursor: pointer;
	line-height: 1;
	font-size: .95em;
}

.fwb__step:disabled {
	opacity: .25;
	cursor: default;
}

.fwb__count {
	min-width: 1.7em;
	text-align: center;
	font-variant-numeric: tabular-nums;
	font-weight: 600;
}

.fwb__size-pick:focus-visible,
.fwb__step:focus-visible,
.fwb__chip:focus-visible,
.fwb__stage:focus-visible,
.fwb__vein:focus-visible,
.fwb__filler:focus-visible,
.fwb__reset:focus-visible {
	outline: 2px solid var( --fwb-accent );
	outline-offset: 2px;
}

.fwb__none,
.fwb__empty {
	padding: 1em;
	opacity: .7;
}

.fwb__submit {
	margin-top: 1.25em;
}

.fwb__submit button[disabled] {
	opacity: .45;
	cursor: not-allowed;
}

/* Rückfrage im Builder */

.fwb__confirm {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: .75em;
	padding: .8em 1em;
	margin-bottom: 1em;
	border: 1px solid var( --fwb-warn-line );
	border-left: 4px solid var( --fwb-warn-line );
	border-radius: 6px;
	background: var( --fwb-warn-bg );
}

.fwb__confirm p {
	margin: 0;
	flex: 1 1 220px;
	font-size: .95em;
}

.fwb__confirm-actions {
	display: flex;
	gap: .4em;
}

.fwb__confirm-yes,
.fwb__confirm-no {
	padding: .45em .95em;
	border: 1px solid var( --fwb-line );
	border-radius: 6px;
	background: #fff;
	cursor: pointer;
	font-size: .9em;
}

.fwb__confirm-yes {
	border-color: var( --fwb-warn-line );
	color: #8a5a12;
	font-weight: 600;
}

/* Hinweis im Warenkorb, wenn ein Pack nicht mehr lieferbar ist */

.woocommerce-error li:has( .fwb-drop ),
.fwb-cart-notice {
	background: var( --fwb-warn-bg );
}

.fwb-drop {
	display: inline-block;
	margin-left: .6em;
	padding: .3em .8em;
	border: 1px solid var( --fwb-warn-line );
	border-radius: 6px;
	background: #fff;
	color: #8a5a12;
	font-size: .9em;
	font-weight: 600;
	text-decoration: none;
	white-space: nowrap;
}

.fwb-drop:hover {
	background: var( --fwb-warn-line );
	color: #fff;
}

/* Warenkorb */

.woocommerce-cart-form .fwb-child td {
	opacity: .8;
	font-size: .92em;
}

.woocommerce-cart-form .fwb-child .product-name {
	padding-left: 1.5em;
}

.fwb-child-marker {
	opacity: .4;
	margin-right: .3em;
}

.fwb-qty,
.fwb-included {
	opacity: .65;
	font-size: .92em;
	white-space: nowrap;
}

/* Mobil */

@media ( max-width: 600px ) {

	.fwb__cards {
		grid-template-columns: repeat( auto-fill, minmax( 150px, 1fr ) );
		gap: .5em;
	}

	.fwb__card-head {
		padding: .45em .5em;
	}

	.fwb__card-head img {
		width: 30px;
		height: 30px;
	}

	.fwb__size {
		min-height: 58px;
		padding: .4em .2em;
	}

	.fwb__toolbar {
		gap: .45em;
	}

	.fwb__search {
		flex: 1 1 100%;
	}

	.fwb__veins {
		width: 100%;
		overflow-x: auto;
		flex-wrap: nowrap;
		padding-bottom: .2em;
		-webkit-overflow-scrolling: touch;
	}

	.fwb__vein {
		flex: none;
	}

	.fwb__reset {
		margin-left: 0;
	}
}

@media ( prefers-reduced-motion: reduce ) {

	.fwb__bar > span,
	.fwb__card {
		transition: none;
	}
}

/* Auffüll-Menü */

.fwb__filler-menu {
	position: relative;
}

.fwb__filler-toggle {
	display: inline-flex;
	align-items: center;
	gap: .4em;
	padding: .45em .9em;
	border: 1px dashed var( --fwb-line );
	border-radius: 6px;
	background: transparent;
	cursor: pointer;
	font-size: .95em;
	opacity: .75;
}

.fwb__filler-toggle::after {
	content: "\25be";
	font-size: .8em;
}

.fwb__filler-toggle:hover,
.fwb__filler-toggle.is-open {
	opacity: 1;
	border-style: solid;
	border-color: var( --fwb-accent );
	color: var( --fwb-accent );
}

.fwb__filler-panel {
	position: absolute;
	top: calc( 100% + .35em );
	left: 0;
	z-index: 30;
	min-width: 220px;
	padding: .7em .8em;
	border: 1px solid var( --fwb-line );
	border-radius: 8px;
	background: #fff;
	box-shadow: 0 8px 24px -12px rgba( 0, 0, 0, .45 );
}

.fwb__filler-hint {
	margin: 0 0 .5em;
	font-size: .85em;
	opacity: .7;
}

/* Nach oben */

.fwb__to-top {
	margin-left: auto;
	width: 30px;
	height: 30px;
	padding: 0;
	border: 2px solid var( --fwb-accent );
	border-radius: 6px;
	background: transparent;
	color: var( --fwb-accent );
	cursor: pointer;
	line-height: 1;
	font-size: 1.1em;
	font-weight: 700;
}

.fwb__to-top:hover {
	background: var( --fwb-accent );
	color: #fff;
}

/* Zweiter Warenkorb-Knopf in der Aktionszeile */

.fwb__actions {
	justify-content: space-between;
}

.fwb__submit-inline {
	margin: 0 auto;
	padding: .5em 1.4em;
	font-size: .95em;
}

.fwb__submit-inline[disabled] {
	opacity: .4;
	cursor: not-allowed;
}

@media ( max-width: 600px ) {

	.fwb__actions {
		justify-content: flex-start;
	}

	.fwb__submit-inline {
		order: 3;
		width: 100%;
		margin: .4em 0 0;
	}
}

/* Statuszeile: Text und Knopf nebeneinander */

.fwb__status-row {
	display: flex;
	align-items: center;
	gap: .75em;
}

.fwb__status-row .fwb__readout {
	flex: 1 1 auto;
}

/* Der Knopf in der Leiste erscheint nur mobil und nur, wenn das Pack voll ist. */
.fwb__submit-bar {
	display: none;
}

/*
 * Mobil laeuft die Fortschrittsleiste als feste Zeile am unteren Rand mit.
 * position: sticky bricht zuverlaessig, sobald irgendein Vorfahre
 * overflow: hidden setzt — was viele Themes gegen horizontales Scrollen tun.
 * fixed ist davon unabhaengig und liegt ausserdem in Daumenreichweite.
 */
@media ( max-width: 682px ) {

	.fwb {
		padding-bottom: 9em;
	}

	.fwb__sticky {
		position: static;
		box-shadow: none;
		padding-top: 0;
	}

	.fwb__status {
		position: fixed;
		left: 0;
		right: 0;
		/* Abstand nach unten, damit der Knopf des Cookie-Banners frei bleibt.
		   Ueber --fwb-bar-offset anpassbar, falls das Banner die Hoehe aendert. */
		bottom: calc( var( --fwb-bar-offset, 1.2em ) + env( safe-area-inset-bottom, 0px ) );
		z-index: 60;
		padding: 0.6em 0.9em;
		background: var( --fwb-page );
		border: 1px solid var( --fwb-line );
		border-radius: 10px;
		margin: 0 .6em;
		box-shadow: 0 6px 20px -8px rgba( 0, 0, 0, .45 );
	}

	.fwb__status .fwb__readout {
		margin: .4em 0 0;
		font-size: .9em;
	}

	/* Suche und Farbsprünge bleiben oben kleben, aber ohne die Leiste. */
	.fwb__toolbar {
		position: sticky;
		top: 0;
		z-index: 20;
		padding: .5em 0;
		background: var( --fwb-page );
	}

	.fwb.is-complete .fwb__submit-bar {
		display: inline-block;
		flex: none;
		padding: .5em 1.1em;
		font-size: .9em;
		white-space: nowrap;
	}

	/* Der Knopf in der Aktionszeile ist mobil doppelt gemoppelt. */
	.fwb__submit-inline {
		display: none;
	}
}
