/* ==========================================================================
   CGT VOTES CE — STYLES FRONT-OFFICE (INTÉGRATION NATIVE DANS cgt-wp-theme)
   ========================================================================== */

.cgt-vote-container {
	max-width: 760px;
	margin-inline: auto;
	font-family: var(--font-sans, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif);
	color: var(--text-main, #1a1a1a);
	line-height: 1.6;
}

/* Neutralise les marges automatiques de .entry-content du thème à l'intérieur des cartes */
.entry-content .cgt-vote-container h2,
.entry-content .cgt-vote-container h3,
.entry-content .cgt-vote-container h4 {
	margin-top: 0;
}

.cgt-vote-container > * + * {
	margin-top: 1.25rem;
}

/* Cartes principales */
.cgt-vote-card {
	background-color: var(--bg-main, #ffffff);
	border: 1px solid var(--border-card, #cbd5e1);
	border-radius: var(--radius-card, 12px);
	padding: 1.65rem 1.75rem;
	box-shadow: var(--shadow-card, 0 4px 14px rgba(15, 23, 42, 0.05));
}

.cgt-vote-card-banner {
	display: inline-block;
	background-color: var(--cgt-red, #d20012);
	color: #ffffff;
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	padding: 0.3rem 0.85rem;
	border-radius: var(--radius-pill, 999px);
	margin-bottom: 0.85rem;
}

.cgt-vote-card-title,
.cgt-vote-poll-title {
	font-size: clamp(1.3rem, 2.4vw, 1.65rem);
	font-weight: 800;
	color: var(--text-main, #1a1a1a);
	margin: 0 0 0.75rem;
	line-height: 1.25;
}

.cgt-vote-lead {
	color: var(--text-muted, #4a5568);
	margin: 0 0 1.25rem;
}

/* Bandeau d'accueil nominatif (État 4) */
.cgt-vote-welcome-banner {
	background: linear-gradient(135deg, #ffffff 0%, var(--bg-soft, #f1f3f5) 100%);
	border: 1px solid var(--border-card, #cbd5e1);
	border-left: 5px solid var(--cgt-red, #d20012);
	border-radius: var(--radius-card, 12px);
	padding: 1.35rem 1.5rem;
	box-shadow: var(--shadow-card, 0 4px 14px rgba(15, 23, 42, 0.05));
}

.cgt-vote-welcome-top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 0.6rem;
	margin-bottom: 0.65rem;
}

.cgt-vote-welcome-hello {
	margin: 0;
	font-size: 1.15rem;
	color: var(--text-main, #1a1a1a);
}

.cgt-vote-syndicat-chip {
	display: inline-block;
	padding: 0.2rem 0.75rem;
	border-radius: var(--radius-pill, 999px);
	background-color: var(--bg-main, #ffffff);
	border: 1px solid var(--border-card, #cbd5e1);
	color: var(--text-muted, #4a5568);
	font-size: 0.82rem;
	font-weight: 600;
}

.cgt-vote-welcome-meta {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 0.6rem 0.9rem;
	margin-bottom: 0.65rem;
}

.cgt-vote-mode-badge,
.cgt-vote-rule-pill,
.cgt-vote-status-pill {
	display: inline-block;
	font-size: 0.8rem;
	font-weight: 700;
	padding: 0.25rem 0.75rem;
	border-radius: var(--radius-pill, 999px);
}

.cgt-vote-mode-badge.is-nominatif {
	background-color: #eef2ff;
	color: #1e3a8a;
	border: 1px solid #c7d2fe;
}

.cgt-vote-mode-badge.is-secret {
	background-color: #1c1e21;
	color: #ffffff;
}

.cgt-vote-rule-pill {
	background-color: rgba(210, 0, 18, 0.09);
	color: var(--cgt-red, #d20012);
	border: 1px solid rgba(210, 0, 18, 0.25);
}

.cgt-vote-status-pill {
	margin-bottom: 0.75rem;
}

.cgt-vote-status-pill.is-success {
	background-color: #dcfce7;
	color: #166534;
	border: 1px solid #86efac;
}

.cgt-vote-status-pill.is-error {
	background-color: #fee2e2;
	color: #991b1b;
	border: 1px solid #fca5a5;
}

.cgt-vote-status-pill.is-closed {
	background-color: #1e293b;
	color: #ffffff;
}

.cgt-vote-deadline {
	font-size: 0.88rem;
	color: var(--text-muted, #4a5568);
}

.cgt-vote-mode-explain {
	margin: 0;
	font-size: 0.9rem;
	color: var(--text-muted, #4a5568);
}

/* Exposé & PDF */
.cgt-vote-poll-desc {
	color: var(--text-main, #1a1a1a);
	font-size: 0.98rem;
}

.cgt-vote-poll-desc > *:last-child {
	margin-bottom: 0;
}

.cgt-vote-pdf-box {
	margin-top: 1.15rem;
	padding-top: 1rem;
	border-top: 1px solid var(--border-subtle, #e2e8f0);
}

/* Alertes */
.cgt-vote-alert {
	border-radius: 10px;
	padding: 0.95rem 1.15rem;
	font-size: 0.95rem;
	line-height: 1.5;
	margin-block: 1rem;
}

.cgt-vote-alert[hidden] {
	display: none;
}

.cgt-vote-alert.is-error {
	background-color: #fef2f2;
	border: 1px solid #fca5a5;
	border-left: 4px solid var(--cgt-red, #d20012);
	color: #991b1b;
}

.cgt-vote-alert.is-success {
	background-color: #f0fdf4;
	border: 1px solid #86efac;
	border-left: 4px solid #16a34a;
	color: #166534;
}

.cgt-vote-alert.is-warning {
	background-color: #fffbeb;
	border: 1px solid #fcd34d;
	border-left: 4px solid #d97706;
	color: #92400e;
}

/* Formulaire manuel */
.cgt-vote-manual-form {
	display: flex;
	flex-direction: column;
	gap: 1rem;
}

.cgt-vote-field {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
}

.cgt-vote-field label {
	font-weight: 700;
	font-size: 0.95rem;
	color: var(--text-main, #1a1a1a);
}

.cgt-vote-input {
	font: inherit;
	font-size: max(1rem, 1em);
	min-height: 48px;
	padding: 0.65rem 0.9rem;
	border: 1.5px solid #767676;
	border-radius: 8px;
	background-color: var(--bg-main, #ffffff);
	color: var(--text-main, #1a1a1a);
	width: 100%;
	box-sizing: border-box;
	font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.cgt-vote-input:user-invalid {
	border-color: var(--cgt-red, #d20012);
	background-color: #fff5f5;
}

.cgt-vote-input:focus-visible {
	outline: 3px solid var(--cgt-red, #d20012);
	outline-offset: 2px;
}

.cgt-vote-help {
	font-size: 0.86rem;
	color: var(--text-muted, #4a5568);
}

/* Questions & Options de vote (cartes tactiles) */
.cgt-vote-ballot-form > * + * {
	margin-top: 1.25rem;
}

.cgt-vote-question-card {
	margin: 0;
	border: 1px solid var(--border-card, #cbd5e1);
	border-top: 4px solid var(--cgt-red, #d20012);
}

.cgt-vote-question-card.is-question-invalid {
	border-color: var(--cgt-red, #d20012);
	box-shadow: 0 0 0 2px rgba(210, 0, 18, 0.16);
}

.cgt-vote-question-legend {
	display: flex;
	flex-direction: column;
	gap: 0.2rem;
	padding: 0 0.25rem;
	width: 100%;
}

.cgt-vote-question-num {
	font-size: 0.78rem;
	font-weight: 800;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--cgt-red, #d20012);
}

.cgt-vote-question-title {
	font-size: 1.15rem;
	font-weight: 800;
	color: var(--text-main, #1a1a1a);
	line-height: 1.35;
}

.cgt-vote-question-desc {
	margin: 0.5rem 0 0.35rem;
	color: var(--text-muted, #4a5568);
	font-size: 0.94rem;
}

.cgt-vote-question-rule {
	margin: 0.35rem 0 1rem;
	font-size: 0.86rem;
	font-weight: 600;
	color: var(--text-muted, #4a5568);
}

.cgt-vote-options-grid {
	display: grid;
	gap: 0.75rem;
}

.cgt-vote-option-item {
	position: relative;
}

.cgt-vote-option-input {
	position: absolute;
	clip-path: inset(50%);
	overflow: hidden;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	border: 0;
	white-space: nowrap;
}

.cgt-vote-option-label {
	display: flex;
	align-items: center;
	gap: 0.85rem;
	min-height: 54px;
	padding: 0.85rem 1.1rem;
	border: 1.5px solid var(--border-card, #cbd5e1);
	border-radius: 10px;
	background-color: var(--bg-soft, #f1f3f5);
	cursor: pointer;
	font-size: 1.02rem;
	font-weight: 600;
	color: var(--text-main, #1a1a1a);
	transition: border-color 160ms ease, background-color 160ms ease, transform 120ms ease;
}

.cgt-vote-option-label:hover {
	border-color: var(--cgt-red, #d20012);
	background-color: #ffffff;
}

.cgt-vote-option-control {
	flex-shrink: 0;
	width: 22px;
	height: 22px;
	border: 2px solid #64748b;
	border-radius: 50%;
	background: #ffffff;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: border-color 160ms ease, background-color 160ms ease;
}

.cgt-vote-option-input[type="checkbox"] + .cgt-vote-option-label .cgt-vote-option-control {
	border-radius: 6px;
}

.cgt-vote-option-input:checked + .cgt-vote-option-label {
	border-color: var(--cgt-red, #d20012);
	background-color: #fff5f5;
	box-shadow: 0 0 0 1px var(--cgt-red, #d20012);
}

.cgt-vote-option-input:checked + .cgt-vote-option-label .cgt-vote-option-control {
	border-color: var(--cgt-red, #d20012);
	background-color: var(--cgt-red, #d20012);
}

.cgt-vote-option-input:checked + .cgt-vote-option-label .cgt-vote-option-control::after {
	content: "";
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background-color: #ffffff;
}

.cgt-vote-option-input[type="checkbox"]:checked + .cgt-vote-option-label .cgt-vote-option-control::after {
	width: 10px;
	height: 6px;
	border-radius: 0;
	background: transparent;
	border-left: 2.5px solid #ffffff;
	border-bottom: 2.5px solid #ffffff;
	transform: rotate(-45deg) translateY(-1px);
}

.cgt-vote-option-input:focus-visible + .cgt-vote-option-label {
	outline: 3px solid var(--cgt-red, #d20012);
	outline-offset: 2px;
}

/* Boutons */
.cgt-vote-submit-zone {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.75rem;
	padding-top: 0.5rem;
}

.cgt-vote-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	min-height: 48px;
	padding: 0.75rem 1.5rem;
	border-radius: var(--radius-btn, 8px);
	font: inherit;
	font-size: 1rem;
	font-weight: 700;
	border: 1.5px solid transparent;
	cursor: pointer;
	text-decoration: none;
	text-align: center;
	transition: background-color 160ms ease, border-color 160ms ease, transform 140ms ease;
}

.cgt-vote-btn:focus-visible {
	outline: 3px solid var(--cgt-red, #d20012);
	outline-offset: 2px;
}

.cgt-vote-btn--primary {
	background-color: var(--cgt-red, #d20012);
	color: #ffffff;
}

.cgt-vote-btn--primary:hover:not(:disabled) {
	background-color: var(--cgt-red-dark, #a8000e);
	color: #ffffff;
	transform: translateY(-1px);
}

.cgt-vote-btn--primary:disabled {
	opacity: 0.65;
	cursor: wait;
}

.cgt-vote-btn--outline {
	background-color: var(--bg-main, #ffffff);
	color: var(--text-main, #1a1a1a);
	border-color: var(--border-card, #cbd5e1);
}

.cgt-vote-btn--outline:hover {
	border-color: var(--cgt-red, #d20012);
	color: var(--cgt-red, #d20012);
}

.cgt-vote-btn--large {
	width: 100%;
	max-width: 420px;
	padding-block: 0.95rem;
	font-size: 1.06rem;
}

/* Reçu de participation */
.cgt-vote-receipt-box {
	background-color: var(--bg-soft, #f1f3f5);
	border: 1px solid var(--border-card, #cbd5e1);
	border-radius: 10px;
	padding: 1.15rem 1.25rem;
	margin-top: 1rem;
}

.cgt-vote-receipt-box h3 {
	font-size: 1.05rem;
	margin: 0 0 0.75rem;
}

.cgt-vote-receipt-meta {
	margin: 0;
	display: grid;
	gap: 0.65rem;
}

.cgt-vote-receipt-meta > div {
	display: grid;
	grid-template-columns: 165px 1fr;
	gap: 0.5rem;
	align-items: baseline;
}

.cgt-vote-receipt-meta dt {
	font-weight: 700;
	font-size: 0.9rem;
	color: var(--text-muted, #4a5568);
}

.cgt-vote-receipt-meta dd {
	margin: 0;
	word-break: break-word;
}

.cgt-vote-receipt-code {
	font-size: 1.05rem;
	font-weight: 800;
	padding: 0.15rem 0.5rem;
	background: #ffffff;
	border: 1px solid var(--border-card, #cbd5e1);
	border-radius: 6px;
}

.cgt-vote-receipt-hash {
	font-size: 0.8rem;
	word-break: break-all;
}

.cgt-vote-copy-btn {
	margin-left: 0.5rem;
	padding: 0.25rem 0.65rem;
	font: inherit;
	font-size: 0.82rem;
	font-weight: 600;
	border: 1px solid var(--border-card, #cbd5e1);
	border-radius: 6px;
	background: #ffffff;
	cursor: pointer;
}

.cgt-vote-receipt-note {
	margin: 0.85rem 0 0;
	font-size: 0.88rem;
	color: var(--text-muted, #4a5568);
}

/* Bloc support UL */
.cgt-vote-support-box {
	margin-top: 1.5rem;
	padding-top: 1rem;
	border-top: 1px solid var(--border-subtle, #e2e8f0);
	font-size: 0.9rem;
	color: var(--text-muted, #4a5568);
}

.cgt-vote-support-title {
	margin: 0 0 0.35rem;
	font-weight: 600;
}

.cgt-vote-support-links {
	display: flex;
	flex-wrap: wrap;
	gap: 0.6rem 1.25rem;
}

.cgt-vote-support-links a {
	color: var(--cgt-red, #d20012);
	font-weight: 700;
}

/* Modale native <dialog> de double validation */
dialog.cgt-vote-dialog {
	border: 1px solid var(--border-card, #cbd5e1);
	border-radius: 14px;
	padding: 1.6rem;
	max-width: 560px;
	width: calc(100% - 2rem);
	background: var(--bg-main, #ffffff);
	color: var(--text-main, #1a1a1a);
	box-shadow: 0 20px 50px rgba(15, 23, 42, 0.28);
}

dialog.cgt-vote-dialog:modal {
	overscroll-behavior: contain;
}

dialog.cgt-vote-dialog::backdrop {
	background: rgba(15, 23, 42, 0.62);
	overflow: hidden;
	overscroll-behavior: contain;
}

dialog.cgt-vote-dialog[open] {
	display: block;
}

.cgt-vote-dialog-title {
	margin: 0 0 0.5rem;
	font-size: 1.35rem;
	font-weight: 800;
}

.cgt-vote-dialog-intro {
	margin: 0 0 1rem;
	color: var(--text-muted, #4a5568);
}

.cgt-vote-summary-list {
	display: grid;
	gap: 0.65rem;
	margin-bottom: 1rem;
}

.cgt-vote-summary-item {
	background: var(--bg-soft, #f1f3f5);
	border: 1px solid var(--border-card, #cbd5e1);
	border-left: 4px solid var(--cgt-red, #d20012);
	border-radius: 8px;
	padding: 0.7rem 0.9rem;
}

.cgt-vote-summary-q {
	display: block;
	font-size: 0.88rem;
	color: var(--text-muted, #4a5568);
	margin-bottom: 0.2rem;
}

.cgt-vote-summary-a {
	display: block;
	font-size: 1rem;
	font-weight: 800;
	color: var(--text-main, #1a1a1a);
}

.cgt-vote-dialog-actions {
	display: flex;
	justify-content: flex-end;
	flex-wrap: wrap;
	gap: 0.75rem;
	margin-top: 1.25rem;
}

@media (pointer: coarse) {
	.cgt-vote-input,
	.cgt-vote-btn {
		min-height: 52px;
	}
}

@media (max-width: 600px) {
	.cgt-vote-card {
		padding: 1.2rem 1.1rem;
	}
	.cgt-vote-receipt-meta > div {
		grid-template-columns: 1fr;
		gap: 0.15rem;
	}
	.cgt-vote-dialog-actions {
		flex-direction: column-reverse;
	}
	.cgt-vote-dialog-actions .cgt-vote-btn {
		width: 100%;
	}
}
