/* =========================================================================
   SPICA — Demande de création de code analytique (CreationCodeAnalytique2.php) : mise en forme (2026-10-14)
   Même charte que les pages projet, fiche projet et conventions : violet SPICA, sections en cartes blanches.
   Le formulaire garde ses tableaux d'origine (libellé à gauche, champ à droite) : seule leur présentation change.
   ========================================================================= */

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

body { background: #faf9fd; font-size: 13px; }
.ca-page { max-width: 1180px; margin: 0 auto; padding: 0 12px 10px; }
.ca-page br { display: none; }

/* --- En-tête : carte de synthèse ---------------------------------------- */
.ca-entete {
	display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px;
	background: #fff; border: 1px solid var(--ca-bordure); border-radius: 12px;
	box-shadow: 0 4px 24px rgba(57, 3, 165, 0.06);
	padding: 14px 20px; margin: 18px 0 14px;
}
.ca-surtitre { color: var(--ca-gris); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
.ca-surtitre i { color: var(--ca-violet); margin-right: 4px; }
.ca-entete h1 { color: var(--ca-violet); font-size: 20px; font-weight: bold; margin: 4px 0 8px; line-height: 1.3; }
.ca-code { display: inline-block; background: var(--ca-violet); color: #fff; border-radius: 8px; padding: 1px 10px; margin-right: 8px; font-size: 16px; vertical-align: 2px; white-space: nowrap; }
.ca-infos { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; color: #444; }
.ca-infos i { color: var(--ca-violet); margin-right: 3px; }
.ca-badge { display: inline-block; font-weight: bold; font-size: 12px; border-radius: 20px; padding: 2px 12px; }
.ca-badge i { color: inherit; }
.ca-badge-ok { background: #e8f5e3; color: #1e5b2a; }
.ca-badge-attente { background: #fff4e0; color: #8a5300; }
.ca-badge-nouveau { background: #eeeaf5; color: #4b3f75; }
.ca-entete-actions { margin: 0; }

/* Boutons */
.ca-bouton-principal, .ca-bouton-secondaire, .ca-bouton-danger, .ca-page button {
	border-radius: 10px; padding: 6px 16px; font-size: 13px; font-weight: bold; cursor: pointer; white-space: nowrap;
	background: #fff; border: 1px solid var(--ca-violet); color: var(--ca-violet); text-decoration: none; display: inline-block; height: auto;
}
.ca-bouton-secondaire:hover, .ca-page button:hover { background: var(--ca-violet-clair); color: var(--ca-violet); }
.ca-bouton-secondaire i, .ca-bouton-principal i, .ca-page button i { margin-right: 5px; }
.ca-bouton-principal { background: var(--ca-violet); color: #fff; }
.ca-bouton-principal:hover { background: var(--ca-violet-fonce); color: #fff; }
.ca-bouton-danger { border-color: #b3261e; color: #b3261e; }
.ca-bouton-danger:hover { background: #b3261e; color: #fff; }
.ca-page input[type=submit]:disabled { opacity: .45; cursor: not-allowed; }

/* --- Sections en cartes --------------------------------------------------- */
.ca-carte {
	background: #fff; border: 1px solid var(--ca-bordure); border-radius: 12px;
	box-shadow: 0 4px 24px rgba(57, 3, 165, 0.06);
	padding: 12px 20px 14px; margin: 0 0 16px;
}
.ca-carte::before {
	display: block;
	font-family: "Font Awesome 5 Free", "Segoe UI", Verdana, Arial, sans-serif;
	font-size: 14px; font-weight: 900; color: var(--ca-violet); letter-spacing: .3px;
	padding-bottom: 8px; margin-bottom: 10px; border-bottom: 1px solid #f1eff6;
}
#caChoix::before        { content: "\f0b0\a0\a0 Projet concerné"; }
#caProjet::before       { content: "\f02b\a0\a0 Identification du projet et code analytique"; }
#caFinancement::before  { content: "\f4c0\a0\a0 Financement"; }
#caContacts::before     { content: "\f0c0\a0\a0 Contacts et découpage en actions"; }
#caCommentaires::before { content: "\f086\a0\a0 Commentaires"; }
#caBudget::before       { content: "\f1c3\a0\a0 Charges du budget Excel"; }   /* 2026-10-19 */

/* Choix du projet */
#caChoix table { width: 100% !important; margin: 0; }
#caChoix td { padding: 0; text-align: left !important; }
#caChoix select { width: 100% !important; }
.ca-aide { color: var(--ca-gris); font-size: 12px; padding-top: 6px !important; }
.ca-aide i { color: var(--ca-violet); margin-right: 4px; }

/* Grilles : libellé à gauche, champ à droite */
.ca-grille { width: 100%; border-collapse: separate; border-spacing: 0; margin: 0; }
.ca-grille td { padding: 4px 6px; vertical-align: middle; color: #333; font-size: 12.5px; text-align: left; }
.ca-grille tr > td:first-child { width: 270px; color: var(--ca-violet-fonce); font-weight: 600; }
.ca-grille td[rowspan] { vertical-align: top; padding-top: 9px; }

/* Champs */
.ca-page input[type=text], .ca-page select, .ca-page textarea {
	border: 1px solid #d9d4e7; border-radius: 8px; padding: 4px 8px; margin: 2px 4px 2px 0;
	font-size: 13px; font-weight: normal; font-family: inherit; color: #222; background-color: #fff; height: auto; max-width: 100%;
}
.ca-page input[type=text]:focus, .ca-page select:focus, .ca-page textarea:focus {
	outline: none; border-color: var(--ca-violet); box-shadow: 0 0 0 3px rgba(57, 3, 165, 0.15);
}
.ca-page input:disabled, .ca-page select:disabled, .ca-page textarea:disabled { background-color: #f6f5fa; color: #333; }
.ca-page .champ { text-align: left; }
#caProjet input[name="TitreCourt"], #caProjet input[name="TitreLong"] { width: 100%; }
#caProjet select[name="CodeCASDARAncien"], #caProjet select[name="Filiere"], #caProjet select[name="Theme"],
#caProjet select[name="NouvAxe2022"], #caProjet select[name="ChefProjet"] { min-width: 320px; }
/* Dates en trois listes (jour, mois, année) */
.ca-page select[name^="Jour"], .ca-page select[name^="Mois"], .ca-page select[name^="Annee"] { padding: 4px 2px 4px 6px; }
/* Code analytique proposé / attribué */
#caProjet input[name="ProposNumeroCodeAnalytique"], #caProjet input[name="ProposCodeAnalytique"] { max-width: 260px; font-weight: bold; }
#caProjet input[name="ProposCodeAnalytique"] { background-color: #f6f5fa !important; }

/* Financement : liste, puis saisie libre « si pas dans la liste » */
#caFinancement select { width: 240px !important; }
#caFinancement input[type=text] { width: 260px; }
/* Contacts et actions */
#caContacts input[name^="Contact"] { width: 100%; max-width: 520px; }
#caContacts input[name^="NomAction"] { width: 100%; max-width: 620px; display: block; }

/* Commentaires */
.ca-rappel { margin: 0 0 8px; background: #fff4e0; border: 1px solid #f1cf94; color: #8a5300; border-radius: 8px; padding: 8px 12px; font-weight: bold; }
.ca-rappel i { margin-right: 6px; }
#caCommentaires td { padding: 0; }
#caCommentaires tr > td:first-child { width: auto; font-weight: 600; }
#caCommentaires textarea { display: block; width: 100%; min-height: 110px; line-height: 1.5; margin-top: 4px; }

/* --- Barre d'actions fixée en bas de l'écran ----------------------------- */
.ca-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(--ca-bordure); border-radius: 12px;
	box-shadow: 0 -4px 18px rgba(57, 3, 165, 0.10);
	padding: 10px 16px; margin: 8px 0 22px;
}
/* « Valider » est le premier bouton du formulaire (touche Entrée) mais s'affiche à droite */
.ca-actions input[name=Valider] { order: 5; }
.ca-option { margin: 0 auto 0 0; font-size: 12.5px; color: #444; cursor: pointer; }
.ca-option input { width: 16px; height: 16px; vertical-align: -3px; margin-right: 4px; accent-color: var(--ca-violet); }

@media (max-width: 991px) {
	.ca-grille tr > td:first-child { width: 160px; }
	#caProjet select { min-width: 0 !important; width: 100%; }
	.ca-actions { justify-content: center; }
	.ca-option { width: 100%; text-align: center; margin: 0; }
}
@media print { .ca-actions, .ca-entete-actions { display: none !important; } .ca-carte { box-shadow: none; break-inside: avoid; } }

/* Motif d'un refus d'acceptation du code */
.ca-erreur { background: #fdecea; border: 1px solid #f3b8b2; color: #8c1d18; border-radius: 10px; padding: 10px 16px; margin: 0 0 14px; }
.ca-erreur i { margin-right: 6px; }

/* --- 2026-10-17 : liste des demandes (page fusionnée avec DashboardCodesAnalytiques2.php) --- */
#caListe::before { content: "\f0ae\a0\a0 Demandes de création de code analytique"; }
#caChoix::before { content: "\f067\a0\a0 Nouvelle demande : projets financés sans code analytique"; }
.ca-liste-outils { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-bottom: 8px; }
.ca-onglets { display: flex; flex-wrap: wrap; gap: 6px; }
.ca-onglet { border-radius: 20px !important; padding: 4px 14px !important; font-size: 12.5px !important; }
.ca-onglet span { display: inline-block; min-width: 20px; margin-left: 4px; padding: 0 6px; border-radius: 10px; background: var(--ca-violet-clair); font-size: 11.5px; }
.ca-onglet.actif { background: var(--ca-violet) !important; color: #fff !important; }
.ca-onglet.actif span { background: rgba(255, 255, 255, 0.25); }
#caRecherche { flex: 1 1 320px; max-width: 460px; }
#caListe .ca-aide { margin-bottom: 8px; }
.ca-tableau { overflow-x: auto; }
.ca-demandes { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
.ca-demandes th { background: var(--ca-violet-clair); color: var(--ca-violet); font-weight: bold; font-size: 12px; text-align: left; padding: 7px 8px; white-space: nowrap; }
.ca-demandes th:first-child { border-radius: 8px 0 0 8px; }
.ca-demandes th:last-child { border-radius: 0 8px 8px 0; }
.ca-demandes td { padding: 7px 8px; border-bottom: 1px solid #f1eff6; vertical-align: top; color: #333; }
.ca-ligne { cursor: pointer; }
.ca-ligne:hover td, .ca-ligne:focus td { background: #faf8ff; }
.ca-ligne:focus { outline: 2px solid rgba(57, 3, 165, 0.35); outline-offset: -2px; }
.ca-num { color: var(--ca-gris); }
.ca-sous { color: var(--ca-gris); font-size: 11.5px; margin-top: 2px; }
.ca-nowrap { white-space: nowrap; }
.ca-nombre { text-align: right !important; white-space: nowrap; }
.ca-code-liste { display: inline-block; background: var(--ca-violet); color: #fff; border-radius: 6px; padding: 1px 8px; font-weight: bold; white-space: nowrap; }
.ca-vide { color: var(--ca-gris); font-style: italic; padding: 12px 8px; }
.ca-entete-actions a { text-decoration: none; }

/* --- 2026-10-17 : statut « sans suite » --- */
.ca-badge-sanssuite { background: #ececef; color: #555; }
.ca-bouton-sanssuite { border-color: #8a8797 !important; color: #555 !important; }
.ca-bouton-sanssuite:hover { background: #f1f0f4 !important; }
.ca-info { background: #e8f5e3; border: 1px solid #b7dcab; color: #1e5b2a; border-radius: 10px; padding: 10px 16px; margin: 0 0 14px; font-weight: bold; }
.ca-info i { margin-right: 6px; }
.ca-ligne[data-etat="sanssuite"] td { color: #888; }
