@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600;9..144,700&family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* Charte ZOLA & ASSOCIÉS — alignée sur le site institutionnel (style.css, zola-associes.com) */
  --navy: #1B2A4A;
  --navy-light: #2C4166;
  --red: #CC0000;
  --red-dark: #A80000;
  --bg: #F7F3ED;
  --card: #ffffff;
  --border: #e6e0d4;
  --text: #2B2B2B;
  --muted: #6B6B6B;
  --green: #2e7d32;
  --blue: #1565c0;
  --purple: #6a1b9a;
  --gold: #C9A227;
  --grey: #8a8f98;
  --radius: 12px;
  --display: 'Fraunces', serif;
  --body: 'Inter', sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--body), "Segoe UI", Roboto, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
}

a { color: inherit; text-decoration: none; }

.layout { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: 250px;
  flex-shrink: 0;
  background: var(--navy);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 20px 0;
}
.sidebar .brand {
  padding: 0 20px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  margin-bottom: 14px;
}
.sidebar .brand .brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar .brand .brand-icon {
  width: 22px;
  height: auto;
  filter: brightness(0) invert(1);
  flex-shrink: 0;
}
.sidebar .brand .org {
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 0.03em;
}
.sidebar .brand .tagline {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.6);
  margin-top: 2px;
}
.sidebar .badge-iree {
  display: inline-block;
  margin-top: 8px;
  background: var(--red);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  letter-spacing: 0.04em;
}
.sidebar nav { flex: 1; display: flex; flex-direction: column; gap: 2px; padding: 0 10px; }
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: rgba(255,255,255,0.78);
  font-size: 0.92rem;
  font-weight: 500;
}
.sidebar nav a:hover { background: rgba(255,255,255,0.06); color: #fff; }
.sidebar nav a.active { background: var(--red); color: #fff; }
.sidebar .icon { width: 18px; text-align: center; }
.sidebar-footer {
  padding: 14px 20px 0 20px;
  border-top: 1px solid rgba(255,255,255,0.12);
  margin-top: 12px;
  font-size: 0.78rem;
  color: rgba(255,255,255,0.55);
}

/* Main */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topbar h1 { font-family: var(--display); font-size: 1.2rem; margin: 0; font-weight: 600; }
.topbar .user-chip {
  display: flex; align-items: center; gap: 10px; font-size: 0.85rem; color: var(--muted);
}
.topbar .user-chip .avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--red);
  color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.85rem;
}
.content { padding: 26px 28px 60px 28px; }

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}
.card h2 { font-family: var(--display); margin-top: 0; font-size: 1.1rem; font-weight: 600; }
.card h3 { font-size: 0.95rem; margin: 0 0 10px 0; }

.grid { display: grid; gap: 20px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) {
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
  .layout { flex-direction: column; }
  .sidebar { width: 100%; }
}

.stat-tile {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.stat-tile .value { font-size: 1.8rem; font-weight: 800; color: var(--navy); }
.stat-tile .label { font-size: 0.8rem; color: var(--muted); margin-top: 4px; }
.stat-tile.accent .value { color: var(--red); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  background: var(--navy);
  color: #fff;
}
.btn:hover { opacity: 0.92; }
.btn.btn-red { background: var(--red); }
.btn.btn-outline { background: transparent; border-color: var(--border); color: var(--text); }
.btn.btn-sm { padding: 5px 10px; font-size: 0.78rem; }
.btn.btn-danger { background: #b3261e; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Forms */
label { display: block; font-size: 0.82rem; font-weight: 600; margin-bottom: 5px; color: var(--text); }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=tel], input[type=date], input[type=datetime-local], select, textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 14px;
  background: #fff;
  font-family: inherit;
}
textarea { min-height: 80px; resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 700px) { .form-row { grid-template-columns: 1fr; } }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; }
tr:hover td { background: #fafbfc; }

/* Badges */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
}
.badge.grey { background: var(--grey); }
.badge.green { background: var(--green); }
.badge.blue { background: var(--blue); }
.badge.purple { background: var(--purple); }
.badge.gold { background: var(--gold); }
.badge.red { background: var(--red); }
.badge.outline { background: transparent; border: 1px solid var(--border); color: var(--muted); }

/* Progress bar */
.progress-bar { background: #eceef2; border-radius: 20px; height: 10px; overflow: hidden; }
.progress-bar .fill { background: var(--red); height: 100%; border-radius: 20px; }

/* Flash messages */
.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 0.88rem; font-weight: 600; }
.flash.success { background: #e6f4ea; color: #1e7c34; }
.flash.error { background: #fdecea; color: #b3261e; }

/* Auth pages */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--navy), #0b1424);
  padding: 20px;
}
.auth-card {
  background: #fff; border-radius: 16px; padding: 36px 34px; width: 100%; max-width: 440px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
}
.auth-card .logo-row { text-align: center; margin-bottom: 6px; }
.auth-card .auth-logo { width: 40px; height: auto; display: block; margin: 0 auto 8px auto; }
.auth-card .auth-logo-full { width: 100%; max-width: 300px; height: auto; display: block; margin: 0 auto; }
.auth-card .logo-row .org { font-weight: 800; font-size: 1.3rem; color: var(--navy); }
.auth-card .logo-row .tagline { font-size: 0.8rem; color: var(--muted); margin-top: 2px; }
.auth-card h1 { font-family: var(--display); font-weight: 600; font-size: 1.1rem; text-align: center; margin: 18px 0 22px 0; color: var(--red); }
.auth-card .switch { text-align: center; margin-top: 14px; font-size: 0.85rem; color: var(--muted); }
.auth-card .switch a { color: var(--red); font-weight: 700; }
.demo-box {
  margin-top: 22px; padding: 12px 14px; background: #f4f5f8; border-radius: 10px; font-size: 0.76rem; color: var(--muted);
}
.demo-box code { background: #e9ebf0; padding: 1px 5px; border-radius: 4px; }

/* Bandeau de démonstration */
.demo-ribbon {
  background: var(--gold); color: #2B2000; text-align: center; font-size: 0.8rem; font-weight: 700;
  padding: 8px 16px; letter-spacing: 0.01em;
}
.demo-ribbon a { text-decoration: underline; margin-left: 10px; color: #2B2000; }

.demo-quick { margin-bottom: 16px; }
.demo-quick > strong { display: block; font-size: 0.8rem; color: var(--navy); margin-bottom: 10px; text-align: center; }
.demo-quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.demo-quick-grid .btn { justify-content: center; width: 100%; }
.auth-divider {
  display: flex; align-items: center; text-align: center; color: var(--muted); font-size: 0.74rem;
  margin: 18px 0; text-transform: uppercase; letter-spacing: 0.03em;
}
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; border-bottom: 1px solid var(--border); }
.auth-divider span { padding: 0 10px; }

/* Module cards */
.module-card {
  display: flex; align-items: center; gap: 16px;
  border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 12px;
  background: #fff;
}
.module-card .num {
  width: 40px; height: 40px; border-radius: 50%; background: var(--navy); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 800; flex-shrink: 0;
}
.module-card.completed .num { background: var(--green); }
.module-card .info { flex: 1; }
.module-card .info .title { font-weight: 700; font-size: 0.95rem; }
.module-card .info .meta { font-size: 0.78rem; color: var(--muted); margin-top: 2px; }

/* Pillar criterion row */
.criterion {
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.criterion .q { font-weight: 600; font-size: 0.88rem; margin-bottom: 8px; }
.scale { display: flex; gap: 8px; flex-wrap: wrap; }
.scale label {
  display: flex; align-items: center; gap: 6px; font-weight: 400; margin: 0;
  border: 1px solid var(--border); padding: 6px 12px; border-radius: 20px; font-size: 0.8rem; cursor: pointer;
}
.scale input { margin: 0; }
.pillar-block { margin-bottom: 26px; }
.pillar-block h3 { color: var(--red); border-bottom: 2px solid var(--red); padding-bottom: 8px; }

/* charts */
.radar-svg { width: 100%; max-width: 460px; height: auto; display: inline-block; }
.line-svg { width: 100%; max-width: 560px; height: auto; display: block; }
.gauge-svg { width: 100%; max-width: 200px; height: auto; display: inline-block; }
.radar-label { font-size: 9.5px; fill: var(--text); }
.axis-label { font-size: 10px; fill: var(--muted); }
.axis-value { font-size: 10px; fill: var(--text); font-weight: 700; }
.gauge-value { font-size: 28px; font-weight: 800; fill: var(--navy); }
.gauge-max { font-size: 12px; fill: var(--muted); }

.muted { color: var(--muted); font-size: 0.85rem; }
.section-title { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 22px 0 10px 0; font-weight: 700; }
.flex { display: flex; align-items: center; }
.flex.gap { gap: 10px; }
.flex.between { justify-content: space-between; }
.flex.wrap { flex-wrap: wrap; }
.mt0 { margin-top: 0; }

/* Bande défilante publicitaire — voir ireeplatform/ads.py. Toujours en bas, sur toutes les
   pages (connectées ou non), invisible tant que ADS_ENABLED n'est pas activé côté serveur ou
   qu'aucune annonce n'est active. */
.ads-ticker {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 500;
  display: flex; align-items: stretch; height: 40px;
  background: var(--navy); border-top: 2px solid var(--gold);
  box-shadow: 0 -2px 10px rgba(0,0,0,0.15);
}
.ads-ticker-label {
  flex-shrink: 0; display: flex; align-items: center; white-space: nowrap;
  background: var(--gold); color: #2B2000; font-weight: 700; font-size: 0.72rem;
  text-transform: uppercase; letter-spacing: 0.04em; padding: 0 14px;
}
.ads-ticker-track { flex: 1; overflow: hidden; position: relative; }
.ads-ticker-content {
  position: absolute; top: 0; left: 0; height: 100%; display: flex; align-items: center;
  white-space: nowrap; will-change: transform;
  animation: ads-ticker-scroll 32s linear infinite;
}
.ads-ticker-item {
  display: inline-flex; align-items: center; color: #fff; font-size: 0.82rem;
  padding: 0 32px; height: 100%;
}
a.ads-ticker-item:hover { text-decoration: underline; color: var(--gold); }
.ads-ticker-item strong { color: var(--gold); margin-right: 5px; font-weight: 700; }
.ads-ticker-logo {
  width: 24px; height: 24px; object-fit: contain; border-radius: 4px; background: #fff;
  margin-right: 8px; flex-shrink: 0; vertical-align: middle;
}
/* Le contenu réel est dupliqué une fois dans le gabarit ; on ne fait défiler que la moitié
   (-50%) pour que la boucle soit continue et invisible. */
@keyframes ads-ticker-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
@media (prefers-reduced-motion: reduce) {
  .ads-ticker-content { position: static; animation: none; flex-wrap: wrap; overflow-x: auto; }
  .ads-ticker-track { overflow-x: auto; }
}
@media (max-width: 640px) {
  .ads-ticker-label { display: none; }
}
body.has-ads-ticker .content { padding-bottom: 90px; }
body.has-ads-ticker .auth-wrap { padding-bottom: 56px; box-sizing: border-box; }
body.has-ads-ticker .sidebar { padding-bottom: 40px; box-sizing: border-box; }
.mb0 { margin-bottom: 0; }
