/* ── Variables ───────────────────────────────────────────── */
:root {
  --bg:       #0f172a;
  --bg2:      #1e293b;
  --bg3:      #273549;
  --border:   #334155;
  --primary:  #06b6d4;
  --accent:   #10b981;
  --danger:   #ef4444;
  --warn:     #f59e0b;
  --text:     #f1f5f9;
  --muted:    #94a3b8;
  --mono:     'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  --font:     system-ui, -apple-system, 'Segoe UI', sans-serif;
  --r:        8px;
  --shadow:   0 4px 24px rgba(0,0,0,.4);
}

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.65; min-height: 100vh; }
img { max-width: 100%; display: block; }
a { color: var(--primary); text-decoration: none; transition: color .15s; }
a:hover { color: var(--accent); }
strong { color: var(--text); }

/* ── Navigation ──────────────────────────────────────────── */
nav {
  background: rgba(30,41,59,.9);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
  backdrop-filter: blur(12px);
}
.nav-inner {
  max-width: 1100px; margin: 0 auto;
  padding: 0 1.5rem;
  display: flex; align-items: center; justify-content: space-between;
  height: 60px;
}
.nav-brand {
  display: flex; align-items: center; gap: .6rem;
  font-weight: 700; font-size: 1rem; color: var(--text);
  text-decoration: none;
}
.nav-brand .badge {
  background: var(--primary); color: #000;
  font-family: var(--mono); font-size: .6rem;
  padding: 2px 7px; border-radius: 4px;
  letter-spacing: .08em; text-transform: uppercase;
}
.nav-links { display: flex; gap: .2rem; }
.nav-links a {
  color: var(--muted); padding: .45rem .85rem;
  border-radius: var(--r); font-size: .88rem;
  transition: color .15s, background .15s;
}
.nav-links a:hover, .nav-links a.active { color: var(--text); background: var(--bg3); }
.nav-toggle {
  display: none; background: none; border: none;
  color: var(--text); cursor: pointer; font-size: 1.4rem; padding: .4rem;
}

/* ── Hero ────────────────────────────────────────────────── */
.hero {
  background: linear-gradient(160deg, var(--bg2) 0%, #0a1628 100%);
  border-bottom: 1px solid var(--border);
  padding: 5rem 1.5rem 4.5rem;
  text-align: center; position: relative; overflow: hidden;
}
.hero::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse 70% 50% at 50% -10%, rgba(6,182,212,.14), transparent);
}
.hero-content { position: relative; max-width: 680px; margin: 0 auto; }
.hero-badge {
  display: inline-block; font-family: var(--mono); font-size: .72rem;
  color: var(--primary); border: 1px solid rgba(6,182,212,.4);
  padding: .3rem .9rem; border-radius: 99px; margin-bottom: 1.5rem; letter-spacing: .12em;
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 3rem); font-weight: 800; line-height: 1.2;
  margin-bottom: 1.1rem;
  background: linear-gradient(135deg, var(--text) 40%, var(--muted));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.hero p { font-size: 1.05rem; color: var(--muted); margin-bottom: 2rem; }
.hero-actions { display: flex; gap: .75rem; justify-content: center; flex-wrap: wrap; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .6rem 1.4rem; border-radius: var(--r);
  font-size: .88rem; font-weight: 600; cursor: pointer;
  transition: all .15s; border: none; text-decoration: none;
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #000; }
.btn-primary:hover { background: #22d3ee; color: #000; }
.btn-outline { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; color: #fff; }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); background: var(--bg3); }
.btn-sm { padding: .3rem .75rem; font-size: .8rem; }
.btn-xs { padding: .2rem .55rem; font-size: .75rem; }

/* ── Layout ──────────────────────────────────────────────── */
.container { max-width: 1100px; margin: 0 auto; padding: 2.5rem 1.5rem; }
.section { margin: 2.5rem 0; }
.section-title {
  font-size: 1.25rem; font-weight: 700; margin-bottom: 1.25rem;
  display: flex; align-items: center; gap: .75rem;
}
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ── Feature cards (accueil) ─────────────────────────────── */
.feature-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.25rem; }
.feature-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 12px; padding: 1.5rem;
  transition: border-color .2s, transform .2s;
  text-decoration: none; color: var(--text); display: block;
}
.feature-card:hover { border-color: var(--primary); transform: translateY(-3px); color: var(--text); }
.feature-icon {
  width: 44px; height: 44px; border-radius: 10px;
  background: rgba(6,182,212,.12); border: 1px solid rgba(6,182,212,.25);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; margin-bottom: 1rem;
}
.feature-card h3 { font-size: 1rem; margin-bottom: .4rem; }
.feature-card p { color: var(--muted); font-size: .88rem; }

/* ── Article cards ───────────────────────────────────────── */
.articles-list { display: flex; flex-direction: column; gap: .75rem; }
.article-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 12px; padding: 1.25rem 1.5rem;
  transition: border-color .2s;
}
.article-card:hover { border-color: var(--primary); }
.article-meta { display: flex; align-items: center; gap: .75rem; font-size: .78rem; color: var(--muted); margin-bottom: .5rem; }
.article-title a { font-size: 1.05rem; font-weight: 600; color: var(--text); }
.article-title a:hover { color: var(--primary); }
.article-excerpt { color: var(--muted); font-size: .88rem; margin-top: .35rem; }
.tag {
  font-family: var(--mono); font-size: .68rem; padding: 2px 8px;
  border-radius: 4px; text-transform: uppercase; letter-spacing: .06em;
}
.tag-general { background: rgba(6,182,212,.12);  color: var(--primary); border: 1px solid rgba(6,182,212,.25); }
.tag-ciel1   { background: rgba(16,185,129,.12); color: var(--accent);  border: 1px solid rgba(16,185,129,.25); }
.tag-ciel2   { background: rgba(245,158,11,.12); color: var(--warn);    border: 1px solid rgba(245,158,11,.25); }

/* ── File list ───────────────────────────────────────────── */
.files-list { display: flex; flex-direction: column; gap: .6rem; }
.file-item {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--r); padding: .8rem 1.2rem;
  display: flex; align-items: center; gap: 1rem;
  transition: border-color .15s;
}
.file-item:hover { border-color: var(--primary); }
.file-ico { font-size: 1.4rem; flex-shrink: 0; }
.file-info { flex: 1; min-width: 0; }
.file-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-meta { font-size: .78rem; color: var(--muted); margin-top: 2px; }
.file-dl { flex-shrink: 0; }

/* ── Page content ────────────────────────────────────────── */
.page-body { max-width: 760px; }
.page-body h1 { font-size: 1.7rem; margin-bottom: 1rem; }
.page-body h2 { font-size: 1.25rem; color: var(--primary); margin: 1.5rem 0 .6rem; }
.page-body h3 { font-size: 1.05rem; margin: 1.25rem 0 .5rem; }
.page-body p  { color: var(--muted); margin-bottom: .9rem; }
.page-body ul { padding-left: 1.5rem; margin-bottom: .9rem; color: var(--muted); }
.page-body li { margin-bottom: .25rem; }
.page-body a  { color: var(--primary); }

/* ── Article full ────────────────────────────────────────── */
.article-full-header { margin-bottom: 2rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--border); }
.article-full-header h1 { font-size: clamp(1.5rem, 4vw, 2rem); margin-bottom: .75rem; }
.article-full-body { max-width: 760px; }
.article-full-body h2 { color: var(--primary); font-size: 1.25rem; margin: 1.5rem 0 .6rem; }
.article-full-body h3 { font-size: 1.05rem; margin: 1.25rem 0 .5rem; }
.article-full-body p  { color: var(--muted); margin-bottom: .9rem; }
.article-full-body ul { padding-left: 1.5rem; margin-bottom: .9rem; color: var(--muted); }
.article-full-body li { margin-bottom: .25rem; }
.article-full-body a  { color: var(--primary); }

/* ── Breadcrumb ──────────────────────────────────────────── */
.breadcrumb { display: flex; align-items: center; gap: .5rem; font-size: .82rem; color: var(--muted); margin-bottom: 1.75rem; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .sep { color: var(--border); }

/* ── Infographie ─────────────────────────────────────────── */
.infographic-wrap {
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.infographic-img {
  width: 100%;
  height: auto;
  display: block;
}

/* ── Présentation formation ──────────────────────────────── */
.pres-intro {
  margin-top: 2rem;
  max-width: 820px;
}
.pres-quote {
  font-size: 1.15rem;
  font-style: italic;
  color: var(--primary);
  border-left: 3px solid var(--primary);
  padding-left: 1rem;
  margin-bottom: 1.25rem;
}
.pres-lead { font-size: 1rem; margin-bottom: .75rem; }
.pres-intro p { color: var(--muted); margin-bottom: .75rem; }
.pres-list { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem .75rem; margin-bottom: 1rem; }
.pres-list li { color: var(--muted); font-size: .9rem; }

.pres-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.1rem;
  margin-top: 1.75rem;
}
.pres-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.35rem;
}
.pres-card-title {
  font-weight: 700;
  font-size: .92rem;
  margin-bottom: 1rem;
  padding-bottom: .6rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.pres-card ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .4rem; }
.pres-card li { font-size: .86rem; color: var(--muted); padding-left: .1rem; }
.pres-card li strong { color: var(--text); }

.pres-cta {
  margin-top: 1.75rem;
  background: linear-gradient(135deg, rgba(6,182,212,.08), rgba(16,185,129,.06));
  border: 1px solid rgba(6,182,212,.2);
  border-radius: 12px;
  padding: 1.5rem;
}
.pres-cta-checks {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1.5rem;
  font-size: .9rem;
  color: var(--accent);
}

/* ── Section cards (CIEL1/CIEL2) ────────────────────────── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.1rem;
  margin-bottom: 2rem;
}
.section-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  transition: border-color .2s;
}
.section-card:hover { border-color: var(--primary); }
.section-card-title {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--primary);
  font-family: var(--mono);
  margin-bottom: .85rem;
  padding-bottom: .6rem;
  border-bottom: 1px solid var(--border);
}
.section-card-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: .3rem;
}
.section-card-links li a {
  color: var(--muted);
  font-size: .84rem;
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .2rem 0;
  transition: color .15s;
}
.section-card-links li a::before { content: '↗'; font-size: .7rem; opacity: .5; flex-shrink: 0; }
.section-card-links li a:hover { color: var(--text); }

/* ── Empty state ─────────────────────────────────────────── */
.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty .empty-icon { font-size: 2.5rem; margin-bottom: .75rem; }
.empty p { font-size: .9rem; }

/* ── PDF hover card ─────────────────────────────────────── */
#pdf-hover-card {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-top: 3px solid var(--primary);
  border-radius: var(--r);
  overflow: hidden;
  width: 196px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(6px) scale(.97);
  transition: opacity .18s, transform .18s;
}
#pdf-hover-card.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.phc-preview {
  width: 196px;
  height: 140px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.phc-canvas { display: block; max-width: 100%; }
.phc-spinner {
  font-size: .75rem;
  color: #888;
  font-family: var(--mono);
}
.phc-footer {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .45rem .6rem;
  background: var(--bg2);
}
.phc-badge {
  flex-shrink: 0;
  font-size: .6rem;
  font-family: var(--mono);
  letter-spacing: .06em;
  text-transform: uppercase;
  background: var(--primary);
  color: #000;
  padding: 1px 5px;
  border-radius: 3px;
}
.phc-label {
  font-size: .75rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Footer ──────────────────────────────────────────────── */
footer {
  background: var(--bg2); border-top: 1px solid var(--border);
  padding: 2rem 1.5rem; text-align: center;
  color: var(--muted); font-size: .82rem; margin-top: 4rem;
}

/* ── Admin layout ────────────────────────────────────────── */
.admin-nav {
  background: var(--bg2); border-bottom: 1px solid var(--border);
  padding: 0 1.5rem; height: 54px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 100;
}
.admin-brand { font-family: var(--mono); font-size: .82rem; color: var(--primary); display: flex; align-items: center; gap: .5rem; }
.admin-nav-links { display: flex; gap: .3rem; }
.admin-nav-links a { color: var(--muted); padding: .35rem .7rem; border-radius: var(--r); font-size: .83rem; transition: all .15s; }
.admin-nav-links a:hover, .admin-nav-links a.active { color: var(--text); background: var(--bg3); }
.admin-nav-links a.danger:hover { color: var(--danger); background: rgba(239,68,68,.1); }
.admin-wrap { max-width: 1000px; margin: 0 auto; padding: 2rem 1.5rem; }
.admin-title { font-size: 1.4rem; font-weight: 700; margin-bottom: 1.5rem; display: flex; align-items: center; gap: .75rem; }
.admin-title a { color: var(--muted); font-size: .85rem; font-weight: 400; margin-left: auto; }

/* ── Stats ───────────────────────────────────────────────── */
.stats-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 10px; padding: 1.1rem;
}
.stat-val { font-size: 2rem; font-weight: 700; font-family: var(--mono); color: var(--primary); }
.stat-label { font-size: .8rem; color: var(--muted); margin-top: .2rem; }

/* ── Table ───────────────────────────────────────────────── */
.tbl-wrap { overflow-x: auto; background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: .75rem; color: var(--muted);
  font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
  padding: .7rem 1rem; border-bottom: 1px solid var(--border);
}
td { padding: .8rem 1rem; border-bottom: 1px solid rgba(51,65,85,.4); font-size: .88rem; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,.02); }

/* ── Forms ───────────────────────────────────────────────── */
.form-group { margin-bottom: 1.1rem; }
label { display: block; font-size: .83rem; color: var(--muted); margin-bottom: .35rem; font-weight: 500; }
input[type=text], input[type=password], select, textarea {
  width: 100%; background: var(--bg3); border: 1px solid var(--border);
  color: var(--text); padding: .6rem .85rem; border-radius: var(--r);
  font-size: .9rem; font-family: var(--font); transition: border-color .15s; outline: none;
}
input[type=text]:focus, input[type=password]:focus, select:focus, textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(6,182,212,.1);
}
textarea { resize: vertical; min-height: 220px; font-family: var(--mono); font-size: .82rem; line-height: 1.6; }
select option { background: var(--bg3); }
.form-hint { font-size: .78rem; color: var(--muted); margin-top: .3rem; }

/* ── File input ──────────────────────────────────────────── */
.file-drop {
  border: 2px dashed var(--border); border-radius: var(--r);
  padding: 2rem; text-align: center; color: var(--muted);
  cursor: pointer; transition: border-color .2s;
}
.file-drop:hover, .file-drop.over { border-color: var(--primary); color: var(--primary); }
.file-drop input[type=file] { display: none; }

/* ── Alerts ──────────────────────────────────────────────── */
.alert {
  padding: .8rem 1.1rem; border-radius: var(--r); font-size: .88rem;
  margin-bottom: 1.2rem; display: flex; align-items: center; gap: .65rem;
}
.alert-ok  { background: rgba(16,185,129,.1); border: 1px solid rgba(16,185,129,.3); color: var(--accent); }
.alert-err { background: rgba(239,68,68,.1);  border: 1px solid rgba(239,68,68,.3);  color: var(--danger); }
.alert-info { background: rgba(6,182,212,.1); border: 1px solid rgba(6,182,212,.3);  color: var(--primary); }

/* ── Login ───────────────────────────────────────────────── */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.login-box {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 16px; padding: 2.5rem; width: 100%; max-width: 380px;
  box-shadow: var(--shadow);
}
.login-logo { text-align: center; margin-bottom: 2rem; }
.login-logo .badge {
  display: inline-block; font-family: var(--mono); font-size: .7rem;
  color: var(--primary); border: 1px solid rgba(6,182,212,.4);
  padding: .25rem .8rem; border-radius: 99px; margin-bottom: .75rem;
}
.login-logo h1 { font-size: 1.3rem; margin-bottom: .3rem; }
.login-logo p { color: var(--muted); font-size: .85rem; }

/* ── Checkbox ────────────────────────────────────────────── */
.checkbox-group { display: flex; align-items: center; gap: .5rem; }
.checkbox-group input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--primary); }
.checkbox-group label { margin-bottom: 0; font-size: .88rem; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 640px) {
  .nav-links { display: none; }
  .nav-toggle { display: block; }
  .nav-links.open {
    display: flex; flex-direction: column;
    position: absolute; top: 60px; left: 0; right: 0;
    background: var(--bg2); border-bottom: 1px solid var(--border);
    padding: .5rem 1rem 1rem; z-index: 99; gap: .2rem;
  }
  .admin-nav-links .lbl { display: none; }
  .hero { padding: 3rem 1.25rem; }
  .container { padding: 1.5rem 1.1rem; }
  .admin-wrap { padding: 1.25rem 1rem; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
}
