/* ===========================================================
   Scholarship Application Portal — Stylesheet
   =========================================================== */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #fff2e4;
  --surface: #ffffff;
  --text: #2f1a11;
  --muted: #7a5a49;
  --primary: #9b370a;
  --primary-2: #e46314;
  --border: rgba(155, 55, 10, .16);
  --shadow: 0 4px 24px rgba(26, 35, 126, 0.08);
}

html { scroll-behavior: smooth; }

body {
  font-family: Overpass, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- Accessibilité ---------- */
.skip-link {
  position: absolute;
  left: -999px;
  top: 12px;
  background: var(--primary);
  color: #fff;
  padding: 10px 14px;
  border-radius: 10px;
  z-index: 10;
}
.skip-link:focus { left: 12px; }

/* Champ piège anti-bot : invisible pour un humain */
.honeypot {
  position: absolute;
  left: -9999px;
  top: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
}

/* ---------- Header ---------- */
header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 22px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, .03);
}
.brand { display: flex; align-items: center; gap: 14px; }
.logo {
  width: 42px; height: 42px;
  border-radius: 14px;
  background: var(--primary);
  display: grid; place-items: center;
  color: #fff; font-size: 1.2rem;
}
header h1 { font-size: 1.45rem; font-weight: 800; }
header p { font-size: .88rem; color: var(--muted); margin-top: 2px; }
.lang-switch {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 999px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 600;
}

main { max-width: 820px; margin: 36px auto; padding: 0 16px 24px; flex: 1; width: 100%; }

/* ---------- Progress + Stepper ---------- */
.progress-bar-wrap { background: #efe3dc; border-radius: 4px; height: 6px; margin-bottom: 28px; }
.progress-bar { height: 100%; border-radius: 4px; background: var(--primary); transition: width .4s ease; }

.stepper { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 32px; position: relative; }
.stepper::before {
  content: "";
  position: absolute; top: 17px; left: 0; right: 0;
  height: 3px; background: #ecd9cf; z-index: 0;
}
.step-item { display: flex; flex-direction: column; align-items: center; gap: 6px; z-index: 1; flex: 1; }
.step-circle {
  width: 36px; height: 36px; border-radius: 50%;
  background: #ecd9cf; color: #8c6f62;
  font-weight: 700; font-size: .95rem;
  display: flex; align-items: center; justify-content: center;
}
.step-item.active .step-circle { background: var(--primary); color: #fff; box-shadow: 0 0 0 4px rgba(155, 55, 10, .12); }
.step-item.done .step-circle { background: var(--primary-2); color: #fff; }
.step-label { font-size: .7rem; color: #9b7d6d; font-weight: 700; text-align: center; text-transform: uppercase; }
.step-item.active .step-label { color: var(--primary); }
.step-item.done .step-label { color: var(--primary-2); }

/* ---------- Card ---------- */
.card { background: var(--surface); border-radius: 16px; padding: 36px 40px; box-shadow: var(--shadow); }
.card-header {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 28px; padding-bottom: 20px;
  border-bottom: 1px solid #efe6e1;
}
.card-header .icon {
  width: 44px; height: 44px; border-radius: 12px;
  background: #f7eee9;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
}
.card-header h2 { font-size: 1.25rem; font-weight: 800; color: var(--primary); }
.card-header p { font-size: .82rem; color: var(--muted); margin-top: 2px; }

/* ---------- Form grid & fields ---------- */
.form-grid { display: grid; gap: 20px; }
.col-2 { grid-template-columns: 1fr 1fr; }
.full-width { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: .82rem; font-weight: 700; color: var(--primary); }
.req { color: #d32f2f; font-weight: 900; margin-left: 3px; }

input, select, textarea {
  border: 1.5px solid #d9cbc4;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: .92rem;
  color: var(--text);
  transition: border-color .2s, box-shadow .2s;
  outline: none;
  font-family: inherit;
  background: #fafafa;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(155, 55, 10, .10);
  background: #fff;
}
textarea { resize: vertical; min-height: 110px; }

.field-hint { font-size: .76rem; color: #a18677; }
.field-hint.limit-reached { color: #b3261e; font-weight: 700; }
.field-error { font-size: .76rem; color: #b3261e; display: none; }
.field-error-http { text-align: center; padding: 16px; font-weight: 800; font-size: .96rem; color: #b3261e; display: none; }


/* Bordure rouge affichée UNIQUEMENT une fois le champ "touché"
   (c'est-à-dire après une tentative de passage à l'étape suivante) */
.field.touched input.invalid,
.field.touched select.invalid,
.field.touched textarea.invalid {
  border-color: #d32f2f !important;
  box-shadow: 0 0 0 3px rgba(211, 47, 47, .12) !important;
  background: #fff7f7 !important;
}

/* ---------- Navigation buttons ---------- */
.nav-buttons {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 32px; padding-top: 20px;
  border-top: 1px solid #efe6e1;
}
.btn {
  padding: 11px 28px; border-radius: 9px;
  font-size: .92rem; font-weight: 800;
  cursor: pointer; border: none;
  transition: all .2s;
  display: flex; align-items: center; gap: 8px;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-secondary { background: #f5ede8; color: var(--primary); border: 1px solid #e7d6cd; }
.btn-success { background: var(--primary-2); color: #fff; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- File uploads ---------- */
.upload-zone { border: 2px dashed #d8c9c1; border-radius: 10px; padding: 16px; background: #fcfbfa; }
.file-list { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.file-item {
  display: flex; align-items: center; gap: 8px;
  background: #f6f0eb; border-radius: 6px;
  padding: 6px 10px; font-size: .82rem;
}

/* ---------- Declaration / consent ---------- */
.declaration {
  background: #fff7f1; border: 1px solid #ead9d2; border-radius: 8px;
  padding: 16px 20px; font-size: .85rem; color: #6c4a3b; line-height: 1.6;
}

/* ---------- Review section ---------- */
.review-section { margin-bottom: 24px; }
.review-section h3 {
  font-size: .9rem; font-weight: 800; color: var(--primary);
  text-transform: uppercase; margin-bottom: 12px;
}
.review-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 24px; }
.review-item { font-size: .85rem; }
.review-item .rlabel { color: #a18677; font-size: .75rem; font-weight: 700; text-transform: uppercase; }
.review-item .rvalue { color: var(--text); margin-top: 1px; word-break: break-word; }

/* ---------- Success screen ---------- */
.success-screen {
  text-align: center; padding: 40px 20px;
  display: none; flex-direction: column; align-items: center; gap: 16px;
}
.success-screen .checkmark { font-size: 4rem; }
.success-screen h2 { font-size: 1.6rem; color: #2f7d32; }
.success-screen p { font-size: .95rem; color: #555; max-width: 460px; line-height: 1.6; }
.ref-box {
  background: #f3fbf3; border-radius: 8px; padding: 12px 24px;
  font-weight: 800; color: #2f7d32; font-size: 1.1rem;
  border: 1px solid #cfe6cf;
}

/* ---------- Anti-spam cooldown message ---------- */
.cooldown-msg { font-size: .82rem; color: #b3261e; margin-top: 10px; display: none; }

footer { text-align: center; padding: 16px; font-size: .75rem; color: #a18677; }

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .col-2, .review-grid { grid-template-columns: 1fr; }
  .card { padding: 24px 20px; }
  header { padding: 18px 20px; align-items: flex-start; flex-direction: column; }
  .stepper { gap: 2px; }
  .step-label { display: none; }
  .nav-buttons { gap: 10px; flex-direction: column; }
  .btn { width: 100%; justify-content: center; }
}

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  z-index: 999;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 5px solid #ecd9cf;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-overlay p {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary);
  text-align: center;
  max-width: 320px;
}