/* ═══ Corporate Blue — Romande Energie OKR ═══ */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

:root {
  --bg: #F8FAFC;
  --card: #FFFFFF;
  --accent: #2563EB;
  --accent-pale: #EFF6FF;
  --border-accent: #BFDBFE;
  --navy-cta: #1E3A5F;
  --text: #0F172A;
  --text-secondary: #64748B;
  --border: #E2E8F0;
  --border-input: #CBD5E1;
  --good: #16A34A;
  --good-bg: #F0FDF4;
  --ok: #D97706;
  --ok-bg: #FFFBEB;
  --bad: #DC2626;
  --bad-bg: #FEF2F2;
  --radius: 10px;
  --radius-sm: 8px;
  --radius-xs: 6px;
}

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

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.6;
  min-height: 100vh;
}

/* ─── Header ─── */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.header-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}
.header-xp {
  flex: 1;
  max-width: 200px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.xp-bar {
  flex: 1;
  height: 4px;
  background: #E2E8F0;
  border-radius: 2px;
  overflow: hidden;
}
.xp-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.5s ease;
}
.xp-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  white-space: nowrap;
}
.header-badges {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
}
.header-badges svg { color: var(--text-secondary); }
.header-badges.has-badges svg { color: var(--accent); }

/* ─── Progress bar (sticky under header) ─── */
.progress-strip {
  position: sticky;
  top: 49px;
  z-index: 99;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 8px 24px 12px;
}
.progress-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.progress-top span {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}
.progress-bar-track {
  height: 4px;
  background: #E2E8F0;
  border-radius: 2px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.4s ease;
}
.module-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-top: 10px;
}
.step-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
  transition: all 0.3s ease;
}
.step-dot.done { background: var(--good); color: #fff; }
.step-dot.active { background: var(--accent); color: #fff; }
.step-dot.upcoming { background: transparent; border: 2px solid var(--border); color: var(--text-secondary); }
.step-line {
  width: 32px;
  height: 2px;
  background: var(--border);
  flex-shrink: 0;
}
.step-line.done { background: var(--good); }

/* ─── Container ─── */
.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 40px 32px;
}
@media (max-width: 768px) {
  .container { padding: 24px 16px; }
  .header { padding: 10px 16px; }
  .progress-strip { padding: 8px 16px 12px; }
}

/* ─── Cards ─── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  margin-bottom: 20px;
  animation: fadeIn 0.4s ease;
}
@media (max-width: 768px) {
  .card { padding: 24px 20px; }
}

/* ─── Typography ─── */
h1 { font-size: 28px; font-weight: 600; color: var(--text); line-height: 1.3; }
h2 { font-size: 20px; font-weight: 500; color: var(--text); line-height: 1.3; margin-bottom: 12px; }
h3 { font-size: 18px; font-weight: 500; color: var(--text); margin-bottom: 8px; }
.label { font-size: 13px; font-weight: 500; color: var(--text-secondary); }
.hint { font-size: 12px; font-weight: 400; color: var(--text-secondary); }

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 200ms ease;
  text-decoration: none;
}
.btn-cta {
  background: var(--navy-cta);
  color: #fff;
}
.btn-cta:hover { opacity: 0.9; }
.btn-secondary {
  background: var(--accent-pale);
  color: var(--accent);
  border: 1.5px solid var(--border-accent);
}
.btn-secondary:hover { background: #DBEAFE; }
.btn-ghost {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text-secondary);
}
.btn-ghost:hover { border-color: var(--border-accent); color: var(--accent); }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ─── Pills / Tags ─── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  background: var(--accent-pale);
  color: #1D4ED8;
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-xs);
  font-size: 12px;
  font-weight: 500;
}

/* ─── Answer buttons ─── */
.answers { display: flex; flex-direction: column; gap: 12px; }
.answer-btn {
  display: block;
  width: 100%;
  padding: 16px 20px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  text-align: left;
  font-size: 15px;
  line-height: 1.5;
  cursor: pointer;
  transition: all 200ms ease;
  font-family: inherit;
  color: var(--text);
}
.answer-btn:hover:not(:disabled):not(.selected) {
  border-color: var(--border-accent);
  background: var(--accent-pale);
}
.answer-btn:disabled { cursor: default; }
.answer-btn.selected { border-color: var(--accent); background: var(--accent-pale); }
.answer-btn.selected-good { border-color: var(--good); background: var(--good-bg); }
.answer-btn.selected-ok { border-color: var(--ok); background: var(--ok-bg); }
.answer-btn.selected-bad { border-color: var(--bad); background: var(--bad-bg); }

/* ─── Feedback card ─── */
.feedback-card {
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 16px;
  animation: fadeIn 0.4s ease;
}
.feedback-card.good { background: var(--good-bg); border-left: 4px solid var(--good); }
.feedback-card.ok { background: var(--ok-bg); border-left: 4px solid var(--ok); }
.feedback-card.bad { background: var(--bad-bg); border-left: 4px solid var(--bad); }
.feedback-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.feedback-header .status-icon { flex-shrink: 0; }
.feedback-label { font-weight: 600; font-size: 15px; }
.feedback-label.good { color: var(--good); }
.feedback-label.ok { color: var(--ok); }
.feedback-label.bad { color: var(--bad); }
.feedback-text { font-size: 15px; line-height: 1.6; color: var(--text); }
.feedback-text strong { font-weight: 600; }

/* ─── Quote blocks in questions ─── */
.quote-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  margin: 12px 0;
  font-size: 14px;
  line-height: 1.6;
}

/* ─── Learning intro card ─── */
.intro-text {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
}
.intro-text strong { font-weight: 600; }

/* ─── Badges ─── */
.badge-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (min-width: 768px) {
  .badge-grid { grid-template-columns: repeat(4, 1fr); }
}
.badge-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
  transition: all 0.3s ease;
}
.badge-card.earned {
  background: var(--accent-pale);
  border-color: var(--border-accent);
}
.badge-card.locked {
  opacity: 0.45;
  filter: grayscale(1);
}
.badge-card .badge-icon { width: 32px; height: 32px; color: #1D4ED8; }
.badge-card.locked .badge-icon { color: var(--text-secondary); }
.badge-card .badge-name { font-size: 13px; font-weight: 600; color: var(--text); }
.badge-card .badge-hint { font-size: 11px; color: var(--text-secondary); }
.badge-card.earned .badge-hint { color: var(--accent); }

@keyframes badgeUnlock {
  0% { transform: scale(0.5); opacity: 0; }
  70% { transform: scale(1.2); }
  100% { transform: scale(1); opacity: 1; }
}
.badge-card.just-earned { animation: badgeUnlock 0.6s ease; }

/* ─── Radar & Results ─── */
.results-score {
  text-align: center;
  margin-bottom: 24px;
}
.results-score .number {
  font-size: 28px;
  font-weight: 600;
  color: var(--text);
}
.results-score .suffix {
  font-size: 18px;
  font-weight: 400;
  color: var(--text-secondary);
}
.radar-container {
  display: flex;
  justify-content: center;
  margin: 24px 0;
}
.radar-container canvas {
  max-width: 400px;
  width: 100%;
}
.module-bars { margin: 24px 0; }
.module-bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.module-bar-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  width: 140px;
  flex-shrink: 0;
  text-align: right;
}
@media (max-width: 768px) {
  .module-bar-label { width: 100px; font-size: 12px; }
}
.module-bar-track {
  flex: 1;
  height: 8px;
  background: #E2E8F0;
  border-radius: 4px;
  overflow: hidden;
}
.module-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.6s ease;
}
.module-bar-pct {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  width: 40px;
}

/* ─── Toasts ─── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
@media (max-width: 768px) {
  .toast-container { bottom: 16px; right: 16px; left: 16px; }
}
.toast {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  animation: toastIn 0.4s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.toast.good { border-left-color: var(--good); }
.toast.ok { border-left-color: var(--ok); }
.toast.badge { border-left-color: var(--accent); }
.toast svg { flex-shrink: 0; }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(12px); }
}

/* ─── XP float animation ─── */
.xp-float {
  position: fixed;
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
  pointer-events: none;
  animation: xpFloat 1.2s ease-out forwards;
  z-index: 1001;
}
@keyframes xpFloat {
  0% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-30px); }
}

/* ─── Tool 2 ─── */
.t2-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin: 0 0 24px;
}
.t2-step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.t2-step-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
}
.t2-step-item.active .t2-step-label { color: var(--accent); font-weight: 600; }
.t2-step-item.done .t2-step-label { color: var(--good); }

textarea, input[type="text"] {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--border-input);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--card);
  resize: vertical;
  transition: all 200ms ease;
}
textarea:focus, input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-pale);
}
textarea { min-height: 80px; }

.field-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.domain-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (min-width: 768px) {
  .domain-grid { grid-template-columns: repeat(3, 1fr); }
}
.domain-card {
  padding: 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
  cursor: pointer;
  transition: all 200ms ease;
  font-size: 14px;
  font-weight: 500;
}
.domain-card:hover { border-color: var(--border-accent); background: var(--accent-pale); }
.domain-card.selected { border-color: var(--accent); background: var(--accent-pale); }
.domain-card .domain-icon { display: block; margin-bottom: 6px; }
.domain-card .domain-icon svg { width: 24px; height: 24px; color: var(--accent); margin: 0 auto; }

/* Criteria cards (Tool 2 evaluation) */
.criterion-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}
.criterion-card .c-icon { flex-shrink: 0; margin-top: 2px; }
.criterion-card .c-name { font-weight: 600; font-size: 14px; color: var(--text); }
.criterion-card .c-comment { font-size: 14px; color: var(--text-secondary); margin-top: 2px; line-height: 1.5; }
.criterion-card .c-comment strong { color: var(--text); }
.criterion-card .c-suggestion {
  margin-top: 6px;
  padding: 8px 12px;
  background: var(--accent-pale);
  border-radius: var(--radius-xs);
  font-size: 13px;
  font-style: italic;
  color: var(--text);
}

/* Score circle */
.score-display { text-align: center; margin: 24px 0; }
.score-display .score-number {
  font-size: 28px;
  font-weight: 600;
  color: var(--text);
}
.score-display .score-suffix { font-size: 18px; color: var(--text-secondary); }

/* Reformulation block */
.reformulation-card {
  background: var(--accent-pale);
  border: 1.5px solid var(--border-accent);
  border-radius: var(--radius);
  padding: 20px;
  margin: 16px 0;
}
.reformulation-card h4 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
}

/* Points forts / améliorations */
.debrief-card {
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 12px;
}
.debrief-card.strong { background: var(--good-bg); border-left: 4px solid var(--good); }
.debrief-card.improve { background: var(--ok-bg); border-left: 4px solid var(--ok); }
.debrief-card h4 { font-size: 15px; font-weight: 600; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.debrief-card.strong h4 { color: var(--good); }
.debrief-card.improve h4 { color: var(--ok); }
.debrief-card ul { list-style: none; padding: 0; }
.debrief-card li { font-size: 14px; line-height: 1.5; padding: 4px 0; padding-left: 16px; position: relative; }
.debrief-card li::before { content: "•"; position: absolute; left: 0; }

/* Loader */
.loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 32px;
  color: var(--text-secondary);
  font-size: 14px;
}
.spinner-svg { width: 32px; height: 32px; animation: spin 1s linear infinite; color: var(--accent); }
@keyframes spin { to { transform: rotate(360deg); } }
.loader-hint { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }

/* Quality gauge (Tool 2) */
.quality-gauge {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0;
}
.quality-gauge-bar {
  flex: 1;
  height: 4px;
  background: #E2E8F0;
  border-radius: 2px;
  overflow: hidden;
}
.quality-gauge-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 300ms ease;
}
.quality-gauge-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  white-space: nowrap;
}

/* ─── Hub ─── */
.hub-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}
@media (max-width: 768px) {
  .hub-grid { grid-template-columns: 1fr; }
}
.hub-card {
  cursor: pointer;
  transition: all 200ms ease;
  position: relative;
}
.hub-card:hover:not(.locked) { border-color: var(--border-accent); }
.hub-card.locked { opacity: 0.45; filter: grayscale(0.6); cursor: not-allowed; }
.hub-card .hub-icon { width: 32px; height: 32px; color: var(--accent); margin-bottom: 12px; }
.hub-card h3 { font-size: 18px; margin-bottom: 4px; }
.hub-card .hub-subtitle { font-size: 14px; color: var(--text-secondary); margin-bottom: 12px; }
.hub-card .hub-bar {
  height: 4px;
  background: #E2E8F0;
  border-radius: 2px;
  margin-top: 16px;
  overflow: hidden;
}
.hub-card .hub-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.5s ease;
}
.hub-card .lock-hint {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 8px;
}

/* ─── Footer ─── */
.footer {
  text-align: center;
  padding: 24px 16px;
  font-size: 11px;
  font-weight: 400;
  color: #94A3B8;
}

/* ─── Animations ─── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn 0.4s ease; }

/* ─── Utilities ─── */
.hidden { display: none !important; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.text-center { text-align: center; }
.gap-12 { gap: 12px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
