/* Archive Variation Toggle (type-brod)
 * Single-row layout: pills sit alongside the Kjøp button so card heights
 * align across simple and variable products. All three buttons share equal
 * flex width via display:contents on the inner pills wrapper.
 */

.kc-archive-picker {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	width: 100%;
	align-items: stretch;
}

.kc-archive-picker__pills {
	display: contents;
}

.kc-archive-picker__pill,
.kc-archive-picker__buy {
	flex: 1 1 0;
	min-width: 0;
	box-sizing: border-box !important;
}

.kc-archive-picker__pill {
	background-color: #fff !important;
	color: #1a1a1a !important;
	border: 2px solid #e5e5e5 !important;
	border-radius: 0 !important;
	padding: 18px 8px !important;
	cursor: pointer;
	text-transform: uppercase;
	font-size: 13px !important;
	font-weight: 700 !important;
	line-height: 1.2;
	text-align: center;
	text-decoration: none !important;
	transition: all 0.2s ease;
	box-shadow: none !important;
}

.kc-archive-picker__pill .kc-archive-picker__pill-label {
	display: block;
}

.kc-archive-picker__pill:hover {
	border-color: #888 !important;
	background-color: #fff !important;
	color: #1a1a1a !important;
}

.kc-archive-picker__pill:focus-visible {
	outline: 2px solid #000;
	outline-offset: 2px;
}

.kc-archive-picker__pill.is-active {
	background-color: #000 !important;
	color: #fff !important;
	border-color: #000 !important;
}

.kc-archive-picker__pill.is-unavailable,
.kc-archive-picker__pill[disabled] {
	opacity: 0.4 !important;
	cursor: not-allowed !important;
}

.kc-archive-picker__pill.is-unavailable:hover,
.kc-archive-picker__pill[disabled]:hover {
	border-color: #e5e5e5 !important;
}

/* Buy button — visual skin comes from .product-buy-link button rule in
 * style.css; here we just enforce flex sizing + state classes. */
.kc-archive-picker__buy[disabled],
.kc-archive-picker__buy[aria-disabled="true"] {
	opacity: 0.45 !important;
	cursor: not-allowed !important;
	pointer-events: none;
}

.kc-archive-picker__buy.is-loading {
	opacity: 0.7 !important;
	cursor: progress !important;
}

.kc-archive-picker__buy.is-added {
	background-color: #2ea44f !important;
	border-color: #2ea44f !important;
	color: #fff !important;
}

/* Feedback wraps to its own row below the buttons. */
.kc-archive-picker__feedback {
	flex: 1 1 100%;
	font-size: 12px;
	min-height: 0;
	color: #666;
}

.kc-archive-picker__feedback[data-kind="error"] {
	color: #c0392b;
}

.kc-archive-picker__feedback[data-kind="success"] {
	color: #2ea44f;
}

/* ---------- Glutenfritt-toggle layout ----------
 * Single-row: [qty input] [Glutenfritt toggle] [Kjøp]. Replaces the two-pill
 * picker for the typical Vanlig/Glutenfritt 2-option case. The qty input is
 * the standard WC quantity field (qib enhances with +/- buttons). The toggle
 * mirrors the single-product variation feedback pattern: white background,
 * subtle border, "Velg alternativ" → "✓ Valgt" via ::after — never a black
 * fill. */

form.kc-archive-picker--toggle {
	margin: 0;
	padding: 0;
}

/* Sizing of the qib +/- buttons and qty input is handled globally in
 * style.css (.qib-container .qib-button, .qib-container .quantity input.qty).
 * Here we just make sure the qty wrapper stretches the qib row to match the
 * tallest sibling (Glutenfritt toggle / Kjøp) in the picker row. */
.kc-archive-picker--toggle .kc-archive-picker__qty {
	flex: 0 0 auto;
	display: flex;
	align-items: stretch;
}

.kc-archive-picker--toggle .kc-archive-picker__qty .qib-container,
.kc-archive-picker--toggle .kc-archive-picker__qty .quantity {
	align-self: stretch;
}

.kc-archive-picker__gf-btn {
	flex: 1 1 0;
	min-width: 0;
	min-height: 60px;
	box-sizing: border-box !important;
	background-color: #fff !important;
	color: #1a1a1a !important;
	border: 2px solid #e5e5e5 !important;
	border-radius: 0 !important;
	padding: 8px 8px !important;
	cursor: pointer;
	text-transform: uppercase;
	font-size: 13px !important;
	font-weight: 700 !important;
	line-height: 1.2;
	text-align: center;
	text-decoration: none !important;
	transition: all 0.2s ease;
	box-shadow: none !important;
	display: flex !important;
	flex-direction: column;
	gap: 3px;
	align-items: center;
	justify-content: center;
	align-self: stretch;
}

.kc-archive-picker__gf-btn:hover {
	border-color: #888 !important;
	background-color: #fff !important;
	color: #1a1a1a !important;
}

.kc-archive-picker__gf-btn:focus-visible {
	outline: 2px solid #000;
	outline-offset: 2px;
}

.kc-archive-picker__gf-btn[aria-pressed="true"] {
	border-color: #000 !important;
	background-color: #fafafa !important;
	color: #1a1a1a !important;
}

.kc-archive-picker__gf-btn[aria-pressed="true"]:hover {
	border-color: #000 !important;
	background-color: #fafafa !important;
}

.kc-archive-picker__gf-btn::after {
	content: "Velg alternativ";
	font-size: 11px;
	font-weight: 500;
	color: #888;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	white-space: nowrap;
	max-width: 100%;
	overflow: hidden;
}

.kc-archive-picker__gf-btn[aria-pressed="true"]::after {
	content: "✓ Valgt";
	color: #000;
	font-weight: 700;
}

/* Mobile: the picker column is too narrow for qty + toggle + Kjøp on one
 * row, so the toggle gets clipped ("GLUTENFRIT…"). Stack it above qty +
 * Kjøp via order:-1 + flex-basis 100%, then let qty + buy share the second
 * row. Toggle returns to its natural label/state size since it now has the
 * full row to breathe in. */
@media (max-width: 600px) {
	.kc-archive-picker__gf-btn {
		flex: 1 1 100% !important;
		order: -1;
		padding: 10px 12px !important;
		min-height: 52px;
	}

	.kc-archive-picker__gf-label {
		white-space: nowrap;
	}

	.kc-archive-picker__gf-btn::after {
		letter-spacing: 0.3px;
	}

	.kc-archive-picker--toggle .kc-archive-picker__qty {
		order: 1;
	}

	.kc-archive-picker--toggle .kc-archive-picker__buy {
		order: 2;
	}

	.kc-archive-picker--toggle .kc-archive-picker__feedback {
		order: 3;
	}
}

.kc-archive-picker__gf-btn.is-unavailable,
.kc-archive-picker__gf-btn[disabled] {
	opacity: 0.4 !important;
	cursor: not-allowed !important;
}

.kc-archive-picker__gf-btn.is-unavailable:hover,
.kc-archive-picker__gf-btn[disabled]:hover {
	border-color: #e5e5e5 !important;
}

.kc-archive-picker__gf-btn.is-unavailable::after,
.kc-archive-picker__gf-btn[disabled]::after {
	content: "Ikke tilgjengelig";
	color: #aaa;
}
