/* ===========================================
   CIVICLEARN – CONSOLIDATED SHARED STYLES
   (Base, Fonts, Colors, Box-Sizing Fix, Header, Footer, Banner)
   =========================================== */

/* --- CORE SETUP --- */

/* GLOBAL FONTS (Must be BEFORE other styles) */
@import url("https://fonts.googleapis.com/css2?family=Lexend:wght@300;400;500;600;700&display=swap");

/* BOX-SIZING FIX */
html {
  box-sizing: border-box;
}

*, *::before, *::after {
  box-sizing: inherit;
}

/* COLOR PALETTE */
:root {
  --brand: #7c3aed;
  --brand-dark: #5b21b6;
  --bg-soft: #f7f2e8; /* Background color */
  --bg: #f7f2e8;      /* Alias for BG */
  --text-main: #101013;
  --text: #101013;   /* Alias for Text */
  --muted: #555;
  --card-bg: #ffffff;
}

/* BASE STYLES */
body {
  margin: 0;
  padding: 0;
  line-height: 1.6;
  background: var(--bg-soft);
  font-family: "Lexend", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text-main);
  min-height: 400;
  display: flex;
  flex-direction: column;
}

/* ===========================================
   GLOBAL HEADER (.site-header)
   =========================================== */

.site-header {
  backdrop-filter: blur(14px);
  background: linear-gradient(
    to bottom,
    rgba(247,242,232,0.96),
    rgba(247,242,232,0.90)
  );
  border-bottom: 1px solid rgba(0,0,0,0.05);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.8rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-shrink: 0;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  text-decoration: none;
  color: var(--text-main);
}
.brand-link img {
  height: 22px;
  width: auto;
}

.brand-title {
  font-weight: 600;
  font-size: 0.98rem;
}

.header-center {
  flex: 1;
  display: flex;
  justify-content: center;
}

.header-nav {
  display: flex;
  gap: 1.1rem;
  font-size: 0.9rem;
  flex-wrap: wrap;
  justify-content: center;
}

.header-nav a {
  text-decoration: none;
  color: #333;
  padding: 0.15rem 0;
  border-bottom: 2px solid transparent;
  font-weight: 500;
}

.header-nav a:hover {
  border-bottom-color: var(--brand);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}

.brand-powered {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}

.brand-powered span {
  font-weight: 600;
  color: var(--brand);
}

.btn-small-purple {
  background: var(--brand);
  color: #fff;
  font-weight: 500;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  text-decoration: none;
  font-size: 0.85rem;
  white-space: nowrap;
}

.btn-small-purple:hover {
  background: var(--brand-dark);
}


/* --- HEADER RESPONSIVENESS --- */
@media (max-width: 800px) {
  .header-inner {
    flex-wrap: wrap;
    justify-content: center;
    row-gap: 0.6rem;
  }
  .header-left {
    width: 100%;
    justify-content: center;
  }
  .header-center {
    order: 3;
    width: 100%;
  }
  .header-right {
    order: 2;
  }
  .header-nav {
    justify-content: center;
  }
}

@media (max-width: 500px) {
  .header-inner {
    padding-inline: 1.0rem;
  }
  .header-left,
  .header-left .brand-link {
    flex-shrink: 0 !important;
  }
  .header-nav {
    gap: 0.7rem;
    font-size: 0.85rem;
  }
  .brand-powered {
    display: none;
  }
}


/* ===========================================
   GLOBAL FOOTER (.cl-footer)
   =========================================== */

/* Footer base (styles from civiclearn-pages.css) */
footer {
  border-top: 1px solid rgba(0,0,0,0.06);
  margin-top: 2rem;
  padding: 1.5rem 1rem 2rem;
}

.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  row-gap: 0.5rem;
  column-gap: 1rem;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  color: #666;
}

/* cl-footer structure (styles from shared.css) */
.cl-footer {
  padding: 1.8rem 1rem 2.2rem;
  margin-top: 3rem;
  border-top: 1px solid rgba(0,0,0,0.06);
}

.cl-footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  font-size: 0.82rem;
  color: rgba(0,0,0,0.55);
  text-align: center;
  font-weight: 400;
}

.cl-footer-brand {
  color: var(--brand);
  font-weight: 600;
}

/* free.css — pages gratuites (questions officielles, examen blanc, guides) */
.free-main{max-width:980px;margin:0 auto;padding:1.6rem 1.2rem 2rem}
.free-main h1{font-size:2rem;line-height:1.2;margin:.4rem 0 .6rem;letter-spacing:-.3px}
.free-main h2{font-size:1.35rem;margin:2rem 0 .7rem}
.free-main h3{font-size:1.1rem;margin:1.4rem 0 .5rem}
.free-main p,.free-main li{font-size:1rem;color:#222}
.free-main a{color:var(--brand)}
.lead{font-size:1.1rem;color:#333;margin-bottom:1.2rem}
.kicker{display:inline-block;font-size:.8rem;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--brand);margin-top:.6rem}
.crumbs{font-size:.85rem;color:#666;margin:.2rem 0 1rem}
.crumbs a{color:#666;text-decoration:none}
.crumbs a:hover{text-decoration:underline}
.btn-cta{display:inline-block;background:var(--brand);color:#fff!important;font-weight:600;padding:.8rem 1.4rem;border-radius:999px;text-decoration:none;margin-top:.6rem}
.btn-cta:hover{background:var(--brand-dark)}
.btn-ghost{display:inline-block;border:1.5px solid var(--brand);color:var(--brand);font-weight:600;padding:.7rem 1.3rem;border-radius:999px;text-decoration:none;margin:.6rem .4rem 0 0;background:#fff}
.btn-ghost:hover{background:#f3edff}
.free-cta{background:#fff;border:1px solid #ece6ff;border-radius:1rem;padding:1.6rem;margin:2.2rem 0;text-align:center;box-shadow:0 4px 14px rgba(0,0,0,.05)}
.free-cta h2{margin-top:0}
.free-cta-sub{font-size:.85rem;color:#666;margin:.6rem 0 0}
.grid-3{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:1rem;margin:1rem 0}
.grid-2{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:1rem;margin:1rem 0}
@media(max-width:760px){.grid-3,.grid-2{grid-template-columns:1fr}}
.card{background:#fff;border-radius:.9rem;padding:1.1rem 1.2rem;box-shadow:0 3px 12px rgba(0,0,0,.05);border:1px solid rgba(0,0,0,.04)}
.card h3{margin:.2rem 0 .4rem;font-size:1.05rem}
.card p{margin:.3rem 0;font-size:.93rem;color:#444}
.card .num{font-size:1.6rem;font-weight:700;color:var(--brand)}
.card a.more{font-weight:600;text-decoration:none}
.facts-box{background:#fff;border-left:4px solid var(--brand);border-radius:.8rem;padding:1.2rem 1.4rem;margin:1.6rem 0;box-shadow:0 3px 12px rgba(0,0,0,.05)}
.facts-box h2{margin:0 0 .8rem;font-size:1.15rem}
.facts-box dl{margin:0;display:grid;grid-template-columns:1fr;gap:.45rem}
.facts-box dl>div{display:grid;grid-template-columns:170px 1fr;gap:.6rem;font-size:.93rem}
.facts-box dt{font-weight:600;color:#333}
.facts-box dd{margin:0;color:#333}
@media(max-width:600px){.facts-box dl>div{grid-template-columns:1fr;gap:.1rem}}
.facts-src{font-size:.8rem;color:#777;margin:.9rem 0 0}
.free-faq details{background:#fff;border-radius:.7rem;padding:.7rem 1rem;margin:.5rem 0;border:1px solid rgba(0,0,0,.05)}
.free-faq summary{cursor:pointer;font-weight:600}
.free-faq details div{padding:.5rem 0 .2rem;color:#333;font-size:.95rem}
.steps{counter-reset:s;list-style:none;padding:0;margin:1rem 0}
.steps li{counter-increment:s;position:relative;padding:.3rem 0 .9rem 2.6rem}
.steps li::before{content:counter(s);position:absolute;left:0;top:.2rem;width:1.9rem;height:1.9rem;border-radius:50%;background:var(--brand);color:#fff;font-weight:700;display:flex;align-items:center;justify-content:center;font-size:.9rem}
.notice{background:#fff7e6;border:1px solid #f5d9a0;border-radius:.7rem;padding:.8rem 1rem;font-size:.93rem;margin:1rem 0}
table.free-table{width:100%;border-collapse:collapse;background:#fff;border-radius:.8rem;overflow:hidden;font-size:.93rem;margin:1rem 0}
table.free-table th,table.free-table td{padding:.6rem .8rem;border-bottom:1px solid #eee;text-align:left;vertical-align:top}
table.free-table th{background:#f3edff;font-weight:600}
/* mention badges */
.mb{display:inline-block;font-size:.68rem;font-weight:700;letter-spacing:.04em;padding:.12rem .45rem;border-radius:4px;margin-right:.25rem;vertical-align:middle}
.mb-cr{background:#e3f0ff;color:#1d4ed8}.mb-csp{background:#e6f7ea;color:#15803d}.mb-nat{background:#fde7f3;color:#be185d}
/* question lists */
.filters{display:flex;flex-wrap:wrap;gap:.5rem;align-items:center;margin:1rem 0;position:sticky;top:64px;background:rgba(247,242,232,.96);padding:.5rem 0;z-index:5;backdrop-filter:blur(8px)}
.filters button{border:1.5px solid #ddd;background:#fff;border-radius:999px;padding:.4rem .9rem;font:inherit;font-size:.85rem;cursor:pointer}
.filters button.on{border-color:var(--brand);background:#f3edff;color:var(--brand);font-weight:600}
.filters .spacer{flex:1}
.filters label{font-size:.85rem;color:#444;display:flex;gap:.35rem;align-items:center;cursor:pointer}
.qlist{list-style:none;padding:0;margin:0}
.qitem{background:#fff;border-radius:.9rem;padding:1rem 1.2rem;margin:.7rem 0;box-shadow:0 3px 12px rgba(0,0,0,.04);border:1px solid rgba(0,0,0,.04)}
.qitem.hide{display:none}
.qhead{display:flex;gap:.6rem;align-items:flex-start}
.qno{font-size:.78rem;color:#777;white-space:nowrap;margin-top:.15rem}
.qtext{font-weight:600;margin:0}
.qopts{list-style:none;padding:0;margin:.6rem 0 0}
.qopts li{padding:.4rem .7rem;border-radius:.5rem;border:1px solid #eee;margin:.3rem 0;font-size:.93rem;background:#fafafa}
.qopts li.ok{background:#e3f7e6;border-color:#4caf50;font-weight:600}
.qopts li.ok::before{content:"✓ ";color:#2e7d32}
body.hide-answers .qopts li.ok{background:#fafafa;border-color:#eee;font-weight:400}
body.hide-answers .qopts li.ok::before{content:""}
body.hide-answers .qexp{display:none}
.qopts li{cursor:default}
body.hide-answers .qopts li{cursor:pointer}
body.hide-answers .qitem.revealed .qopts li.ok{background:#e3f7e6;border-color:#4caf50;font-weight:600}
body.hide-answers .qitem.revealed .qopts li.ok::before{content:"✓ ";color:#2e7d32}
body.hide-answers .qitem.revealed .qopts li.picked:not(.ok){background:#fde7e7;border-color:#e53935}
body.hide-answers .qitem.revealed .qexp{display:block}
.qexp{font-size:.88rem;color:#444;margin:.6rem 0 0;padding:.5rem .7rem;background:#f7f2e8;border-radius:.5rem}
.qexp b{color:var(--brand)}
.qexp a{font-weight:600}
.count{font-size:.85rem;color:#666;margin:.4rem 0 1rem}
.inline-cta{background:#f3edff;border-radius:.9rem;padding:1rem 1.2rem;margin:1.4rem 0;display:flex;gap:1rem;align-items:center;justify-content:space-between;flex-wrap:wrap}
.inline-cta p{margin:0;font-size:.95rem}
/* exam */
.exam-setup{background:#fff;border-radius:1rem;padding:1.6rem;box-shadow:0 4px 14px rgba(0,0,0,.06)}
.mention-pick{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:.8rem;margin:1rem 0}
@media(max-width:700px){.mention-pick{grid-template-columns:1fr}}
.mention-pick button{border:2px solid #e5e5e5;background:#fafafa;border-radius:.9rem;padding:1rem;text-align:left;font:inherit;cursor:pointer}
.mention-pick button.on{border-color:var(--brand);background:#f3edff}
.mention-pick b{display:block;font-size:1rem}
.mention-pick small{color:#666;font-size:.82rem}
.exam-bar{display:flex;justify-content:space-between;align-items:center;gap:1rem;margin:1.2rem 0 1rem;flex-wrap:wrap}
.badge{background:#ece6ff;color:var(--brand);padding:.5rem 1.1rem;border-radius:999px;font-size:.95rem;font-weight:600;display:inline-block}
.badge.timer{background:#fee;color:#b00020;font-variant-numeric:tabular-nums}
.badge.timer.low{background:#b00020;color:#fff}
.exam-card{background:#fff;border-radius:1rem;padding:1.6rem;box-shadow:0 4px 14px rgba(0,0,0,.06)}
.exam-q{font-size:1.15rem;font-weight:600;margin:0 0 1.2rem}
.exam-type{font-size:.78rem;color:#777;text-transform:uppercase;letter-spacing:.05em;margin-bottom:.5rem}
.choices{display:flex;flex-direction:column;gap:.7rem}
.choice{background:#fafafa;border:1.5px solid #ddd;border-radius:.6rem;padding:.9rem 1.1rem;cursor:pointer;text-align:left;font:inherit;font-size:.95rem}
.choice:hover{background:#f0eef4}
.choice.sel{border-color:var(--brand);background:#f3edff;font-weight:600}
.controls{margin-top:1.6rem;display:flex;justify-content:space-between;gap:.6rem;flex-wrap:wrap}
.btn{background:var(--brand);color:#fff;padding:.7rem 1.4rem;border:none;border-radius:999px;font:inherit;font-size:.92rem;cursor:pointer;font-weight:600}
.btn:disabled{background:#ccc;cursor:not-allowed}
.btn.secondary{background:#e8e4ee;color:#333}
.btn.danger{background:#fff;color:#b00020;border:1.5px solid #b00020}
.dots{display:flex;flex-wrap:wrap;gap:.3rem;margin:1rem 0 0}
.dots button{width:30px;height:30px;border-radius:6px;border:1px solid #ddd;background:#fff;font:inherit;font-size:.75rem;cursor:pointer}
.dots button.done{background:#ece6ff;border-color:#c9b8f5}
.dots button.cur{outline:2px solid var(--brand)}
.result{background:#fff;border-radius:1rem;padding:1.8rem;box-shadow:0 4px 15px rgba(0,0,0,.06);text-align:center}
.result .score{font-size:3rem;font-weight:700;line-height:1}
.result .pass{color:#2e7d32}.result .fail{color:#c62828}
.result .verdict{font-size:1.2rem;font-weight:700;margin:.4rem 0 1rem}
.breakdown{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:.6rem;margin:1.2rem 0;text-align:left}
.breakdown div{background:#f7f2e8;border-radius:.6rem;padding:.6rem .8rem;font-size:.85rem}
.breakdown b{display:block;font-size:1.1rem}
.review .qitem{text-align:left}
.review .qitem.wrong{border-color:#f3b9b9}
.hint{font-size:.85rem;color:#666}
@media(max-width:500px){.header-nav{gap:.45rem .7rem;font-size:.8rem}.header-nav a[href*='login']{display:none}}

/* language switch + RTL */
.header-nav a{white-space:nowrap}
.langs{display:flex;gap:.35rem;font-size:.78rem;margin-inline-end:.4rem}
.langs a{color:#555;text-decoration:none;padding:.15rem .35rem;border-radius:5px}
.langs a.on{background:#ece6ff;color:var(--brand);font-weight:700}
.langs a:hover{background:#f3edff}
@media(max-width:800px){.langs{order:3;width:100%;justify-content:center;margin:.3rem 0 0}}
html[dir=rtl] body{font-family:"Noto Naskh Arabic","Lexend",system-ui,sans-serif}
html[dir=rtl] .free-main h1,html[dir=rtl] .free-main h2,html[dir=rtl] .free-main h3{font-family:"Noto Naskh Arabic","Lexend",sans-serif}
html[dir=rtl] .crumbs,html[dir=rtl] .steps li{text-align:right}
html[dir=rtl] .steps li{padding:.3rem 2.6rem .9rem 0}
html[dir=rtl] .steps li::before{left:auto;right:0}
html[dir=rtl] .facts-box{border-left:0;border-right:4px solid var(--brand)}
html[dir=rtl] .mb{margin-right:0;margin-left:.25rem}
.qtext[lang=fr],.qopts[lang=fr],.exam-q[lang=fr],.choices[lang=fr]{font-family:"Lexend",system-ui,sans-serif;text-align:left}
