/* =========================================================
   Candidature PFE – NEXT CONSULT
   Styles sans framework. Couleurs, espacements et rayons
   centralisés dans les variables ci-dessous.
   ========================================================= */

:root {
  /* Couleurs de marque */
  --c-primary: #0B55A5;
  --c-primary-dark: #084482;
  --c-ink: #062F5E;          /* bleu très foncé : bannière, titres */
  --c-primary-50: #F0F6FD;
  --c-primary-100: #DCE8F6;
  --c-primary-200: #B9D0EC;

  /* Neutres (contraste ≥ 4.5:1 sur blanc pour le texte) */
  --c-text: #1F2937;
  --c-muted: #4B5563;
  --c-placeholder: #8A94A3;
  --c-border: #D5DEE8;
  --c-border-strong: #A9BCD3;
  --c-bg: #F5F7FA;
  --c-surface: #FFFFFF;

  /* États */
  --c-danger: #C81E1E;
  --c-danger-bg: #FEF5F5;
  --c-success: #15803D;

  /* Espacements */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-8: 32px;
  --s-10: 40px;

  /* Rayons */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-full: 999px;

  /* Divers */
  --ring: 0 0 0 3px rgba(11, 85, 165, .22);
  --ring-danger: 0 0 0 3px rgba(200, 30, 30, .18);
  --shadow-card: 0 1px 2px rgba(6, 47, 94, .05), 0 8px 24px -12px rgba(6, 47, 94, .18);
  --dur: 180ms;
  --ease: cubic-bezier(.2, .7, .3, 1);

  /* Motif du logo (arcs + point), en blanc pour la bannière et en bleu pour le fond de page */
  --pattern-white: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96' fill='none' stroke='%23ffffff' stroke-opacity='.07' stroke-width='6' stroke-linecap='round'%3E%3Cpath d='M12 52a20 20 0 0 1 40 0'/%3E%3Cpath d='M60 84a16 16 0 0 0 28-10'/%3E%3Ccircle cx='76' cy='24' r='4' fill='%23ffffff' fill-opacity='.09' stroke='none'/%3E%3C/svg%3E");
  --pattern-blue: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96' fill='none' stroke='%230B55A5' stroke-opacity='.035' stroke-width='6' stroke-linecap='round'%3E%3Cpath d='M12 52a20 20 0 0 1 40 0'/%3E%3Cpath d='M60 84a16 16 0 0 0 28-10'/%3E%3Ccircle cx='76' cy='24' r='4' fill='%230B55A5' fill-opacity='.04' stroke='none'/%3E%3C/svg%3E");
  /* Bord bas arrondi de la bannière (utilisé comme masque) */
  --wave: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 56' preserveAspectRatio='none'%3E%3Cpath d='M0 0H1440V8C1080 60 360 60 0 8Z'/%3E%3C/svg%3E");
  --wave-h: 56px;
}

/* ---------- Base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Poppins", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--c-text);
  /* Fond très discret : halos bleus (5-6 %) + motif du logo (≈3,5 %) */
  background:
    radial-gradient(900px 600px at 0% 45%, rgba(11, 85, 165, .05), transparent 70%),
    radial-gradient(800px 600px at 100% 85%, rgba(11, 85, 165, .06), transparent 70%),
    var(--pattern-blue),
    var(--c-bg);
  -webkit-font-smoothing: antialiased;
  display: flex;           /* pied de page collé en bas sur les pages courtes */
  flex-direction: column;
  min-height: 100vh;
}

h1, h2, h3, p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img { display: block; max-width: 100%; }
a { color: var(--c-primary); }
a:hover { color: var(--c-primary-dark); }
button, input { font: inherit; color: inherit; }

svg { flex: none; }
/* Icônes trait : style commun */
.topbar-link svg, .section-icon svg, .control-icon,
.dropzone-icon svg, .file-icon svg, .btn-ghost svg, .btn-arrow {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.container {
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  padding: 0 var(--s-5);
}

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

.honeypot { display: none; }

:focus-visible { outline: 3px solid rgba(11, 85, 165, .45); outline-offset: 2px; }

.req { color: var(--c-danger); }
.opt { font-weight: 400; color: var(--c-muted); }

/* ---------- Barre du haut ---------- */
.topbar { background: var(--c-surface); border-bottom: 1px solid var(--c-border); }
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
/* Le logo JPG a des marges blanches : on le recadre */
.topbar-logo { display: block; width: 104px; height: 52px; overflow: hidden; }
.topbar-logo img { width: 100%; height: 100%; object-fit: cover; }
.topbar-link {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}
.topbar-link svg { width: 16px; height: 16px; }

/* ---------- Bannière ---------- */
.hero {
  position: relative;
  overflow: hidden;
  color: #fff;
  background: linear-gradient(120deg, var(--c-ink) 0%, var(--c-primary-dark) 55%, var(--c-primary) 100%);
  /* Bord bas en courbe douce : rectangle + vague. La page apparaît dessous, sans raccord visible. */
  -webkit-mask:
    linear-gradient(#000 0 0) top / 100% calc(100% - var(--wave-h) + 1px) no-repeat,
    var(--wave) bottom / 100% var(--wave-h) no-repeat;
          mask:
    linear-gradient(#000 0 0) top / 100% calc(100% - var(--wave-h) + 1px) no-repeat,
    var(--wave) bottom / 100% var(--wave-h) no-repeat;
}
/* Motif du logo, qui s'efface vers le bas */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--pattern-white);
  -webkit-mask-image: linear-gradient(to bottom, #000 25%, transparent 85%);
          mask-image: linear-gradient(to bottom, #000 25%, transparent 85%);
  pointer-events: none;
}
.hero-shapes {
  position: absolute;
  right: -40px;
  bottom: -30px;
  width: 520px;
  height: 360px;
  fill: none;
  stroke: rgba(255, 255, 255, .09);
  stroke-width: 34;
  stroke-linecap: round;
  pointer-events: none;
}
.hero-shapes circle { fill: rgba(255, 255, 255, .12); stroke: none; }
.hero-inner {
  position: relative;
  padding-top: 28px;
  padding-bottom: 356px;   /* bannière haute : la carte remonte dessus (chevauchement profond) */
}
.eyebrow {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #BFD8F5;
}
.hero h1 {
  margin-top: var(--s-2);
  max-width: none;
  text-wrap: balance;      /* lignes équilibrées ; "NEXT CONSULT" reste groupé (espace insécable) */
  font-size: clamp(24px, 3.2vw, 34px);
  font-weight: 700;
  line-height: 1.15;
}

/* ---------- Mise en page ---------- */
.layout {
  display: grid;
  gap: var(--s-6);
  margin-top: -324px;       /* la carte chevauche la bannière et masque son bord */
  padding-bottom: 56px;
  flex: 1 0 auto;
  position: relative;
}

.card {
  background: var(--c-surface);
  border: 1px solid #E3EAF2;
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
}

/* ---------- Formulaire ---------- */
.form-card { padding: var(--s-6) var(--s-8); }
@media (max-width: 599px) { .form-card { padding: var(--s-5); } }

.form-intro { margin-bottom: var(--s-2); }
.form-intro h2 { font-size: 22px; font-weight: 700; color: var(--c-ink); }
.form-intro p { margin-top: var(--s-1); font-size: 14px; color: var(--c-muted); }

.form-section { margin-top: var(--s-4); }   /* + ligne erreur réservée = écart entre sections */
.section-head {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin-bottom: var(--s-3);
  padding-bottom: var(--s-2);
  border-bottom: 1px solid #E8EEF5;
}
.section-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  background: var(--c-primary-100);
  color: var(--c-primary);
}
.section-icon svg { width: 18px; height: 18px; }
.section-head h3 { font-size: 16px; font-weight: 600; color: var(--c-ink); }

.grid-2 { display: grid; gap: var(--s-3) var(--s-5); }
@media (min-width: 600px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 500;
}

/* Champ avec icône */
.control { position: relative; }
.control-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  color: #94A3B8;
  pointer-events: none;
  transition: color var(--dur) var(--ease);
}
.control:focus-within .control-icon { color: var(--c-primary); }
.control:has([aria-invalid="true"]) .control-icon { color: var(--c-danger); }

.input {
  width: 100%;
  height: 46px;
  padding: 0 14px 0 42px;
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  background-color: #FBFCFE;
  font-size: 15px;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
.input::placeholder { color: var(--c-placeholder); }
.input:hover { border-color: var(--c-border-strong); }
.input:focus { outline: none; background-color: #fff; border-color: var(--c-primary); box-shadow: var(--ring); }
.input[aria-invalid="true"] { border-color: var(--c-danger); background-color: var(--c-danger-bg); }
.input[aria-invalid="true"]:focus { box-shadow: var(--ring-danger); }

/* Ligne réservée sous chaque champ : pas de saut de mise en page à l'affichage d'une erreur */
.error {
  min-height: 18px;
  margin-top: var(--s-1);
  font-size: 13px;
  line-height: 18px;
  color: var(--c-danger);
}
.hint { font-size: 13px; color: var(--c-muted); }
.hint-line { min-height: 18px; margin-top: var(--s-1); line-height: 18px; }

/* ---------- Listes déroulantes (sujets) ---------- */
.select {
  appearance: none;
  padding: 0 40px 0 14px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%230B55A5' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
}
.select:disabled {
  cursor: not-allowed;
  color: var(--c-placeholder);
  background-color: #F1F4F8;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%238A94A3' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
}

/* ---------- CV ---------- */
.dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-1);
  padding: var(--s-4);
  border: 1.5px dashed var(--c-border-strong);
  border-radius: var(--r-md);
  background: var(--c-primary-50);
  text-align: center;
  transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.dropzone:hover,
.dropzone.is-dragover { border-color: var(--c-primary); background: #E6F0FA; }
.dropzone:focus-within { border-color: var(--c-primary); box-shadow: var(--ring); }
.dropzone:has([aria-invalid="true"]) { border-color: var(--c-danger); background: var(--c-danger-bg); }
.dropzone[hidden] { display: none; }
.dropzone input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.dropzone-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: var(--s-2);
  border-radius: var(--r-md);
  background: #fff;
  color: var(--c-primary);
  box-shadow: 0 2px 8px -2px rgba(11, 85, 165, .3);
}
.dropzone-icon svg { width: 22px; height: 22px; }
.dropzone-title { font-size: 14px; }
.dropzone-title strong { font-weight: 600; color: var(--c-ink); }
.dropzone-title .link { font-weight: 600; color: var(--c-primary); text-decoration: underline; text-underline-offset: 2px; }
.dropzone-hint { font-size: 13px; color: var(--c-muted); }

.file-card {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border: 1.5px solid var(--c-primary);
  border-radius: var(--r-md);
  background: #fff;
  animation: fade-in var(--dur) var(--ease);
}
.file-card[hidden] { display: none; }
.file-card:focus { outline: none; box-shadow: var(--ring); }
.file-card.is-invalid { border-color: var(--c-danger); background: var(--c-danger-bg); }
.file-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--r-sm);
  background: var(--c-primary);
  color: #fff;
}
.file-card.is-invalid .file-icon { background: var(--c-danger); }
.file-icon svg { width: 20px; height: 20px; }
.file-meta { flex: 1; min-width: 0; }
.file-name { overflow: hidden; font-size: 14px; font-weight: 600; color: var(--c-ink); white-space: nowrap; text-overflow: ellipsis; }
.file-size { font-size: 13px; color: var(--c-muted); }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 var(--s-3);
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  color: var(--c-muted);
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.btn-ghost:hover { border-color: var(--c-danger); color: var(--c-danger); }
.btn-ghost svg { width: 16px; height: 16px; }

/* ---------- Consentement + envoi ---------- */
.form-actions {
  margin-top: var(--s-3);
  padding-top: var(--s-4);
  border-top: 1px solid #E8EEF5;
}
.consent-row { display: flex; align-items: flex-start; gap: var(--s-3); }
.consent-row label { font-size: 14px; color: var(--c-text); cursor: pointer; }
.checkbox {
  flex: none;
  width: 20px;
  height: 20px;
  margin: 2px 0 0;
  accent-color: var(--c-primary);
  cursor: pointer;
}
.checkbox[aria-invalid="true"] { outline: 2px solid var(--c-danger); outline-offset: 2px; }

.status {
  margin-bottom: var(--s-4);
  padding: var(--s-3) var(--s-4);
  border: 1px solid #F5C2C2;
  border-radius: var(--r-sm);
  background: var(--c-danger-bg);
  font-size: 14px;
  color: var(--c-danger);
}
.status[hidden] { display: none; }

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  width: 100%;
  min-height: 52px;
  padding: 0 var(--s-8);
  border: 0;
  border-radius: var(--r-sm);
  background: var(--c-primary);
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  transition: background-color var(--dur) var(--ease);
}
.btn-primary:hover:not(:disabled) { background: var(--c-primary-dark); }
.btn-primary:disabled { opacity: .7; cursor: progress; }
.btn-arrow { width: 18px; height: 18px; transition: transform var(--dur) var(--ease); }
.btn-primary:hover:not(:disabled) .btn-arrow { transform: translateX(3px); }

/* Indicateur de chargement : visible seulement pendant l'envoi */
.spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  border-radius: var(--r-full);
  animation: spin .7s linear infinite;
}
.btn-primary.is-loading .spinner { display: inline-block; }
.btn-primary.is-loading .btn-arrow { display: none; }

.btn-secondary {
  min-height: 44px;
  padding: 0 var(--s-5);
  border: 1.5px solid var(--c-primary);
  border-radius: var(--r-sm);
  background: #fff;
  font-weight: 600;
  color: var(--c-primary);
  cursor: pointer;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.btn-secondary:hover { background: var(--c-primary); color: #fff; }

/* ---------- Succès ---------- */
.success {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-3);
  padding: 56px var(--s-6);
  text-align: center;
  animation: fade-in 250ms var(--ease);
}
.success[hidden] { display: none; }
.success:focus { outline: none; }
.success h2 { font-size: 22px; font-weight: 700; color: var(--c-ink); }
.success p { max-width: 440px; color: var(--c-muted); }
.success .btn-secondary { margin-top: var(--s-3); }
.success-check { width: 72px; height: 72px; fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.success-check circle { stroke: var(--c-success); stroke-dasharray: 151; stroke-dashoffset: 151; animation: draw 500ms var(--ease) forwards; }
.success-check path { stroke: var(--c-success); stroke-dasharray: 36; stroke-dashoffset: 36; animation: draw 300ms 400ms var(--ease) forwards; }

/* ---------- Pied de page ---------- */
.footer { background: var(--c-surface); border-top: 1px solid var(--c-border); }
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
  padding-top: var(--s-4);
  padding-bottom: var(--s-4);
  font-size: 14px;
  color: var(--c-muted);
}
.footer-brand { display: flex; align-items: center; gap: var(--s-2); }
.footer-mark { display: block; width: 32px; height: 32px; overflow: hidden; }
.footer-mark img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.5); }
.footer a { font-weight: 600; text-decoration: none; }

/* ---------- Petits écrans ---------- */
@media (max-width: 599px) {
  .container { padding: 0 var(--s-4); }
  .hero-inner { padding-top: var(--s-6); padding-bottom: 112px; }
  .layout { margin-top: -84px; }
  .hero-shapes { width: 320px; height: 220px; right: -80px; opacity: .7; }
  .footer-inner { justify-content: center; text-align: center; }
}

/* ---------- Animations ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-delay: 0ms !important;
  }
  .spinner { animation: spin 1.5s linear infinite !important; }   /* garde un indicateur lent */
}
