/**
 * Styles front — TCG Calendrier de Cours (coaches & athlètes).
 */

.tcg-cc {
	--tcg-white: #ffffff;
	--tcg-text: #231f20;
	--tcg-primary: #b00261;
	--tcg-secondary: #01d1af;
	--tcg-accent: #f7f7f7;
	--tcg-tertiary: #ff5728;
	--tcg-border: #e0e0e0;
	--tcg-muted: #717182;
	--tcg-radius: 8px;
	--tcg-shadow: 0 1px 6px rgba(0, 0, 0, 0.07);

	font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	color: var(--tcg-text);
	background: transparent;
	box-sizing: border-box;
}
.tcg-cc *,
.tcg-cc *::before,
.tcg-cc *::after {
	box-sizing: border-box;
}

/* Panneau : en-tête + grille fusionnés en un seul bloc. */
.tcg-cc-panel {
	position: relative; /* ancre l'overlay de chargement (.tcg-cc-loading). */
	background: var(--tcg-white);
	border: 1px solid #ebebeb;
	border-radius: 20px;
	overflow: hidden;
	box-shadow: 0 2px 16px rgba(0, 0, 0, 0.08);
}

/* En-tête. */
.tcg-cc-header {
	background: var(--tcg-white);
}
.tcg-cc-nav {
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 16px;
	padding: 12px 16px;
}
.tcg-cc-weeklabel {
	font-weight: 600;
	color: var(--tcg-text);
}
.tcg-cc-navbtn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	padding: 0;
	background: transparent;
	border: 1px solid var(--tcg-border);
	border-radius: 6px;
	color: var(--tcg-text);
	cursor: pointer;
}
.tcg-cc-navbtn:hover {
	background: var(--tcg-accent);
}
.tcg-cc-navbtn:disabled {
	opacity: 0.35;
	cursor: default;
	background: transparent;
}
.tcg-cc-navbtn[hidden] {
	display: none;
}
.tcg-cc-header-filter {
	display: flex;
	justify-content: flex-start;
	align-items: center;
	padding: 8px 16px;
	border-top: 1px solid #f0f0f0;
	font-size: 13px;
}
.tcg-cc-filter-inline {
	display: inline-flex;
	align-items: center;
	gap: 8px;
}
.tcg-cc-coach-filter,
.tcg-cc-groupe-filter {
	border: 1px solid #e8e8e8;
	border-radius: var(--tcg-radius);
	padding: 5px 9px;
	background: #fff;
	font: inherit;
	font-size: 13px;
	color: var(--tcg-text);
}
/* Overlay de chargement : superposé à la grille (position absolue) → aucun
 * décalage de hauteur au changement de semaine. Léger voile + spinner discret.
 * Le texte « Chargement… » est masqué visuellement mais reste lu par les
 * lecteurs d'écran (l'attribut hidden le retire de l'arbre quand inactif). */
.tcg-cc-loading {
	position: absolute;
	inset: 0;
	z-index: 5;
	display: flex;
	align-items: center;
	justify-content: center;
	background: color-mix(in srgb, var(--tcg-white) 65%, transparent);
	font-size: 0; /* masque le libellé au profit du spinner */
}
/* display:flex écraserait l'attribut hidden : on restaure le masquage. */
.tcg-cc-loading[hidden] {
	display: none;
}
.tcg-cc-loading::after {
	content: "";
	width: 28px;
	height: 28px;
	border-radius: 50%;
	border: 3px solid color-mix(in srgb, var(--tcg-text) 15%, transparent);
	border-top-color: var(--tcg-primary);
	animation: tcg-cc-spin 0.7s linear infinite;
}
@keyframes tcg-cc-spin {
	to {
		transform: rotate(360deg);
	}
}
@media (prefers-reduced-motion: reduce) {
	.tcg-cc-loading::after {
		animation: none;
	}
}

/* Affichage desktop / mobile. */
@media (min-width: 768px) {
	.tcg-cc-mobile { display: none; }
}
@media (max-width: 767px) {
	.tcg-cc-desktop { display: none; }
}

/* --- Grille horaire (desktop) --------------------------------------- */
.tcg-cc-desktop {
	overflow-x: auto;
	background: #fff;
	border-top: 1px solid #ebebeb;
}
.tcg-cc-cal-grid-wrap {
	background: #fff;
}
.tcg-cc-cal-headrow {
	display: flex;
	border-bottom: 1px solid #ebebeb;
	background: #fff;
}
.tcg-cc-cal-axis-head {
	width: 56px;
	flex-shrink: 0;
	border-right: 1px solid #f0f0f0;
}
.tcg-cc-cal-dayhead {
	flex: 1;
	text-align: center;
	padding: 10px 4px;
	font-size: 12px;
	font-weight: 600;
	color: #50575e;
	border-left: 1px solid #f0f0f0;
}
.tcg-cc-cal-dayhead small {
	display: block;
	font-weight: 400;
	opacity: 0.6;
	font-size: 10px;
}
.tcg-cc-cal-dayhead.is-today {
	background: var(--tcg-primary);
	color: #fff;
}
.tcg-cc-cal-dayhead.is-past {
	color: #bbb;
	background: #fafafa;
}
.tcg-cc-cal-body {
	display: flex;
}
.tcg-cc-cal-axis {
	width: 56px;
	flex-shrink: 0;
	position: relative; /* Ancre les lignes d'heure prolongées dans la colonne horaire. */
	border-right: 1px solid #f0f0f0;
	background: #fff;
}
.tcg-cc-cal-hour {
	display: flex;
	align-items: flex-start;
	justify-content: flex-end;
	/* Pas de padding-top : le haut du label s'aligne sur la ligne d'heure. */
	padding: 0 8px 0 0;
	font-size: 10px;
	color: #999;
	font-variant-numeric: tabular-nums;
	position: relative; /* Garde le libellé au-dessus de la ligne d'heure. */
	z-index: 1;
}
.tcg-cc-cal-col {
	flex: 1;
	position: relative;
	border-left: 1px solid #f0f0f0;
	background: #fff;
}
.tcg-cc-cal-col.is-today {
	background: rgba(176, 2, 97, 0.025);
}
.tcg-cc-cal-col.is-past {
	background: #fafafa;
}
.tcg-cc-cal-line {
	position: absolute;
	left: 0;
	right: 0;
	pointer-events: none;
}
.tcg-cc-cal-line--hour {
	border-top: 1px solid #dadce0; /* Repère d'heure désormais visible. */
}
.tcg-cc-cal-line--half {
	border-top: 1px dashed #ececec;
}

/* Blocs de cours. */
.tcg-cc-block {
	position: absolute;
	left: 4%;
	width: 88%;
	/* Au-dessus des lignes de repère horaire (z-index auto). */
	z-index: 2;
	border-radius: var(--tcg-radius);
	overflow: hidden;
	cursor: pointer;
	background: color-mix(in srgb, var(--c) 20%, #fff);
	border: 1.5px solid color-mix(in srgb, var(--c) 40%, transparent);
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.07);
	transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.tcg-cc-block.is-confirmed {
	background: color-mix(in srgb, var(--c) 26%, #fff);
	border-color: color-mix(in srgb, var(--c) 55%, transparent);
}
.tcg-cc-block:not(.tcg-cc-block--ro):hover {
	transform: translateY(-1px);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}
.tcg-cc-block--ro {
	cursor: default;
}
.tcg-cc-block-in {
	padding: 5px 8px;
	height: 100%;
	overflow: hidden;
	color: var(--tcg-text);
}
.tcg-cc-block-top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 4px;
	margin-bottom: 2px;
}
.tcg-cc-block-disc {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	min-width: 0;
	font-size: 11px;
	font-weight: 700;
}
.tcg-cc-block-disc span {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.tcg-cc-block-icon {
	width: 14px;
	height: 14px;
	object-fit: contain;
	flex-shrink: 0;
}
.tcg-cc-badge {
	flex-shrink: 0;
	padding: 1px 7px;
	border-radius: 999px;
	font-size: 9px;
	font-weight: 700;
	color: #fff;
}
.tcg-cc-block-time {
	font-size: 10px;
	font-weight: 600;
}
.tcg-cc-block-real {
	font-size: 9px;
	color: var(--tcg-muted);
}
.tcg-cc-block-meta {
	display: flex;
	align-items: center;
	gap: 5px;
	margin-top: 3px;
	font-size: 9px;
	color: var(--tcg-muted);
}
.tcg-cc-chip {
	padding: 1px 7px;
	border-radius: 999px;
	background: rgba(0, 0, 0, 0.05);
	color: var(--tcg-text);
	font-weight: 500;
}
.tcg-cc-coach {
	color: #aaa;
}

/* Pastille de statut (calendrier entraîneur uniquement). */
.tcg-cc-status-dot {
	position: absolute;
	top: 6px;
	right: 6px;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	z-index: 3;
	pointer-events: none;
}

/* Affichage adaptatif selon la hauteur du bloc. */
.tcg-cc-block-time--sm {
	font-size: 9px;
}
.tcg-cc-block--l2 .tcg-cc-block-meta {
	margin-top: 2px;
}
.tcg-cc-block--l3 .tcg-cc-block-in {
	display: flex;
	align-items: center;
	padding: 0 8px;
}
.tcg-cc-block-min {
	display: flex;
	align-items: center;
	gap: 4px;
	width: 100%;
	overflow: hidden;
	white-space: nowrap;
	font-size: 10px;
	font-weight: 700;
}
.tcg-cc-block-mintime {
	overflow: hidden;
	text-overflow: ellipsis;
}

/* Tooltip custom (survol des blocs). */
.tcg-cc-tip {
	display: none;
}
.tcg-cc-tooltip {
	position: fixed;
	z-index: 9999;
	width: 240px;
	/* Élément injecté dans <body>, hors .tcg-cc : couleurs littérales (pas de var). */
	background: #ffffff;
	color: #231f20;
	border: 1px solid #e0e0e0;
	border-radius: 10px;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
	padding: 11px 13px;
	font-family: Inter, system-ui, sans-serif;
	font-size: 12px;
	pointer-events: none;
}
.tcg-cc-tip-title {
	display: flex;
	align-items: center;
	gap: 6px;
	font-weight: 700;
	font-size: 13px;
	margin-bottom: 7px;
}
.tcg-cc-tip-title .tcg-cc-block-icon {
	width: 16px;
	height: 16px;
}
.tcg-cc-tip-rows {
	display: flex;
	flex-direction: column;
	gap: 4px;
}
.tcg-cc-tip-row {
	display: flex;
	justify-content: space-between;
	gap: 12px;
}
.tcg-cc-tip-row span {
	color: #717182;
}
.tcg-cc-tip-row strong {
	text-align: right;
}

/* --- Mobile : onglets + cartes -------------------------------------- */
.tcg-cc-tabs {
	display: flex;
	gap: 4px;
	padding: 10px;
	overflow-x: auto;
	background: #fff;
	border-bottom: 1px solid #ebebeb;
}
.tcg-cc-tab {
	flex: 1 0 auto;
	min-width: 44px;
	border: 1px solid #e8e8e8;
	background: #fff;
	border-radius: var(--tcg-radius);
	padding: 6px 4px;
	font: inherit;
	font-size: 12px;
	font-weight: 600;
	cursor: pointer;
	color: var(--tcg-text);
	text-align: center;
}
.tcg-cc-tab small {
	display: block;
	font-weight: 400;
	font-size: 11px;
	opacity: 0.7;
}
.tcg-cc-tab.is-active {
	background: var(--tcg-primary);
	border-color: var(--tcg-primary);
	color: #fff;
}
.tcg-cc-tab.is-today:not(.is-active) {
	border-color: var(--tcg-primary);
	color: var(--tcg-primary);
}
.tcg-cc-tab.is-past {
	color: #bbb;
	background: #fafafa;
	cursor: pointer;
}
.tcg-cc-cards {
	display: flex;
	flex-direction: column;
	gap: 10px;
	padding: 12px;
}
.tcg-cc-card {
	position: relative;
	display: flex;
	width: 100%;
	text-align: left;
	background: color-mix(in srgb, var(--c) 20%, #fff);
	border: 1.5px solid color-mix(in srgb, var(--c) 40%, transparent);
	border-radius: var(--tcg-radius);
	box-shadow: var(--tcg-shadow);
	overflow: hidden;
	cursor: pointer;
	font: inherit;
	color: var(--tcg-text);
}
.tcg-cc-card--ro { cursor: default; }
.tcg-cc-card-in {
	flex: 1;
	padding: 12px 14px;
	display: flex;
	flex-direction: column;
	gap: 6px;
}
.tcg-cc-card-top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
}
.tcg-cc-card-time {
	font-size: 14px;
	font-weight: 600;
}
.tcg-cc-card-real {
	font-size: 12px;
	font-weight: 400;
	color: var(--tcg-muted);
}
.tcg-cc-card-meta {
	font-size: 12px;
	color: var(--tcg-muted);
}

/* États vides. */
.tcg-cc-empty {
	padding: 32px 16px;
	text-align: center;
	color: var(--tcg-muted);
	font-size: 14px;
}
.tcg-cc-empty-all {
	padding: 56px 24px;
	text-align: center;
	color: var(--tcg-muted);
	background: #fff;
}
.tcg-cc-empty-illu {
	font-size: 48px;
	filter: grayscale(0.2);
	color: var(--tcg-primary);
	margin-bottom: 12px;
}

/* --- Modale --------------------------------------------------------- */
body.tcg-cc-modal-open {
	overflow: hidden;
}
.tcg-cc-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: flex-end;
	justify-content: center;
	font-family: Inter, system-ui, sans-serif;
	/* La modale est injectée dans <body>, hors .tcg-cc : on redéclare les variables. */
	--tcg-white: #ffffff;
	--tcg-text: #231f20;
	--tcg-primary: #b00261;
	--tcg-secondary: #01d1af;
	--tcg-accent: #f7f7f7;
	--tcg-tertiary: #ff5728;
	--tcg-border: #e0e0e0;
	--tcg-muted: #717182;
}
@media (min-width: 768px) {
	.tcg-cc-modal { align-items: center; }
}
.tcg-cc-modal-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.5);
}
.tcg-cc-modal-box {
	position: relative;
	background: #fff;
	width: 100%;
	max-height: 90vh;
	overflow-y: auto;
	border-radius: 16px 16px 0 0;
	box-shadow: 0 -4px 40px rgba(0, 0, 0, 0.18);
}
@media (min-width: 768px) {
	.tcg-cc-modal-box {
		max-width: 480px;
		border-radius: 12px;
	}
}
.tcg-cc-modal-band {
	height: 8px;
}
.tcg-cc-modal-head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	padding: 16px 20px 12px;
}
.tcg-cc-modal-title {
	display: flex;
	align-items: center;
	gap: 8px;
	font-weight: 700;
	font-size: 16px;
}
.tcg-cc-modal-title .tcg-cc-block-icon {
	width: 20px;
	height: 20px;
}
.tcg-cc-modal-date {
	margin: 4px 0 0;
	font-size: 12px;
	color: var(--tcg-muted);
}
.tcg-cc-modal-x {
	background: none;
	border: 0;
	font-size: 24px;
	line-height: 1;
	color: #bbb;
	cursor: pointer;
}
.tcg-cc-modal-x:hover { color: var(--tcg-text); }
.tcg-cc-modal-summary {
	margin: 0 20px 16px;
	padding: 14px;
	background: var(--tcg-accent);
	border-radius: 12px;
	display: flex;
	flex-direction: column;
	gap: 8px;
	font-size: 14px;
}
.tcg-cc-modal-row {
	display: flex;
	justify-content: space-between;
	gap: 12px;
}
.tcg-cc-modal-row span { color: var(--tcg-muted); }
.tcg-cc-modal-body {
	padding: 0 20px 20px;
}
.tcg-cc-modal-field {
	margin-bottom: 18px;
}
.tcg-cc-modal-field > label {
	display: block;
	font-weight: 600;
	font-size: 14px;
	margin-bottom: 4px;
}
.tcg-cc-modal-hint {
	margin: 0 0 8px;
	font-size: 12px;
	color: var(--tcg-muted);
}
.tcg-cc-modal-time,
.tcg-cc-modal-num {
	width: 100%;
	/* Modale injectée hors .tcg-cc : le box-sizing universel ne s'applique pas
	 * ici, on le force sinon padding + bordure font déborder l'input. */
	box-sizing: border-box;
	text-align: center;
	font-size: 20px;
	font-weight: 700;
	padding: 12px;
	border: 2px solid var(--tcg-primary);
	border-radius: 12px;
	box-shadow: 0 0 0 3px rgba(176, 2, 97, 0.10);
	outline: none;
	font-family: inherit;
}
.tcg-cc-stepper {
	display: flex;
	align-items: center;
	gap: 12px;
}
.tcg-cc-stepper button {
	width: 44px;
	height: 44px;
	border: 2px solid var(--tcg-border);
	background: #fff;
	border-radius: 12px;
	font-size: 20px;
	font-weight: 700;
	cursor: pointer;
	color: var(--tcg-text);
}
.tcg-cc-stepper button:hover { border-color: var(--tcg-primary); }
.tcg-cc-stepper .tcg-cc-modal-num { flex: 1; }
.tcg-cc-modal-foot {
	padding-top: 4px;
}
.tcg-cc-modal .tcg-cc-modal-confirm {
	width: 100%;
	padding: 13px;
	/* Couleurs littérales + !important pour résister aux styles de bouton du thème. */
	background: #b00261 !important;
	color: #ffffff !important;
	border: 0;
	border-radius: 12px;
	font-size: 14px;
	font-weight: 600 !important;
	cursor: pointer;
	font-family: inherit;
	text-shadow: none;
	text-decoration: none;
}
.tcg-cc-modal .tcg-cc-modal-confirm:hover { opacity: 0.9; }
.tcg-cc-modal-cancel {
	display: block;
	margin: 12px auto 0;
	background: none;
	border: 0;
	color: var(--tcg-muted);
	text-decoration: underline;
	cursor: pointer;
	font: inherit;
	font-size: 14px;
}
.tcg-cc-modal-success {
	text-align: center;
	padding: 40px 24px;
}
.tcg-cc-modal-check {
	width: 72px;
	height: 72px;
	margin: 0 auto 18px;
	border-radius: 50%;
	background: var(--tcg-secondary);
	color: #fff;
	font-size: 38px;
	line-height: 72px;
}
.tcg-cc-modal-okmsg {
	font-size: 18px;
	font-weight: 700;
	margin: 0 0 6px;
}

/* --- Cours simultanés : bloc réduit à l'icône (contenu au survol) ---- */
.tcg-cc-block--icon .tcg-cc-block-in {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 2px;
	overflow: hidden;
}
.tcg-cc-block-iconmark {
	width: 20px;
	height: 20px;
	max-width: 78%;
	max-height: 78%;
	flex-shrink: 0;
	background-color: var(--c);
	border-radius: 4px; /* fallback : discipline sans icône → pastille colorée */
}
.tcg-cc-block-iconmark.has-svg {
	border-radius: 0;
	background-color: var(--c);
	-webkit-mask-repeat: no-repeat;
	mask-repeat: no-repeat;
	-webkit-mask-position: center;
	mask-position: center;
	-webkit-mask-size: contain;
	mask-size: contain;
}
