/* ═══════════════════════════════════════════════
   PrépaConcours — Auth & Dashboard styles
   nav-user · login · register · dashboard
═══════════════════════════════════════════════ */

/* ── Nav user zone ──────────────────────────── */
.nav-login-btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .3rem .9rem;
  background: var(--clr-primary);
  color: #fff !important;
  border-radius: 99px;
  font-size: .82rem;
  font-weight: 700;
  text-decoration: none;
  transition: background .18s;
  white-space: nowrap;
}
.nav-login-btn:hover { background: var(--clr-primary-dk); }
.nav-login-btn__icon { width: .9rem; height: .9rem; flex-shrink: 0; }

.nav-user { position: relative; }
.nav-user__btn {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .25rem .7rem .25rem .4rem;
  background: rgba(29,78,216,.1);
  border: 1.5px solid rgba(29,78,216,.22);
  border-radius: 99px;
  cursor: pointer;
  font-family: inherit;
  font-size: .82rem;
  font-weight: 700;
  color: var(--clr-primary-dk);
  transition: background .18s;
}
.nav-user__btn:hover { background: rgba(29,78,216,.17); }
.nav-user__avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 50%;
  background: var(--clr-primary);
  color: #fff;
  font-size: .75rem;
  font-weight: 800;
  flex-shrink: 0;
}
.nav-user__name {
  max-width: 7rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-user__dropdown {
  position: absolute;
  top: calc(100% + .5rem);
  inset-inline-end: 0;
  min-width: 15.5rem;
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  list-style: none;
  padding: .35rem 0;
  z-index: 200;
}
.nav-user__dropdown[hidden] { display: none; }
.nav-user__dropdown li[role="separator"] {
  border-top: 1px solid var(--clr-border);
  margin: .25rem 0;
}

/* ── Résumé (progression + روائز) ── */
.nav-user__stats {
  display: flex;
  gap: .5rem;
  padding: .5rem .9rem .65rem;
}
.nav-user__stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .1rem;
  padding: .45rem .3rem;
  background: var(--clr-primary-lt);
  border-radius: .55rem;
  text-align: center;
}
.nav-user__stat strong { font-size: 1.05rem; color: var(--clr-primary-dk); line-height: 1; }
.nav-user__stat span { font-size: .68rem; color: var(--clr-muted); }

/* ── Reprise de lecture ── */
.nav-user__resume {
  display: flex !important;
  align-items: center;
  gap: .5rem;
  white-space: normal !important;
  line-height: 1.35;
}
.nav-user__resume i { flex-shrink: 0; color: var(--clr-primary); }
.nav-user__resume span {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.nav-user__dropdown a,
.nav-user__dropdown button {
  display: block;
  width: 100%;
  padding: .5rem 1rem;
  font: inherit;
  font-size: .88rem;
  color: var(--clr-body);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  text-align: inherit;
  transition: background .14s;
}
.nav-user__dropdown a:hover,
.nav-user__dropdown button:hover {
  background: var(--clr-primary-lt);
  color: var(--clr-primary-dk);
}

html[data-theme="dark"] .nav-user__btn {
  background: rgba(96,165,250,.1);
  border-color: rgba(96,165,250,.25);
  color: #93c5fd;
}
html[data-theme="dark"] .nav-login-btn { background: #1d4ed8; }

/* ── Auth pages (login / register) ─────────── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  background: linear-gradient(135deg, #f0f4f9 0%, #e5eef8 100%);
}
html[data-theme="dark"] .auth-page {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0,0,0,.1);
  padding: 2.25rem 2rem;
}

.auth-card__logo {
  text-align: center;
  margin-bottom: 1.75rem;
}
.auth-card__logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.25rem;
  height: 3.25rem;
  background: linear-gradient(135deg, #1d4ed8, #2563eb);
  border-radius: .875rem;
  margin-bottom: .6rem;
  font-size: 1.5rem;
}
.auth-card__logo h1 {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--clr-heading);
  margin: 0 0 .2rem;
}
.auth-card__logo p {
  font-size: .82rem;
  color: var(--clr-muted);
  margin: 0;
}

.auth-form { display: flex; flex-direction: column; gap: 1rem; }

.auth-field { display: flex; flex-direction: column; gap: .35rem; }
.auth-field label {
  font-size: .85rem;
  font-weight: 600;
  color: var(--clr-heading);
}
.auth-field input {
  padding: .65rem .9rem;
  border: 1.5px solid var(--clr-border);
  border-radius: var(--radius-sm);
  background: var(--clr-bg);
  color: var(--clr-body);
  font: inherit;
  font-size: .9375rem;
  transition: border-color .18s;
}
.auth-field input:focus {
  outline: none;
  border-color: var(--clr-primary);
  box-shadow: 0 0 0 3px rgba(29,78,216,.12);
}
.auth-field input::placeholder { color: var(--clr-muted); }

.auth-error {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  color: #991b1b;
  border-radius: var(--radius-sm);
  padding: .6rem .9rem;
  font-size: .875rem;
  text-align: center;
}
html[data-theme="dark"] .auth-error {
  background: rgba(220,38,38,.12);
  border-color: #991b1b;
  color: #fca5a5;
}

.auth-submit {
  padding: .75rem;
  background: var(--clr-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .18s;
  margin-top: .25rem;
}
.auth-submit:hover { background: var(--clr-primary-dk); }

.auth-divider {
  display: flex;
  align-items: center;
  gap: .75rem;
  color: var(--clr-muted);
  font-size: .8rem;
  margin: .25rem 0;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--clr-border);
}

.auth-social { display: flex; flex-direction: column; gap: .6rem; }
.auth-social__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .65rem;
  padding: .6rem 1rem;
  border: 1.5px solid var(--clr-border);
  border-radius: var(--radius-sm);
  background: var(--clr-surface);
  color: var(--clr-body);
  font: inherit;
  font-size: .9rem;
  font-weight: 600;
  cursor: not-allowed;
  opacity: .55;
  position: relative;
}
.auth-social__badge {
  position: absolute;
  inset-inline-end: .7rem;
  font-size: .68rem;
  font-weight: 700;
  background: rgba(245,158,11,.15);
  color: #b45309;
  border-radius: 99px;
  padding: .1rem .5rem;
}
html[data-theme="dark"] .auth-social__badge {
  background: rgba(245,158,11,.18);
  color: #fcd34d;
}

.auth-footer {
  text-align: center;
  margin-top: 1.25rem;
  font-size: .875rem;
  color: var(--clr-muted);
}
.auth-footer a { color: var(--clr-primary); font-weight: 600; text-decoration: none; }
.auth-footer a:hover { text-decoration: underline; }

/* ── Dashboard ─────────────────────────────── */
.dash-hero {
  background: linear-gradient(135deg, #172033 0%, #1d4ed8 60%, #1e3a5f 100%);
  color: #fff;
  padding: 4.5rem 0 2.5rem;
}
.dash-hero__inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.dash-hero__avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 5rem;
  height: 5rem;
  border-radius: 50%;
  background: rgba(255,255,255,.18);
  border: 3px solid rgba(255,255,255,.35);
  font-size: 2rem;
  font-weight: 900;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
}
.dash-hero__avatar-wrap { position: relative; flex-shrink: 0; }
.dash-hero__avatar-form { margin: 0; }
.dash-hero__avatar-btn {
  position: absolute;
  bottom: -.15rem;
  left: -.15rem;
  width: 1.9rem;
  height: 1.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  color: var(--clr-primary);
  border-radius: 50%;
  font-size: .95rem;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
  transition: transform .15s;
}
.dash-hero__avatar-btn:hover { transform: scale(1.08); }
.dash-hero__avatar-flash { font-size: .78rem; margin-top: .3rem; }
.dash-hero__avatar-flash--ok { color: #86efac; }
.dash-hero__avatar-flash--err { color: #fca5a5; }
.dash-hero__reset { text-align: center; margin-top: 1rem; }
.dash-reset-btn {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.3);
  color: #f1f5f9;
  font-size: .8rem;
  font-weight: 600;
  padding: .45rem 1rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s;
}
.dash-reset-btn:hover { background: rgba(255,255,255,.22); }
.dash-hero__info h1 {
  font-size: 1.5rem;
  font-weight: 800;
  margin: 0 0 .25rem;
  color: #fff;
}
.dash-hero__info p {
  font-size: .9rem;
  color: rgba(255,255,255,.7);
  margin: 0;
}
.dash-hero__stats {
  margin-top: 1.5rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}
.dash-stat {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: var(--radius-md);
  padding: .65rem 1.1rem;
  min-width: 6rem;
  text-align: center;
}
.dash-stat__val {
  font-size: 1.4rem;
  font-weight: 900;
  color: #fff;
  line-height: 1;
}
.dash-stat__lbl {
  font-size: .78rem;
  color: rgba(255,255,255,.68);
  margin-top: .2rem;
}

.dash-body { padding: 2.5rem 0 4rem; }

/* ── Dashboard: primary competition card ─────── */
.dash-comp {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1.5rem;
  align-items: center;
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-inline-start: 4px solid var(--dc-accent, var(--clr-primary));
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.75rem;
  margin-bottom: 2rem;
  box-shadow: 0 6px 20px rgba(0,0,0,.05);
}
.dash-comp__head {
  display: flex;
  align-items: center;
  gap: .9rem;
  margin-bottom: .75rem;
}
.dash-comp__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3.2rem;
  height: 3.2rem;
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--dc-accent, #1d4ed8) 14%, transparent);
  font-size: 1.7rem;
  flex-shrink: 0;
}
.dash-comp__label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--dc-accent, var(--clr-primary));
}
.dash-comp__title {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--clr-heading);
  margin: .1rem 0 0;
  line-height: 1.3;
}
.dash-comp__desc {
  font-size: .88rem;
  color: var(--clr-muted);
  line-height: 1.7;
  margin: 0 0 1rem;
}
.dash-comp__progress { margin-bottom: 1rem; }
.dash-comp__bar {
  height: 9px;
  background: var(--clr-border);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: .4rem;
}
.dash-comp__fill {
  height: 100%;
  background: var(--dc-accent, var(--clr-primary));
  border-radius: 99px;
  transition: width .6s ease;
}
.dash-comp__pct { font-size: .8rem; color: var(--clr-muted); font-weight: 600; }
.dash-comp__cta {
  display: inline-block;
  padding: .55rem 1.4rem;
  background: var(--dc-accent, var(--clr-primary));
  color: #fff !important;
  border-radius: 99px;
  font-size: .88rem;
  font-weight: 700;
  text-decoration: none;
  transition: filter .18s;
}
.dash-comp__cta:hover { filter: brightness(1.08); }
.dash-comp__stats {
  display: flex;
  flex-direction: column;
  gap: .6rem;
  min-width: 9rem;
}
.dash-comp__stat {
  text-align: center;
  padding: .6rem 1rem;
  background: var(--clr-bg);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-md);
}
.dash-comp__stat strong {
  display: block;
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--clr-heading);
  line-height: 1;
}
.dash-comp__stat span {
  font-size: .72rem;
  color: var(--clr-muted);
  margin-top: .2rem;
  display: block;
}
@media (max-width: 700px) {
  .dash-comp { grid-template-columns: 1fr; }
  .dash-comp__stats { flex-direction: row; min-width: 0; }
  .dash-comp__stat { flex: 1; }
}
.dash-comp__head { position: relative; }
.dash-comp__auto { font-weight: 600; opacity: .7; font-size: .68rem; }
.dash-comp__change {
  margin-inline-start: auto;
  align-self: flex-start;
  background: var(--clr-bg);
  border: 1px solid var(--clr-border);
  color: var(--clr-muted);
  border-radius: 99px;
  padding: .3rem .8rem;
  font: inherit;
  font-size: .78rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color .15s, color .15s;
  white-space: nowrap;
}
.dash-comp__change:hover { border-color: var(--dc-accent, var(--clr-primary)); color: var(--dc-accent, var(--clr-primary)); }

/* ── Competition picker ──────────────────────── */
.comp-picker {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-bottom: 2rem;
}
.comp-picker--open { animation: compFade .25s ease; }
@keyframes compFade { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.comp-picker__title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--clr-heading);
  margin: 0 0 .35rem;
}
.comp-picker__sub {
  font-size: .88rem;
  color: var(--clr-muted);
  margin: 0 0 1.25rem;
}
.comp-picker__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: .85rem;
}
.comp-pick {
  position: relative;
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1rem 1.1rem;
  background: var(--clr-bg);
  border: 2px solid var(--clr-border);
  border-radius: var(--radius-md);
  font: inherit;
  text-align: start;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .12s;
}
.comp-pick:hover {
  border-color: var(--cp-accent, var(--clr-primary));
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0,0,0,.07);
}
.comp-pick--active {
  border-color: var(--cp-accent, var(--clr-primary));
  background: color-mix(in srgb, var(--cp-accent, #1d4ed8) 8%, transparent);
}
.comp-pick:disabled { opacity: .6; cursor: progress; }
.comp-pick__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--cp-accent, #1d4ed8) 14%, transparent);
  font-size: 1.4rem;
  flex-shrink: 0;
}
.comp-pick__title {
  font-size: .9rem;
  font-weight: 700;
  color: var(--clr-heading);
  line-height: 1.35;
  flex: 1;
}
.comp-pick__check {
  position: absolute;
  inset-inline-end: .7rem;
  top: .6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  background: var(--cp-accent, var(--clr-primary));
  color: #fff;
  font-size: .8rem;
  font-weight: 800;
}
.dash-tabs {
  display: flex;
  gap: .25rem;
  border-bottom: 2px solid var(--clr-border);
  margin-bottom: 2rem;
  overflow-x: auto;
}
.dash-tab {
  padding: .65rem 1.25rem;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  font: inherit;
  font-size: .9375rem;
  font-weight: 600;
  color: var(--clr-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: color .15s;
}
.dash-tab:hover { color: var(--clr-primary); }
.dash-tab--active {
  color: var(--clr-primary);
  border-bottom-color: var(--clr-primary);
}

.dash-section { display: none; }
.dash-section--active { display: block; }

.dash-section-title {
  font-size: 1.125rem;
  font-weight: 800;
  color: var(--clr-heading);
  margin: 0 0 1.25rem;
}

/* Progress cards */
.progress-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.progress-card {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.25rem;
  text-decoration: none;
  color: inherit;
  transition: box-shadow .18s, transform .18s;
  display: block;
}
.progress-card:hover {
  box-shadow: 0 8px 24px rgba(0,0,0,.09);
  transform: translateY(-2px);
}
.progress-card__head {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: .85rem;
}
.progress-card__icon {
  font-size: 1.5rem;
  flex-shrink: 0;
  line-height: 1;
}
.progress-card__title {
  font-size: .9375rem;
  font-weight: 700;
  color: var(--clr-heading);
  line-height: 1.35;
}
.progress-bar-wrap {
  height: 7px;
  background: var(--clr-border);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: .45rem;
}
.progress-bar-fill {
  height: 100%;
  background: var(--clr-primary);
  border-radius: 99px;
  transition: width .4s ease;
}
.progress-card__meta {
  font-size: .78rem;
  color: var(--clr-muted);
}

/* ── مساري (parcours personnalisé) ────────────────────────── */
.mypath-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.mypath-encouragement {
  color: var(--clr-muted);
  font-size: .88rem;
  margin-top: .35rem;
}
.mypath-ring {
  --size: 4.5rem;
  --thickness: 7px;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(closest-side, var(--clr-surface) 0%, var(--clr-surface) calc(100% - var(--thickness) - 2px), transparent calc(100% - var(--thickness) - 1px)),
    conic-gradient(#7dd3fc calc(var(--pct) * 1%), var(--clr-border) 0);
}
.mypath-ring__val {
  font-size: .95rem;
  font-weight: 800;
  color: var(--clr-heading);
}
.mypath-list {
  display: flex;
  flex-direction: column;
  gap: .65rem;
}
.mypath-card {
  display: flex;
  align-items: center;
  gap: .9rem;
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-inline-start: 4px solid var(--clr-border);
  border-radius: var(--radius-md);
  padding: .85rem 1.1rem;
  text-decoration: none;
  color: inherit;
  transition: box-shadow .18s, transform .18s;
}
.mypath-card:hover { box-shadow: 0 8px 24px rgba(0,0,0,.09); transform: translateY(-1px); }
.mypath-card--done     { border-inline-start-color: #6ee7b7; }
.mypath-card--progress { border-inline-start-color: #7dd3fc; }
.mypath-card--todo     { opacity: .8; }
.mypath-card__rank {
  flex-shrink: 0;
  width: 1.6rem;
  height: 1.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--clr-bg-alt);
  color: var(--clr-muted);
  font-size: .72rem;
  font-weight: 800;
}
.mypath-card__icon { font-size: 1.35rem; flex-shrink: 0; }
.mypath-card__body { flex: 1; min-width: 0; display: block; }
.mypath-card__title {
  display: block;
  font-size: .9rem;
  font-weight: 700;
  color: var(--clr-heading);
  margin-bottom: .4rem;
}
.mypath-card__meta { display: block; font-size: .74rem; color: var(--clr-muted); margin-top: .3rem; }
.mypath-card__status {
  flex-shrink: 0;
  font-size: .74rem;
  font-weight: 700;
  color: var(--clr-muted);
  white-space: nowrap;
}
.mypath-card--done .mypath-card__status { color: #10b981; }
.mypath-card--progress .mypath-card__status { color: #0ea5e9; }
@media (max-width: 640px) {
  .mypath-card { flex-wrap: wrap; }
  .mypath-card__status { order: 4; width: 100%; }
}

/* Quiz history */
.quiz-history { display: flex; flex-direction: column; gap: .75rem; }
.quiz-hist-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .875rem 1rem;
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: inherit;
  transition: background .15s;
}
.quiz-hist-item:hover { background: var(--clr-primary-lt); }
.quiz-hist-item__icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}
.quiz-hist-item__info { flex: 1; min-width: 0; }
.quiz-hist-item__title {
  font-size: .9rem;
  font-weight: 700;
  color: var(--clr-heading);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.quiz-hist-item__date {
  font-size: .78rem;
  color: var(--clr-muted);
  margin-top: .15rem;
}
.quiz-hist-item__badge {
  flex-shrink: 0;
  font-size: .875rem;
  font-weight: 800;
  padding: .2rem .65rem;
  border-radius: 99px;
}
.quiz-hist-item__badge--great { background: #f0fdf4; color: #16a34a; }
.quiz-hist-item__badge--ok    { background: #fffbeb; color: #b45309; }
.quiz-hist-item__badge--low   { background: #fef2f2; color: #b91c1c; }
html[data-theme="dark"] .quiz-hist-item__badge--great { background: rgba(22,163,74,.15); color: #86efac; }
html[data-theme="dark"] .quiz-hist-item__badge--ok    { background: rgba(245,158,11,.1);  color: #fcd34d; }
html[data-theme="dark"] .quiz-hist-item__badge--low   { background: rgba(220,38,38,.12);  color: #fca5a5; }

/* Favorites */
.fav-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
}
.fav-card {
  display: flex;
  flex-direction: column;
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-md);
  padding: 1rem 1.125rem;
  text-decoration: none;
  color: inherit;
  transition: box-shadow .18s;
}
.fav-card:hover { box-shadow: 0 8px 24px rgba(0,0,0,.09); }
.fav-card__icon { font-size: 1.5rem; margin-bottom: .5rem; }
.fav-card__title {
  font-size: .9375rem;
  font-weight: 700;
  color: var(--clr-heading);
  flex: 1;
  line-height: 1.35;
}
.fav-card__comp {
  font-size: .78rem;
  color: var(--clr-muted);
  margin-top: .5rem;
}

.dash-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--clr-muted);
}
.dash-empty__icon { font-size: 2.5rem; margin-bottom: .75rem; }
.dash-empty p { font-size: .9375rem; margin: 0; }

/* ── Suggestions de contenu ─────────────────────────────── */
.suggest-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 36rem;
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
}
.suggest-form__row { display: flex; flex-direction: column; gap: .4rem; }
.suggest-form__row label { font-size: .85rem; font-weight: 600; color: var(--clr-text); }
.suggest-form__row select,
.suggest-form__row input,
.suggest-form__row textarea {
  font: inherit;
  padding: .55rem .7rem;
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-sm);
  background: var(--clr-bg);
  color: var(--clr-text);
}
.suggest-form__row textarea { resize: vertical; }
.suggest-form__hint { font-size: .78rem; color: var(--clr-muted); margin-top: -.1rem; }
.suggest-flash {
  padding: .7rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .875rem;
}
.suggest-flash--ok  { background: rgba(22,163,74,.12); color: #16a34a; }
.suggest-flash--err { background: rgba(220,38,38,.12); color: #dc2626; }

.suggest-list { display: flex; flex-direction: column; gap: .85rem; margin-top: 1rem; }
.suggest-card {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-md);
  padding: 1rem 1.125rem;
}
.suggest-card__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  margin-bottom: .4rem;
  flex-wrap: wrap;
}
.suggest-card__comp { font-size: .8rem; color: var(--clr-muted); font-weight: 600; }
.suggest-card__title { font-size: .95rem; font-weight: 700; color: var(--clr-heading); }
.suggest-card__desc { font-size: .85rem; color: var(--clr-muted); margin-top: .35rem; }
.suggest-card__content {
  margin-top: .5rem;
  font-size: .85rem;
  background: var(--clr-bg-alt);
  border-radius: var(--radius-sm);
  padding: .5rem .7rem;
}
.suggest-card__content summary { cursor: pointer; font-weight: 600; color: var(--clr-primary); }
.suggest-card__content p { margin-top: .5rem; color: var(--clr-text); line-height: 1.6; white-space: pre-line; }
.suggest-card__note {
  margin-top: .5rem;
  padding: .5rem .7rem;
  border-radius: var(--radius-sm);
  background: var(--clr-bg-alt);
  font-size: .8rem;
}
.suggest-card__date { font-size: .72rem; color: var(--clr-muted); margin-top: .5rem; }
.suggest-badge {
  font-size: .68rem;
  font-weight: 700;
  padding: .15rem .6rem;
  border-radius: 99px;
  white-space: nowrap;
}
.suggest-badge--pending  { background: rgba(217,119,6,.14);  color: #d97706; }
.suggest-badge--approved { background: rgba(22,163,74,.14);  color: #16a34a; }
.suggest-badge--rejected { background: rgba(220,38,38,.14);  color: #dc2626; }

/* ── Favorite toggle button (in module page) ─ */
.fav-btn {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .45rem .9rem;
  border: 1.5px solid var(--clr-border);
  border-radius: 99px;
  background: var(--clr-surface);
  color: var(--clr-muted);
  font: inherit;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .18s, color .18s, background .18s;
}
.fav-btn:hover { border-color: #ef4444; color: #ef4444; }
.fav-btn--active {
  border-color: #ef4444;
  background: #fef2f2;
  color: #ef4444;
}
html[data-theme="dark"] .fav-btn--active {
  background: rgba(239,68,68,.12);
  border-color: #991b1b;
  color: #fca5a5;
}
.fav-btn__heart { font-size: 1rem; line-height: 1; }

/* Favorite button on the colored module hero — glass style for contrast */
.module-hero .fav-btn {
  background: rgba(255,255,255,.16);
  border: 1.5px solid rgba(255,255,255,.55);
  color: #fff;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(0,0,0,.12);
}
.module-hero .fav-btn:hover {
  background: rgba(255,255,255,.28);
  border-color: #fff;
  color: #fff;
}
.module-hero .fav-btn--active {
  background: #fff;
  border-color: #fff;
  color: #e11d48;
}
.module-hero .fav-btn--active:hover {
  background: #fff;
  color: #e11d48;
}
.module-hero .fav-btn__heart { font-size: 1.05rem; }

/* ── Chapter done indicator (sidebar) ────────── */
.ch-done-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 50%;
  background: #16a34a;
  color: #fff;
  font-size: .65rem;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity .3s;
}
.ch-done-mark--visible { opacity: 1; }

/* Logged-in users get the DB-backed ✓ (.ch-done-mark); suppress the old
   localStorage "opened" checkmark from module.css to avoid a duplicate. */
.chapters--auth .chapter.is-read .chapter__header::after { content: none !important; }
.chapters--auth .chapter.is-read .chapter__header { border-inline-start: 0 !important; }

/* End-of-chapter sentinel — invisible 1px marker used to detect "read to end" */
.ch-end-sentinel {
  display: block;
  width: 100%;
  height: 1px;
  margin: 0;
  pointer-events: none;
}

/* ── Resume reading banner ───────────────────── */
.resume-banner {
  display: flex;
  align-items: center;
  gap: .9rem;
  padding: .85rem 1.1rem;
  margin-bottom: 1.25rem;
  background: linear-gradient(135deg, rgba(29,78,216,.08), rgba(37,99,235,.04));
  border: 1.5px solid rgba(29,78,216,.22);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: inherit;
  transition: border-color .18s, box-shadow .18s, transform .12s;
}
a.resume-banner:hover {
  border-color: var(--clr-primary);
  box-shadow: 0 6px 18px rgba(29,78,216,.12);
  transform: translateY(-1px);
}
.resume-banner__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  background: var(--clr-primary);
  color: #fff;
  font-size: 1.2rem;
  font-weight: 800;
  flex-shrink: 0;
}
.resume-banner__text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .15rem; }
.resume-banner__text strong { font-size: .9rem; color: var(--clr-heading); }
.resume-banner__text span {
  font-size: .82rem;
  color: var(--clr-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.resume-banner__go {
  flex-shrink: 0;
  font-size: .82rem;
  font-weight: 700;
  color: var(--clr-primary);
  white-space: nowrap;
}
.resume-banner--done {
  background: linear-gradient(135deg, rgba(22,163,74,.08), rgba(22,163,74,.03));
  border-color: rgba(22,163,74,.25);
}
.resume-banner--done .resume-banner__icon { background: #16a34a; }

html[data-theme="dark"] .resume-banner {
  background: linear-gradient(135deg, rgba(96,165,250,.1), rgba(37,99,235,.05));
  border-color: rgba(96,165,250,.25);
}
html[data-theme="dark"] .resume-banner--done {
  background: linear-gradient(135deg, rgba(22,163,74,.12), rgba(22,163,74,.04));
  border-color: rgba(34,197,94,.3);
}

/* ── Sidebar: per-module progress ────────────── */
.sidebar-progress__bar {
  height: 8px;
  background: var(--clr-border);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: .55rem;
}
.sidebar-progress__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--clr-primary), #2563eb);
  border-radius: 99px;
  transition: width .5s ease;
}
.sidebar-progress__meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .82rem;
  color: var(--clr-muted);
}
.sidebar-progress__meta strong { color: var(--clr-primary); font-size: .95rem; }

/* ── Sidebar: competition info widget ────────── */
.comp-widget {
  border-top: 3px solid var(--cw-accent, var(--clr-primary)) !important;
}
.comp-widget__head {
  display: flex;
  align-items: center;
  gap: .7rem;
  margin-bottom: .7rem;
}
.comp-widget__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--cw-accent, #1d4ed8) 14%, transparent);
  font-size: 1.4rem;
  flex-shrink: 0;
}
.comp-widget__label {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--cw-accent, var(--clr-primary));
}
.comp-widget__title {
  font-size: .92rem;
  font-weight: 800;
  color: var(--clr-heading);
  line-height: 1.3;
}
.comp-widget__desc {
  font-size: .82rem;
  color: var(--clr-muted);
  line-height: 1.6;
  margin: 0 0 .85rem;
}
.comp-widget__stats {
  display: flex;
  gap: .6rem;
  margin-bottom: .85rem;
}
.comp-widget__stats > div {
  flex: 1;
  text-align: center;
  padding: .5rem;
  background: var(--clr-bg);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-sm);
}
.comp-widget__stats strong {
  display: block;
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--clr-heading);
  line-height: 1;
}
.comp-widget__stats span {
  font-size: .72rem;
  color: var(--clr-muted);
}
.comp-widget__link {
  display: block;
  text-align: center;
  padding: .55rem;
  background: var(--cw-accent, var(--clr-primary));
  color: #fff !important;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  font-weight: 700;
  text-decoration: none;
  transition: filter .18s;
}
.comp-widget__link:hover { filter: brightness(1.08); }
