/* =========================================================================
   SPICA — Fiche projet (SaisieFicheProjet.php) : mise en forme (2026-10-08)
   Même charte que les listes et synthèses (StyleListesSPICA.css) : violet SPICA, cartes blanches.
   À charger APRÈS StyleSPICA.css. StyleFicheProjet.css reste utilisée par SaisieOrdreMission.php.
   Les sections s'appuient sur les identifiants présents dans le HTML (BlocXxx), utilisés aussi par FicheProjetEtapes.js.
   ========================================================================= */

:root {
	--fp-violet: #3903A5;
	--fp-violet-fonce: #2a0279;
	--fp-violet-clair: #f3f1f8;
	--fp-bordure: #e4e0ee;
	--fp-gris: #666;
}

body { background: #faf9fd; }

/* --- Conteneur : en-tête et formulaire centrés, même largeur ------------ */
.fp-page, #SaisieFiche {
	max-width: 1180px;
	margin-left: auto !important;
	margin-right: auto !important;
	padding-left: 12px;
	padding-right: 12px;
	float: none;
}
#SaisieFiche { width: 100%; }

/* --- En-tête : carte de synthèse ---------------------------------------- */
.fp-entete {
	display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px;
	background: #fff; border: 1px solid var(--fp-bordure); border-radius: 12px;
	box-shadow: 0 4px 24px rgba(57, 3, 165, 0.06);
	padding: 14px 20px; margin: 18px 0 12px;
}
.fp-surtitre { color: var(--fp-gris); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
.fp-surtitre i { color: var(--fp-violet); margin-right: 4px; }
.fp-entete h1 { color: var(--fp-violet); font-size: 20px; font-weight: bold; margin: 4px 0 8px; line-height: 1.3; }
.fp-acronyme { display: inline-block; background: var(--fp-violet); color: #fff; border-radius: 8px; padding: 1px 10px; margin-right: 8px; font-size: 16px; vertical-align: 2px; }
.fp-infos { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; color: #444; font-size: 13px; }
.fp-infos i { color: var(--fp-violet); margin-right: 3px; }
.fp-legende-requis { color: var(--fp-gris); font-size: 12px; }
.fp-requis-symbole { color: #c62828; font-weight: bold; }

/* Étiquette d'étape */
.fp-etape { display: inline-block; font-weight: bold; font-size: 12px; border-radius: 20px; padding: 2px 12px; background: #eeeaf5; color: #4b3f75; }
.fp-etape-1 { background: #eceff1; color: #455a64; }
.fp-etape-3 { background: #e3f0fd; color: #0d4f8b; }
.fp-etape-4 { background: #fff4e0; color: #8a5300; }
.fp-etape-5 { background: #e8f5e3; color: #1e5b2a; }
.fp-etape-6, .fp-etape-7, .fp-etape-8 { background: #fdecea; color: #b3261e; }
.fp-etape-9 { background: var(--fp-violet); color: #fff; }

/* Boutons */
.fp-bouton-principal, .fp-bouton-secondaire {
	border-radius: 10px; padding: 6px 16px; font-size: 13px; font-weight: bold; cursor: pointer; white-space: nowrap;
}
.fp-bouton-principal { background: var(--fp-violet); border: 1px solid var(--fp-violet); color: #fff; }
.fp-bouton-principal:hover { background: var(--fp-violet-fonce); }
.fp-bouton-secondaire { background: #fff; border: 1px solid var(--fp-violet); color: var(--fp-violet); }
.fp-bouton-secondaire:hover { background: var(--fp-violet-clair); }
.fp-bouton-secondaire i, .fp-bouton-principal i { margin-right: 5px; }
.fp-entete-action { margin: 0; }

/* Frise des étapes */
.fp-frise { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; list-style: none; padding: 0; margin: 0 0 14px; font-size: 12.5px; }
.fp-frise li { display: flex; align-items: center; gap: 6px; color: #9a96a8; background: #fff; border: 1px solid var(--fp-bordure); border-radius: 20px; padding: 3px 12px 3px 4px; }
.fp-frise-num { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; background: #eeeaf5; color: #9a96a8; font-weight: bold; font-size: 11px; }
.fp-frise li.fp-fait { color: var(--fp-violet); }
.fp-frise li.fp-fait .fp-frise-num { background: var(--fp-violet-clair); color: var(--fp-violet); }
.fp-frise li.fp-courant { color: #fff; background: var(--fp-violet); border-color: var(--fp-violet); font-weight: bold; }
.fp-frise li.fp-courant .fp-frise-num { background: #fff; color: var(--fp-violet); }
.fp-frise li.fp-frise-sortie { padding-left: 10px; }
.fp-frise li.fp-frise-sortie.fp-courant { background: #fdecea; border-color: #f3b8b2; color: #b3261e; }

/* Message de confirmation et débogage */
.fp-message { background: #e8f5e3; border: 1px solid #b9dfae; color: #1e5b2a; border-radius: 10px; padding: 8px 14px; margin-bottom: 12px; }
.fp-debug { font-size: 11px; color: var(--fp-gris); margin-bottom: 10px; word-break: break-all; }

/* --- Sections du formulaire : cartes blanches avec titre violet ---------- */
#BlocIdentification,
#BlocDescription,
#BlocDuree-Role-Partenaires,
#BlocBgt,
#BlocFint,
#BlocDates,
#BlocTermine,
#BlocDocuments,
#CommentairesGen {
	background: #fff;
	border: 1px solid var(--fp-bordure);
	border-radius: 12px;
	box-shadow: 0 4px 24px rgba(57, 3, 165, 0.06);
	padding: 12px 20px 16px !important;
	margin: 0 0 16px !important;
	width: auto !important;
	max-width: none !important;
	flex: none !important;
}
#BlocDuree-Role-Partenaires, #BlocBgt, #BlocFint, #BlocDates, #BlocTermine, #CommentairesGen { display: flex; flex-wrap: wrap; }

#BlocIdentification::before,
#BlocDescription::before,
#BlocDuree-Role-Partenaires::before,
#BlocBgt::before,
#BlocFint::before,
#BlocDates::before,
#BlocTermine::before,
#BlocDocuments::before,
#CommentairesGen::before {
	display: block;
	width: 100%;
	flex: 0 0 100%;
	font-family: "Font Awesome 5 Free", "Segoe UI", Verdana, Arial, sans-serif;
	font-size: 14px;
	font-weight: 900;
	color: var(--fp-violet);
	letter-spacing: .3px;
	padding-bottom: 8px;
	margin-bottom: 10px;
	border-bottom: 1px solid #f1eff6;
}
#BlocIdentification::before         { content: "\f02b\a0\a0 Identification"; }
#BlocDescription::before            { content: "\f15c\a0\a0 Description du projet"; }
#BlocDuree-Role-Partenaires::before { content: "\f0c0\a0\a0 Durée, rôle et partenaires"; }
#BlocBgt::before                    { content: "\f555\a0\a0 Budget"; }
#BlocFint::before                   { content: "\f4c0\a0\a0 Financement"; }
#BlocDates::before                  { content: "\f073\a0\a0 Dates clés"; }
#BlocTermine::before                { content: "\f560\a0\a0 Résultats et livrables réalisés"; }
#BlocDocuments::before              { content: "\f0c6\a0\a0 Documents"; }
#CommentairesGen::before            { content: "\f086\a0\a0 Commentaires généraux"; }

/* Mise en page interne : on neutralise les décalages Bootstrap hérités (offset, largeurs fixes) */
#SaisieFiche [class*="offset-lg-"] { margin-left: 0 !important; }
#SaisieFiche .row { margin-left: 0; margin-right: 0; }
#SaisieFiche .row.col-lg-10, #SaisieFiche .row.col-lg-12, #SaisieFiche .row.col-lg-8 { width: 100%; max-width: 100%; flex: 0 0 100%; }
#BlocIdentification > .row > [class*="col-"] { flex: 1 1 170px; max-width: none; width: auto; }
#BlocIdentification > .row > [class*="col-"] > br { display: none; }
#BlocDescription > .row { padding-top: 0 !important; padding-bottom: 0 !important; }

/* --- Libellés : alignés à gauche, au-dessus ou à côté du champ ----------- */
#SaisieFiche label {
	text-align: left !important;
	color: var(--fp-violet-fonce);
	font-size: 12.5px;
	height: auto;
	padding: 10px 0 4px !important;
	border: 0;
	background: none;
	box-shadow: none;
}
#SaisieFiche label b, #SaisieFiche label strong { font-weight: 600; }
#SaisieFiche .col-form-label { padding-top: 6px !important; }
#SaisieFiche #BlocDescription label.col-lg-2 { flex: 0 0 100%; max-width: 100%; }
#SaisieFiche #BlocDescription label.col-lg-2 + .col-lg-10 { flex: 0 0 100%; max-width: 100%; }
/* Description : champs alignés sur toute la largeur ; acronyme et titre côte à côte */
#BlocDescription .row { justify-content: flex-start !important; }
#BlocDescription [class*="col-"] { padding-left: 0; padding-right: 0; }
#BlocDescription > .row:first-of-type { flex-wrap: nowrap; gap: 16px; }
#BlocDescription > .row:first-of-type > .col-lg-2 { flex: 0 0 220px; max-width: 220px; }
#BlocDescription > .row:first-of-type > .col-lg-10 { flex: 1 1 auto; max-width: none; }
/* Autres sections : contenu aligné à gauche */
#BlocDuree-Role-Partenaires, #BlocBgt, #BlocFint, #BlocDates { justify-content: flex-start !important; }
/* Dates clés : grille de champs (libellé au-dessus) */
#BlocDates > [class*="col-"] { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0 24px; flex: 0 0 100%; max-width: 100%; }
#BlocDates .form-group.row { display: block; margin: 0; }
#BlocDates .form-group.row > .col { padding: 0; }
#BlocDates #MessageDateReponse { grid-column: 1 / -1; }

/* Champ obligatoire : « (*) » remplacé par un astérisque rouge (span produit par FicheProjet2.js / FicheProjetEtapes.js) */
.fp-requis { font-size: 0; }
.fp-requis::after { content: "*"; font-size: 13px; color: #c62828; font-weight: bold; margin-left: 3px; }

/* --- Champs ------------------------------------------------------------- */
#SaisieFiche .form-control, #SaisieFiche .form-select, #SaisieFiche select {
	border-color: #d9d4e7;
	border-radius: 8px !important;
	font-size: 13px;
	font-family: inherit !important;
	background-color: #fff !important;
}
#SaisieFiche .form-control:focus, #SaisieFiche select:focus {
	border-color: var(--fp-violet);
	box-shadow: 0 0 0 3px rgba(57, 3, 165, 0.15);
}
#SaisieFiche textarea.form-control { line-height: 1.5 !important; }
#SaisieFiche input[style*="font-weight:bold"] { color: #1f1640; }

/* Commentaires horodatés (budget, financement, généraux) : fond ambré léger */
#CommentBudget, #CommentFint, #CommentGen {
	background-color: #fffaf0 !important;
	border-color: #f0dcb0 !important;
}

/* Aides sous les champs */
#SaisieFiche small, #SaisieFiche .form-text { color: #8a84a0 !important; font-size: 11px; }

/* --- Compteurs de caractères -------------------------------------------- */
.counter { font-size: 11px; color: #8a84a0; text-align: right; width: 100%; padding: 2px 2px 0; }
.counter span { font-weight: bold; color: var(--fp-violet); }
.counter.limite-proche span { color: #b36a00; }
.counter.limite-depassee span { color: #c62828; }
.counter.limite-depassee { color: #c62828; }

/* --- Thèmes et filières : étiquettes cliquables -------------------------- */
.fp-liste-masquee { display: none !important; }
.fp-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 0; }
.fp-chip {
	border: 1px solid #d9d4e7; background: #fff; color: #3d3557;
	border-radius: 16px; padding: 3px 11px; font-size: 12.5px; line-height: 1.4; cursor: pointer;
	transition: background .1s, color .1s, border-color .1s;
}
.fp-chip:hover { border-color: var(--fp-violet); color: var(--fp-violet); }
.fp-chip[aria-pressed="true"] { background: var(--fp-violet); border-color: var(--fp-violet); color: #fff; }
.fp-chip[aria-pressed="true"]::before { content: "\f00c"; font-family: "Font Awesome 5 Free"; font-weight: 900; font-size: 10px; margin-right: 5px; }
.fp-chips-aide { width: 100%; font-size: 11px; color: #8a84a0; }
.fp-chips.fp-chips-erreur .fp-chip { border-color: #c62828; }
.fp-chips.fp-chips-erreur .fp-chips-aide { color: #c62828; font-weight: bold; }

/* --- Message d'alerte sur la date de réponse ---------------------------- */
#MessageDateReponse {
	font-size: 12px;
	background-color: #fff8e1;
	border: 1px solid #ffe082;
	border-radius: 8px;
	padding: 6px 10px;
	margin-top: 6px;
	color: #8a5300 !important;
}

/* --- Barre d'actions fixée en bas de l'écran ----------------------------- */
.fp-actions {
	position: sticky;
	bottom: 0;
	z-index: 20;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: flex-end;
	gap: 10px;
	background: rgba(255, 255, 255, 0.96);
	border: 1px solid var(--fp-bordure);
	border-radius: 12px 12px 0 0;
	box-shadow: 0 -4px 18px rgba(57, 3, 165, 0.10);
	padding: 10px 16px;
	margin: 8px 0 0;
}
/* « Enregistrer » est le premier bouton du formulaire (touche Entrée) mais s'affiche à droite */
.fp-actions #Valider { order: 3; }
.fp-modifs { margin-right: auto; color: #b36a00; font-size: 12.5px; font-weight: bold; }
.fp-modifs i { margin-right: 4px; }

/* --- Écrans étroits ------------------------------------------------------ */
@media (max-width: 991px) {
	#BlocIdentification > .row > [class*="col-"] { flex: 1 1 100%; }
	.fp-entete h1 { font-size: 17px; }
	.fp-actions { justify-content: center; }
	.fp-modifs { width: 100%; text-align: center; margin-right: 0; }
}

/* --- Impression --------------------------------------------------------- */
@media print {
	.fp-actions, .fp-frise, .fp-entete-action, .fp-debug, .barreNiv1 { display: none !important; }
	#BlocIdentification, #BlocDescription, #BlocDuree-Role-Partenaires, #BlocBgt, #BlocFint, #BlocDates, #BlocTermine, #CommentairesGen { break-inside: avoid; box-shadow: none; }
	.fp-liste-masquee { display: block !important; }
	.fp-chips { display: none !important; }
}

/* Champs numériques et courts : largeur minimale lisible */
#SaisieFiche input[type=number] { min-width: 90px; }

/* --- Documents associés à la fiche (2026-10-10) --------------------------- */
.fp-doc-zone {
	display: flex; align-items: center; gap: 14px;
	border: 2px dashed #cfc7e6; border-radius: 12px; background: #faf9fd;
	padding: 14px 18px; color: #3d3557; transition: background .15s, border-color .15s;
}
.fp-doc-zone > i { font-size: 28px; color: var(--fp-violet); }
.fp-doc-zone.fp-doc-survol { background: var(--fp-violet-clair); border-color: var(--fp-violet); }
.fp-doc-zone.fp-doc-envoi { opacity: .6; pointer-events: none; }
.fp-doc-zone .fp-bouton-secondaire { padding: 3px 12px; margin-left: 4px; }
.fp-doc-aide { font-size: 11px; color: #8a84a0; margin-top: 4px; }
.fp-doc-info { margin: 0; color: var(--fp-gris); }
.fp-doc-info i { color: var(--fp-violet); margin-right: 4px; }
#fpDocMessages > div { border-radius: 8px; padding: 6px 12px; margin-top: 10px; font-size: 12.5px; }
#fpDocMessages .fp-doc-ok { background: #e8f5e3; border: 1px solid #b9dfae; color: #1e5b2a; }
#fpDocMessages .fp-doc-ko { background: #fdecea; border: 1px solid #f3b8b2; color: #8c1d18; }
#fpDocMessages ul { margin: 4px 0 0; padding-left: 18px; }
.fp-doc-liste { list-style: none; margin: 12px 0 0; padding: 0; }
.fp-doc-liste li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 7px 4px; border-top: 1px solid #f1eff6; }
.fp-doc-liste li:first-child { border-top: 0; }
.fp-doc-liste li.fp-doc-vide { color: #8a84a0; font-style: italic; }
.fp-doc-icone { width: 22px; text-align: center; font-size: 17px; color: var(--fp-violet); }
.fp-doc-nom { font-weight: 600; color: var(--fp-violet-fonce); word-break: break-word; }
.fp-doc-nom:hover { text-decoration: underline; color: var(--fp-violet); }
.fp-doc-meta { color: #8a84a0; font-size: 11.5px; margin-right: auto; }
.fp-doc-supprimer { border: 1px solid #e3b5b1; background: #fff; color: #b3261e; border-radius: 8px; padding: 1px 9px; font-size: 12px; }
.fp-doc-supprimer:hover { background: #b3261e; color: #fff; border-color: #b3261e; }
@media print { .fp-doc-zone, .fp-doc-supprimer { display: none !important; } }
