/* =========================================================
   BR Design Option Produit — pastilles couleur
   Appliqué uniquement aux formulaires qui contiennent des pastilles (.br-sw-form)
   ========================================================= */

.br-sw-form {
	--br-sw-accent: #22a2c4;
	--br-sw-accent-bg: #e8f6fa;
	--br-sw-border: #d5dde3;
	--br-sw-text: #1c314c;
}

/* ---------- Mise en page : libellé au-dessus, pastilles en dessous ---------- */
body .br-sw-form table.variations,
body .br-sw-form table.variations tbody,
body .br-sw-form table.variations tr,
body .br-sw-form table.variations tr th.label,
body .br-sw-form table.variations tr td.value {
	display: block !important;
	width: 100% !important;
	max-width: 100% !important;
}

body .br-sw-form table.variations {
	margin: 0 0 1.2em !important;
	border: 0 !important;
}

body .br-sw-form table.variations tr + tr {
	margin-top: 14px;
}

/* Neutralise le bandeau bleu du thème sur le libellé */
body .br-sw-form table.variations tr th.label {
	background: transparent !important;
	border: 0 !important;
	border-radius: 0 !important;
	padding: 0 0 8px !important;
	line-height: 1.4 !important;
	white-space: normal !important;
	text-align: left !important;
}

body .br-sw-form table.variations tr th.label label {
	display: inline !important;
	padding: 0 !important;
	margin: 0 !important;
	color: var(--br-sw-text) !important;
	font-size: 15px;
	font-weight: 600;
}

.br-sw-current {
	color: var(--br-sw-accent);
	font-weight: 600;
}

/* Neutralise le fond gris et le transform du thème sur la cellule */
body .br-sw-form table.variations tr td.value {
	background: transparent !important;
	border: 0 !important;
	border-radius: 0 !important;
	padding: 0 !important;
	transform: none !important;
	line-height: 1.4 !important;
}

/* ---------- <select> natif : masqué mais toujours fonctionnel ---------- */
.br-sw-wrap {
	position: relative;
}

.br-sw-wrap select[data-br-sw] {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	padding: 0 !important;
	margin: -1px !important;
	overflow: hidden !important;
	clip: rect(0, 0, 0, 0) !important;
	white-space: nowrap !important;
	border: 0 !important;
	opacity: 0 !important;
	pointer-events: none !important;
}

/* ---------- Pastilles ---------- */
.br-sw {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

/* ---------- Carte blanche autour des options (comme la maquette) ---------- */
body form.variations_form.br-sw-form {
	background: #fff !important;
	border: 1px solid #e3e8ec;
	border-radius: 10px;
	padding: 16px !important;
	margin-top: 1.5rem !important;
}

/* Prix de la variante déjà affiché en haut : on masque le doublon */
.br-sw-price-moved .single_variation .woocommerce-variation-price {
	display: none !important;
}

/* Description de variante (ex. "TN-247K") : discrète */
.br-sw-form .single_variation .woocommerce-variation-description {
	font-size: 13px;
	color: #6b7a88;
	margin: 0 0 10px;
}
.br-sw-form .single_variation .woocommerce-variation-description p {
	margin: 0;
}

body .br-sw-form .br-sw .br-sw__item {
	background-color: #fff !important;
	color: var(--br-sw-text) !important;
	border: 1.5px solid var(--br-sw-border) !important;
}
body .br-sw-form .br-sw .br-sw__item:hover {
	border-color: var(--br-sw-accent) !important;
}
body .br-sw-form .br-sw .br-sw__item.is-selected {
	background-color: var(--br-sw-accent-bg) !important;
	border-color: var(--br-sw-accent) !important;
}

.br-sw__item {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	max-width: 100%;
	min-height: 40px;
	margin: 0;
	padding: 7px 14px 7px 9px;
	border: 1.5px solid var(--br-sw-border);
	border-radius: 999px;
	background: #fff;
	color: var(--br-sw-text);
	font: inherit;
	font-size: 14px;
	line-height: 1.25;
	text-align: left;
	text-transform: none;
	letter-spacing: normal;
	box-shadow: none;
	cursor: pointer;
	transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
	-webkit-tap-highlight-color: transparent;
}

.br-sw__item:hover {
	border-color: var(--br-sw-accent);
	background: #fff;
	color: var(--br-sw-text);
}

.br-sw__item:focus {
	outline: none;
}

.br-sw__item:focus-visible {
	outline: none;
	box-shadow: 0 0 0 3px rgba(34, 162, 196, .3);
}

.br-sw__item.is-selected {
	border-color: var(--br-sw-accent);
	background: var(--br-sw-accent-bg);
	box-shadow: inset 0 0 0 1px var(--br-sw-accent);
	font-weight: 600;
}

.br-sw__label {
	overflow-wrap: anywhere;
}

/* Point de couleur */
.br-sw__dot {
	position: relative;
	flex: 0 0 auto;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: var(--br-sw-color, #ccc);
	border: 1px solid rgba(0, 0, 0, .15);
}

.br-sw__dot--light {
	border-color: rgba(0, 0, 0, .3);
}

/* Pack / couleur : pastille tricolore cyan-magenta-jaune */
.br-sw__dot--multi {
	background: conic-gradient(#00a3e0 0 33.3%, #d6007e 0 66.6%, #ffd400 0);
}

/* Couleur non détectée : pastille neutre */
.br-sw__dot--none {
	background: repeating-linear-gradient(45deg, #eef1f3 0 4px, #dfe4e8 4px 8px);
}

/* Coche sur la pastille sélectionnée */
.br-sw__item.is-selected .br-sw__dot::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 5px;
	height: 9px;
	margin: -6px 0 0 -2.5px;
	border: solid #fff;
	border-width: 0 2px 2px 0;
	transform: rotate(45deg);
	filter: drop-shadow(0 0 1px rgba(0, 0, 0, .6));
}

/* ---------- États ---------- */

/* Rupture de stock : toujours cliquable (WooCommerce affiche le message) mais barrée */
.br-sw__item.is-oos {
	opacity: .55;
}

.br-sw__item.is-oos .br-sw__label {
	text-decoration: line-through;
}

.br-sw__item.is-oos .br-sw__dot::before {
	content: "";
	position: absolute;
	top: 50%;
	left: -2px;
	right: -2px;
	height: 2px;
	background: #c62828;
	transform: rotate(-45deg);
}

/* Combinaison indisponible avec les autres attributs choisis */
.br-sw__item.is-disabled {
	opacity: .35;
	cursor: not-allowed;
}

.br-sw__item.is-hidden {
	display: none;
}

/* Lien "Effacer" */
.br-sw-form .reset_variations {
	display: inline-block;
	margin-top: 8px;
	font-size: 13px;
	color: var(--br-sw-accent);
}

/* ---------- Mobile ---------- */
@media (max-width: 480px) {
	.br-sw__item {
		flex: 1 1 calc(50% - 4px);
		justify-content: flex-start;
		min-height: 44px;
	}
}

@media (max-width: 480px) {
	body form.variations_form.br-sw-form {
		padding: 12px !important;
	}
}

/* =========================================================
   v1.1.1 — Ajustements de rendu (alignement, grille, panier)
   ========================================================= */

/* Libellé parfaitement aligné à gauche (pseudo-éléments / retraits du thème) */
body .br-sw-form table.variations tr th.label,
body .br-sw-form table.variations tr th.label label {
	text-indent: 0 !important;
	margin-left: 0 !important;
	padding-left: 0 !important;
}
body .br-sw-form table.variations tr th.label::before,
body .br-sw-form table.variations tr th.label::after,
body .br-sw-form table.variations tr th.label label::before,
body .br-sw-form table.variations tr th.label label::after {
	content: none !important;
	display: none !important;
}

/* Pastilles en grille régulière 2 × 2 (4 sur une ligne si la place le permet) */
body .br-sw-form .br-sw {
	display: grid !important;
	grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
	gap: 8px;
}
body .br-sw-form .br-sw .br-sw__item {
	width: 100%;
	justify-content: flex-start;
}

/* Suppression des bordures / séparateurs ajoutés par le thème */
body .br-sw-form table.variations tr,
body .br-sw-form table.variations th,
body .br-sw-form table.variations td,
body .br-sw-form .single_variation_wrap,
body .br-sw-form .single_variation,
body .br-sw-form .woocommerce-variation {
	border: 0 !important;
	box-shadow: none !important;
}
body .br-sw-form table.variations {
	margin-bottom: 0 !important;
}

/* Lien "Effacer" collé aux pastilles */
body .br-sw-form .reset_variations {
	margin-top: 6px;
	text-decoration: none;
}

/* Référence de la variante (ex. TN-247K) */
body .br-sw-form .single_variation .woocommerce-variation-description {
	margin: 12px 0 0 !important;
}
body .br-sw-form .single_variation .woocommerce-variation-description p::before {
	content: "Réf. ";
}

/* Quantité + bouton panier sur une même ligne */
body .br-sw-form .woocommerce-variation-add-to-cart {
	display: flex !important;
	align-items: stretch;
	gap: 8px;
	margin-top: 14px;
}
body .br-sw-form .woocommerce-variation-add-to-cart .quantity {
	flex: 0 0 72px;
	margin: 0 !important;
	float: none !important;
}
body .br-sw-form .woocommerce-variation-add-to-cart .quantity input.qty {
	width: 100% !important;
	height: 100% !important;
	min-height: 48px;
	margin: 0 !important;
	border: 1px solid #c9d3da !important;
	border-radius: 6px !important;
	background: #fff !important;
	text-align: center;
}
body .br-sw-form .woocommerce-variation-add-to-cart .single_add_to_cart_button {
	flex: 1 1 auto;
	width: auto !important;
	min-height: 48px;
	margin: 0 !important;
	float: none !important;
	border-radius: 6px !important;
}
/* Champs cachés : pas d'impact sur le flex */
body .br-sw-form .woocommerce-variation-add-to-cart > input[type="hidden"] {
	display: none;
}
