/* ============================================================
   Daara Khidmatoul Khadim — Portail d'Admission
   Design tokens
   ------------------------------------------------------------
   Couleurs  : vert profond (identité du daara), laiton/or (liseré
               du logo), teal (sceau central), papier chaud.
   Typo      : "Amiri" (serif calligraphique, FR + AR) pour les
               titres, "Cairo" (sans-serif bilingue) pour le corps.
   Motif     : les 5 étapes du parcours sont représentées comme
               les maillons d'une chaîne de transmission (isnad),
               un clin d'œil à la mémorisation du Coran plutôt
               qu'une simple liste de cartes numérotées.
   ============================================================ */

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

:root {
  /* Couleurs */
  --green-950: #0a3320;
  --green-900: #0b4429;
  --green-700: #146c43;
  --green-600: #1c8452;
  --green-100: #e3efe6;
  --gold-700: #9c7423;
  --gold-600: #b8894b;
  --gold-400: #d3a95f;
  --gold-100: #f3e6cd;
  --teal-700: #1f5c5c;
  --ink-900: #1c1b18;
  --ink-700: #47443c;
  --ink-500: #736e62;
  --paper-0: #fdfbf6;
  --paper-100: #f6f1e6;
  --paper-200: #ede4d0;
  --red-600: #a3372c;
  --red-100: #f6e3e0;

  /* Typo */
  --font-display: 'Amiri', 'Amiri Quran', serif;
  --font-body: 'Cairo', 'Segoe UI', Tahoma, sans-serif;

  /* Rythme */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 18px;
  --shadow-card: 0 4px 24px rgba(11, 68, 41, 0.08);
  --shadow-pop: 0 12px 40px rgba(11, 68, 41, 0.16);
  --content-width: 1120px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink-900);
  background: var(--paper-0);
  line-height: 1.6;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--green-950);
  line-height: 1.25;
  margin: 0 0 0.5em;
}

p { margin: 0 0 1em; }
a { color: inherit; }
img { max-width: 100%; display: block; }

.container {
  max-width: var(--content-width);
  margin-inline: auto;
  padding-inline: 24px;
}

:focus-visible {
  outline: 3px solid var(--gold-600);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.98rem;
  padding: 13px 26px;
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
  background: var(--gold-600);
  color: var(--green-950);
}
.btn-primary:hover { background: var(--gold-400); }
.btn-outline {
  background: transparent;
  color: var(--paper-0);
  border-color: rgba(253, 251, 246, 0.55);
}
.btn-outline:hover { background: rgba(253, 251, 246, 0.12); }
.btn-ghost {
  background: var(--paper-100);
  color: var(--green-950);
  border-color: var(--paper-200);
}
.btn-ghost:hover { background: var(--paper-200); }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn svg { width: 18px; height: 18px; flex: none; }
[dir="rtl"] .btn svg.icon-arrow { transform: scaleX(-1); }

/* ---------------- Header ---------------- */
.site-header {
  background: var(--paper-0);
  border-bottom: 1px solid var(--paper-200);
  position: sticky;
  top: 0;
  z-index: 40;
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: 12px;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  min-width: 0;
}
.brand img {
  width: 46px;
  height: 46px;
  object-fit: contain;
  flex: none;
}
.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--green-950);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}
.main-nav a {
  text-decoration: none;
  color: var(--ink-700);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
}
.main-nav a:hover { background: var(--paper-100); }
.main-nav a.active { background: var(--green-100); color: var(--green-900); }

.lang-switch {
  display: flex;
  border: 1.5px solid var(--paper-200);
  border-radius: 999px;
  overflow: hidden;
  flex: none;
}
.lang-switch a {
  padding: 7px 14px;
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--ink-500);
}
.lang-switch a.active { background: var(--green-900); color: var(--paper-0); }

.nav-toggle { display: none; }

@media (max-width: 780px) {
  .main-nav { display: none; }
}

/* ---------------- Hero ---------------- */
.hero {
  position: relative;
  background: var(--green-950);
  color: var(--paper-0);
  overflow: hidden;
  padding-block: 76px;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.14;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cg fill='none' stroke='%23d3a95f' stroke-width='1.1'%3E%3Cpath d='M60 6 L92 30 L108 68 L84 104 L36 104 L12 68 L28 30 Z'/%3E%3Cpath d='M60 6 L36 104 M92 30 L12 68 M108 68 L28 30'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 220px 220px;
}
.hero .container { position: relative; max-width: 860px; text-align: center; }
.hero h1 {
  color: var(--paper-0);
  font-size: clamp(1.9rem, 4vw, 3rem);
  margin-bottom: 0.4em;
}
.hero p.lead {
  font-size: 1.15rem;
  color: var(--paper-100);
  max-width: 620px;
  margin-inline: auto;
  margin-bottom: 2em;
}
.hero-actions {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ---------------- Period banner ---------------- */
.period-banner {
  margin-top: -34px;
  position: relative;
  z-index: 5;
}
.period-card {
  background: linear-gradient(135deg, var(--green-900), var(--green-700));
  color: var(--paper-0);
  border-radius: var(--radius-lg);
  padding: 26px 32px;
  box-shadow: var(--shadow-pop);
  border-inline-start: 6px solid var(--gold-600);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}
.period-card .period-info h2 {
  color: var(--paper-0);
  font-size: 1.35rem;
  margin-bottom: 4px;
}
.period-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
  color: var(--paper-100);
  flex-wrap: wrap;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
}
.badge-open { background: rgba(211, 169, 95, 0.22); color: var(--gold-400); }
.badge-closed { background: rgba(253, 251, 246, 0.15); color: var(--paper-100); }
.badge-upcoming { background: rgba(31, 92, 92, 0.35); color: #a9d7d7; }
.period-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  text-align: end;
}
[dir="rtl"] .period-side { align-items: flex-start; text-align: start; }
.period-side small { color: var(--paper-100); opacity: 0.85; }

/* ---------------- Process / chain of steps ---------------- */
.process {
  padding-block: 84px 56px;
  text-align: center;
}
.process h2 { font-size: 1.9rem; margin-bottom: 48px; }

.chain {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
  position: relative;
}
.chain::before {
  content: "";
  position: absolute;
  top: 34px;
  inset-inline: 8%;
  height: 2px;
  background: repeating-linear-gradient(
    to right, var(--gold-400) 0 10px, transparent 10px 18px
  );
}
[dir="rtl"] .chain::before {
  background: repeating-linear-gradient(
    to left, var(--gold-400) 0 10px, transparent 10px 18px
  );
}
.chain-step {
  position: relative;
  padding-inline: 10px;
}
.chain-badge {
  width: 68px;
  height: 68px;
  margin-inline: auto;
  margin-bottom: 18px;
  border-radius: 50%;
  background: var(--paper-0);
  border: 2.5px solid var(--gold-600);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.4rem;
  color: var(--green-900);
  position: relative;
  z-index: 1;
  box-shadow: var(--shadow-card);
}
.chain-step.is-final .chain-badge {
  background: var(--green-900);
  color: var(--gold-400);
  border-color: var(--green-900);
}
.chain-step h3 { font-size: 1.05rem; margin-bottom: 8px; }
.chain-step p { font-size: 0.88rem; color: var(--ink-700); }

@media (max-width: 900px) {
  .chain { grid-template-columns: repeat(2, 1fr); gap: 32px 16px; }
  .chain::before { display: none; }
}

/* ---------------- Help card ---------------- */
.help-section { background: var(--paper-100); padding-block: 60px; }
.help-card {
  background: var(--paper-0);
  border-radius: var(--radius-lg);
  padding: 40px;
  text-align: center;
  max-width: 760px;
  margin-inline: auto;
  box-shadow: var(--shadow-card);
}
.help-card h3 { font-size: 1.3rem; }
.help-contacts {
  display: flex;
  gap: 32px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 22px;
}
.help-contact {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  color: var(--green-900);
  text-decoration: none;
}
.help-contact svg { width: 20px; height: 20px; color: var(--gold-700); }
.help-hours { margin-top: 16px; color: var(--ink-500); font-size: 0.9rem; }

/* ---------------- Footer ---------------- */
.site-footer {
  background: var(--green-950);
  color: var(--paper-100);
  padding-block: 52px 26px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 40px;
}
.site-footer h4 {
  color: var(--gold-400);
  font-size: 1.05rem;
}
.site-footer p, .site-footer li { color: var(--paper-100); font-size: 0.92rem; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.site-footer a { text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.footer-bottom {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid rgba(253, 251, 246, 0.12);
  text-align: center;
  font-size: 0.85rem;
  color: var(--paper-200);
}
@media (max-width: 760px) {
  .footer-grid { grid-template-columns: 1fr; }
}

/* ---------------- Generic page shell (form/tracking) ---------------- */
.page-shell { padding-block: 48px 80px; }

/* ---------------- Wizard / form card ---------------- */
.wizard-card {
  max-width: 880px;
  margin-inline: auto;
  background: var(--paper-0);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.wizard-head {
  background: linear-gradient(135deg, var(--green-900), var(--teal-700));
  color: var(--paper-0);
  padding: 34px 40px;
  text-align: center;
}
.wizard-head h1 { color: var(--paper-0); font-size: 1.7rem; margin-bottom: 6px; }
.wizard-head p { color: var(--paper-100); margin: 0; }

.wizard-tabs {
  display: flex;
  justify-content: space-between;
  padding: 26px 40px 0;
  gap: 8px;
}
.wizard-tab {
  flex: 1;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink-500);
  position: relative;
  padding-bottom: 22px;
}
.wizard-tab::before {
  content: attr(data-index);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--paper-100);
  border: 2px solid var(--paper-200);
  color: var(--ink-500);
  margin: 0 auto 8px;
  font-family: var(--font-display);
}
.wizard-tab.is-active { color: var(--green-900); }
.wizard-tab.is-active::before { background: var(--green-900); border-color: var(--green-900); color: var(--paper-0); }
.wizard-tab.is-done::before { background: var(--gold-600); border-color: var(--gold-600); color: var(--green-950); content: "✓"; }
.wizard-progress-bar { height: 3px; background: var(--paper-200); margin: 0 40px; position: relative; }
.wizard-progress-fill { height: 100%; background: var(--gold-600); width: 25%; transition: width 0.3s ease; }

.wizard-body { padding: 36px 40px 8px; }
.wizard-section-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 26px;
}
.wizard-section-title .icon-circle {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--green-100); color: var(--green-900);
  display: flex; align-items: center; justify-content: center; flex: none;
}
.wizard-section-title h2 { margin: 0; font-size: 1.2rem; }

.form-step { display: none; }
.form-step.is-active { display: block; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px 24px;
}
.form-field { display: flex; flex-direction: column; gap: 7px; }
.form-field.full { grid-column: 1 / -1; }
.form-field label { font-weight: 600; font-size: 0.9rem; color: var(--ink-900); }
.form-field .required { color: var(--red-600); }
.form-field input[type="text"],
.form-field input[type="email"],
.form-field input[type="tel"],
.form-field select {
  border: 1.5px solid var(--paper-200);
  background: var(--paper-0);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--ink-900);
}
.form-field input:focus, .form-field select:focus {
  border-color: var(--gold-600);
  outline: none;
  box-shadow: 0 0 0 3px rgba(184, 137, 75, 0.18);
}
.date-group { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

.option-card {
  background: var(--paper-100);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  display: grid;
  gap: 16px;
}
.radio-row { font-weight: 600; font-size: 0.9rem; margin-bottom: 8px; color: var(--ink-900); }
.radio-choices { display: flex; gap: 22px; }
.radio-choices label {
  display: flex; align-items: center; gap: 8px;
  font-weight: 500; font-size: 0.92rem; cursor: pointer;
}
.radio-choices input[type="radio"] { accent-color: var(--green-900); width: 18px; height: 18px; }

.file-drop {
  border: 1.6px dashed var(--paper-200);
  border-radius: var(--radius-md);
  padding: 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--paper-100);
}
.file-drop .file-icon {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--paper-0); border: 1.5px solid var(--gold-600);
  display: flex; align-items: center; justify-content: center; flex: none; color: var(--gold-700);
}
.file-drop input[type="file"] { font-family: var(--font-body); font-size: 0.88rem; }
.file-drop .file-hint { font-size: 0.8rem; color: var(--ink-500); margin-top: 4px; }
.file-name { font-size: 0.85rem; color: var(--green-700); font-weight: 600; margin-top: 4px; }

.tuteur-block { margin-bottom: 8px; }
.tuteur-block h3 {
  font-size: 1rem; color: var(--teal-700); margin-bottom: 14px;
  display: flex; align-items: center; gap: 8px;
}
.tuteur-block h3::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--gold-600); }

.summary-list { display: grid; gap: 0; border: 1px solid var(--paper-200); border-radius: var(--radius-md); overflow: hidden; }
.summary-row {
  display: grid; grid-template-columns: 1fr 1.4fr;
  padding: 12px 18px; font-size: 0.9rem;
}
.summary-row:nth-child(odd) { background: var(--paper-100); }
.summary-row dt { font-weight: 600; color: var(--ink-700); margin: 0; }
.summary-row dd { margin: 0; color: var(--ink-900); }

.confirm-check {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--paper-100); padding: 16px 18px; border-radius: var(--radius-md);
  font-size: 0.9rem; margin-top: 20px;
}
.confirm-check input { margin-top: 3px; accent-color: var(--green-900); }

.wizard-actions {
  display: flex; justify-content: space-between; align-items: center;
  padding: 28px 40px 40px;
}

.alert { padding: 14px 18px; border-radius: var(--radius-md); font-size: 0.9rem; margin-bottom: 20px; }
.alert-error { background: var(--red-100); color: var(--red-600); border: 1px solid rgba(163, 55, 44, 0.25); }
.alert-success { background: var(--green-100); color: var(--green-900); border: 1px solid rgba(20, 108, 67, 0.25); }

@media (max-width: 680px) {
  .form-grid { grid-template-columns: 1fr; }
  .date-group { grid-template-columns: 1fr 1fr 1fr; }
  .wizard-head, .wizard-body, .wizard-actions, .wizard-tabs { padding-inline: 20px; }
  .wizard-tab span.label-text { display: none; }
}

/* ---------------- Confirmation screen ---------------- */
.confirm-screen { text-align: center; padding: 60px 40px; }
.confirm-icon {
  width: 84px; height: 84px; border-radius: 50%;
  background: var(--green-100); color: var(--green-700);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
}
.confirm-icon svg { width: 42px; height: 42px; }
.dossier-pill {
  display: inline-block; background: var(--green-950); color: var(--gold-400);
  font-family: var(--font-display); font-size: 1.6rem; letter-spacing: 2px;
  padding: 14px 34px; border-radius: 999px; margin: 18px 0;
}
.confirm-actions { display: flex; gap: 14px; justify-content: center; margin-top: 28px; flex-wrap: wrap; }

/* ---------------- Tracking page ---------------- */
.track-card {
  max-width: 560px; margin-inline: auto; background: var(--paper-0);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-card);
  padding: 44px 40px; text-align: center;
}
.track-card .search-icon {
  width: 60px; height: 60px; border-radius: 50%;
  background: var(--green-900); color: var(--paper-0);
  display: flex; align-items: center; justify-content: center; margin: 0 auto 18px;
}
.track-card .search-icon svg { width: 28px; height: 28px; }
.track-form { text-align: start; margin-top: 26px; }
.tip-box {
  background: var(--green-100); border-radius: var(--radius-md);
  padding: 18px 20px; text-align: start; margin-top: 24px; font-size: 0.88rem;
}
.tip-box strong { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; color: var(--green-900); }
.tip-box ul { margin: 0; padding-inline-start: 20px; color: var(--ink-700); display: grid; gap: 6px; }

.result-card {
  max-width: 640px; margin: 32px auto 0; background: var(--paper-0);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-card); overflow: hidden;
}
.result-head {
  background: var(--paper-100); padding: 26px 32px; display: flex; align-items: center; gap: 18px;
}
.result-photo {
  width: 64px; height: 64px; border-radius: 50%; object-fit: cover;
  border: 2px solid var(--gold-600); flex: none; background: var(--paper-200);
}
.result-head h3 { margin: 0 0 4px; font-size: 1.2rem; }
.result-head p { margin: 0; color: var(--ink-500); font-size: 0.88rem; }
.result-body { padding: 24px 32px 32px; }
.status-pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 18px; border-radius: 999px; font-weight: 700; font-size: 0.9rem; }
.status-pending { background: var(--gold-100); color: var(--gold-700); }
.status-validated { background: var(--green-100); color: var(--green-700); }
.status-rejected { background: var(--red-100); color: var(--red-600); }

/* Utility */
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
