/**
 * RH module — styles communs, jetons de design et composants partagés
 *
 * Palette alignée sur le CRM (kanban_prospects.css) : navy d'en-tête,
 * teal de marque (#175251), bleu d'action, vert / rouge / orange sémantiques.
 */

:root {
	/* Palette partagée avec le CRM */
	--rh-navy: #2d2f55;
	--rh-navy-light: #3d4070;
	--rh-brand: #175251;
	--rh-brand-dark: #1f6b6a;
	--rh-primary: #2563eb;
	--rh-primary-dark: #1d4ed8;
	--rh-primary-soft: #e8f1fd;
	--rh-success: #27ae60;
	--rh-success-soft: #e8f8ef;
	--rh-danger: #e74c3c;
	--rh-danger-soft: #fdecea;
	--rh-warning: #f39c12;
	--rh-warning-soft: #fef5e7;
	--rh-neutral: #7f8c8d;

	/* Zones atelier */
	--rh-usinage: #0ea5e9;
	--rh-montage: #8b5cf6;

	/* Surfaces et typographie */
	--rh-border: #e2e8f0;
	--rh-border-strong: #cbd5e1;
	--rh-bg-muted: #f8fafc;
	--rh-text: #1e293b;
	--rh-text-muted: #64748b;

	--rh-radius: 8px;
	--rh-radius-sm: 6px;
	--rh-radius-pill: 999px;
	--rh-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
	--rh-shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.16);
	--rh-focus: #1976d2;

	/* Hauteur minimale de cible tactile */
	--rh-control-h: 40px;
}

/* --- Accessibilité globale ------------------------------------------- */

.mod-rh :focus-visible {
	outline: 2px solid var(--rh-focus);
	outline-offset: 2px;
	border-radius: var(--rh-radius-sm);
}

.mod-rh .rh-visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

@media (prefers-reduced-motion: reduce) {
	.mod-rh *,
	.mod-rh *::before,
	.mod-rh *::after {
		transition-duration: 0.01ms !important;
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		scroll-behavior: auto !important;
	}
}

/* --- Boutons --------------------------------------------------------- */

.mod-rh .rh-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: var(--rh-control-h);
	padding: 0 16px;
	border: 1px solid var(--rh-border-strong);
	border-radius: var(--rh-radius-sm);
	background: #fff;
	color: var(--rh-text);
	font-size: 0.92rem;
	font-family: inherit;
	font-weight: 500;
	line-height: 1.2;
	cursor: pointer;
	text-decoration: none;
	transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.mod-rh .rh-btn:hover:not(:disabled) {
	background: var(--rh-bg-muted);
	border-color: var(--rh-neutral);
}

.mod-rh .rh-btn:disabled,
.mod-rh .rh-btn[aria-disabled="true"] {
	opacity: 0.55;
	cursor: not-allowed;
}

.mod-rh .rh-btn--primary {
	background: var(--rh-primary);
	border-color: var(--rh-primary);
	color: #fff;
}

.mod-rh .rh-btn--primary:hover:not(:disabled) {
	background: var(--rh-primary-dark);
	border-color: var(--rh-primary-dark);
}

/* Même teal et hover que les .butAction CRM (kanban_prospects.css) */
.mod-rh .rh-btn--brand {
	background: var(--rh-brand);
	border-color: var(--rh-brand);
	color: #fff;
	transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.mod-rh .rh-btn--brand:hover:not(:disabled) {
	background: var(--rh-brand-dark);
	border-color: var(--rh-brand-dark);
	transform: translateY(-1px);
	box-shadow: 0 2px 6px rgb(23 82 81 / 20%);
}

.mod-rh .rh-btn--success {
	background: var(--rh-success);
	border-color: var(--rh-success);
	color: #fff;
}

.mod-rh .rh-btn--success:hover:not(:disabled) {
	background: #1e8449;
	border-color: #1e8449;
}

.mod-rh .rh-btn--danger {
	background: #fff;
	border-color: var(--rh-danger);
	color: #b03a2e;
}

.mod-rh .rh-btn--danger:hover:not(:disabled) {
	background: var(--rh-danger-soft);
	border-color: var(--rh-danger);
}

.mod-rh .rh-btn--ghost {
	background: transparent;
	border-color: transparent;
	color: var(--rh-text-muted);
}

.mod-rh .rh-btn--ghost:hover:not(:disabled) {
	background: var(--rh-bg-muted);
	border-color: var(--rh-border);
	color: var(--rh-text);
}

.mod-rh .rh-btn--sm {
	min-height: 32px;
	padding: 0 10px;
	font-size: 0.85rem;
}

.mod-rh .rh-btn--icon {
	min-width: var(--rh-control-h);
	padding: 0 10px;
}

/* Groupe de boutons segmenté (bascule de vue) */
.mod-rh .rh-btn-group {
	display: inline-flex;
	border: 1px solid var(--rh-border-strong);
	border-radius: var(--rh-radius-sm);
	overflow: hidden;
	background: #fff;
}

.mod-rh .rh-btn-group .rh-btn {
	border: none;
	border-radius: 0;
	border-right: 1px solid var(--rh-border);
}

.mod-rh .rh-btn-group .rh-btn:last-child {
	border-right: none;
}

.mod-rh .rh-btn-group .rh-btn[aria-pressed="true"] {
	background: var(--rh-primary-soft);
	color: var(--rh-primary-dark);
	font-weight: 600;
	box-shadow: inset 0 -2px 0 var(--rh-primary);
}

/* Calendrier / demande de congés : mêmes CTA navy que l'annuaire et les équipes */
body.page-rh-calendar,
body.page-rh-leave-request {
	--rh-primary: #1d2140;
	--rh-primary-dark: #16182f;
	--rh-primary-soft: #e8e9ef;
}

/* --- Barres d'outils ------------------------------------------------- */

.mod-rh .rh-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px;
	padding: 12px 16px;
	margin-bottom: 16px;
	background: #fff;
	border: 1px solid var(--rh-border);
	border-radius: var(--rh-radius);
	box-shadow: var(--rh-shadow);
}

.mod-rh .rh-toolbar-spacer {
	margin-left: auto;
}

.mod-rh .rh-toolbar select,
.mod-rh .rh-toolbar input[type="month"] {
	min-height: var(--rh-control-h);
	padding: 0 10px;
	border: 1px solid var(--rh-border-strong);
	border-radius: var(--rh-radius-sm);
	background: #fff;
	font-family: inherit;
	font-size: 0.92rem;
}

/* --- Badges ---------------------------------------------------------- */

.mod-rh .rh-badge {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 2px 10px;
	border-radius: var(--rh-radius-pill);
	font-size: 0.8rem;
	font-weight: 600;
	line-height: 1.6;
	background: var(--rh-bg-muted);
	color: var(--rh-text-muted);
	border: 1px solid var(--rh-border);
}

.mod-rh .rh-badge--pending {
	background: var(--rh-warning-soft);
	color: #9a6100;
	border-color: #f0c987;
}

.mod-rh .rh-badge--approved {
	background: var(--rh-success-soft);
	color: #196f43;
	border-color: #9bd9b6;
}

.mod-rh .rh-badge--rejected {
	background: var(--rh-danger-soft);
	color: #a5281a;
	border-color: #f0a79d;
}

.mod-rh .rh-badge-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	flex-shrink: 0;
}

/* --- Notifications (aria-live) --------------------------------------- */

.mod-rh .rh-toast-region {
	position: fixed;
	right: 16px;
	bottom: 16px;
	z-index: 10060;
	display: flex;
	flex-direction: column;
	gap: 8px;
	max-width: min(420px, calc(100vw - 32px));
	pointer-events: none;
}

.mod-rh .rh-toast {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	padding: 12px 14px;
	border-radius: var(--rh-radius);
	border-left: 4px solid var(--rh-primary);
	background: #fff;
	box-shadow: var(--rh-shadow-lg);
	font-size: 0.92rem;
	color: var(--rh-text);
	pointer-events: auto;
}

.mod-rh .rh-toast--success {
	border-left-color: var(--rh-success);
}

.mod-rh .rh-toast--error {
	border-left-color: var(--rh-danger);
}

.mod-rh .rh-toast--warning {
	border-left-color: var(--rh-warning);
}

.mod-rh .rh-panel {
	background: #fff;
	border: 1px solid var(--rh-border);
	border-radius: var(--rh-radius);
	padding: 16px 20px;
	box-shadow: var(--rh-shadow);
	margin-bottom: 16px;
}

.mod-rh .rh-panel h3 {
	margin: 0 0 12px;
	font-size: 1.05em;
	color: #1e293b;
}

.mod-rh .rh-absence-badge {
	display: inline-block;
	color: #fff;
	padding: 2px 8px;
	border-radius: 4px;
	font-size: 0.85em;
}

.mod-rh .rh-table-compact td,
.mod-rh .rh-table-compact th {
	padding: 8px 10px;
}

.mod-rh .rh-sensitive-indicator {
	padding: 10px 14px;
	border-radius: var(--rh-radius);
	margin-top: 16px;
	font-size: 0.9em;
}

.mod-rh .rh-sensitive-yes {
	background: #ecfdf5;
	border: 1px solid #6ee7b7;
	color: #065f46;
}

.mod-rh .rh-sensitive-no {
	background: #fef2f2;
	border: 1px solid #fca5a5;
	color: #991b1b;
}

/* Modal */
.mod-rh .rh-modal {
	display: none;
	position: fixed;
	inset: 0;
	z-index: 10050;
}

.mod-rh .rh-modal.rh-modal-open {
	display: block;
}

.mod-rh .rh-modal-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(15, 23, 42, 0.45);
}

.mod-rh .rh-modal-dialog {
	position: relative;
	max-width: 900px;
	width: calc(100% - 32px);
	max-height: calc(100vh - 40px);
	margin: 20px auto;
	background: #fff;
	border-radius: 12px;
	box-shadow: 0 20px 50px rgba(15, 23, 42, 0.2);
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.mod-rh .rh-modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 20px 24px;
	border-bottom: 2px solid #e0e0e0;
	background: linear-gradient(135deg, var(--rh-navy) 0%, var(--rh-navy-light) 100%);
	color: #fff;
	border-radius: 12px 12px 0 0;
}

.mod-rh .rh-modal-identity {
	display: flex;
	gap: 16px;
	align-items: center;
}

.mod-rh .rh-modal-avatar {
	width: 56px;
	height: 56px;
	border-radius: 50%;
	background: var(--rh-primary);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	font-size: 1.2em;
	flex-shrink: 0;
}

.mod-rh .rh-modal-header h2 {
	margin: 0;
	font-size: 1.35em;
	color: #fff;
	font-weight: 600;
}

.mod-rh .rh-modal-subtitle {
	color: rgba(255, 255, 255, 0.8);
	margin-top: 4px;
	font-size: 0.9em;
}

.mod-rh .rh-modal-close {
	background: none;
	border: none;
	border-radius: var(--rh-radius-sm);
	font-size: 2em;
	font-weight: 300;
	line-height: 1;
	cursor: pointer;
	color: #fff;
	width: var(--rh-control-h);
	height: var(--rh-control-h);
	flex-shrink: 0;
	transition: color 0.2s ease, transform 0.2s ease;
}

.mod-rh .rh-modal-close:hover {
	background: transparent;
	color: #ff6b6b;
	transform: rotate(90deg);
}

.mod-rh .rh-modal-tabs {
	display: flex;
	gap: 0;
	border-bottom: 1px solid var(--rh-border);
	padding: 0 16px;
	background: #fff;
}

.mod-rh .rh-tab-btn {
	background: none;
	border: none;
	border-bottom: 3px solid transparent;
	padding: 12px 16px;
	cursor: pointer;
	font-size: 0.95em;
	color: var(--rh-text-muted);
	margin-bottom: -1px;
}

.mod-rh .rh-tab-btn.rh-tab-active {
	color: var(--rh-primary);
	border-bottom-color: var(--rh-primary);
	font-weight: 600;
}

.mod-rh .rh-modal-body {
	padding: 20px 24px;
	overflow-y: auto;
	flex: 1;
}

.mod-rh .rh-tab-panel {
	display: none;
}

.mod-rh .rh-tab-panel.rh-tab-active {
	display: block;
}

.mod-rh .rh-info-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 12px 20px;
}

.mod-rh .rh-info-item {
	padding: 10px 0;
	border-bottom: 1px solid #f1f5f9;
}

.mod-rh .rh-info-label {
	font-size: 0.8em;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	color: var(--rh-text-muted);
	margin-bottom: 4px;
}

.mod-rh .rh-info-value {
	font-size: 0.95em;
	color: #1e293b;
}

.mod-rh .rh-info-value.rh-blurred {
	filter: blur(5px);
	user-select: none;
}

.mod-rh .rh-info-section-title {
	grid-column: 1 / -1;
	font-weight: 600;
	color: #334155;
	margin-top: 8px;
	padding-bottom: 4px;
	border-bottom: 2px solid var(--rh-border);
}

.mod-rh .rh-chip-list {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.mod-rh .rh-skill-chip {
	background: #e0e7ff;
	color: #3730a3;
	padding: 2px 10px;
	border-radius: 12px;
	font-size: 0.85em;
}

.mod-rh .rh-skill-chip.rh-skill-primary {
	background: #dbeafe;
	color: #1d4ed8;
	font-weight: 600;
}

.mod-rh .rh-doc-category {
	margin-bottom: 16px;
}

.mod-rh .rh-doc-category h4 {
	margin: 0 0 8px;
	font-size: 0.95em;
	color: #475569;
}

.mod-rh .rh-doc-item {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 12px;
	background: var(--rh-bg-muted);
	border-radius: 6px;
	margin-bottom: 6px;
	font-size: 0.9em;
}

.mod-rh .rh-doc-item .fa {
	color: var(--rh-primary);
}

.mod-rh .rh-history-item {
	padding: 10px 0;
	border-bottom: 1px solid #f1f5f9;
	font-size: 0.9em;
}

.mod-rh .rh-history-item strong {
	color: #334155;
}

.mod-rh .rh-modal-footer {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 14px 24px;
	border-top: 1px solid var(--rh-border);
	background: var(--rh-bg-muted);
}

.mod-rh .rh-modal-footer-note {
	margin-right: auto;
	font-size: 0.85em;
}

.mod-rh .rh-archived-badge {
	display: inline-block;
	background: #94a3b8;
	color: #fff;
	padding: 2px 8px;
	border-radius: 4px;
	font-size: 0.75em;
	margin-left: 8px;
	vertical-align: middle;
}

/* --- Modale de demande / validation de congés ------------------------- */

.mod-rh .rh-modal--narrow .rh-modal-dialog {
	max-width: 620px;
}

.mod-rh .rh-req-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 12px 20px;
	margin-bottom: 18px;
}

.mod-rh .rh-req-field {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.mod-rh .rh-req-label {
	font-size: 0.75rem;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--rh-text-muted);
	font-weight: 600;
}

.mod-rh .rh-req-value {
	font-size: 0.98rem;
	color: var(--rh-text);
}

.mod-rh .rh-req-type {
	display: inline-flex;
	align-items: center;
	gap: 8px;
}

/* Bandeau solde avant / après */
.mod-rh .rh-balance-strip {
	display: flex;
	align-items: center;
	gap: 14px;
	flex-wrap: wrap;
	padding: 12px 16px;
	margin-bottom: 18px;
	background: var(--rh-bg-muted);
	border: 1px solid var(--rh-border);
	border-radius: var(--rh-radius);
}

.mod-rh .rh-balance-item {
	display: flex;
	flex-direction: column;
}

.mod-rh .rh-balance-value {
	font-size: 1.3rem;
	font-weight: 700;
	color: var(--rh-text);
}

.mod-rh .rh-balance-value.is-negative {
	color: #a5281a;
}

.mod-rh .rh-balance-arrow {
	color: var(--rh-text-muted);
	font-size: 1.2rem;
}

.mod-rh .rh-balance-cost {
	margin-left: auto;
	text-align: right;
}

.mod-rh .rh-negative-warning {
	display: flex;
	gap: 8px;
	padding: 10px 14px;
	margin-bottom: 16px;
	border-radius: var(--rh-radius);
	background: var(--rh-warning-soft);
	border: 1px solid #f0c987;
	color: #7a4e00;
	font-size: 0.9rem;
}

.mod-rh .rh-negative-warning[hidden] {
	display: none;
}

/* Formulaire de refus */
.mod-rh .rh-refuse-block {
	padding: 14px 16px;
	border-radius: var(--rh-radius);
	background: var(--rh-danger-soft);
	border: 1px solid #f0a79d;
	margin-top: 4px;
}

.mod-rh .rh-refuse-block label {
	display: block;
	font-weight: 600;
	font-size: 0.9rem;
	margin-bottom: 6px;
	color: #a5281a;
}

.mod-rh .rh-textarea {
	width: 100%;
	min-height: 76px;
	padding: 10px 12px;
	border: 1px solid var(--rh-border-strong);
	border-radius: var(--rh-radius-sm);
	font-family: inherit;
	font-size: 0.92rem;
	resize: vertical;
	box-sizing: border-box;
}

.mod-rh .rh-field-error {
	display: block;
	margin-top: 6px;
	font-size: 0.85rem;
	color: #a5281a;
	font-weight: 600;
}

.mod-rh .rh-modal-error {
	padding: 10px 14px;
	margin-bottom: 14px;
	border-radius: var(--rh-radius);
	background: var(--rh-danger-soft);
	border: 1px solid #f0a79d;
	color: #a5281a;
	font-size: 0.9rem;
}

@media (max-width: 768px) {
	.mod-rh .rh-modal-dialog {
		width: calc(100% - 16px);
		margin: 8px auto;
		max-height: calc(100vh - 16px);
	}

	.mod-rh .rh-info-grid,
	.mod-rh .rh-req-grid {
		grid-template-columns: 1fr;
	}

	.mod-rh .rh-modal-footer {
		flex-wrap: wrap;
	}

	.mod-rh .rh-balance-cost {
		margin-left: 0;
		text-align: left;
	}
}
