@import url("/css/tokens.css");

/* ========== LAYOUT ========== */
.wrap { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.wrap-sm { max-width: 520px; }
.wrap-md { max-width: 820px; }

/* ========== NAV ========== */
.nav {
  position: sticky; top: 0; z-index: 10;
  background: rgba(236, 237, 248, .85);
  backdrop-filter: saturate(1.2) blur(12px);
  -webkit-backdrop-filter: saturate(1.2) blur(12px);
  border-bottom: 1px solid var(--c-border);
}
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 68px;
}
.brand {
  display: inline-flex; align-items: baseline; gap: 10px;
  font-family: var(--font-accent); font-weight: 600;
  font-size: 1.35rem; color: var(--c-ocean);
}
.brand-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--grad-main);
  display: inline-block;
}
.brand small {
  color: var(--c-muted); font-weight: 400; font-size: .75rem;
  font-family: var(--font-main);
}
.nav-actions { display: flex; gap: 10px; align-items: center; }

/* ========== BOUTONS ========== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border-radius: 999px; font-weight: 500;
  border: 1px solid transparent; cursor: pointer;
  transition: transform var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
  font-size: .95rem; text-decoration: none; color: inherit;
  background: #fff; color: var(--c-ocean); border-color: var(--c-border);
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn-primary {
  background: var(--c-ocean); color: #fff; border-color: var(--c-ocean);
}
.btn-primary:hover { background: var(--c-ocean-2); color: #fff; }
.btn-accent {
  background: var(--grad-main); color: var(--c-ocean); border: none;
  font-weight: 600;
}
.btn-ghost { background: transparent; }
.btn-lg { padding: 16px 30px; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* ========== CARDS ========== */
.card {
  background: var(--c-surface);
  border-radius: var(--r-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--c-border);
}
.card-dark {
  background: var(--grad-card-ocean);
  color: #fff;
  border-radius: var(--r-lg);
  padding: 28px;
}
.card-dark h1, .card-dark h2, .card-dark h3 { color: #fff; }

/* ========== HERO LANDING ========== */
.hero {
  background: var(--grad-hero);
  padding: 80px 0 60px;
  position: relative;
  overflow: hidden;
}
.hero-grid {
  display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 60px; align-items: center;
}
.hero h1 { font-size: clamp(2.2rem, 5vw, 3.8rem); }
.hero .tagline {
  font-family: var(--font-accent); font-weight: 500; font-size: 1.1rem;
  color: var(--c-mint-dark);
  text-transform: uppercase; letter-spacing: .14em;
  margin-bottom: 24px;
}
.hero p.lead { font-size: 1.15rem; color: var(--c-muted); max-width: 56ch; }
.hero-cta { display: flex; gap: 12px; margin-top: 28px; flex-wrap: wrap; }
.hero-visual {
  position: relative; aspect-ratio: 1 / 1;
  background: var(--grad-main);
  border-radius: 40% 60% 50% 50% / 60% 40% 60% 40%;
  box-shadow: var(--shadow-lg);
  display: grid; place-items: center; color: var(--c-ocean);
  animation: morph 9s ease-in-out infinite alternate;
}
@keyframes morph {
  0%   { border-radius: 40% 60% 50% 50% / 60% 40% 60% 40%; }
  50%  { border-radius: 56% 44% 38% 62% / 40% 62% 38% 60%; }
  100% { border-radius: 62% 38% 58% 42% / 46% 38% 62% 54%; }
}
.hero-visual .badge-xl {
  font-family: var(--font-accent); font-size: 4.5rem; font-weight: 600;
  color: var(--c-ocean);
}
@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-visual { max-width: 360px; margin: 0 auto; }
}

/* ========== SECTIONS ========== */
section { padding: 64px 0; }
.section-head { text-align: center; margin-bottom: 40px; }
.section-head .eyebrow {
  font-family: var(--font-accent); text-transform: uppercase;
  letter-spacing: .2em; font-size: .85rem; color: var(--c-mint-dark);
  margin-bottom: 8px;
}

.features {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px;
}
.feature {
  padding: 28px;
  background: #fff;
  border-radius: var(--r-lg);
  border: 1px solid var(--c-border);
  transition: transform var(--t-mid), box-shadow var(--t-mid);
}
.feature:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.feature .icon {
  width: 50px; height: 50px; border-radius: var(--r-md);
  display: grid; place-items: center;
  background: var(--c-frosty);
  color: var(--c-ocean); font-size: 1.5rem;
  margin-bottom: 16px;
}
.feature.mint .icon { background: var(--c-mint); color: var(--c-ocean); }
.feature.lime .icon { background: var(--c-lime); color: var(--c-ocean); }
.feature.grape .icon { background: var(--c-grapefruit); color: #fff; }

@media (max-width: 780px) {
  .features { grid-template-columns: 1fr; }
}

/* ========== STUDENT DASH ========== */
.stud-hero {
  background: var(--grad-card-ocean);
  color: #fff;
  border-radius: var(--r-xl);
  padding: 32px;
  margin-top: 24px;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 24px;
  position: relative; overflow: hidden;
}
.stud-hero::after {
  content: ""; position: absolute; right: -80px; top: -80px;
  width: 280px; height: 280px; border-radius: 50%;
  background: radial-gradient(circle, rgba(222,226,121,.5), transparent 65%);
  pointer-events: none;
}
.stud-hero h2 { color: #fff; font-size: 1.8rem; margin-bottom: 6px; }
.stud-hero .muted { color: rgba(255,255,255,.72); }
.level-badge {
  display: inline-flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,.1); padding: 8px 14px; border-radius: 999px;
  backdrop-filter: blur(6px); font-weight: 500; font-size: .9rem;
}
.xp-bar {
  margin-top: 18px; height: 12px; border-radius: 999px;
  background: rgba(255,255,255,.15); overflow: hidden;
}
.xp-bar > div {
  height: 100%; background: var(--grad-main);
  transition: width .4s ease;
}
.stats-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
  align-self: center;
}
.stat {
  background: rgba(255,255,255,.08); padding: 16px; border-radius: var(--r-md);
  text-align: center;
}
.stat .n { font-family: var(--font-accent); font-size: 1.7rem; font-weight: 600; display: block; }
.stat .label { font-size: .75rem; color: rgba(255,255,255,.7); text-transform: uppercase; letter-spacing: .06em; }
@media (max-width: 780px) { .stud-hero { grid-template-columns: 1fr; } }

/* Liste modules */
.mod-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px;
}
.mod {
  background: #fff; border-radius: var(--r-lg); padding: 22px;
  border: 1px solid var(--c-border);
  display: flex; flex-direction: column; gap: 10px;
  transition: transform var(--t-mid), box-shadow var(--t-mid), border-color var(--t-mid);
  cursor: pointer;
  text-decoration: none; color: inherit;
}
.mod:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--c-mint); }
.mod .mod-tag {
  display: inline-block; font-size: .7rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--c-mint-dark); font-weight: 600;
}
.mod h3 { margin: 4px 0; font-family: var(--font-accent); }
.mod .prog {
  height: 6px; background: var(--c-frosty); border-radius: 999px; overflow: hidden;
  margin-top: 6px;
}
.mod .prog > div { height: 100%; background: var(--grad-main); transition: width .4s; }
.mod-footer {
  display: flex; justify-content: space-between; align-items: center; font-size: .85rem; color: var(--c-muted);
  margin-top: auto;
}
.mod.completed { border-color: var(--c-mint); background: linear-gradient(180deg, #fff, #f6fbf8); }
.mod.completed .mod-tag { color: var(--c-ocean); }
.status-pill {
  font-size: .7rem; padding: 3px 10px; border-radius: 999px;
  background: var(--c-frosty); color: var(--c-ocean);
}
.status-pill.ok { background: var(--c-mint); }
.status-pill.wip { background: var(--c-lime); }

/* ========== MODULE PLAYER ========== */
.player {
  background: #fff;
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-md);
  padding: 40px;
  margin-top: 24px;
  min-height: 480px;
  position: relative;
}
.player .progress-strip {
  position: absolute; top: 0; left: 0; right: 0; height: 6px;
  background: var(--c-frosty); border-top-left-radius: var(--r-xl); border-top-right-radius: var(--r-xl);
  overflow: hidden;
}
.player .progress-strip > div { height: 100%; background: var(--grad-main); transition: width .4s; }
.player-head { display: flex; gap: 16px; align-items: center; margin-bottom: 12px; color: var(--c-muted); font-size: .85rem; }
.card-step {
  min-height: 300px; display: flex; flex-direction: column; justify-content: center;
}
.card-step h2 { font-size: 1.8rem; }
.card-step p { font-size: 1.1rem; max-width: 60ch; color: #3a3758; }
.step-actions { display: flex; gap: 12px; margin-top: 28px; flex-wrap: wrap; }
.step-actions .spacer { flex: 1; }

/* Quiz */
.quiz-opt {
  display: block; width: 100%; text-align: left;
  padding: 16px 20px; border-radius: var(--r-md);
  background: var(--c-frosty); border: 2px solid transparent;
  margin-bottom: 10px; cursor: pointer; font-weight: 500;
  transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
  font-family: inherit; color: var(--c-ocean); font-size: 1rem;
}
.quiz-opt:hover { background: #e4e5f2; }
.quiz-opt.selected { border-color: var(--c-mint); background: #dff3e9; }
.quiz-opt.correct { border-color: var(--c-mint); background: #dff3e9; }
.quiz-opt.wrong { border-color: var(--c-grapefruit); background: #ffe3df; }
.quiz-opt[disabled] { cursor: default; }

/* Résultat quiz */
.result-card {
  text-align: center; padding: 30px 10px;
}
.result-card .big-score {
  font-family: var(--font-accent); font-size: 4.5rem; font-weight: 600;
  color: var(--c-ocean); line-height: 1;
}
.result-card .sub { color: var(--c-muted); margin-bottom: 12px; }
.badges-row {
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 18px 0 6px;
}
.badge-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: 999px;
  background: var(--c-lime); color: var(--c-ocean); font-weight: 600;
  animation: pop .6s cubic-bezier(.2,.9,.3,1.4);
}
@keyframes pop {
  from { transform: scale(.7); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ========== TEACHER DASH ========== */
.kpi-row {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin: 24px 0;
}
.kpi {
  background: #fff; border-radius: var(--r-lg); padding: 22px;
  border: 1px solid var(--c-border);
}
.kpi .v { font-family: var(--font-accent); font-size: 2rem; font-weight: 600; }
.kpi .l { color: var(--c-muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .1em; }
.kpi.accent { background: var(--grad-main); color: var(--c-ocean); border: none; }

@media (max-width: 860px) { .kpi-row { grid-template-columns: repeat(2, 1fr); } }

.table-wrap {
  background: #fff; border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--c-border);
}
table.roster {
  width: 100%; border-collapse: collapse;
}
.roster th, .roster td {
  text-align: left; padding: 14px 18px; border-bottom: 1px solid var(--c-border);
  font-size: .92rem;
}
.roster th {
  background: var(--c-frosty); font-family: var(--font-accent); font-weight: 600;
  color: var(--c-ocean); font-size: .8rem; letter-spacing: .08em; text-transform: uppercase;
}
.roster tr:hover td { background: #fafbff; }
.mini-bar {
  display: inline-block; width: 90px; height: 8px; background: var(--c-frosty); border-radius: 999px; overflow: hidden;
  vertical-align: middle; margin-right: 8px;
}
.mini-bar > div { height: 100%; background: var(--grad-main); }

.flag {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px;
}
.flag.green { background: var(--c-mint); }
.flag.grey  { background: #c4c4d6; }
.flag.red   { background: var(--c-grapefruit); }

/* ========== AUTH PAGES ========== */
.auth-wrap {
  min-height: calc(100vh - 68px);
  display: grid; place-items: center;
  padding: 40px 20px;
  background: var(--grad-hero);
}
.auth-card {
  background: #fff; border-radius: var(--r-xl);
  padding: 40px; max-width: 440px; width: 100%;
  box-shadow: var(--shadow-lg);
}
.auth-card h1 { font-size: 1.7rem; margin-bottom: 4px; }
.auth-card .sub { color: var(--c-muted); margin-bottom: 24px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 500; margin-bottom: 6px; font-size: .9rem; }
.field input, .field select {
  width: 100%; padding: 12px 14px; border-radius: var(--r-md);
  border: 1px solid var(--c-border); background: #fcfcff;
  font: inherit; color: var(--c-ocean);
}
.field input:focus, .field select:focus {
  outline: none; border-color: var(--c-mint); background: #fff;
}
.auth-card .alt {
  font-size: .85rem; color: var(--c-muted); text-align: center; margin-top: 16px;
}
.error-msg { color: var(--c-grapefruit); font-size: .9rem; margin-top: 8px; }

/* ========== DIVERS ========== */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--c-frosty); color: var(--c-ocean);
  padding: 4px 10px; border-radius: 999px; font-size: .75rem; font-weight: 500;
}
.chip.mint { background: var(--c-mint); }
.chip.lime { background: var(--c-lime); }
.chip.grape { background: var(--c-grapefruit); color: #fff; }

.footer {
  padding: 40px 0; text-align: center; color: var(--c-muted); font-size: .85rem;
}

.skip-link {
  position: absolute; left: -999px;
  background: var(--c-ocean); color: #fff; padding: 8px 14px; border-radius: 6px;
}
.skip-link:focus { left: 12px; top: 12px; }

/* Toast */
.toast-container {
  position: fixed; top: 20px; right: 20px; z-index: 50;
  display: flex; flex-direction: column; gap: 10px;
}
.toast {
  background: var(--c-ocean); color: #fff; padding: 12px 18px;
  border-radius: var(--r-md); box-shadow: var(--shadow-md);
  animation: slide-in .3s ease;
  font-size: .9rem;
  max-width: 320px;
}
.toast.success { background: var(--c-mint); color: var(--c-ocean); }
.toast.error { background: var(--c-grapefruit); }
@keyframes slide-in {
  from { transform: translateX(120%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* a11y utility */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0;
  margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0;
}
