/* =========================================================
   Badrleprof — styles partagés
   Couleurs du logo (vert, jaune, rouge, bleu sur blanc),
   typographie ronde et composants façon autocollant.
   ========================================================= */
:root {
  --green: #8bc34a;
  --green-d: #689f38;
  --green-t: #6fa53a; /* vert des grands titres (meilleur contraste) */
  --green-wash: #e6f4d4;
  --leaf: #c5e1a5;
  --blue: #00bcd4;
  --blue-d: #00838f;
  --blue-wash: #e0f7fa;
  --ink: #333333;
  --paper: #ffffff;
  --charcoal: #3d3d3d;
  --pencil: #777777;
  --faded: #afafaf;
  --line: #e5e5e5;
  --snow: #f7f7f7;
  --red: #f44336;
  --red-d: #d32f2f;
  --red-wash: #ffebee;
  --yellow: #ffc106;
  --yellow-d: #e0a800;
  --orange: #ff9800;
  --pink: #ff86d0;
  --purple: #ab47bc;

  --r: 12px;
  --r-lg: 16px;
  --r-xl: 24px;
  --max: 1200px;
  --font: 'Nunito', ui-rounded, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--charcoal);
  font: 500 17px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}
img, svg, video { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--blue-d); text-decoration: none; font-weight: 700; }
h1, h2, h3, h4 { margin: 0; line-height: 1.15; }
p { margin: 0; }
[hidden] { display: none !important; }
::selection { background: var(--green-wash); color: var(--ink); }

.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 24px; }
.display {
  font-weight: 900;
  font-size: clamp(40px, 6vw, 64px);
  line-height: 1.08;
  letter-spacing: -0.02em;
  color: var(--green-t);
}
.h-sub { font: 800 clamp(22px, 2.4vw, 32px)/1.2 var(--font); color: var(--charcoal); }
.label {
  display: inline-block;
  font: 800 15px/1.33 var(--font);
  letter-spacing: 0.053em;
  text-transform: uppercase;
  color: var(--pencil);
}
.muted { color: var(--pencil); }
.small { font-size: 14px; }

/* ---------- Boutons autocollants ---------- */
.btn {
  --bg: var(--paper);
  --fg: var(--blue-d);
  --bd: var(--line);
  --edge: var(--line);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 12px 22px;
  border: 2px solid var(--bd);
  border-radius: var(--r);
  background: var(--bg);
  color: var(--fg);
  font: 800 15px/1 var(--font);
  letter-spacing: 0.053em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  box-shadow: 0 4px 0 var(--edge);
  /* « translate » (et non « transform ») : l'effet d'appui reste compatible avec les animations GSAP */
  transition: translate 0.1s, box-shadow 0.1s, filter 0.2s, background-color 0.2s, color 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { translate: 0 4px; box-shadow: 0 0 0 var(--edge); }
.btn:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
.btn:disabled, .btn.is-disabled {
  --bg: var(--line); --fg: var(--faded); --bd: var(--line); --edge: #d0d0d0;
  cursor: not-allowed; filter: none;
}
.btn:disabled:active { translate: none; box-shadow: 0 4px 0 var(--edge); }
.btn-green { --bg: var(--green); --fg: #fff; --bd: var(--green); --edge: var(--green-d); }
.btn-blue { --bg: var(--blue); --fg: #fff; --bd: var(--blue); --edge: var(--blue-d); }
.btn-red { --bg: var(--red); --fg: #fff; --bd: var(--red); --edge: var(--red-d); }
.btn-yellow { --bg: var(--yellow); --fg: #fff; --bd: var(--yellow); --edge: var(--yellow-d); }
.btn-ink { --bg: var(--ink); --fg: #fff; --bd: var(--ink); --edge: #000; }
.btn-ghost { --fg: var(--blue-d); }
.btn-ghost-gray { --fg: var(--pencil); }
.btn-sm { min-height: 38px; padding: 8px 14px; font-size: 13px; gap: 6px; box-shadow: 0 3px 0 var(--edge); }
.btn-sm:active { translate: 0 3px; }
.btn-lg { min-height: 58px; padding: 16px 30px; font-size: 16px; }
.btn-block { width: 100%; }
.btn-icon { min-height: 44px; width: 44px; padding: 0; }
.btn .ico { width: 20px; height: 20px; flex: none; }
.btn-sm .ico { width: 17px; height: 17px; }

/* ---------- Surfaces ---------- */
.card {
  background: #fff;
  border: 2px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: 0 4px 0 var(--line);
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font: 800 13px/1 var(--font);
  letter-spacing: 0.053em;
  text-transform: uppercase;
  color: var(--pencil);
}
.pill-green { border-color: var(--leaf); background: #f1f8e9; color: var(--green-d); }
.pill-blue { border-color: #b2ebf2; background: var(--blue-wash); color: var(--blue-d); }
.pill-red { border-color: #ffcdd2; background: var(--red-wash); color: var(--red-d); }
.pill-yellow { border-color: #ffe08a; background: #fff8e1; color: #a67c00; }
.live-dot::before {
  content: '';
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 0 rgba(255, 75, 75, 0.6);
  animation: livePulse 1.6s infinite;
}
@keyframes livePulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 75, 75, 0.55); }
  70% { box-shadow: 0 0 0 10px rgba(255, 75, 75, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 75, 75, 0); }
}

/* ---------- Formulaires ---------- */
.field { display: grid; gap: 8px; }
.field > span, .field > label {
  font: 800 13px/1.2 var(--font);
  letter-spacing: 0.053em;
  text-transform: uppercase;
  color: var(--pencil);
}
.input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--line);
  border-radius: var(--r);
  background: var(--snow);
  font-weight: 700;
  color: var(--charcoal);
  outline: none;
  transition: border-color 0.2s, background-color 0.2s;
}
.input::placeholder { color: var(--faded); }
.input:focus { border-color: var(--blue); background: #fff; }
textarea.input { resize: vertical; min-height: 96px; line-height: 1.4; }
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23777' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; background-size: 18px; padding-right: 44px; }
.form-error {
  padding: 12px 14px;
  border: 2px solid #ffcdd2;
  border-radius: var(--r);
  background: var(--red-wash);
  color: var(--red-d);
  font-weight: 800;
  font-size: 15px;
}

/* Interrupteur */
.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; font-weight: 800; color: var(--charcoal); }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track {
  position: relative;
  width: 52px; height: 30px; flex: none;
  border-radius: 999px;
  background: var(--line);
  transition: background-color 0.25s;
}
.switch .track::after {
  content: '';
  position: absolute; top: 3px; left: 3px;
  width: 24px; height: 24px; border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.12);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.switch input:checked + .track { background: var(--green); }
.switch input:checked + .track::after { transform: translateX(22px); }
.switch input:focus-visible + .track { outline: 3px solid var(--blue); outline-offset: 2px; }

/* ---------- Logo BADRLEPROF & mascotte ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); flex: none; }
.brand img { width: 42px; height: 42px; border-radius: 6px; transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1); }
.brand:hover img { transform: rotate(-8deg) scale(1.08); }
.brand-text { display: grid; line-height: 1; }
.brand-text b { font: 700 23px/1 'Rajdhani', var(--font); letter-spacing: 0.07em; color: var(--ink); }
.brand-text small {
  margin-top: 3px;
  padding-top: 3px;
  border-top: 2.5px solid var(--ink);
  font: 500 9.5px/1 'Rajdhani', var(--font);
  letter-spacing: 0.34em;
  color: var(--ink);
  white-space: nowrap;
}
.brand-icon img { width: 38px; height: 38px; }
.brand-white b, .brand-white small { color: #fff; border-color: #fff; }
@media (max-width: 420px) { .brand-text { display: none; } }
.lumi { overflow: visible; }
.lumi .lumi-eye, .lumi .lumi-rays, .lumi .lumi-cap, .lumi .lumi-mouth { transform-box: fill-box; transform-origin: 50% 50%; }
.lumi .lumi-arm { transform-box: fill-box; transform-origin: 0% 100%; }
.lumi .lumi-arm-l { transform-box: fill-box; transform-origin: 100% 0%; }

/* ---------- Avatars ---------- */
.avatar {
  --c: var(--green);
  --s: 48px;
  width: var(--s); height: var(--s);
  flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 3px solid var(--c);
  background: color-mix(in srgb, var(--c) 18%, #fff);
  font-size: calc(var(--s) * 0.5);
  line-height: 1;
}
.avatar.has-photo { overflow: hidden; background: #fff; }
.avatar.has-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- Icônes ---------- */
.ico { width: 22px; height: 22px; flex: none; }

/* ---------- Barre d'application ---------- */
.appnav { position: sticky; top: 0; z-index: 50; background: #fff; border-bottom: 2px solid var(--line); }
.appnav .container { display: flex; align-items: center; gap: 16px; height: 72px; }
.appnav .spacer { flex: 1; }
.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 14px 4px 4px;
  border: 2px solid var(--line); border-radius: 999px;
  font-weight: 800;
}
.user-chip .avatar { --s: 36px; border-width: 2px; }
.role-tag { font: 800 12px/1 var(--font); letter-spacing: 0.053em; text-transform: uppercase; padding: 6px 10px; border-radius: 999px; }
.role-tag.teacher { background: #f1f8e9; color: var(--green-d); }
.role-tag.student { background: var(--blue-wash); color: var(--blue-d); }
@media (max-width: 640px) {
  .user-chip .user-name, .appnav .role-tag { display: none; }
  .user-chip { padding: 4px; }
}

/* Onglets */
.tabs { display: flex; gap: 10px; flex-wrap: wrap; }
.tab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 18px;
  border: 2px solid var(--line);
  border-radius: var(--r);
  background: #fff;
  color: var(--pencil);
  font: 800 14px/1 var(--font);
  letter-spacing: 0.053em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--line);
  transition: color 0.2s, border-color 0.2s, background-color 0.2s;
}
.tab .ico { width: 18px; height: 18px; }
.tab:hover { color: var(--charcoal); }
.tab.is-active { border-color: #80deea; background: var(--blue-wash); color: var(--blue-d); box-shadow: 0 3px 0 #80deea; }

/* ---------- Toasts ---------- */
.toasts {
  position: fixed; left: 50%; bottom: 24px; z-index: 1000;
  transform: translateX(-50%);
  display: grid; gap: 10px;
  width: min(calc(100vw - 32px), 460px);
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  border: 2px solid var(--line);
  border-radius: var(--r-lg);
  background: #fff;
  box-shadow: 0 4px 0 var(--line);
  font-weight: 800;
  color: var(--charcoal);
}
.toast .toast-emoji { font-size: 24px; line-height: 1; }
.toast .toast-msg { flex: 1; }
.toast.success { border-color: var(--leaf); box-shadow: 0 4px 0 var(--leaf); background: #f6fbef; }
.toast.error { border-color: #ffcdd2; box-shadow: 0 4px 0 #ffcdd2; background: #fff5f5; color: var(--red-d); }
.toast.info { border-color: #b2ebf2; box-shadow: 0 4px 0 #b2ebf2; background: #f0fbfc; }

/* ---------- Modale ---------- */
.modal-back {
  position: fixed; inset: 0; z-index: 900;
  display: grid; place-items: center;
  padding: 16px;
  background: rgba(34, 34, 34, 0.45);
}
.modal { width: min(100%, 460px); padding: 28px; text-align: center; }
.modal .lumi { width: 96px; margin: 0 auto 12px; }
.modal h3 { font: 900 26px/1.2 var(--font); color: var(--charcoal); margin-bottom: 8px; }
.modal p { color: var(--pencil); margin-bottom: 22px; }
.modal .modal-actions { display: grid; gap: 12px; }

/* ---------- Confettis ---------- */
.confetti { position: fixed; z-index: 1100; pointer-events: none; width: 10px; height: 14px; border-radius: 3px; top: 0; left: 0; }

/* ---------- Divers ---------- */
.empty { text-align: center; padding: 40px 20px; color: var(--pencil); }
.empty .lumi { width: 110px; margin: 0 auto 16px; }
.empty h3 { font: 900 22px/1.2 var(--font); color: var(--charcoal); margin-bottom: 6px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
