/* ===================================================================
   REZO FORMATION PRO — Règles d'interface communes à toutes les pages

   Ce fichier existe pour une seule raison : que le catalogue, les
   fiches de formation, le compte et l'accueil se ressemblent.
   Largeur de page, taille des titres, apparence des boutons.

   À charger APRÈS base.css et layout.css, dans chaque page :

     <link rel="stylesheet" href="css/rfp-ui.css">          (racine)
     <link rel="stylesheet" href="../css/rfp-ui.css">       (dossier pages/)

   Et, juste avant, la police Montserrat :

     <link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@600;700&family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
   =================================================================== */

:root {
  --rfp-navy:  #13294B;
  --rfp-blue:  #1565D8;
  --rfp-amber: #F59518;
  --rfp-dim:   #55657C;
  --rfp-line:  #DCE4EE;
}

/* ---------- 1. Largeur de page ----------
   Même conteneur centré partout : en-tête, contenu, pied de page. */

.container {
  width: 100%;
  max-width: 1200px;
  box-sizing: border-box;
  margin-left: auto;
  margin-right: auto;
  padding-left: 28px;
  padding-right: 28px;
}

@media (max-width: 620px) {
  .container { padding-left: 18px; padding-right: 18px; }
}

/* ---------- 2. Hiérarchie des titres ----------
   Un titre de page doit être nettement plus grand qu'un paragraphe.
   L'accueil a ses propres règles (préfixe rfp-) et n'est pas touché. */

main h1,
main h2,
main h3 {
  font-family: 'Montserrat', Inter, system-ui, sans-serif;
  color: var(--rfp-navy);
  letter-spacing: -.005em;
}

main h1 { font-size: 40px; line-height: 1.18; font-weight: 700; margin: 0 0 16px; }
main h2 { font-size: 31px; line-height: 1.25; font-weight: 700; margin: 0 0 14px; }
main h3 { font-size: 19px; line-height: 1.35; font-weight: 700; margin: 0 0 10px; }

@media (max-width: 760px) {
  main h1 { font-size: 30px; }
  main h2 { font-size: 25px; }
  main h3 { font-size: 18px; }
}

/* ---------- 3. Boutons ----------
   Mêmes couleurs, mêmes arrondis, mêmes hauteurs partout.
   Les boutons de l'administration (cms-, rp-) ne sont pas touchés. */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 13px 24px;
  min-height: 46px;
  border-radius: 11px;
  border: 2px solid transparent;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 15.5px;
  font-weight: 600;
  line-height: 1.25;
  text-decoration: none;
  cursor: pointer;
  box-sizing: border-box;
}

.btn-primary,
.btn-blue {
  background: var(--rfp-blue);
  color: #FFFFFF !important;
  border-color: var(--rfp-blue);
}
.btn-primary:hover,
.btn-blue:hover { background: #0F4FB0; border-color: #0F4FB0; }

.btn-amber {
  background: var(--rfp-amber);
  color: #FFFFFF !important;
  border-color: var(--rfp-amber);
}
.btn-amber:hover { background: #DC8008; border-color: #DC8008; }

/* Le bouton « fantôme » : fond blanc, texte marine, bordure visible.
   C'est le correctif du texte blanc sur fond blanc qui rendait
   certains boutons invisibles (attestation, profil, codes de rabais). */
.btn-ghost {
  background: #FFFFFF;
  color: var(--rfp-navy) !important;
  border-color: var(--rfp-line);
}
.btn-ghost:hover {
  border-color: var(--rfp-blue);
  color: var(--rfp-blue) !important;
  background: #FFFFFF;
}

/* Exception : dans l'en-tête bleu marine, le bouton fantôme reste clair. */
.site-header .btn-ghost {
  background: transparent;
  color: #FFFFFF !important;
  border-color: rgba(255, 255, 255, .45);
}
.site-header .btn-ghost:hover {
  background: rgba(255, 255, 255, .12);
  color: #FFFFFF !important;
  border-color: #FFFFFF;
}

.btn-sm { padding: 10px 17px; min-height: 40px; font-size: 14px; border-radius: 9px; }

@media (max-width: 620px) {
  .btn { width: 100%; }
  .btn-sm { width: auto; }
}

/* ===================================================================
   4. FORMULAIRES
   Un libellé au-dessus, un champ sur toute la largeur, une hauteur
   identique partout. S'applique à Nous joindre, Connexion, Création
   de compte, Inscription et Profil, sans toucher à leur HTML.
   =================================================================== */

main label {
  display: block;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--rfp-navy);
  margin-bottom: 7px;
  line-height: 1.4;
}

/* Les cases à cocher et boutons radio gardent leur libellé à côté */
main label:has(input[type="checkbox"]),
main label:has(input[type="radio"]) {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 500;
}

main input[type="text"],
main input[type="email"],
main input[type="tel"],
main input[type="password"],
main input[type="number"],
main input[type="search"],
main input[type="date"],
main select,
main textarea {
  display: block;
  width: 100%;
  box-sizing: border-box;
  min-height: 48px;
  padding: 13px 15px;
  border: 1px solid var(--rfp-line);
  border-radius: 10px;
  background: #FFFFFF;
  color: #1D2939;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 15.5px;
  line-height: 1.4;
}

main textarea { min-height: 128px; resize: vertical; line-height: 1.6; }

main input::placeholder,
main textarea::placeholder { color: #9AA7B8; }

main input:focus,
main select:focus,
main textarea:focus {
  outline: none;
  border-color: var(--rfp-blue);
  box-shadow: 0 0 0 3px rgba(21, 101, 216, .14);
}

/* Espacement vertical entre les champs */
main input[type="text"],
main input[type="email"],
main input[type="tel"],
main input[type="password"],
main input[type="number"],
main select,
main textarea { margin-bottom: 18px; }

/* ---- Erreurs : seulement après une saisie, jamais à l'ouverture ----
   C'est le défaut signalé sur « Nous joindre » : les champs vides
   s'affichaient en rouge avant que le visiteur ait rien tapé. */

main input:invalid,
main select:invalid,
main textarea:invalid {
  border-color: var(--rfp-line);
  box-shadow: none;
}

main input:user-invalid,
main select:user-invalid,
main textarea:user-invalid {
  border-color: #DC2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, .12);
}

/* ---- Messages d'erreur sous un champ ----
   Le script ajoute la classe « has-error » au .field concerné lors de
   l'envoi. Sans cette règle, les messages restaient visibles dès
   l'ouverture de la page — c'était le défaut du formulaire de contact. */

main .field-error {
  display: none;
  font-size: 13px;
  font-weight: 500;
  color: #DC2626;
  margin: -12px 0 16px;
  line-height: 1.5;
}

main .field.has-error .field-error { display: block; }

main .field.has-error input,
main .field.has-error select,
main .field.has-error textarea {
  border-color: #DC2626;
}

/* ===================================================================
   5. CARTES DE CONTENU
   Marge intérieure suffisante : les champs ne touchent plus le bord.
   =================================================================== */

main .card,
main .auth-card,
main .form-card,
main .checkout-card,
main .contact-card {
  box-sizing: border-box;
  padding: 28px;
  border-radius: 14px;
}

@media (max-width: 620px) {
  main .card,
  main .auth-card,
  main .form-card,
  main .checkout-card,
  main .contact-card { padding: 20px; }
}

/* ===================================================================
   6. BOUTON « MON COMPTE » DANS L'EN-TÊTE

   Ce bouton est injecté par js/auth.js, et on ne sait pas exactement
   dans quel conteneur. On vise donc large : tout bouton ou lien de
   type bouton placé dans l'en-tête, en excluant le logo et le
   hamburger. Le !important est là parce qu'une règle existante du
   site gagnait sur celle-ci.
   =================================================================== */

.site-header .btn,
.site-header .nav-actions a,
.site-header .nav-actions button:not(.nav-toggle),
.site-header .nav > a:not(.logo),
.site-header a[href*="compte"]:not(.logo):not(.mobile-menu a) {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 11px 22px !important;
  border-radius: 11px !important;
  border: 2px solid var(--rfp-blue) !important;
  background: var(--rfp-blue) !important;
  color: #FFFFFF !important;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14.5px !important;
  font-weight: 600 !important;
  line-height: 1.2;
  text-decoration: none !important;
  cursor: pointer;
  white-space: nowrap;
  box-sizing: border-box;
}

.site-header .btn:hover,
.site-header .nav-actions a:hover,
.site-header .nav-actions button:not(.nav-toggle):hover,
.site-header .nav > a:not(.logo):hover {
  background: #0F4FB0 !important;
  border-color: #0F4FB0 !important;
}

/* Quand l'apprenant est connecté, l'en-tête affiche plusieurs boutons
   (Mes formations · Mon profil · Se déconnecter). Trois boutons pleins
   feraient un bloc trop lourd : seul le premier reste bleu, les autres
   deviennent des contours clairs. */
.site-header .nav-actions > *:not(:first-child):not(.nav-toggle) {
  background: transparent !important;
  border-color: rgba(255, 255, 255, .45) !important;
}
.site-header .nav-actions > *:not(:first-child):not(.nav-toggle):hover {
  background: rgba(255, 255, 255, .13) !important;
  border-color: #FFFFFF !important;
}

/* Le menu déroulant du mobile garde ses liens en texte simple */
.site-header .mobile-menu a {
  display: block !important;
  min-height: 0;
  padding: 12px 0 !important;
  border: none !important;
  background: none !important;
  border-radius: 0 !important;
}

/* Le hamburger reste une icône */
.site-header .nav-toggle {
  background: none !important;
  border: none !important;
  padding: 6px !important;
  min-height: 0;
  border-radius: 0 !important;
  color: #FFFFFF !important;
}
