/* ============================================================
   SAPHIR DÉVELOPPEMENT — VARIABLES CSS ET THÈME OFFICIEL
   Plateforme Recrutement UCP | Version 2.0
   Palette alignée sur les couleurs réelles du logo Saphir
   Développement : bleu marine, bleu saphir, rouge brique.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  /* --- Couleurs primaires SAPHIR (extraites du logo) --- */
  --saphir-nuit:    #0A2159;  /* bleu marine profond — texte "HIR", fonds sombres */
  --saphir-royal:   #25538A;  /* bleu principal — boutons, liens, éléments actifs */
  --saphir-intense: #34649F;  /* survol / focus */
  --saphir-vif:     #4F81BC;  /* bleu du bloc logo — icônes, badges, accents clairs */
  --saphir-clair:   #A9C6E8;  /* bleu clair — bordures, fonds actifs */
  --saphir-glace:   #EEF3FA;  /* bleu très pâle — fonds de section */

  /* --- Accent RUBIS (rouge du logo, texte "DEVELOPPEMENT") — à utiliser avec parcimonie --- */
  --or-saphir:  #A63A2C;
  --or-clair:   #E0987F;
  --or-fonce:   #7A2A1E;

  /* --- Couleurs fonctionnelles --- */
  --succes:   #1B7A5E;
  --attention: #B8720E;
  --danger:   #C0362B;
  --info:     #1D6FA5;

  /* --- Neutres --- */
  --blanc-pur:       #FFFFFF;
  --gris-perle:      #F7F8FA;
  --gris-leger:      #E6E9EF;
  --gris-moyen:      #96A0AE;
  --gris-fonce:      #4A5261;
  --texte-principal: #1E2532;
  --texte-secondaire:#5B6472;

  /* --- Typographie --- */
  /* Une seule famille professionnelle pour tout le site (titres et corps),
     la hiérarchie se fait par la graisse — cohérent avec le reste du design
     sobre et institutionnel. */
  --font-titre: 'Inter', 'Segoe UI', Arial, sans-serif;
  --font-corps: 'Inter', 'Segoe UI', Arial, sans-serif;
  --font-mono:  'Courier New', monospace;

  /* --- Effets (sobres, peu de flou/bloom) --- */
  --ombre-sm:       0 1px 3px rgba(10,33,89,0.09);
  --ombre-saphir:   0 4px 14px rgba(37,83,138,0.22);
  --ombre-card:     0 2px 10px rgba(10,33,89,0.07);
  --ombre-profonde: 0 10px 28px rgba(10,33,89,0.16);
  --ombre-or:       0 4px 14px rgba(166,58,44,0.22);

  /* Alias de compatibilité (anciens noms référencés ailleurs dans le code) */
  --shadow-sm: var(--ombre-sm);
  --shadow-xl: var(--ombre-profonde);

  --gradient-saphir: linear-gradient(135deg, #0A2159 0%, #1D4373 55%, #2C5C91 100%);
  --gradient-or:     linear-gradient(135deg, #7A2A1E 0%, #A63A2C 100%);
  --gradient-hero:   linear-gradient(160deg, #081B49 0%, #163A6E 55%, #25538A 100%);
  --gradient-card:   linear-gradient(180deg, #FFFFFF 0%, #F7F8FA 100%);

  /* --- Transitions --- */
  --transition-base:    all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-lente:   all 0.45s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-ressort: all 0.35s cubic-bezier(0.34, 1.4, 0.64, 1);

  /* --- Bordures (rayons modérés — esthétique sobre, moins « pilule ») --- */
  --radius-sm:  6px;
  --radius-md:  9px;
  --radius-lg:  13px;
  --radius-xl:  18px;
  --radius-full:9999px;
}

/* ── RESET & BASE ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: var(--font-corps);
  color: var(--texte-principal);
  background: var(--gris-perle);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── TYPOGRAPHIE ──────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-titre);
  color: var(--saphir-nuit);
  line-height: 1.25;
}

h1 { font-size: clamp(1.9rem, 4vw, 3.1rem); font-weight: 800; letter-spacing: normal; }
h2 { font-size: clamp(1.4rem, 2.6vw, 2rem); font-weight: 700; letter-spacing: normal; }
h3 { font-size: clamp(1.15rem, 1.8vw, 1.45rem); font-weight: 700; }
h4 { font-size: 1.15rem; font-weight: 600; }

a { color: var(--saphir-royal); text-decoration: none; transition: var(--transition-base); }
a:hover { color: var(--saphir-nuit); }

p { margin-bottom: 1rem; }
ul, ol { padding-left: 1.5rem; }

/* ── BOUTONS ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.5rem;
  border-radius: var(--radius-md);
  font-family: var(--font-corps);
  font-size: 0.875rem;
  font-weight: 600;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: var(--transition-base);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--saphir-royal);
  color: var(--blanc-pur);
  box-shadow: var(--ombre-sm);
}
.btn-primary:hover {
  background: var(--saphir-nuit);
  box-shadow: var(--ombre-saphir);
  transform: translateY(-1px);
  color: var(--blanc-pur);
}

.btn-or {
  background: var(--or-saphir);
  color: var(--blanc-pur);
  box-shadow: var(--ombre-sm);
}
.btn-or:hover {
  background: var(--or-fonce);
  box-shadow: var(--ombre-or);
  transform: translateY(-1px);
  color: var(--blanc-pur);
}

.btn-outline {
  background: transparent;
  border-color: var(--gris-leger);
  color: var(--saphir-royal);
}
.btn-outline:hover {
  background: var(--saphir-royal);
  border-color: var(--saphir-royal);
  color: var(--blanc-pur);
}

.btn-outline-or {
  background: transparent;
  border-color: var(--or-saphir);
  color: var(--or-saphir);
}
.btn-outline-or:hover {
  background: var(--or-saphir);
  color: var(--blanc-pur);
}

.btn-success  { background: var(--succes); color: #fff; border-color: var(--succes); }
.btn-danger   { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-warning  { background: var(--attention); color: #fff; border-color: var(--attention); }
.btn-sm { padding: 0.4rem 1rem; font-size: 0.78rem; }
.btn-lg { padding: 0.9rem 2.2rem; font-size: 1rem; }

.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ── CARDS ────────────────────────────────────────────────── */
.saphir-card {
  background: var(--blanc-pur);
  border-radius: var(--radius-lg);
  box-shadow: var(--ombre-sm);
  padding: 1.75rem;
  transition: var(--transition-base);
  border: 1px solid var(--gris-leger);
}
.saphir-card:hover {
  box-shadow: var(--ombre-card);
  border-color: var(--saphir-clair);
}

.card-titre {
  font-family: var(--font-titre);
  color: var(--saphir-royal);
  margin-bottom: 0.75rem;
}

/* ── BADGES ───────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.8rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.badge-primary   { background: var(--saphir-glace); color: var(--saphir-royal); }
.badge-success   { background: #E6F4EF; color: #145A44; }
.badge-danger    { background: #FBEAE8; color: #8E241A; }
.badge-warning   { background: #FBF1E1; color: #8A5709; }
.badge-info      { background: #E5F1FA; color: #0F5A87; }
.badge-secondary { background: var(--gris-leger); color: var(--gris-fonce); }
.badge-or        { background: #FBEAE6; color: var(--or-fonce); border: 1px solid var(--or-clair); }

/* ── FORMULAIRES ─────────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--saphir-nuit);
  margin-bottom: 0.4rem;
}
.form-label .required { color: var(--danger); margin-left: 3px; }

.form-control {
  width: 100%;
  padding: 0.65rem 0.95rem;
  border: 1.5px solid var(--gris-leger);
  border-radius: var(--radius-md);
  font-family: var(--font-corps);
  font-size: 0.9rem;
  color: var(--texte-principal);
  background: var(--blanc-pur);
  transition: var(--transition-base);
  outline: none;
}
.form-control:focus {
  border-color: var(--saphir-intense);
  box-shadow: 0 0 0 3px rgba(37,83,138,0.12);
}
.form-control.is-invalid { border-color: var(--danger); }
.form-control.is-valid   { border-color: var(--succes); }

.form-control::placeholder { color: var(--gris-moyen); }

select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 100px; }

.form-text  { font-size: 0.78rem; color: var(--texte-secondaire); margin-top: 0.25rem; }
.form-error { font-size: 0.78rem; color: var(--danger); margin-top: 0.25rem; }

/* ── TABLEAUX ─────────────────────────────────────────────── */
.table-saphir {
  width: 100%;
  border-collapse: collapse;
  background: var(--blanc-pur);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--ombre-sm);
}
.table-saphir thead th {
  background: var(--saphir-nuit);
  color: var(--blanc-pur);
  padding: 0.55rem 0.75rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
.table-saphir tbody tr {
  border-bottom: 1px solid var(--gris-leger);
  transition: var(--transition-base);
}
.table-saphir tbody tr:hover { background: var(--saphir-glace); }
.table-saphir tbody td { padding: 0.42rem 0.75rem; font-size: 0.82rem; vertical-align: middle; color: var(--texte-principal); }
.table-saphir tfoot td {
  padding: 0.42rem 0.75rem;
  font-weight: 600;
  background: var(--gris-perle);
  border-top: 2px solid var(--saphir-glace);
}

/* ── ALERTES ──────────────────────────────────────────────── */
.alert {
  padding: 0.95rem 1.2rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  border-left: 4px solid;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.alert-success { background: #E6F4EF; border-color: var(--succes); color: #124A39; }
.alert-danger,
.alert-error   { background: #FBEAE8; border-color: var(--danger); color: #7A1E15; }
.alert-warning { background: #FBF1E1; border-color: var(--attention); color: #714608; }
.alert-info    { background: #E5F1FA; border-color: var(--info); color: #0C4463; }

/* ── MODALS ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(10,33,89,0.55);
  backdrop-filter: blur(3px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-overlay.active { display: flex; }

.modal-box {
  background: var(--blanc-pur);
  border-radius: var(--radius-xl);
  max-width: 560px;
  width: 100%;
  box-shadow: var(--ombre-profonde);
  overflow: hidden;
  animation: modalIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96) translateY(12px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
  background: var(--saphir-nuit);
  color: var(--blanc-pur);
  padding: 1.1rem 1.6rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h4 { font-family: var(--font-corps); font-weight: 600; color: var(--blanc-pur); }
.modal-close { background: none; border: none; color: rgba(255,255,255,0.7); font-size: 1.4rem; cursor: pointer; transition: var(--transition-base); }
.modal-close:hover { color: var(--blanc-pur); }
.modal-body   { padding: 1.6rem; }
.modal-footer { padding: 1rem 1.6rem; background: var(--gris-perle); display: flex; justify-content: flex-end; gap: 0.75rem; }

/* ── SCORE BARS ───────────────────────────────────────────── */
.score-bar-wrap { background: var(--gris-leger); border-radius: var(--radius-full); height: 8px; overflow: hidden; }
.score-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}
.score-bar-fill.low    { background: var(--danger); }
.score-bar-fill.medium { background: var(--attention); }
.score-bar-fill.high   { background: var(--succes); }

/* ── PAGINATION ───────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.page-link {
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--gris-leger);
  color: var(--saphir-royal);
  font-weight: 500;
  font-size: 0.85rem;
  transition: var(--transition-base);
  cursor: pointer;
  background: var(--blanc-pur);
}
.page-link:hover, .page-link.active {
  background: var(--saphir-royal);
  border-color: var(--saphir-royal);
  color: var(--blanc-pur);
}

/* ── UTILITAIRES ─────────────────────────────────────────── */
.container { max-width: 1280px; margin: 0 auto; padding: 0 1.5rem; }
.container-sm { max-width: 800px; margin: 0 auto; padding: 0 1.5rem; }

.text-center  { text-align: center; }
.text-right   { text-align: right; }
.text-primary { color: var(--saphir-royal); }
.text-or      { color: var(--or-saphir); }
.text-success { color: var(--succes); }
.text-danger  { color: var(--danger); }
.text-muted   { color: var(--texte-secondaire); }

.bg-saphir    { background: var(--gradient-saphir); color: var(--blanc-pur); }
.bg-or        { background: var(--gradient-or); color: var(--blanc-pur); }
.bg-white     { background: var(--blanc-pur); }
.bg-light     { background: var(--gris-perle); }

.d-flex       { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1  { gap: 0.5rem; }
.gap-2  { gap: 1rem; }
.gap-3  { gap: 1.5rem; }
.flex-wrap { flex-wrap: wrap; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }

.fw-bold { font-weight: 700; }
.fw-600  { font-weight: 600; }
.fs-sm   { font-size: 0.8rem; }
.fs-lg   { font-size: 1.1rem; }

.rounded    { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }

.shadow     { box-shadow: var(--ombre-sm); }
.shadow-md  { box-shadow: var(--ombre-card); }
.shadow-lg  { box-shadow: var(--ombre-profonde); }

.rotate-90  { transform: rotate(90deg); }
.rotate-180 { transform: rotate(180deg); }

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; }

/* Du plus large au plus étroit : la dernière règle applicable l'emporte, le
   passage à une colonne doit donc venir après celui à deux colonnes. */
@media (max-width: 1024px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ── DIVIDER ──────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gris-leger), transparent);
  border: none;
  margin: 2rem 0;
}

/* ── SECTION TITRES ───────────────────────────────────────── */
.section-titre {
  text-align: center;
  margin-bottom: 3rem;
}
.section-titre h2 { color: var(--saphir-nuit); }
.section-titre p  { color: var(--texte-secondaire); max-width: 600px; margin: 0.75rem auto 0; }
.section-titre .titre-accent {
  display: inline-block;
  width: 48px;
  height: 3px;
  background: var(--saphir-vif);
  border-radius: var(--radius-full);
  margin-top: 0.9rem;
}

/* ── ICÔNES INLINE ────────────────────────────────────────── */
.icon-sm  { width: 16px; height: 16px; }
.icon-md  { width: 24px; height: 24px; }
.icon-lg  { width: 32px; height: 32px; }
.icon-xl  { width: 48px; height: 48px; }

/* ── TOAST NOTIFICATIONS ─────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.toast {
  background: var(--blanc-pur);
  border-radius: var(--radius-lg);
  box-shadow: var(--ombre-profonde);
  padding: 1rem 1.5rem;
  min-width: 300px;
  border-left: 4px solid var(--saphir-royal);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: toastIn 0.3s var(--transition-ressort);
}
.toast.success { border-color: var(--succes); }
.toast.error   { border-color: var(--danger); }
.toast.warning { border-color: var(--attention); }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── RESPONSIVE ───────────────────────────────────────────── */
@media (max-width: 768px) {
  :root { --radius-lg: 12px; --radius-xl: 16px; }
  .btn  { padding: 0.6rem 1.25rem; font-size: 0.82rem; }
  .saphir-card { padding: 1.25rem; }
  .container { padding: 0 1rem; }
}

/* ── CONTENU RICHE (sortie éditeur Quill) ─────────────────── */
.rich-content { line-height: 1.75; }
.rich-content p          { margin: 0 0 .65em; }
.rich-content p:last-child { margin-bottom: 0; }
.rich-content h1, .rich-content h2, .rich-content h3 {
  font-family: var(--font-titre);
  color: var(--saphir-nuit);
  margin: 1em 0 .45em;
  line-height: 1.3;
}
.rich-content h1 { font-size: 1.25em; }
.rich-content h2 { font-size: 1.1em; }
.rich-content h3 { font-size: 1em; }
.rich-content ul, .rich-content ol {
  margin: .4em 0 .65em 1.5em;
  padding: 0;
}
.rich-content ul { list-style: disc; }
.rich-content ol { list-style: decimal; }
.rich-content li { margin-bottom: .25em; }
.rich-content blockquote {
  border-left: 3px solid var(--saphir-vif);
  margin: .75em 0;
  padding: .4em .85em;
  color: var(--texte-secondaire);
  font-style: italic;
}
.rich-content a {
  color: var(--saphir-royal);
  text-decoration: underline;
}
.rich-content strong { font-weight: 700; }
.rich-content em     { font-style: italic; }
.rich-content u      { text-decoration: underline; }
.rich-content s      { text-decoration: line-through; }
.rich-content .ql-indent-1 { padding-left: 2em; }
.rich-content .ql-indent-2 { padding-left: 4em; }
.rich-content .ql-indent-3 { padding-left: 6em; }
.rich-content .ql-align-center  { text-align: center; }
.rich-content .ql-align-right   { text-align: right; }
.rich-content .ql-align-justify { text-align: justify; }

/* ── TIMELINE DE SUIVI (candidature) ─────────────────────── */
/* Utilisée par public/candidature/confirmation.php et
   public/espace-candidat/mon-dossier.php */
.wm-timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-item {
  position: relative;
  display: flex;
  gap: 1rem;
  padding-bottom: 1.5rem;
  padding-left: 0.25rem;
}
.timeline-item::before {
  content: '';
  position: absolute;
  left: 9px;
  top: 22px;
  bottom: 0;
  width: 2px;
  background: var(--gris-leger);
}
.timeline-item:last-child::before { display: none; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-point {
  flex-shrink: 0;
  width: 20px; height: 20px;
  border-radius: 50%;
  margin-top: 2px;
  background: var(--blanc-pur);
  border: 3px solid var(--gris-moyen);
  z-index: 1;
  transition: var(--transition-base);
}
.timeline-item.done .timeline-point {
  background: var(--succes);
  border-color: var(--succes);
}
.timeline-item.current .timeline-point {
  background: var(--saphir-royal);
  border-color: var(--saphir-royal);
  box-shadow: 0 0 0 4px rgba(37,83,138,0.18);
}
.timeline-item.done::before { background: var(--succes); }
.timeline-body { flex: 1; padding-top: 1px; }
.timeline-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--texte-secondaire);
}
.timeline-item.done .timeline-title,
.timeline-item.current .timeline-title { color: var(--saphir-nuit); }
.timeline-desc {
  font-size: 0.8rem;
  color: var(--texte-secondaire);
  margin-top: 0.15rem;
}
