/* =====================================================================
   21 Jump Food – options produit (YITH Product Add-ons)
   Portée : body.jf-commande (ajoutée par le mu-plugin jf-commande.php)
   ===================================================================== */

body.jf-commande {
	--jf-gold: #E2B94C;
	--jf-gold-soft: #FBF3DD;
	--jf-gold-deep: #B88E22;
	--jf-ink: #23262A;
	--jf-slate: #40454A;
	--jf-muted: #7A7F85;
	--jf-line: #E7E1D8;
	--jf-cream: #F9F5F2;
	--jf-white: #FFFFFF;
	--jf-radius: 12px;
	--jf-font-title: "Barlow Condensed", "Arial Narrow", sans-serif;
	--jf-font-ui: "Barlow Semi Condensed", "Arial Narrow", sans-serif;
}

/* ---------- Colonne image collante (desktop) ---------- */
@media (min-width: 1025px) {
	body.jf-commande .elementor-column:has(.elementor-widget-woocommerce-product-images) > .elementor-widget-wrap {
		position: sticky;
		top: calc(var(--wp-admin--admin-bar--height, 0px) + 130px); /* sous le header Elementor collant */
		align-self: flex-start;
	}
}

/* ---------- Formulaire ---------- */
body.jf-commande form.cart {
	display: block !important;
	margin-top: 8px;
}

body.jf-commande #yith-wapo-container {
	margin: 0 0 8px;
	padding: 0;
	font-family: var(--jf-font-ui);
	color: var(--jf-ink);
}

body.jf-commande .jf-sections {
	display: flex;
	flex-direction: column;
	gap: 28px;
}

/* ---------- Sections ---------- */
body.jf-commande .jf-section__head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 12px;
	padding-bottom: 8px;
	border-bottom: 2px solid var(--jf-gold);
}

body.jf-commande .jf-section__title {
	margin: 0;
	font-family: var(--jf-font-title);
	font-size: 26px;
	font-weight: 700;
	line-height: 1.1;
	letter-spacing: .5px;
	text-transform: uppercase;
	color: var(--jf-ink);
}

body.jf-commande .jf-section__hint {
	margin: 0;
	font-size: 14px;
	font-weight: 500;
	color: var(--jf-muted);
	white-space: nowrap;
}

/* ---------- Neutralisation du rendu YITH ---------- */
body.jf-commande .jf-sections .yith-wapo-block,
body.jf-commande .jf-sections .yith-wapo-addon {
	margin: 0 !important;
	padding: 0 !important;
	background: transparent !important;
	border: 0 !important;
}

body.jf-commande .jf-sections .options-container {
	display: block !important;
	height: auto !important;
}

/* Titres YITH : masqués dans les sections à en-tête propre */
body.jf-commande .jf-section--formule .addon-header,
body.jf-commande .jf-section--sauce .addon-header,
body.jf-commande .jf-section--retirer .addon-header {
	display: none;
}

/* Grille d'options façon « pastilles » */
body.jf-commande .jf-sections .options {
	display: grid !important;
	grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)) !important;
	gap: 8px !important;
	width: auto !important;
}

body.jf-commande .jf-sections .yith-wapo-option {
	position: relative;
	margin: 0 !important;
	padding: 0 !important;
	min-width: 0;
}

body.jf-commande .jf-sections .yith-wapo-option .label,
body.jf-commande .jf-sections .yith-wapo-option .option-container {
	display: block !important;
	width: 100% !important;
	height: 100%;
	margin: 0 !important;
	padding: 0 !important;
}

body.jf-commande .jf-sections .radio-button-container,
body.jf-commande .jf-sections .checkbox-button-container {
	box-sizing: border-box;
	width: 100%;
	height: 100%;
}

body.jf-commande .jf-sections .radio-button-container,
body.jf-commande .jf-sections .checkbox-button-container {
	display: flex !important;
	align-items: center;
	gap: 10px;
	min-height: 48px;
	margin: 0 !important;
	padding: 10px 12px;
	background: var(--jf-white);
	border: 1.5px solid var(--jf-line);
	border-radius: var(--jf-radius);
	cursor: pointer;
	transition: border-color .15s, background-color .15s, box-shadow .15s;
}

body.jf-commande .jf-sections .yith-wapo-option:hover .radio-button-container,
body.jf-commande .jf-sections .yith-wapo-option:hover .checkbox-button-container {
	border-color: var(--jf-gold);
}

/* Input natif conservé (accessibilité) mais invisible */
body.jf-commande .jf-sections .radiobutton,
body.jf-commande .jf-sections .checkboxbutton {
	position: relative !important;
	flex: 0 0 auto;
	width: 22px !important;
	height: 22px !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 2px solid #C9C2B8 !important;
	border-radius: 50% !important;
	background: var(--jf-white) !important;
	box-shadow: none !important;
	transition: border-color .15s, background-color .15s;
}

body.jf-commande .jf-sections .checkboxbutton {
	border-radius: 6px !important;
}

body.jf-commande .jf-sections .radiobutton input,
body.jf-commande .jf-sections .checkboxbutton input {
	position: absolute !important;
	inset: 0;
	width: 100% !important;
	height: 100% !important;
	margin: 0 !important;
	opacity: 0 !important;
	cursor: pointer;
}

body.jf-commande .jf-sections .radiobutton::before,
body.jf-commande .jf-sections .radiobutton::after,
body.jf-commande .jf-sections .checkboxbutton::before {
	display: none !important;
}

body.jf-commande .jf-sections .checkboxbutton::after {
	content: "";
	position: absolute;
	left: 6px;
	top: 2px;
	width: 6px;
	height: 11px;
	border: solid var(--jf-white);
	border-width: 0 2.5px 2.5px 0;
	transform: rotate(45deg) scale(0);
	transition: transform .12s;
	background: none !important;
}

/* Libellé : toute la carte est cliquable */
body.jf-commande .jf-sections .yith-wapo-option label {
	flex: 1 1 auto;
	display: flex !important;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	min-width: 0;
	margin: 0 !important;
	padding: 0 !important;
	font-family: var(--jf-font-ui);
	font-size: 15px !important;
	font-weight: 600 !important;
	line-height: 1.2;
	letter-spacing: .3px;
	text-transform: uppercase;
	color: var(--jf-ink) !important;
	cursor: pointer;
}

body.jf-commande .jf-sections .yith-wapo-option label::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: var(--jf-radius);
}

body.jf-commande .jf-sections .option-price {
	flex: 0 0 auto;
	padding: 2px 8px;
	border-radius: 999px;
	background: var(--jf-cream);
	font-size: 13px !important;
	font-weight: 700;
	color: var(--jf-slate) !important;
	white-space: nowrap;
}

body.jf-commande .jf-sections .option-price .brackets {
	display: none;
}

/* État sélectionné */
body.jf-commande .jf-sections .yith-wapo-option:has(input:checked) .radio-button-container,
body.jf-commande .jf-sections .yith-wapo-option:has(input:checked) .checkbox-button-container {
	border-color: var(--jf-gold);
	background: var(--jf-gold-soft);
	box-shadow: 0 0 0 1px var(--jf-gold) inset;
}

body.jf-commande .jf-sections .yith-wapo-option:has(input:checked) .radiobutton {
	border-color: var(--jf-gold) !important;
	background: var(--jf-white) !important;
	box-shadow: inset 0 0 0 4px var(--jf-white), inset 0 0 0 11px var(--jf-gold) !important;
}

body.jf-commande .jf-sections .yith-wapo-option:has(input:checked) .checkboxbutton {
	border-color: var(--jf-gold) !important;
	background: var(--jf-gold) !important;
}

body.jf-commande .jf-sections .yith-wapo-option:has(input:checked) .checkboxbutton::after {
	transform: rotate(45deg) scale(1);
}

body.jf-commande .jf-sections .yith-wapo-option:has(input:checked) .option-price {
	background: var(--jf-gold);
	color: var(--jf-ink) !important;
}

/* Focus clavier */
body.jf-commande .jf-sections .yith-wapo-option:has(input:focus-visible) .radio-button-container,
body.jf-commande .jf-sections .yith-wapo-option:has(input:focus-visible) .checkbox-button-container,
body.jf-commande .jf-formule-none:has(input:focus-visible) {
	outline: 3px solid var(--jf-slate);
	outline-offset: 2px;
}

/* ---------- Formule (cartes larges) ---------- */
body.jf-commande .jf-formules {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
	gap: 10px;
}

body.jf-commande .jf-formules .options {
	grid-template-columns: 1fr !important;
	height: 100%;
}

body.jf-commande .jf-formules .yith-wapo-block,
body.jf-commande .jf-formules .yith-wapo-addon,
body.jf-commande .jf-formules .options-container,
body.jf-commande .jf-formules .yith-wapo-option,
body.jf-commande .jf-formules .yith-wapo-option .label,
body.jf-commande .jf-formules .yith-wapo-option .option-container {
	height: 100%;
}

body.jf-commande .jf-formules .radio-button-container {
	height: 100%;
	min-height: 84px;
	align-items: flex-start;
	padding: 14px;
}

body.jf-commande .jf-formules .yith-wapo-option label {
	flex-direction: column;
	align-items: flex-start;
	justify-content: flex-start;
	gap: 8px;
	font-size: 16px !important;
}

body.jf-commande .jf-formule-none {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-height: 84px;
	margin: 0;
	padding: 14px 14px 14px 46px;
	background: var(--jf-white);
	border: 1.5px solid var(--jf-line);
	border-radius: var(--jf-radius);
	cursor: pointer;
	transition: border-color .15s, background-color .15s;
}

body.jf-commande .jf-formule-none:hover {
	border-color: var(--jf-gold);
}

body.jf-commande .jf-formule-none::before {
	content: "";
	position: absolute;
	left: 14px;
	top: 14px;
	width: 22px;
	height: 22px;
	box-sizing: border-box;
	border: 2px solid #C9C2B8;
	border-radius: 50%;
	background: var(--jf-white);
}

body.jf-commande .jf-formule-none input {
	position: absolute;
	left: 14px;
	top: 14px;
	width: 22px;
	height: 22px;
	margin: 0;
	opacity: 0;
}

body.jf-commande .jf-formule-none__name {
	font-family: var(--jf-font-ui);
	font-size: 16px;
	font-weight: 600;
	letter-spacing: .3px;
	text-transform: uppercase;
	color: var(--jf-ink);
}

body.jf-commande .jf-formule-none__sub {
	font-size: 14px;
	color: var(--jf-muted);
}

body.jf-commande .jf-formule-none.is-selected {
	border-color: var(--jf-gold);
	background: var(--jf-gold-soft);
	box-shadow: 0 0 0 1px var(--jf-gold) inset;
}

body.jf-commande .jf-formule-none.is-selected::before {
	border-color: var(--jf-gold);
	box-shadow: inset 0 0 0 4px var(--jf-white), inset 0 0 0 11px var(--jf-gold);
}

/* ---------- Produits à retirer ---------- */
body.jf-commande .jf-section--retirer .yith-wapo-option:has(input:checked) .checkbox-button-container {
	border-color: #C0504D;
	background: #FBEDEC;
	box-shadow: 0 0 0 1px #C0504D inset;
}

body.jf-commande .jf-section--retirer .yith-wapo-option:has(input:checked) .checkboxbutton {
	border-color: #C0504D !important;
	background: #C0504D !important;
}

body.jf-commande .jf-section--retirer .yith-wapo-option:has(input:checked) label {
	color: #8E2F2C !important;
}

/* ---------- Suppléments (accordéon) ---------- */
body.jf-commande .jf-extra-toggle {
	display: flex;
	align-items: center;
	gap: 12px;
	width: 100%;
	margin: 0;
	padding: 14px 16px;
	background: var(--jf-cream);
	border: 1.5px dashed #D8CBB5;
	border-radius: var(--jf-radius);
	color: var(--jf-ink);
	font-family: var(--jf-font-ui);
	text-align: left;
	text-transform: none;
	letter-spacing: 0;
	cursor: pointer;
	transition: border-color .15s, background-color .15s;
}

body.jf-commande .jf-extra-toggle:focus {
	background: var(--jf-cream);
	color: var(--jf-ink);
}

body.jf-commande .jf-extra-toggle:hover {
	background: var(--jf-gold-soft);
	border-color: var(--jf-gold);
	color: var(--jf-ink);
}

body.jf-commande .jf-extra-toggle:focus-visible {
	outline: 3px solid var(--jf-slate);
	outline-offset: 2px;
}

body.jf-commande .jf-extra-toggle__text {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
	min-width: 0;
}

body.jf-commande .jf-extra-toggle__title {
	font-family: var(--jf-font-title);
	font-size: 22px;
	font-weight: 700;
	line-height: 1.1;
	text-transform: uppercase;
}

body.jf-commande .jf-extra-toggle__sub {
	margin-top: 2px;
	font-size: 14px;
	font-weight: 500;
	color: var(--jf-muted);
}

body.jf-commande .jf-extra-toggle__sub::first-letter {
	text-transform: uppercase;
}

body.jf-commande .jf-extra-toggle__count {
	flex: 0 0 auto;
	min-width: 26px;
	height: 26px;
	padding: 0 8px;
	border-radius: 999px;
	background: var(--jf-gold);
	font-size: 14px;
	font-weight: 700;
	line-height: 26px;
	text-align: center;
}

body.jf-commande .jf-extra-toggle__count[hidden] {
	display: none;
}

body.jf-commande .jf-extra-toggle__icon {
	flex: 0 0 auto;
	position: relative;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	background: var(--jf-ink);
}

body.jf-commande .jf-extra-toggle__icon::before,
body.jf-commande .jf-extra-toggle__icon::after {
	content: "";
	position: absolute;
	left: 50%;
	top: 50%;
	width: 12px;
	height: 2px;
	background: var(--jf-white);
	transform: translate(-50%, -50%);
	transition: transform .2s;
}

body.jf-commande .jf-extra-toggle__icon::after {
	transform: translate(-50%, -50%) rotate(90deg);
}

body.jf-commande .jf-section--extra.is-open .jf-extra-toggle__icon::after {
	transform: translate(-50%, -50%) rotate(0deg);
}

/* Replié sans display:none (YITH ne compte que les add-ons « visibles ») */
body.jf-commande .jf-extra-panel {
	display: flex;
	flex-direction: column;
	gap: 22px;
	max-height: 0;
	overflow: hidden;
	opacity: 0;
	transition: max-height .3s ease, opacity .2s ease, padding .2s ease;
}

body.jf-commande .jf-section--extra.is-open .jf-extra-panel {
	max-height: 4000px;
	opacity: 1;
	padding-top: 18px;
}

body.jf-commande .jf-extra-panel .addon-header {
	margin: 0 0 10px !important;
	padding: 0 !important;
}

body.jf-commande .jf-extra-panel .wapo-addon-title {
	margin: 0 !important;
	font-family: var(--jf-font-ui) !important;
	font-size: 17px !important;
	font-weight: 700 !important;
	letter-spacing: .5px;
	text-transform: uppercase;
	color: var(--jf-slate) !important;
}

body.jf-commande .jf-extra-panel .wapo-addon-title::after {
	display: none !important;
}

/* Autres titres YITH (choix principal) */
body.jf-commande .jf-section--main .wapo-addon-title {
	margin: 0 0 8px !important;
	font-family: var(--jf-font-ui) !important;
	font-size: 17px !important;
	font-weight: 700 !important;
	text-transform: uppercase;
	color: var(--jf-slate) !important;
}

body.jf-commande .jf-section--main select {
	width: 100% !important;
	min-height: 48px;
	padding: 10px 12px;
	border: 1.5px solid var(--jf-line);
	border-radius: var(--jf-radius);
	background-color: var(--jf-white);
	font-family: var(--jf-font-ui);
	font-size: 16px;
	font-weight: 600;
}

body.jf-commande .jf-section--main .options {
	width: 100% !important;
	grid-template-columns: 1fr !important;
}

/* ---------- Tableau des totaux : remplacé par le prix sur le bouton ---------- */
body.jf-commande #wapo-total-price-table {
	display: none !important;
}

/* ---------- Barre Ajouter au panier ---------- */
body.jf-commande .jf-cta {
	position: sticky;
	bottom: 0;
	z-index: 20;
	display: flex;
	align-items: stretch;
	gap: 10px;
	margin: 24px -12px 0;
	padding: 12px 12px calc(12px + env(safe-area-inset-bottom, 0px));
	background: rgba(255, 255, 255, .96);
	border-top: 1px solid var(--jf-line);
	box-shadow: 0 -8px 20px -12px rgba(0, 0, 0, .18);
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
}

body.jf-commande .jf-qty {
	display: flex;
	align-items: stretch;
	flex: 0 0 auto;
	border: 1.5px solid var(--jf-line);
	border-radius: var(--jf-radius);
	background: var(--jf-white);
	overflow: hidden;
}

body.jf-commande .jf-qty .quantity {
	display: flex !important;
	margin: 0 !important;
}

body.jf-commande .jf-qty input.qty {
	width: 44px !important;
	height: auto !important;
	min-height: 52px;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 0 !important;
	background: transparent !important;
	font-family: var(--jf-font-ui);
	font-size: 18px !important;
	font-weight: 700;
	text-align: center;
	-moz-appearance: textfield;
	appearance: textfield;
}

body.jf-commande .jf-qty input.qty::-webkit-outer-spin-button,
body.jf-commande .jf-qty input.qty::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

body.jf-commande .jf-qty__btn {
	width: 44px;
	margin: 0;
	padding: 0;
	border: 0 !important;
	border-radius: 0 !important;
	background: transparent !important;
	color: var(--jf-ink) !important;
	font-size: 22px;
	font-weight: 600;
	line-height: 1;
	cursor: pointer;
}

body.jf-commande .jf-qty__btn:hover {
	background: var(--jf-cream) !important;
}

body.jf-commande .jf-qty__btn:disabled {
	color: #C9C2B8 !important;
	cursor: default;
	background: transparent !important;
}

body.jf-commande .jf-cta .single_add_to_cart_button {
	flex: 1 1 auto;
	display: flex !important;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	min-height: 56px;
	margin: 0 !important;
	padding: 0 20px !important;
	border: 0 !important;
	border-radius: var(--jf-radius) !important;
	background: var(--jf-gold) !important;
	color: var(--jf-ink) !important;
	font-family: var(--jf-font-ui) !important;
	font-size: 17px !important;
	font-weight: 700 !important;
	letter-spacing: 1px !important;
	text-transform: uppercase !important;
	box-shadow: 0 6px 16px -8px rgba(184, 142, 34, .8);
	transition: background-color .15s, transform .1s;
}

body.jf-commande .jf-cta .single_add_to_cart_button:not(.has-price) {
	justify-content: center;
}

body.jf-commande .jf-cta .single_add_to_cart_button:hover {
	background: #D6AB3A !important;
}

body.jf-commande .jf-cta .single_add_to_cart_button:active {
	transform: translateY(1px);
}

body.jf-commande .jf-cta__price {
	padding: 4px 10px;
	border-radius: 8px;
	background: rgba(255, 255, 255, .55);
	font-size: 18px;
	letter-spacing: 0;
	white-space: nowrap;
}

body.jf-commande .jf-cta__price:empty {
	display: none;
}

/* ---------- Mobile ---------- */
@media (max-width: 767px) {
	body.jf-commande .jf-sections {
		gap: 24px;
	}

	body.jf-commande .jf-section__title {
		font-size: 23px;
	}

	body.jf-commande .jf-sections .options {
		grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
	}

	body.jf-commande .jf-sections .yith-wapo-option label {
		flex-wrap: wrap;
		font-size: 14px !important;
		row-gap: 4px;
	}

	body.jf-commande .jf-formules,
	body.jf-commande .jf-formules .options,
	body.jf-commande .jf-section--main .options {
		grid-template-columns: 1fr !important;
	}

	body.jf-commande .jf-formule-none,
	body.jf-commande .jf-formules .radio-button-container {
		min-height: 0;
	}

	body.jf-commande .jf-formules .yith-wapo-option label {
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
	}

	body.jf-commande .jf-cta {
		margin-left: -16px;
		margin-right: -16px;
		padding-left: 16px;
		padding-right: 16px;
	}

	body.jf-commande .jf-cta .single_add_to_cart_button {
		padding: 0 14px !important;
		font-size: 15px !important;
		letter-spacing: .5px !important;
	}
}

@media (prefers-reduced-motion: reduce) {
	body.jf-commande .jf-extra-panel,
	body.jf-commande .jf-extra-toggle__icon::before,
	body.jf-commande .jf-extra-toggle__icon::after {
		transition: none;
	}
}
