/*
 * PICMAN : composants maison, communs à plusieurs écrans (docs/UI.md § 9).
 * Chaque composant est documenté ici et exposé sur la page uikit.xhtml.
 */

/* ---------- Choix segmenté : quelques options exclusives, ex. thème Clair / Sombre / Auto ---------- */
.segmented {
	display: inline-flex;
	gap: 2px;
	padding: 3px;
	border: 1px solid var(--line);
	border-radius: 999px;
	background: var(--paper);
}

.segmented__option {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-height: 32px;
	padding: 0 12px;
	border: 0;
	border-radius: 999px;
	background: transparent;
	color: var(--slate);
	font: inherit;
	font-size: 0.8125rem;
	font-weight: 600;
	cursor: pointer;
}

.segmented__option:hover {
	color: var(--ink);
}

.segmented__option[aria-pressed="true"] {
	background: var(--blue-soft);
	color: var(--blue);
}

.segmented__option:focus-visible {
	outline: none;
	box-shadow: var(--focus-ring);
}

@media screen and (pointer: coarse) {
	.segmented__option {
		min-height: 44px;
		padding: 0 14px;
	}
}

/* ---------- Pastille de filtre : un critère qui se cumule aux autres, aria-pressed porte l'état ---------- */

.filter-pill {
	display: inline-flex;
	align-items: center;
	gap: 0.375rem;
	min-height: 2.125rem;
	padding: 0 0.75rem;
	border: 1px solid var(--line-strong);
	border-radius: 999px;
	background: var(--paper);
	color: var(--ink);
	font: inherit;
	font-size: 0.84375rem;
	font-weight: 560;
	white-space: nowrap;
	cursor: pointer;
	transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

.filter-pill:hover {
	border-color: var(--blue);
}

.filter-pill:focus-visible {
	outline: none;
	box-shadow: var(--focus-ring);
}

.filter-pill[aria-pressed="true"] {
	border-color: var(--blue);
	background: var(--blue-soft);
	color: var(--blue);
	font-weight: 650;
}

.filter-pill > .icon {
	display: none;
	width: 0.875rem;
	height: 0.875rem;
	stroke-width: 2.4;
}

.filter-pill[aria-pressed="true"] > .icon {
	display: inline-block;
}

.filter-pill__count {
	color: var(--muted);
	font-size: 0.75rem;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
}

.filter-pill[aria-pressed="true"] .filter-pill__count {
	color: var(--blue);
}

.filter-pill--scope {
	border-style: dashed;
}

@media screen and (pointer: coarse) {
	.filter-pill {
		min-height: 2.75rem;
		padding: 0 0.875rem;
	}
}

/* ---------- Icône du sprite (templates/picman/icons.xhtml, balise pm:icon) ---------- */

.icon {
	width: 1.25rem;
	height: 1.25rem;
	flex: none;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.75;
	stroke-linecap: round;
	stroke-linejoin: round;
	vertical-align: middle;
}

/* ---------- État vide : ce qui manque et ce qu'il faut faire ---------- */

.empty-state {
	display: grid;
	justify-items: center;
	gap: 0.375rem;
	padding: 2.5rem 1.5rem;
	color: var(--slate);
	text-align: center;
}

.empty-state__title {
	margin: 0;
	color: var(--ink);
	font-size: 1rem;
	font-weight: 700;
}

.empty-state__text {
	max-width: 52ch;
	margin: 0;
	font-size: 0.875rem;
}

/* ---------- Pastille d'état : icône + texte, jamais la couleur seule ---------- */

.chip {
	display: inline-flex;
	align-items: center;
	gap: 0.375rem;
	min-height: 1.625rem;
	padding: 0 0.625rem;
	border-radius: 999px;
	font-size: 0.78125rem;
	font-weight: 620;
	line-height: 1.2;
	white-space: nowrap;
}

.chip .icon {
	width: 0.875rem;
	height: 0.875rem;
	stroke-width: 2.2;
}

.chip--ok {
	background: var(--green-soft);
	color: var(--green-deep);
}

.chip--warn {
	background: var(--amber-soft);
	color: var(--amber-ink);
}

.chip--bad {
	background: var(--red-soft);
	color: var(--red);
}

.chip--info {
	background: var(--blue-soft);
	color: var(--blue);
}

.chip--neutral {
	background: var(--paper-2);
	color: var(--slate);
	box-shadow: inset 0 0 0 1px var(--line);
}

/* ---------- Régime de facturation d'un vol (planches) ---------- */

.bill {
	display: inline-flex;
	align-items: center;
	min-height: 1.375rem;
	padding: 0 0.5rem;
	border-radius: var(--radius-xs);
	background: var(--paper-2);
	color: var(--slate);
	box-shadow: inset 0 0 0 1px var(--line);
	font-size: 0.75rem;
	font-weight: 640;
	white-space: nowrap;
}

.bill--INSTRUCTION,
.bill--TRAINING {
	background: var(--blue-soft);
	color: var(--blue);
	box-shadow: none;
}

.bill--MUTUAL,
.bill--SHARE {
	background: var(--violet-soft);
	color: var(--violet);
	box-shadow: none;
}

/* Des catégories, pas des états : ni le vert (« positif ») ni l'ambre (« attention ») de la charte */
.bill--LAP,
.bill--RECOVER {
	background: transparent;
	color: var(--violet);
	box-shadow: inset 0 0 0 1px var(--violet);
}

.bill--CLUB,
.bill--PASSENGER {
	background: var(--paper-2);
	color: var(--ink);
	box-shadow: none;
}

.bill--EXTERIEUR {
	background: transparent;
	color: var(--muted);
	box-shadow: inset 0 0 0 1px var(--line-strong);
}

/* ---------- Carte : un objet distinct de la page (en-tête de membre, relevé) ---------- */

.card {
	min-width: 0;
	background: var(--paper);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	box-shadow: var(--shadow-1);
}

/* ---------- Touche du clavier citée dans un texte ou un champ ---------- */

kbd {
	padding: 0 0.3125rem;
	border: 1px solid var(--line-strong);
	border-bottom-width: 2px;
	border-radius: var(--radius-xs);
	background: var(--paper-2);
	color: var(--slate);
	font-family: var(--font);
	font-size: 0.75rem;
	font-weight: 650;
	line-height: 1.125rem;
	white-space: nowrap;
}

/* ---------- Action discrète dans une ligne de tableau ou une carte (voir, corriger, supprimer) ---------- */

.row-action {
	display: inline-flex;
	align-items: center;
	gap: 0.25rem;
	height: 1.75rem;
	padding: 0 0.5625rem;
	border: 0;
	border-radius: var(--radius-sm);
	background: transparent;
	color: var(--slate);
	font: inherit;
	font-size: 0.78125rem;
	font-weight: 600;
	text-decoration: none;
	vertical-align: middle;
	cursor: pointer;
}

.row-action:hover {
	background: var(--blue-mist);
	color: var(--ink);
}

.row-action .icon {
	width: 0.9375rem;
	height: 0.9375rem;
}

.row-action--danger {
	width: 1.75rem;
	padding: 0;
	justify-content: center;
	color: var(--red);
}

.row-action--danger:hover {
	background: var(--red-soft);
	color: var(--red);
}

@media screen and (pointer: coarse) {
	.row-action {
		justify-content: center;
		min-width: 2.75rem;
		height: 2.75rem;
	}

	.row-action--danger {
		width: 2.75rem;
	}
}

/* ---------- Fenêtre de dialogue : jamais plus large que l'écran ---------- */

.app-dialog.ui-dialog {
	max-width: calc(100vw - 2rem);
}

/* ---------- Aide sous un champ de saisie ---------- */

.cell-hint {
	display: block;
	margin-top: 0.1875rem;
	color: var(--muted);
	font-size: 0.75rem;
	line-height: 1.35;
}

/* Dans une cellule de saisie, l'aide tient sur sa ligne ; ailleurs (dialogues) elle passe à la ligne */
td .cell-hint {
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

/* ---------- Bandeau : une information qui attend un geste (photo manquante) ---------- */

.notice {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr);
	gap: 0.75rem;
	padding: 0.875rem 1rem;
	border: 1px solid var(--blue-line);
	border-left: 4px solid var(--blue);
	border-radius: var(--radius);
	background: var(--blue-mist);
}

.notice__icon {
	width: 1.375rem;
	height: 1.375rem;
	margin-top: 0.125rem;
	color: var(--blue);
}

.notice__body {
	display: grid;
	gap: 0.25rem;
	min-width: 0;
}

.notice__title {
	margin: 0;
	font-size: 0.9375rem;
	font-weight: 700;
}

.notice__text {
	margin: 0;
	color: var(--slate);
	font-size: 0.84375rem;
}

.notice__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin-top: 0.375rem;
}

/* ---------- Interrupteur (role="switch") : l'état se lit aussi en texte ---------- */

.toggle {
	display: inline-flex;
	align-items: center;
	gap: 0.5625rem;
	min-height: 2.75rem;
	padding: 0.25rem 0.125rem 0.25rem 0.375rem;
	border: 0;
	border-radius: 999px;
	background: transparent;
	color: var(--muted);
	font: inherit;
	cursor: pointer;
}

.toggle:focus-visible {
	outline: none;
	box-shadow: var(--focus-ring);
}

.toggle[aria-busy="true"] {
	cursor: progress;
}

.toggle__track {
	position: relative;
	flex: none;
	width: 2.625rem;
	height: 1.5rem;
	border-radius: 999px;
	background: var(--muted);
	transition: background-color 0.2s ease;
}

.toggle__knob {
	position: absolute;
	top: 0.1875rem;
	left: 0.1875rem;
	display: grid;
	place-items: center;
	width: 1.125rem;
	height: 1.125rem;
	border-radius: 50%;
	background: var(--on-accent);
	box-shadow: var(--shadow-1);
	transition: transform 0.2s ease;
}

.toggle__knob .icon {
	width: 0.75rem;
	height: 0.75rem;
	stroke-width: 2.6;
	color: var(--fill-primary);
	opacity: 0;
}

.toggle[aria-checked="true"] .toggle__track {
	background: var(--fill-primary);
}

.toggle[aria-checked="true"] .toggle__knob {
	transform: translateX(1.125rem);
}

.toggle[aria-checked="true"] .toggle__knob .icon {
	opacity: 1;
}

.toggle__state {
	min-width: 4.5rem;
	font-size: 0.78125rem;
	font-weight: 640;
	text-align: left;
}

.toggle[aria-checked="true"] .toggle__state {
	color: var(--ink);
}

/* ---------- Zone de recherche d'une liste : icône, champ, touche « / » qui y mène ---------- */

.search-box {
	position: relative;
	min-width: 0;
}

.search-box > .icon {
	position: absolute;
	top: 50%;
	left: 0.75rem;
	color: var(--muted);
	transform: translateY(-50%);
	pointer-events: none;
}

.search-box > .search-box__field {
	width: 100%;
	height: 2.375rem;
	padding: 0 2.75rem 0 2.5rem;
	border: 1px solid var(--line-strong);
	border-radius: var(--radius-sm);
	background: var(--field-bg);
	color: var(--ink);
	font: inherit;
	font-size: 0.875rem;
}

.search-box > .search-box__field::placeholder {
	color: var(--muted);
}

.search-box > .search-box__field:focus {
	border-color: var(--blue);
	outline: none;
	box-shadow: var(--focus-ring);
}

.search-box__key {
	position: absolute;
	top: 50%;
	right: 0.75rem;
	transform: translateY(-50%);
	pointer-events: none;
}

.search-box:focus-within .search-box__key,
.search-box__field:not(:placeholder-shown) + .search-box__key {
	display: none;
}

@media screen and (pointer: coarse) {
	.search-box > .search-box__field {
		height: 2.75rem;
		font-size: 1rem;
	}

	/* Le raccourci clavier « / » ne sert à rien au doigt */
	.search-box__key {
		display: none;
	}
}

@media screen and (max-width: 767.98px) {
	.search-box > .search-box__field {
		height: 3rem;
		font-size: 1rem;
	}

	.search-box__key {
		display: none;
	}
}

/* ---------- Étiquette de rôle d'un membre (Membres, Annuaire), drapeaux de PersonCard ---------- */

.role-tag {
	display: inline-flex;
	align-items: center;
	min-height: 1.375rem;
	margin-right: 0.25rem;
	padding: 0 0.5rem;
	border-radius: var(--radius-xs);
	font-size: 0.75rem;
	font-weight: 640;
	white-space: nowrap;
	vertical-align: middle;
}

.role-tag--i {
	background: var(--blue-soft);
	color: var(--blue);
}

.role-tag--a {
	background: var(--paper-2);
	color: var(--slate);
	box-shadow: inset 0 0 0 1px var(--line);
}

.role-tag--r {
	background: var(--violet-soft);
	color: var(--violet);
}

.role-tag--f {
	background: var(--paper);
	color: var(--blue);
	box-shadow: inset 0 0 0 1px var(--blue-line);
}

.role-tag--b {
	background: var(--green-soft);
	color: var(--green-deep);
}

.role-tag--d {
	background: transparent;
	color: var(--slate);
	box-shadow: inset 0 0 0 1px var(--line-strong);
}

.role-tag--s {
	background: var(--line);
	color: var(--ink);
}

/* ---------- Pastille de choix : un bouton radio présenté en pastille, la valeur cochée porte une coche ---------- */

.choice-pill {
	position: relative;
	display: inline-flex;
}

.choice-pill > input {
	position: absolute;
	inset: 0;
	margin: 0;
	opacity: 0;
	cursor: pointer;
}

.choice-pill > span {
	display: inline-flex;
	align-items: center;
	gap: 0.375rem;
	min-height: 2.25rem;
	padding: 0 0.75rem;
	border: 1px solid var(--line-strong);
	border-radius: 999px;
	background: var(--field-bg);
	color: var(--ink);
	font-size: 0.84375rem;
	font-weight: 560;
	transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

.choice-pill > span small {
	padding: 0 0.375rem;
	border: 1px solid var(--line-strong);
	border-radius: 999px;
	color: var(--muted);
	font-size: 0.75rem;
	font-weight: 650;
	line-height: 1rem;
}

.choice-pill > input:checked + span {
	border-color: var(--blue);
	background: var(--blue-soft);
	color: var(--blue);
	font-weight: 650;
}

.choice-pill > input:checked + span::before {
	content: "";
	width: 0.5625rem;
	height: 0.3125rem;
	border-bottom: 2px solid currentColor;
	border-left: 2px solid currentColor;
	transform: translateY(-2px) rotate(-45deg);
}

.choice-pill > input:checked + span small {
	border-color: var(--blue-line);
	color: var(--blue);
}

.choice-pill > input:focus-visible + span {
	box-shadow: var(--focus-ring);
}

@media screen and (pointer: coarse) {
	.choice-pill > span {
		min-height: 2.75rem;
		font-size: 0.9375rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	.choice-pill > span {
		transition: none;
	}
}

/* ---------- Liens isolés au doigt : cible de 44 px de haut (liens de contact de l'en-tête de
   Facturation, nom d'un membre, raccourcis « Ouvrir… », « À tarifer », dernier jour de vol) ---------- */
@media screen and (pointer: coarse) {
	.pilot__meta a,
	.member__name,
	.home-link,
	.bundles-row__price-link,
	.touch-link {
		display: inline-flex;
		align-items: center;
		min-height: 2.75rem;
	}

	.home-toggle {
		min-height: 2.75rem;
	}
}

/* Lien dans une phrase : souligné, il se distingue du texte autrement que par la couleur */
.touch-link {
	text-decoration: underline;
	text-underline-offset: 2px;
}

