/* =========================================================
   Vote : ruban, mise en page responsive, ergonomie tactile
   ========================================================= */

:root {
	--vote-accent: #00A65A;
	--vote-touch: 44px; /* taille minimale d'une cible tactile */
}

body { -webkit-tap-highlight-color: transparent; }

/* Empêche le débordement horizontal sans créer un conteneur de défilement :
   nécessaire pour que la barre « Soumettre » reste collée (sticky). */
.content-wrapper { overflow-x: hidden; overflow-x: clip; }

/* Ancres : laisser de la place sous un éventuel en-tête fixe */
[id^="pos-"] { scroll-margin-top: 70px; }

/* ---------- Cartes ---------- */
.card {
	background: #fff;
	border-radius: 4px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, .1);
}

/* ---------- Textes ---------- */
.vote-title {
	display: block;
	font-size: 1.1rem;
	line-height: 1.3;
	overflow-wrap: anywhere;
}
.vote-intro h4 { font-size: 1rem; line-height: 1.5; margin: 0; padding: 0.5em; }
.vote-message { font-size: 1.05rem; line-height: 1.5; padding: 0.5em 0; }
.vote-box .alert { margin: 0.5em; }

@media (min-width: 768px) {
	.vote-title { font-size: 1.5rem; }
	.vote-intro h4 { font-size: 1.2rem; }
	.vote-message { font-size: 1.4rem; }
}

/* ---------- En-tête : logo + titre ---------- */
.vote-brand .card-header { padding: 10px; }
.vote-brand .card-img-top { max-width: 100%; max-height: 90px; width: auto; margin: 0 auto; }

@media (max-width: 991px) {
	.vote-brand {
		display: flex;
		align-items: center;
		gap: 12px;
		padding: 10px 12px;
		text-align: left;
	}
	.vote-brand .card-header { flex: 0 0 auto; padding: 0; border: 0; background: none; }
	.vote-brand .card-img-top { max-height: 50px; }
	.vote-brand .card-body { flex: 1 1 auto; min-width: 0; padding: 0; }
	.vote-brand .card-title { margin: 0; }
}

/* ---------- Bandeau multi-identifiants ---------- */
.multi-ribbon {
	background: #3c8dbc;
	color: #fff;
	text-align: center;
	padding: 8px 12px;
	margin-bottom: 12px;
	border-radius: 3px;
	font-weight: 600;
	box-shadow: 0 2px 4px rgba(0, 0, 0, .15);
}

/* ---------- Ruban « Votre vote » ---------- */
.vote-ribbon {
	--f: 10px;  /* hauteur du pli */
	--r: 15px;  /* profondeur de l'encoche en V */
	--t: 10px;  /* décalage haut */

	position: relative;
	inset: var(--t) calc(-1 * var(--f)) auto auto;
	padding: 0.4em calc(10px + var(--r)) 1em;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	text-align: center;
	clip-path: polygon(
		0 0,
		100% 0,
		calc(100% - var(--r)) calc(50% - var(--f) / 2),
		100% calc(100% - var(--f)),
		calc(100% - var(--f)) 100%,
		calc(100% - var(--f)) calc(100% - var(--f)),
		var(--f) calc(100% - var(--f)),
		var(--f) 100%,
		0 calc(100% - var(--f)),
		var(--r) calc(50% - var(--f) / 2)
	);
	background: var(--vote-accent);
	box-shadow: 0 calc(-1 * var(--f)) 0 inset #0005;
	margin-left: -1.15em;
	margin-top: 0.8em;
	margin-bottom: 0.5em;
	font-size: large;
	color: #fff;
}

.vote-ribbon-title { margin: 0; font-size: 1.4rem; }
.vote-ribbon-sub   { margin: 0.5em 0 0; overflow-wrap: anywhere; }

@media (max-width: 767px) {
	.vote-ribbon {
		--f: 8px;
		--r: 10px;
		inset: auto;
		margin: 0 0 1em;
		padding: 0.6em calc(12px + var(--r)) 1em;
		font-size: 1rem;
	}
	.vote-ribbon-title { font-size: 1.2rem; }
}

/* ---------- Boutons et actions ---------- */
.vote-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	justify-content: center;
	margin-top: 10px;
}

@media (max-width: 767px) {
	.btn { min-height: var(--vote-touch); white-space: normal; }
	.vote-actions .btn,
	.vote-btn-block { width: 100%; }
}

/* ---------- Navigation entre scrutins ---------- */
.vote-nav { margin-bottom: 12px; }
.vote-nav-title { text-align: center; margin: 0 0 6px; }
.vote-nav-list {
	display: flex;
	gap: 6px;
	overflow-x: auto;
	padding-bottom: 6px;
	-webkit-overflow-scrolling: touch;
}
.vote-nav-item {
	flex: 0 0 auto;
	max-width: 80vw;
	white-space: normal;
	text-align: left;
	margin: 0 !important;
}

@media (min-width: 768px) {
	.vote-nav-list { flex-wrap: wrap; justify-content: center; overflow: visible; }
}

/* ---------- Bulletin : toute la ligne est cliquable ---------- */
.vote-row { margin: 15px 0; }

.vote-option {
	display: flex;
	align-items: center;
	gap: 12px;
	min-height: var(--vote-touch);
	padding: 10px 14px;
	font-size: 1rem;
	cursor: pointer;
	overflow-wrap: anywhere;
}
.vote-option:active { background: #eef6fb; }
.vote-option:has(.checked) { background: #e8f4fb; font-weight: 600; }
.vote-option > [class*="_flat-green"] { flex: 0 0 auto; margin: 0; }

@media (min-width: 768px) {
	.vote-option { font-size: 1.1rem; min-height: 50px; }
}

.vote-next { margin: 0 10px 10px; text-align: right; }
@media (max-width: 767px) {
	.vote-next .btn { width: 100%; }
}

/* ---------- Barre « Soumettre » : collée en bas sur mobile ---------- */
.vote-submit-bar {
	position: sticky;
	bottom: 0;
	z-index: 5;
	margin-top: 10px;
	padding: 10px 10px calc(10px + env(safe-area-inset-bottom, 0px));
	text-align: center;
	background: #fff;
	box-shadow: 0 -4px 12px rgba(0, 0, 0, .1);
}
.vote-submit-bar .btn { width: 100%; min-height: 48px; font-size: 1.1rem; }

@media (min-width: 768px) {
	.vote-submit-bar {
		position: static;
		padding: 10px 0;
		background: none;
		box-shadow: none;
	}
	.vote-submit-bar .btn { width: auto; min-width: 260px; }
}

/* ---------- Changement d'identifiant ---------- */
.vote-switch-toggle {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 8px;
	min-height: var(--vote-touch);
	padding: 10px 15px;
	color: #555;
	text-decoration: none;
}
.vote-switch-toggle > span { min-width: 0; overflow-wrap: anywhere; }
.vote-chevron { margin-left: auto; }
.vote-switch-help { text-align: left; margin-bottom: 10px; }

.switch-option {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr);
	align-items: center;
	gap: 6px 12px;
	min-height: var(--vote-touch);
	margin-bottom: 6px;
	border-radius: 4px;
	cursor: pointer;
}
.switch-option.is-current { cursor: default; }
.switch-option > input[type="radio"] { margin: 0; width: 20px; height: 20px; }
.switch-name { min-width: 0; overflow-wrap: anywhere; }
.switch-badges {
	grid-column: 2;
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}
.switch-badges .label { white-space: normal; text-align: left; }

/* ---------- Modales et lecteur QR ---------- */
@media (max-width: 767px) {
	.modal-dialog { width: auto; margin: 10px; }
}
#QrCodeReader #reader { width: 100%; }