/**
 * Ekoscan Probes Selector — styles (filtres + tableau responsive).
 * Chemin cible : wp-content/themes/salient-child/inc/maj-probes/maj-probes.css
 *
 * Rôle : habillage sobre et cohérent Salient. Tout est préfixé .maj-probes pour ne rien polluer.
 * Palette de marque : accent #2776f5, bleu #22519a, navy #210d7e. Boutons arrondis 15px, sans ombre.
 * Responsive : scroll horizontal + en-tête collant sur desktop/tablette, bascule en cartes en mobile.
 */

/* ---------------------------------------------------------------------------
 * Variables (limitées au module)
 * ------------------------------------------------------------------------- */
.maj-probes {
	--maj-accent: #2776f5;
	--maj-blue: #22519a;
	--maj-navy: #210d7e;
	--maj-line: #d8e0ef;          /* trait de grille discret */
	--maj-head-bg: #f4f7fc;       /* fond d'en-tête clair */
	--maj-hover: #eef4ff;         /* survol de ligne */
	--maj-radius: 15px;           /* rayon de marque (boutons/cartes) */
	--maj-radius-sm: 10px;        /* rayon des champs */

	color: var(--maj-navy);
	font-size: 15px;
	line-height: 1.4;
}

/* Filet de sécurité : le JS masque via l'attribut [hidden] ; on neutralise tout
   display:table-row global du thème qui pourrait l'écraser. */
.maj-probes [hidden] {
	display: none !important;
}

.maj-probes *,
.maj-probes *::before,
.maj-probes *::after {
	box-sizing: border-box;
}

.maj-probes__intro {
	margin: 0 0 1em;
	color: var(--maj-blue);
}

/* ---------------------------------------------------------------------------
 * Déroulants de filtres
 * ------------------------------------------------------------------------- */
.maj-probes__filters {
	display: grid;
	/* 6 déroulants sur une seule ligne en desktop ; minmax(0,1fr) autorise le rétrécissement. */
	grid-template-columns: repeat(6, minmax(0, 1fr));
	gap: 0.75em 1em;
	margin-bottom: 1em;
}

/* Dégradation responsive des filtres : 6 → 3 → 2 → 1 colonne. */
@media (max-width: 1100px) {
	.maj-probes__filters {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (max-width: 700px) {
	.maj-probes__filters {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 460px) {
	.maj-probes__filters {
		grid-template-columns: 1fr;
	}
}

.maj-probes__field {
	display: flex;
	flex-direction: column;
	gap: 0.3em;
}

.maj-probes__label {
	font-size: 0.82em;
	font-weight: 600;
	color: var(--maj-navy);
}

.maj-probes__select {
	width: 100%;
	padding: 0.5em 0.7em;
	border: 1px solid var(--maj-line);
	border-radius: var(--maj-radius-sm);
	background-color: #fff;
	color: var(--maj-navy);
	font-size: 0.95em;
	line-height: 1.3;
	cursor: pointer;
	appearance: none;
	-webkit-appearance: none;
	/* chevron SVG inline (pas d'asset externe) */
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath fill='%2322519a' d='M6 8 0 2l1.4-1.4L6 5.2 10.6.6 12 2z'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 0.7em center;
	background-size: 0.7em;
	padding-right: 2em;
}

.maj-probes__select:hover {
	border-color: var(--maj-accent);
}

.maj-probes__select:focus-visible,
.maj-probes__reset:focus-visible,
.maj-probes__tablewrap:focus-visible {
	outline: 2px solid var(--maj-accent);
	outline-offset: 2px;
}

/* ---------------------------------------------------------------------------
 * Barre d'état : compteur + réinitialisation
 * ------------------------------------------------------------------------- */
.maj-probes__toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 0.75em;
	margin-bottom: 0.75em;
}

.maj-probes__count {
	margin: 0;
	font-weight: 600;
	color: var(--maj-blue);
}

.maj-probes__reset {
	border: none;
	border-radius: var(--maj-radius);
	background-color: var(--maj-accent);
	color: #fff;
	font: inherit;
	font-weight: 600;
	padding: 0.55em 1.3em;
	cursor: pointer;
	box-shadow: none;            /* style de marque : arrondi, pas d'ombre */
	transition: background-color 0.15s ease;
}

.maj-probes__reset:hover {
	background-color: var(--maj-blue);
}

/* ---------------------------------------------------------------------------
 * Tableau (desktop / tablette) : scroll + en-tête collant
 * ------------------------------------------------------------------------- */
.maj-probes__tablewrap {
	max-height: 70vh;             /* 583 lignes : on borne la hauteur, scroll interne */
	overflow: auto;
	border: 1px solid var(--maj-line);
	border-radius: var(--maj-radius);
}

.maj-probes__table {
	width: 100%;
	border-collapse: collapse;
	margin: 0;
	font-size: 0.9em;
}

.maj-probes__th,
.maj-probes__cell {
	padding: 0.55em 0.8em;
	border: 1px solid var(--maj-line);
	/* !important : une règle de Salient (styles de contenu, probablement CSS dynamique du thème)
	   force les <th> à gauche. Même parade que le tableau existant du site (.data-table-content th). */
	text-align: center !important;
	vertical-align: middle;
	/* Les cellules peuvent se wrapper : le tableau tient sur 100% de la largeur,
	   pas de scroll horizontal sur desktop (9 colonnes au lieu de 11).
	   overflow-wrap (et non word-break) : ne coupe un mot QUE s'il déborde vraiment,
	   donc les en-têtes courts restent entiers (« Exciter » et non « Excite/r »). */
	white-space: normal;
	overflow-wrap: break-word;
}

.maj-probes__th {
	position: sticky;             /* en-tête figé au scroll vertical */
	top: 0;
	z-index: 1;
	background-color: var(--maj-head-bg);
	color: var(--maj-navy);
	font-weight: 700;
	/* la bordure collapse ne « colle » pas : on simule le trait bas */
	box-shadow: inset 0 -1px 0 var(--maj-line);
}

.maj-probes__row:hover .maj-probes__cell {
	background-color: var(--maj-hover);
}

/* Part Number = la « réponse » : mis en avant */
.maj-probes__cell--pn {
	font-weight: 700;
	color: var(--maj-accent);
}

.maj-probes__empty td {
	padding: 1.2em;
	text-align: center;
	font-style: italic;
	color: var(--maj-blue);
}

.maj-probes__error {
	padding: 1em;
	color: var(--maj-blue);
}

/* ---------------------------------------------------------------------------
 * Mobile : bascule en cartes (chaque ligne = un bloc, libellés via data-label)
 * ------------------------------------------------------------------------- */
@media (max-width: 768px) {
	.maj-probes__tablewrap {
		max-height: none;
		border: none;
		overflow: visible;
	}

	.maj-probes__table,
	.maj-probes__table tbody,
	.maj-probes__row,
	.maj-probes__cell {
		display: block;
		width: 100%;
	}

	.maj-probes__table thead {
		display: none;            /* les libellés passent dans chaque cellule (::before) */
	}

	.maj-probes__row {
		border: 1px solid var(--maj-line);
		border-radius: var(--maj-radius);
		margin-bottom: 0.8em;
		padding: 0.25em 0.75em;
		background-color: #fff;
	}

	.maj-probes__row:hover .maj-probes__cell {
		background-color: transparent; /* pas de survol pertinent en tactile */
	}

	.maj-probes__cell {
		display: flex;
		justify-content: space-between;
		align-items: baseline;
		gap: 1em;
		text-align: right !important; /* override le center !important de la règle de base (mode carte) */
		white-space: normal;
		border: none;
		border-bottom: 1px solid var(--maj-line);
		padding: 0.5em 0.1em;
	}

	.maj-probes__cell:last-child {
		border-bottom: none;
	}

	.maj-probes__cell::before {
		content: attr(data-label);
		flex: 0 0 auto;
		font-weight: 600;
		color: var(--maj-navy);
		text-align: left;
	}

	.maj-probes__empty td {
		border: 1px solid var(--maj-line);
		border-radius: var(--maj-radius);
	}
}

/* ===========================================================================
 * BASCULE RESPONSIVE (vue 'responsive' = défaut)
 * Desktop : sélecteur filtrable. Mobile (≤768px) : tableau comparatif.
 * =========================================================================== */
.maj-probes__view--mobile {
	display: none;
}

@media (max-width: 768px) {
	.maj-probes__view--desktop {
		display: none;
	}
	.maj-probes__view--mobile {
		display: block;
	}
}

/* ===========================================================================
 * VUE COMPARATIVE (données Bobbin_Website.pdf) — table statique 3 technologies
 * =========================================================================== */
.maj-probes__compare-wrap {
	border: 1px solid var(--maj-line);
	border-radius: var(--maj-radius);
	overflow: hidden; /* coins arrondis sur la table interne */
}

.maj-probes__compare {
	width: 100%;
	border-collapse: collapse;
	margin: 0;
	font-size: 0.92em;
}

.maj-probes__compare th,
.maj-probes__compare td {
	padding: 0.7em 0.9em;
	border: 1px solid var(--maj-line);
	vertical-align: middle;
	text-align: center;
	overflow-wrap: break-word;
}

/* En-tête : ECT / RFT / NFT */
.maj-probes__compare-head {
	background-color: var(--maj-navy);
	color: #fff;
	font-weight: 700;
	letter-spacing: 0.04em;
}

.maj-probes__compare-corner {
	background-color: var(--maj-navy);
	border-color: var(--maj-navy);
}

/* 1re colonne : libellé de la spécification */
.maj-probes__compare-label {
	text-align: left;
	font-weight: 700;
	color: var(--maj-navy);
	background-color: var(--maj-head-bg);
	white-space: nowrap;
}

/* Ligne « Technology » mise en accent (comme dans le PDF) */
.maj-probes__compare-cell--accent {
	color: var(--maj-accent);
	font-weight: 700;
}

/* Zebra sur les lignes de valeurs */
.maj-probes__compare tbody tr:nth-child(even) .maj-probes__compare-cell {
	background-color: var(--maj-head-bg);
}

/* Notes de pied */
.maj-probes__compare-notes {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.2em 0;
	margin: 0.9em 0 0;
	font-size: 0.82em;
	color: var(--maj-blue);
	text-align: center;
}

.maj-probes__compare-note {
	padding: 0 0.9em;
}

.maj-probes__compare-note:not(:last-child) {
	border-right: 1px solid var(--maj-line);
}

/* Mobile : bascule en cartes par spécification (zéro scroll horizontal) */
@media (max-width: 768px) {
	.maj-probes__compare-wrap {
		border: none;
		border-radius: 0;
		overflow: visible;
	}

	.maj-probes__compare,
	.maj-probes__compare tbody,
	.maj-probes__compare tr,
	.maj-probes__compare th,
	.maj-probes__compare td {
		display: block;
		width: 100%;
	}

	.maj-probes__compare thead {
		display: none; /* les libellés ECT/RFT/NFT passent dans chaque cellule (::before) */
	}

	.maj-probes__compare tbody tr {
		border: 1px solid var(--maj-line);
		border-radius: var(--maj-radius);
		margin-bottom: 0.8em;
		overflow: hidden;
	}

	.maj-probes__compare-label {
		background-color: var(--maj-navy);
		color: #fff;
		white-space: normal;
		border: none;
	}

	.maj-probes__compare-cell {
		display: flex;
		justify-content: space-between;
		align-items: baseline;
		gap: 1em;
		text-align: right;
		border: none;
		border-bottom: 1px solid var(--maj-line);
	}

	.maj-probes__compare tbody tr .maj-probes__compare-cell:last-child {
		border-bottom: none;
	}

	.maj-probes__compare-cell::before {
		content: attr(data-label);
		flex: 0 0 auto;
		font-weight: 700;
		color: var(--maj-navy);
		text-align: left;
	}

	/* La ligne commune (Cable Lengths) n'a pas de techno : pas de libellé, centrée. */
	.maj-probes__compare-cell--span {
		justify-content: center;
		text-align: center;
	}

	.maj-probes__compare-cell--span::before {
		content: none;
	}

	/* Zebra inutile en mode carte */
	.maj-probes__compare tbody tr:nth-child(even) .maj-probes__compare-cell {
		background-color: transparent;
	}
}
