/* =========================================================
   🍏 Apple-like Minimal (Medical Light)
   - Fond clinique: #F7FAFC (très utilisé en apps santé)
   - Bleu logo en accent: #024B96
   - Ultra clean + micro-interactions (subtiles)
   - HTML inchangé (mêmes classes)
========================================================= */

/* =========================
   THEME TOKENS
========================= */
:root{
  /* Medical light */
  --bg: #F7FAFC;
  --card: #FFFFFF;
  --surface: #F2F6FB;

  /* Typography */
  --ink: #0B1B2B;
  --muted: rgba(11,27,43,.64);
  --muted2: rgba(11,27,43,.44);

  /* Logo blue */
  --primary: #024B96;
  --primary-dark: #003B89;
  --primary-soft: rgba(2,75,150,.12);
  --primary-soft2: rgba(2,75,150,.06);

  /* Lines & shadows (Apple-like) */
  --line: rgba(11,27,43,.10);
  --line2: rgba(2,75,150,.18);
  --shadow1: 0 1px 0 rgba(0,0,0,.03);
  --shadow2: 0 10px 30px rgba(11,27,43,.08);

  /* Radius */
  --r12: 12px;
  --r14: 14px;
  --r16: 16px;

  /* Motion (subtle) */
  --ease: cubic-bezier(.2,.8,.2,1);
  --t: 180ms var(--ease);
  --t2: 260ms var(--ease);
  --ring: 0 0 0 3px rgba(2,75,150,.16);
}

/* =========================
   BASE
========================= */
html, body {
  height: 100%;
  margin: 0;
  background: var(--bg);
}

body {
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
               system-ui, Segoe UI, Roboto, Arial, "Apple Color Emoji","Segoe UI Emoji";
  color: var(--ink);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.main-content { flex: 1 0 auto; }

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--t);
}
a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

/* Nice selection */
::selection { background: rgba(2,75,150,.14); }

/* Reduced motion */
@media (prefers-reduced-motion: reduce){
  * { transition: none !important; animation: none !important; }
}

/* ================= HEADER ================= */
.header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.86);
  backdrop-filter: blur(12px);
  display: flex;
  justify-content: space-between;
  align-items: center;

  position: sticky;
  top: 0;
  z-index: 50;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  height: 88px;
  width: 88px;
  object-fit: cover;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow1);
}

.brandTitle {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: .2px;
  color: var(--ink);
}

.brandSub {
  font-size: 12px;
  color: var(--muted);
}

.headerActions {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
}

/* =========================
   BUTTONS
========================= */
button,
.btnAdminHeader,
.btnDownloadApp,
a.btnSmall,
.btnPrimary,
.btnSecondary,
.btnDanger,
.backLink {
  transition: transform var(--t), box-shadow var(--t), background var(--t), border-color var(--t), color var(--t), opacity var(--t);
}

button {
  padding: 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(2,75,150,.18);
}

button:hover {
  transform: translateY(-1px);
  background: var(--primary-dark);
  box-shadow: 0 10px 24px rgba(2,75,150,.22);
}

button:active { transform: translateY(0); }

button:focus {
  outline: none;
  box-shadow: var(--ring), 0 10px 24px rgba(2,75,150,.22);
}

.btnSmall {
  padding: 8px 12px;
  border-radius: 10px;
  height: 36px;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Header admin button */
.btnAdminHeader {
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
  box-shadow: var(--shadow1);
}
.btnAdminHeader:hover {
  transform: translateY(-1px);
  border-color: var(--line2);
  box-shadow: 0 10px 24px rgba(11,27,43,.08);
  text-decoration: none;
}

/* Download app */
.btnDownloadApp {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(2,75,150,.18);
}
.btnDownloadApp:hover {
  transform: translateY(-1px);
  background: var(--primary-dark);
  box-shadow: 0 10px 24px rgba(2,75,150,.22);
  text-decoration: none;
}
.btnDownloadApp .downloadIcon { font-size: 16px; }

/* Modifier = même style que bouton, couleur bleu */
.btnEdit {
  background-color: var(--primary);
  color: #fff;
  text-decoration: none;
  border: 1px solid transparent;
  box-shadow: 0 8px 20px rgba(2,75,150,.18);
}
.btnEdit:hover {
  background-color: var(--primary-dark);
  transform: translateY(-1px);
  color: #fff;
  text-decoration: none;
  box-shadow: 0 10px 24px rgba(2,75,150,.22);
}

/* lien qui se comporte comme un bouton */
.btnLink {
  text-decoration: none;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btnLink:hover {
  text-decoration: none;
  color: #fff;
}

/* btnSmall en <a> */
a.btnSmall {
  border: none;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  box-sizing: border-box;
  text-decoration: none;
  box-shadow: 0 8px 20px rgba(2,75,150,.18);
}
a.btnSmall:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  text-decoration: none;
  color: #fff;
  box-shadow: 0 10px 24px rgba(2,75,150,.22);
}

/* Primary/Secondary/Danger */
.btnPrimary {
  display: inline-block;
  padding: 14px 24px;
  border-radius: 12px;
  border: none;
  background: var(--primary);
  color: #fff;
  font-weight: 900;
  font-size: 16px;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  box-shadow: 0 8px 20px rgba(2,75,150,.18);
}
.btnPrimary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  text-decoration: none;
  color: #fff;
  box-shadow: 0 10px 24px rgba(2,75,150,.22);
}

.btnSecondary {
  display: inline-block;
  padding: 14px 24px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-weight: 900;
  font-size: 16px;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  box-shadow: var(--shadow1);
}
.btnSecondary:hover {
  transform: translateY(-1px);
  border-color: var(--line2);
  text-decoration: none;
  color: var(--ink);
  box-shadow: 0 14px 34px rgba(11,27,43,.10);
}

.btnDanger {
  display: inline-block;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid rgba(2,75,150,.25);
  background: rgba(2,75,150,.06);
  color: var(--primary-dark);
  font-weight: 900;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
}
.btnDanger:hover {
  transform: translateY(-1px);
  background: rgba(2,75,150,.09);
  border-color: rgba(2,75,150,.35);
  text-decoration: none;
}

.backLink {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
  font-weight: 900;
  font-size: 14px;
  text-decoration: none;
  box-shadow: var(--shadow1);
}
.backLink:hover {
  transform: translateY(-1px);
  border-color: var(--line2);
  text-decoration: none;
  color: var(--ink);
  box-shadow: 0 14px 34px rgba(11,27,43,.10);
}

/* =========================
   LAYOUT / CARDS
========================= */
.card {
  max-width: 920px;
  margin: 22px auto;
  padding: 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r16);
  box-shadow: var(--shadow2);
}

.topbar {
  max-width: 920px;
  margin: 10px auto;
  padding: 0 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* =========================
   FORMS
========================= */
.form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 12px 0;
}

input, textarea, select {
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  outline: none;
}
input::placeholder, textarea::placeholder { color: var(--muted2); }

input:focus, textarea:focus, select:focus {
  border-color: var(--line2);
  box-shadow: var(--ring);
}

/* =========================
   ERRORS
========================= */
.error {
  color: var(--primary-dark);
  font-weight: 700;
}

/* =========================
   LISTS
========================= */
.list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.list li {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  box-shadow: var(--shadow1);
  transition: transform var(--t), border-color var(--t);
}

.list li:hover {
  transform: translateY(-1px);
  border-color: var(--line2);
}

.tag {
  font-size: 11px;
  background: var(--primary-soft2);
  border: 1px solid var(--line2);
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 8px;
  color: var(--primary-dark);
  font-weight: 800;
}

/* =========================
   DASHBOARD BUTTONS
========================= */
.buttonGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.btnTile {
  display: block;
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  background: #fff;
  color: var(--ink);
  box-shadow: var(--shadow1);
  transition: transform var(--t), border-color var(--t), box-shadow var(--t);
}

.btnTile:hover {
  transform: translateY(-2px);
  border-color: var(--line2);
  box-shadow: 0 14px 34px rgba(11,27,43,.10);
  text-decoration: none;
}

.btnTile:active { transform: translateY(-1px); }

.btnTitle {
  font-weight: 900;
  font-size: 16px;
  margin-bottom: 6px;
  color: var(--ink);
}

.btnTag {
  display: inline-block;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: var(--surface);
  transition: border-color var(--t), color var(--t);
}

.btnTile:hover .btnTag {
  border-color: var(--line2);
  color: var(--primary-dark);
}

/* Appear animation (subtle) */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.buttonGrid .btnTile { animation: fadeUp 0.4s var(--ease) both; }
.buttonGrid .btnTile:nth-child(1){ animation-delay: .05s; }
.buttonGrid .btnTile:nth-child(2){ animation-delay: .10s; }
.buttonGrid .btnTile:nth-child(3){ animation-delay: .15s; }
.buttonGrid .btnTile:nth-child(4){ animation-delay: .20s; }
.buttonGrid .btnTile:nth-child(5){ animation-delay: .25s; }
.buttonGrid .btnTile:nth-child(6){ animation-delay: .30s; }
.buttonGrid .btnTile:nth-child(7){ animation-delay: .35s; }

/* =========================
   CONTENT
========================= */
.grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 16px;
}

.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  box-shadow: var(--shadow1);
}

.content {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #fff;
  box-shadow: var(--shadow1);
}

pre {
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  color: var(--ink);
}

/* =========================
   QCM
========================= */
.qcm {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  margin-top: 12px;
  background: #fff;
  box-shadow: var(--shadow1);
}

.hint { color: var(--muted); }

/* barre note en bas */
.scoreBar{
  margin-top:16px;
  padding:12px 14px;
  border-radius:14px;
  background: var(--surface);
  border:1px solid var(--line);
  font-weight:900;
  color: var(--ink);
}

/* QCM layout */
#choicesBox{
  display:flex;
  flex-direction:column;
  gap:10px;
  margin-bottom:14px;
}

.choiceItem{
  display:flex;
  gap:10px;
  align-items:center;
  padding:12px 12px;
  border-radius:14px;
  border:1px solid var(--line);
  background:#fff;
  cursor:pointer;
  box-shadow: var(--shadow1);
  transition: transform var(--t), border-color var(--t), box-shadow var(--t);
}
.choiceItem:hover{
  transform: translateY(-1px);
  border-color: var(--line2);
  box-shadow: 0 12px 26px rgba(11,27,43,.08);
}
.choiceItem input{ transform: scale(1.1); }

/* vert/rouge corrections (version clinique bleue) */
.choiceCorrect{
  border-color: rgba(2,75,150,.35);
  background: rgba(2,75,150,.05);
}
.choiceWrong{
  border-color: rgba(0,59,137,.30);
  background: rgba(0,59,137,.04);
}
.choiceSelected{
  box-shadow: 0 0 0 2px rgba(2,75,150,.10) inset, var(--shadow1);
}

/* cacher les couleurs */
.hideCorrections.choiceCorrect,
.hideCorrections.choiceWrong{
  border-color: var(--line) !important;
  background:#fff !important;
}

/* =========================
   NEWS
========================= */
.newsGrid{
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap:12px;
  margin-top:12px;
}

.newsItem{
  background:#fff;
  border:1px solid var(--line);
  border-radius:16px;
  padding:14px;
  box-shadow: var(--shadow1);
  transition: transform var(--t), border-color var(--t), box-shadow var(--t);
}

.newsItem:hover{
  transform: translateY(-2px);
  border-color: var(--line2);
  box-shadow: 0 14px 34px rgba(11,27,43,.10);
}

.newsHeader{
  display:flex;
  justify-content:space-between;
  gap:10px;
  margin-bottom:10px;
}

.newsTitle{
  font-weight:900;
  font-size:14px;
  color: var(--ink);
}

.newsDate{
  font-size:12px;
  color: var(--muted2);
  white-space:nowrap;
}

.newsText{
  margin:0 0 10px 0;
  color: var(--muted);
  line-height:1.6;
}

.newsImg, .newsVideo{
  width:100%;
  border-radius:14px;
  border:1px solid var(--line);
}

/* ================= NEWS CARDS (MINI) ================= */
.newsCard{
  display:block;
  text-decoration:none;
  color: var(--ink);
  border:1px solid var(--line);
  border-radius:16px;
  overflow:hidden;
  background:#fff;
  box-shadow: var(--shadow1);
  transition: transform var(--t), border-color var(--t), box-shadow var(--t);
}

.newsCard:hover{
  transform: translateY(-2px);
  border-color: var(--line2);
  box-shadow: 0 14px 34px rgba(11,27,43,.10);
  text-decoration:none;
}

.newsThumb{
  position:relative;
  width:100%;
  height:160px;
  background: var(--surface);
  border-bottom:1px solid var(--line);
  display:flex;
  align-items:center;
  justify-content:center;
}

.newsThumb img,
.newsThumb video{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}

.textThumb{
  font-size:42px;
  opacity:0.9;
  color: var(--primary-dark);
}

.playBadge{
  position:absolute;
  right:10px;
  bottom:10px;
  background: rgba(255,255,255,.84);
  border:1px solid var(--line);
  border-radius:999px;
  padding:6px 10px;
  font-weight:900;
  color: var(--primary-dark);
}

.newsCardBody{ padding:12px; }

.newsSnippet{
  margin-top:8px;
  font-size:12px;
  color: var(--muted);
  line-height:1.45;
}

/* ================= NEWS DETAIL (GRAND) ================= */
.newsImgLarge{
  width:100%;
  margin-top:14px;
  border-radius:16px;
  border:1px solid var(--line);
}

.newsVideoLarge{
  width:100%;
  margin-top:14px;
  border-radius:16px;
  border:1px solid var(--line);
}

/* ================= PANORAMA (carousel) ================= */
.panoramaWrap {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow1);
}

.panoramaTrack {
  display: flex;
  gap: 16px;
  padding: 18px;
  width: max-content;
  animation: panoScroll 50s linear infinite;
}

.panoramaWrap:hover .panoramaTrack {
  animation-play-state: paused;
}

.panoramaItem {
  width: 420px;
  height: 220px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  flex: 0 0 auto;
  background: var(--surface);
  transition: transform var(--t), box-shadow var(--t), border-color var(--t);
}

.panoramaItem:hover{
  transform: translateY(-2px);
  border-color: var(--line2);
  box-shadow: 0 14px 34px rgba(11,27,43,.10);
}

.panoramaItem img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

@keyframes panoScroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.panoAdminImg{
  width: 100%;
  height: 320px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid var(--line);
  display: block;
}

/* =========================
   COURSE BUTTONS
========================= */
.courseButtons {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-top: 24px;
}

.btnCourse {
  display: block;
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  padding: 16px 20px;
  border-radius: 14px;
  font-weight: 900;
  text-align: center;
  box-shadow: 0 8px 20px rgba(2,75,150,.18);
}
.btnCourse:hover {
  transform: translateY(-1px);
  background: var(--primary-dark);
  box-shadow: 0 10px 24px rgba(2,75,150,.22);
}

.courseBtn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  border-radius: 16px;
  text-decoration: none;
  color: #fff;
  font-weight: 900;
  font-size: 15px;
  box-shadow: 0 8px 20px rgba(2,75,150,.14);
}
.courseBtn:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(2,75,150,.18);
  text-decoration: none;
}

.courseBtnIcon { font-size: 32px; margin-bottom: 10px; }

/* Apple-like: même base bleue pour cohérence clinique */
.courseBtnCours,
.courseBtnResume,
.courseBtnQuestions,
.courseBtnRecommendations {
  background: var(--primary);
}

.courseBtnEmpty { opacity: 0.55; filter: grayscale(30%); }
.courseBtnStatus { font-size: 11px; opacity: 0.9; margin-top: 6px; font-weight: 700; }

/* =========================
   ADMIN QUESTIONS
========================= */
.choiceRow {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.choiceRow input[type="text"] { flex: 1; }

.choiceRow label {
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  font-size: 13px;
  color: var(--muted);
}

/* =========================
   QUIZ SELECT
========================= */
.quizTypeCards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.quizTypeCard {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px;
  text-align: center;
  transition: transform var(--t), border-color var(--t), box-shadow var(--t);
  box-shadow: var(--shadow1);
}

.quizTypeCard:hover:not(.disabled) {
  border-color: var(--line2);
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(11,27,43,.10);
}

.quizTypeCard.clickable {
  text-decoration: none;
  color: inherit;
  display: block;
  cursor: pointer;
}

.quizTypeCard.disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.quizTypeWrapper { display: flex; flex-direction: column; }
.resetForm { margin-top: 10px; text-align: center; }

.quizTypeCard h3 {
  font-size: 20px;
  margin-bottom: 8px;
  color: var(--primary-dark);
  font-weight: 900;
}

.quizTypeCard .quizCount {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 15px;
}

.quizProgressInfo {
  background: var(--surface);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 15px;
  border: 1px solid var(--line);
}

.quizProgressInfo p {
  font-size: 13px;
  margin: 4px 0;
  color: var(--muted);
}

.badge.completed {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  margin-top: 8px;
}

/* =========================
   PASSWORD TOGGLE
========================= */
.passwordWrapper { position: relative; width: 100%; }
.passwordWrapper input { width: 100%; box-sizing: border-box; }

.togglePassword {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  padding: 0;
  line-height: 1;
  opacity: 0.55;
  color: var(--ink);
}
.togglePassword:hover { opacity: 1; }

/* =========================
   PDF VIEWER
========================= */
.pdfViewer {
  width: 100%;
  min-height: 400px;
  max-height: 70vh;
  background: #fff;
  border-radius: 16px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 10px;
  box-sizing: border-box;
  margin-top: 10px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow1);
}

.pdfLoading {
  color: var(--muted);
  padding: 40px;
  text-align: center;
}

.pdfPage {
  border-radius: 8px;
  box-shadow: 0 10px 22px rgba(11,27,43,.12);
}

.pdfControls {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 15px;
  padding: 10px;
  background: #fff;
  border-radius: 14px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow1);
}

.pdfControls button {
  padding: 8px 14px;
  font-size: 14px;
  min-width: 40px;
}

.pdfControls span {
  font-size: 14px;
  color: var(--muted);
  padding: 0 10px;
}

/* =========================
   CONTENT PROTECTION
========================= */
.locked {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.textContent {
  line-height: 1.7;
  margin-top: 15px;
  white-space: pre-wrap;
  color: var(--muted);
}

/* =========================
   LANGUAGE SELECTOR
========================= */
.langSelect {
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23024B96' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

.langSelectFlags {
  font-size: 20px;
  padding: 6px 28px 6px 10px;
  min-width: 50px;
  text-align: center;
}

.langSelect:hover { border-color: var(--line2); box-shadow: var(--ring); }

.langSelect option {
  background: #fff;
  color: var(--ink);
  padding: 10px;
  font-size: 18px;
}

/* =========================
   COUNTDOWN / QUOTE
========================= */
.countdownBox, .quoteBox {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  background: #fff;
  box-shadow: var(--shadow1);
}

.countdownGrid {
  display: grid;
  grid-template-columns: repeat(5, minmax(88px, 1fr));
  gap: 10px;
}

.cdItem {
  text-align: center;
  border-radius: 14px;
  padding: 10px 8px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.cdNum {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0.5px;
  color: var(--ink);
}

.cdLbl {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
  font-weight: 700;
}

.quoteText {
  font-size: 16px;
  line-height: 1.45;
  font-weight: 900;
  color: var(--ink);
}

.quoteAuthor {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

@media (max-width: 720px) {
  .countdownGrid { grid-template-columns: repeat(2, minmax(120px, 1fr)); }
}

/* =========================
   RESIDANAT BUTTONS + MODULES
========================= */
.residanat-buttons {
  display: flex;
  gap: 24px;
  justify-content: center;
  flex-wrap: wrap;
}

.residanat-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 32px 48px;
  min-width: 200px;
  text-decoration: none;
  color: var(--ink);
  box-shadow: var(--shadow1);
}
.residanat-btn:hover {
  transform: translateY(-2px);
  border-color: var(--line2);
  box-shadow: 0 14px 34px rgba(11,27,43,.10);
  text-decoration: none;
}
.residanat-btn-icon { font-size: 48px; margin-bottom: 12px; }
.residanat-btn-title { font-size: 20px; font-weight: 900; margin-bottom: 8px; }
.residanat-btn-desc { font-size: 13px; color: var(--muted); text-align: center; font-weight: 700; }

/* YEAR SECTIONS FOR MODULES */
.year-section { margin-bottom: 32px; }

.year-heading {
  font-size: 18px;
  color: var(--primary-dark);
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
  margin-bottom: 16px;
  font-weight: 900;
}

.modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.module-card-link { text-decoration: none; }

.module-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  transition: transform var(--t), border-color var(--t), box-shadow var(--t);
  position: relative;
  box-shadow: var(--shadow1);
}
.module-card:hover {
  border-color: var(--line2);
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(11,27,43,.10);
}

.module-title {
  color: var(--ink);
  font-weight: 900;
  font-size: 15px;
}

.module-year-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 8px;
  font-weight: 900;
}

/* =========================
   PROGRAMME STYLES
========================= */
.programme-form-container { max-width: 500px; margin: 0 auto; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-box {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow1);
}

.stat-value {
  font-size: 24px;
  font-weight: 900;
  color: var(--primary-dark);
}

.stat-label {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
  font-weight: 700;
}

.progress-bar-container {
  background: var(--surface);
  border-radius: 999px;
  height: 20px;
  overflow: hidden;
  margin-bottom: 8px;
  border: 1px solid var(--line);
}

.progress-bar {
  background: var(--primary);
  height: 100%;
  border-radius: 999px;
  transition: width var(--t2);
}

.progress-text {
  text-align: center;
  font-size: 14px;
  color: var(--muted);
  font-weight: 700;
}

.delay-warning {
  background: var(--surface);
  border: 1px solid var(--line2);
  border-radius: 14px;
  padding: 12px 16px;
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--primary-dark);
  font-weight: 900;
  box-shadow: var(--shadow1);
}

.delay-icon { font-size: 20px; }

.layer-badge {
  background: var(--primary);
  color: white;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 6px;
  font-weight: 900;
  margin-left: 8px;
}

.delay-item {
  border-left: 3px solid var(--primary) !important;
  background: var(--primary-soft2) !important;
}

/* DAILY SCHEDULE */
.daily-stats {
  display: flex;
  gap: 24px;
  margin-bottom: 20px;
  padding: 12px;
  background: #fff;
  border-radius: 16px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow1);
}

.daily-courses-list { display: flex; flex-direction: column; gap: 8px; }

.module-separator {
  background: var(--primary);
  color: #fff;
  padding: 8px 12px;
  border-radius: 12px;
  font-weight: 900;
  margin-top: 16px;
  margin-bottom: 8px;
}

.module-separator:first-child { margin-top: 0; }

.daily-course-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow1);
  transition: transform var(--t), border-color var(--t), box-shadow var(--t);
}
.daily-course-item:hover {
  transform: translateY(-1px);
  border-color: var(--line2);
  box-shadow: 0 14px 34px rgba(11,27,43,.10);
}

.daily-course-item.completed {
  opacity: 0.75;
  background: var(--surface);
  border-color: var(--line);
}

.daily-course-item.other-course {
  background: var(--surface);
  border-style: dashed;
}

.course-info { display: flex; flex-direction: column; gap: 4px; }
.course-title { font-weight: 900; color: var(--ink); }
.course-duration { font-size: 12px; color: var(--muted); font-weight: 700; }

.course-module-badge {
  font-size: 11px;
  background: var(--surface);
  padding: 2px 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  color: var(--primary-dark);
  font-weight: 800;
}

.completed-badge { color: var(--primary); font-size: 24px; }

.btnSuccess { background: var(--primary); border-color: transparent; }
.btnSuccess:hover { background: var(--primary-dark); }

.rest-day-notice {
  text-align: center;
  padding: 40px 20px;
  background: #fff;
  border-radius: 16px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow1);
}
.rest-day-icon { font-size: 64px; margin-bottom: 16px; }

/* SUJETS RESIDANAT */
.sujets-list { display: flex; flex-direction: column; gap: 16px; }

.sujet-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow1);
  transition: transform var(--t), border-color var(--t), box-shadow var(--t);
}
.sujet-card:hover {
  transform: translateY(-2px);
  border-color: var(--line2);
  box-shadow: 0 14px 34px rgba(11,27,43,.10);
}

.sujet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.sujet-header h3 { margin: 0; font-size: 18px; font-weight: 900; }

.sujet-year {
  background: var(--primary);
  color: #fff;
  padding: 4px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 900;
}

.sujet-desc { font-size: 14px; color: var(--muted); margin-bottom: 16px; }
.sujet-buttons { display: flex; gap: 12px; }

/* =========================
   ADMIN TABLE (Messagerie)
========================= */
.adminTable {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.adminTable th,
.adminTable td {
  padding: 12px 10px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}

.adminTable th {
  background: var(--surface);
  font-weight: 900;
  white-space: nowrap;
}

.adminTable tbody tr:hover { background: rgba(2,75,150,.04); }

.tableWrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* =========================
   FOOTER
========================= */
.footer {
  flex-shrink: 0;
  margin-top: 40px;
  padding: 20px 14px;
  border-top: 1px solid var(--line);
  background: rgba(255,255,255,.86);
  backdrop-filter: blur(12px);
}

.footerContent {
  max-width: 920px;
  margin: 0 auto;
  text-align: center;
}

.footerLine {
  font-size: 13px;
  color: var(--ink);
  font-weight: 800;
}

.footerSub {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

/* =========================
   MOBILE WEB RESPONSIVE
========================= */
.mobileMenuBtn {
  display: none;
  background: transparent;
  border: none;
  color: var(--ink);
  font-size: 28px;
  cursor: pointer;
  padding: 8px;
  z-index: 1001;
  position: relative;
}

.mobileNav {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(247,250,252,0.98);
  z-index: 1000;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--t2), visibility var(--t2);
  backdrop-filter: blur(14px);
}

.mobileNav.active {
  opacity: 1;
  visibility: visible;
}

.mobileNav a {
  color: var(--ink);
  text-decoration: none;
  font-size: 18px;
  font-weight: 900;
  padding: 14px 40px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--line);
  min-width: 220px;
  text-align: center;
  transition: transform var(--t), box-shadow var(--t), border-color var(--t);
  box-shadow: var(--shadow1);
}
.mobileNav a:hover {
  transform: translateY(-1px);
  border-color: var(--line2);
  box-shadow: 0 14px 34px rgba(11,27,43,.10);
}

.mobileNav a.primary {
  background: var(--primary);
  color: #fff;
  border: 1px solid transparent;
  box-shadow: 0 10px 24px rgba(2,75,150,.22);
}

.mobileNavClose {
  position: absolute;
  top: 20px;
  right: 20px;
  background: transparent;
  border: none;
  color: var(--ink);
  font-size: 32px;
  cursor: pointer;
}

@media (max-width: 768px) {
  .header { padding: 12px 16px; }
  .headerActions { display: none; }
  .mobileMenuBtn { display: block; }

  .brand { gap: 10px; }
  .logo { width: 80px; height: 80px; }

  .brandTitle { font-size: 16px; }
  .brandSub { font-size: 11px; }

  .card { margin: 12px; padding: 14px; border-radius: 16px; }

  .buttonGrid { grid-template-columns: 1fr; gap: 12px; }
  .newsGrid { grid-template-columns: 1fr; gap: 16px; }

  .quizTypeCards { grid-template-columns: 1fr; }
  .courseButtons { grid-template-columns: 1fr; gap: 12px; }

  input, select, textarea { font-size: 16px; }

  .adminTable { font-size: 13px; min-width: 500px; }
  .adminTable th, .adminTable td { padding: 10px 8px; }

  .mobileNav { display: flex; }
}

@media (max-width: 480px) {
  .countdownGrid { grid-template-columns: repeat(2, 1fr); }
  .cdItem:nth-child(5) { grid-column: span 2; }

  .quoteText { font-size: 14px; }

  .mobileNav a {
    font-size: 16px;
    padding: 12px 30px;
    min-width: 190px;
  }
}

/* =========================
   CONTENT SAFETY (overflow)
========================= */
.card p,
.panel p,
td {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* =========================
   RTL GLOBAL (AR)
========================= */
html[dir="rtl"],
body[dir="rtl"] {
  direction: rtl;
  text-align: right;
}

html[dir="rtl"] .topbar,
html[dir="rtl"] .card,
html[dir="rtl"] .buttonGrid,
html[dir="rtl"] .newsGrid,
html[dir="rtl"] .list,
html[dir="rtl"] .form {
  direction: rtl;
}

html[dir="rtl"] .hint,
html[dir="rtl"] .newsTitle,
html[dir="rtl"] .newsSnippet,
html[dir="rtl"] .newsDate,
html[dir="rtl"] .newsCardBody,
html[dir="rtl"] .qcm,
html[dir="rtl"] p,
html[dir="rtl"] h1,
html[dir="rtl"] h2,
html[dir="rtl"] h3 {
  text-align: right;
}

/* Flex reverse */
html[dir="rtl"] .topbar,
html[dir="rtl"] .header,
html[dir="rtl"] .headerActions,
html[dir="rtl"] .newsCard {
  flex-direction: row-reverse;
}

/* media always LTR */
html[dir="rtl"] img,
html[dir="rtl"] video {
  direction: ltr;
}

/* Tag spacing */
html[dir="rtl"] .tag {
  margin-left: 0;
  margin-right: 6px;
}

/* RTL PANORAMA */
html[dir="rtl"] .panoramaTrack {
  animation: panoScrollRTL 50s linear infinite;
  direction: ltr;
}
@keyframes panoScrollRTL {
  0% { transform: translateX(0); }
  100% { transform: translateX(50%); }
}

/* Flip arrow icons in RTL */
html[dir="rtl"] [class*="arrow"] {
  transform: scaleX(-1);
  display: inline-block;
}

/* RTL header layout */
html[dir="rtl"] .header { flex-direction: row-reverse; }
html[dir="rtl"] .headerActions { flex-direction: row-reverse; }
html[dir="rtl"] .brand a { flex-direction: row-reverse; }
html[dir="rtl"] .topbar { flex-direction: row-reverse; }

/* RTL module badge */
html[dir="rtl"] .module-year-badge {
  right: auto;
  left: 10px;
}

/* RTL mobile menu */
html[dir="rtl"] .mobileMenuBtn {
  left: 16px;
  right: auto;
}

html[dir="rtl"] .mobileNavClose {
  left: 20px;
  right: auto;
}

html[dir="rtl"] .mobileNav {
  direction: rtl;
}

html[dir="rtl"] .mobileNav a {
  text-align: center;
}

@media (max-width: 768px) {
  html[dir="rtl"] .header { flex-direction: row; }
  html[dir="rtl"] .mobileMenuBtn { order: -1; }
}
