:root{
  --rpm-bg:#0b1220; --rpm-card:#0f172a; --rpm-text:#e5e7eb; --rpm-sub:#9ca3af;
  --rpm-border:rgba(255,255,255,.08); --rpm-primary:#6366f1; --rpm-primary-2:#8b5cf6;
}
@media (prefers-color-scheme: light){
  :root{ --rpm-bg:#f8fafc; --rpm-card:#ffffff; --rpm-text:#111827; --rpm-sub:#4b5563; --rpm-border:rgba(0,0,0,.06);}
}
.rpm-courses-wrap{ display:grid; gap:1.25rem; }
.rpm-login-message{ padding:.75rem 1rem; border:1px dashed var(--rpm-border); border-radius:12px; color:var(--rpm-sub); }

/* Cartes cours */
.rpm-course-list{ list-style:none; margin:0; padding:0; display:grid; gap:.75rem; }
.rpm-course-item{
  display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap;
  padding:.75rem 1rem; border:1px solid var(--rpm-border); border-radius:12px;
  background:var(--rpm-card); transition:transform .08s ease, border-color .2s ease;
}
.rpm-course-item:hover{ transform:translateY(-1px); border-color: color-mix(in srgb,var(--rpm-primary) 35%, var(--rpm-border)); }
.rpm-course-title{ font-weight:600; color:var(--rpm-text); margin-right:1rem; }
.rpm-course-actions{ display:flex; gap:.5rem; }
.rpm-course-actions a{
  display:inline-flex; align-items:center; padding:.55rem .9rem; border-radius:10px; text-decoration:none; font-weight:600;
  border:1px solid var(--rpm-border); transition:opacity .2s ease, transform .05s ease;
}
a.rpm-course-view{ background:linear-gradient(90deg,var(--rpm-primary),var(--rpm-primary-2)); color:#fff; border-color:transparent; }
a.rpm-course-download{ background:transparent; color:var(--rpm-text); }
.rpm-course-actions a:hover{ opacity:.95 } 
.rpm-course-actions a:active{ transform:translateY(1px) }

/* Accordéon matières (replié par défaut) */
.rpm-subject{
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.02));
  border: 1px solid var(--rpm-border);
  border-radius: 16px;
  padding: .25rem .25rem .75rem;
}
.rpm-subject[open]{ border-color: color-mix(in srgb, var(--rpm-primary) 35%, var(--rpm-border)); }

.rpm-subject-summary{
  list-style: none;
  display: grid;
  grid-template-columns: 1fr auto 20px;
  align-items: center;
  gap: .5rem;
  padding: .9rem 1rem;
  cursor: pointer;
  border-radius: 12px;
  transition: background-color .2s ease;
}
.rpm-subject-summary::-webkit-details-marker{ display:none; }
.rpm-subject-summary:hover{ background: rgba(255,255,255,.04); }
.rpm-subject-title{ font-size: 1.05rem; font-weight: 700; }
.rpm-subject-count{
  display:inline-flex; align-items:center; justify-content:center;
  min-width:2.25rem; height:2rem; padding:0 .6rem; border-radius:999px;
  border:1px solid var(--rpm-border); color:var(--rpm-text); font-weight:700; font-size:.9rem;
  background:var(--rpm-card);
}
.rpm-caret{
  width:0; height:0;
  border-left:6px solid transparent; border-right:6px solid transparent; border-top:7px solid var(--rpm-text);
  transition: transform .2s ease, opacity .2s ease; opacity:.8;
}
.rpm-subject[open] .rpm-caret{ transform: rotate(180deg); opacity:1; }

.rpm-subject[open] .rpm-course-list,
.rpm-subject[open] .rpm-no-course-message{ animation: rpmFadeIn .18s ease; }
@keyframes rpmFadeIn{
  from { opacity:0; transform: translateY(-2px); }
  to   { opacity:1; transform: translateY(0); }
}

.rpm-subject[disabled] .rpm-subject-summary{ cursor: default; opacity:.65; }
