/* =====================================================================
   UEMF — Layout / Site
   ===================================================================== */

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background-color: var(--bg-app);
  background-image:
    radial-gradient(60rem 30rem at 85% -10%, var(--bg-app-grad1), transparent 60%),
    radial-gradient(50rem 28rem at -10% 110%, var(--bg-app-grad2), transparent 60%);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  margin: 0;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color var(--t-mid), color var(--t-mid);
}

a { color: var(--text-brand); }

/* ===== Header ===== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--border);
}

.app-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-h);
  padding: 0.5rem 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  color: var(--text);
}

.brand-logo {
  width: 40px;
  height: 40px;
  display: block;
  border-radius: 11px;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.brand-logo-full {
  height: 56px;
  width: auto;
  max-width: min(320px, 58vw);
  object-fit: contain;
  display: block;
  flex-shrink: 0;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.1; justify-content: center; }
.brand-title { font-weight: 800; font-size: 1.02rem; letter-spacing: -0.01em; }
.brand-subtitle { font-size: 0.74rem; color: var(--text-muted); font-weight: 500; }

.btn-theme-toggle {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-soft);
  cursor: pointer;
  font-size: 1.05rem;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
}
.btn-theme-toggle:hover { color: var(--text-brand); border-color: var(--border-brand); transform: translateY(-1px); }

/* Affiche la bonne icône selon le thème effectif */
.theme-icon-dark { display: none; }
.theme-icon-light { display: inline-block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-icon-light { display: none; }
  :root:not([data-theme="light"]) .theme-icon-dark  { display: inline-block; }
}
[data-theme="dark"] .theme-icon-light { display: none; }
[data-theme="dark"] .theme-icon-dark  { display: inline-block; }
[data-theme="light"] .theme-icon-light { display: inline-block; }
[data-theme="light"] .theme-icon-dark  { display: none; }

/* ===== Barre de progression globale ===== */
.progress-track { border-top: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 60%, transparent); }
.progress-steps {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0.85rem 0;
  gap: 0.4rem;
}
.progress-steps li {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  position: relative;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
}
.progress-steps li span {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: var(--r-full);
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
  transition: all var(--t-fast);
  z-index: 1;
}
.progress-steps li::before {
  content: '';
  position: absolute;
  top: 13px; left: -50%;
  width: 100%; height: 2px;
  background: var(--border);
  z-index: 0;
}
.progress-steps li:first-child::before { display: none; }
.progress-steps li.active { color: var(--text-brand); }
.progress-steps li.active span {
  background: var(--brand-500);
  border-color: var(--brand-500);
  color: #fff;
  box-shadow: 0 0 0 4px var(--brand-soft);
}
.progress-steps li.done span {
  background: var(--brand-600);
  border-color: var(--brand-600);
  color: #fff;
}
.progress-steps li.done::before,
.progress-steps li.active::before { background: var(--brand-400); }
.progress-steps li.done span { font-size: 0; }
.progress-steps li.done span::after { content: '\2713'; font-size: 0.8rem; }

/* ===== Main / Footer ===== */
.app-main { padding: 2.2rem 0 3.5rem; }
.app-main .container { max-width: var(--maxw); }
.app-footer {
  border-top: 1px solid var(--border);
  padding: 1.4rem 0;
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* ===== Hero ===== */
.hero-section { text-align: center; margin-bottom: 1.8rem; }
.hero-title {
  font-size: clamp(1.7rem, 4vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 0.4rem;
  color: var(--text);
}
.hero-title .accent {
  background: linear-gradient(90deg, var(--brand-500), var(--gold-400));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-subtitle { color: var(--text-soft); font-size: 1.02rem; margin: 0; }

.search-wrapper { max-width: 620px; margin: 0 auto; }

/* ===== Wizard ===== */
.wizard-stepper {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 0.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-xs);
}
.stepper-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 0.5rem;
  border: none;
  background: transparent;
  border-radius: var(--r-sm);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}
.stepper-item span {
  width: 24px; height: 24px;
  display: grid; place-items: center;
  border-radius: var(--r-full);
  background: var(--surface-3);
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 700;
  flex-shrink: 0;
  transition: all var(--t-fast);
}
.stepper-item small { font-weight: 600; }
.stepper-item:hover { background: var(--surface-hover); color: var(--text-soft); }
.stepper-item.active { background: var(--brand-soft); color: var(--text-brand); }
.stepper-item.active span { background: var(--brand-500); color: #fff; }
.stepper-item.done span { background: var(--brand-600); color: #fff; font-size: 0; }
.stepper-item.done span::after { content: '\2713'; font-size: 0.8rem; }

.wizard-panel { display: none; }
.wizard-panel.active { display: block; animation: fadeSlide var(--t-mid); }

.wizard-nav {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1.25rem;
}
.sticky-wizard-nav {
  position: sticky;
  bottom: 0;
  background: color-mix(in srgb, var(--bg-app) 86%, transparent);
  backdrop-filter: blur(8px);
  padding: 0.85rem 0;
  margin-top: 1.5rem;
  border-top: 1px solid var(--border);
  z-index: 20;
}

/* ===== Vérification ===== */
.shield-icon {
  width: 72px; height: 72px;
  margin: 0 auto;
  display: grid; place-items: center;
  border-radius: var(--r-full);
  background: var(--brand-soft);
  color: var(--brand-500);
  font-size: 1.9rem;
  border: 1px solid var(--border-brand);
}
.candidate-badge {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  text-align: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 1rem;
  margin-bottom: 1.25rem;
}
.badge-name { font-weight: 700; font-size: 1.05rem; color: var(--text); }
.badge-meta { color: var(--text-muted); font-size: 0.85rem; }

/* ===== Confirmation ===== */
.confirmation-section { max-width: 560px; margin: 0 auto; }
.success-animation { display: flex; justify-content: center; }
.success-ring {
  width: 92px; height: 92px;
  border-radius: var(--r-full);
  background: var(--success-bg);
  display: grid; place-items: center;
  border: 1px solid var(--border-brand);
}
.checkmark { width: 52px; height: 52px; }
.checkmark-circle {
  stroke: var(--brand-500); stroke-width: 2.5;
  stroke-dasharray: 166; stroke-dashoffset: 166;
  animation: stroke .6s cubic-bezier(.65,0,.45,1) forwards;
}
.checkmark-check {
  stroke: var(--brand-500); stroke-width: 3.5;
  stroke-linecap: round;
  stroke-dasharray: 48; stroke-dashoffset: 48;
  animation: stroke .35s cubic-bezier(.65,0,.45,1) .6s forwards;
}

/* ===== Toasts ===== */
.toast-container {
  position: fixed;
  top: calc(var(--header-h) + 12px);
  right: 16px;
  z-index: 1080;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.toast-item {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-left: 4px solid var(--brand-500);
  border-radius: var(--r-sm);
  padding: 0.8rem 1rem;
  box-shadow: var(--shadow-md);
  font-size: 0.9rem;
  max-width: 340px;
  animation: toastIn var(--t-mid);
  transition: opacity .3s;
}
.toast-item.error { border-left-color: var(--danger); }
.toast-item.success { border-left-color: var(--success); }

/* ===== Animations ===== */
@keyframes fadeSlide { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }
@keyframes stroke { to { stroke-dashoffset: 0; } }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 var(--ring); } 50% { box-shadow: 0 0 0 10px transparent; } }
.pulse { animation: pulse 2.2s infinite; }
.shake { animation: shake .4s; }
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-6px)} 75%{transform:translateX(6px)} }

/* ===== Modals validation ===== */
.validation-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  color: var(--text);
}
.validation-modal .modal-header,
.validation-modal .modal-footer { border-color: var(--border); }
.validation-error-list {
  padding-left: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.validation-error-list li { color: var(--danger); }
.success-modal .modal-title { color: var(--success); }

.backoffice-table {
  color: var(--text);
  --bs-table-bg: transparent;
}
.backoffice-table th {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom-color: var(--border);
}
.backoffice-table td { border-color: var(--border); vertical-align: middle; }

.nationalite-combobox { position: relative; }
.nationalite-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 30;
  max-height: 240px;
  overflow-y: auto;
  margin: 0;
  padding: 0.35rem 0;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-md);
}
.nationalite-dropdown li {
  padding: 0.55rem 0.85rem;
  cursor: pointer;
  font-size: 0.92rem;
}
.nationalite-dropdown li:hover,
.nationalite-dropdown li.active {
  background: var(--surface-hover);
  color: var(--text-brand);
}
.nationalite-dropdown li.hidden { display: none; }

.form-label.required::after,
label.form-label:has(+ .form-control[required])::after,
label.form-label:has(+ .form-select[required])::after {
  content: ' *';
  color: var(--danger);
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
  .brand-subtitle { display: none; }
  .brand-logo-full { height: 44px; max-width: 72vw; }
  .progress-steps li small { display: none; }
  .stepper-item small { display: none; }
  .stepper-item { padding: 0.6rem 0; }
  .app-main { padding: 1.4rem 0 2.5rem; }
}
