/* ============================================================
   Aula Virtual — Miguel Bordera Pascual
   Feuille de style unique — sans framework
   ============================================================ */

:root {
  /* Charte graphique Cabinet JPT */
  --jpt-blue: #4a8ea8;
  --jpt-blue-light: #5fa8c4;
  --jpt-blue-dark: #3d7f9b;
  --jpt-blue-pale: #e8f2f7;
  --jpt-dark: #1d1d1b;
  --jpt-grey: #6b7280;
  --jpt-grey-light: #e5e7eb;
  --jpt-bg: #f7fafc;
  --white: #ffffff;
  --success: #2e7d52;
  --success-bg: #e2f3ea;
  --danger: #b3362c;
  --danger-bg: #fbe9e7;
  --warning: #b45309;
  --warning-bg: #fef3c7;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.10), 0 1px 2px rgba(0,0,0,.06);
  --shadow-lg: 0 8px 24px rgba(29,29,27,.12);
  --font: 'Open Sans', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; }
body {
  font-family: var(--font);
  background: var(--jpt-bg);
  color: var(--jpt-dark);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img { max-width: 100%; }
a { color: var(--jpt-blue-dark); }

/* ---------- Barre supérieure ---------- */
.topbar {
  background: linear-gradient(105deg, var(--jpt-dark) 55%, #2e2e2c 55.5%);
  color: var(--white);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: .5rem 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--white); }
.brand-logo { width: 40px; height: 40px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 1rem; letter-spacing: .5px; }
.brand-text small { color: var(--jpt-blue-light); font-size: .78rem; }

.mainnav { display: flex; align-items: center; gap: .25rem; margin-left: auto; flex-wrap: wrap; }
.mainnav a {
  color: #d8dee2;
  text-decoration: none;
  padding: .45rem .8rem;
  border-radius: var(--radius);
  font-size: .92rem;
  transition: background .15s, color .15s;
}
.mainnav a:hover { background: rgba(255,255,255,.10); color: var(--white); }
.mainnav a.active { background: var(--jpt-blue); color: var(--white); font-weight: 600; }
.nav-user { color: var(--jpt-blue-light); font-size: .85rem; padding: 0 .6rem; }
.nav-logout { border: 1px solid rgba(255,255,255,.35); }
.nav-toggle { display: none; background: none; border: 1px solid rgba(255,255,255,.4); color: var(--white); font-size: 1.3rem; padding: .2rem .6rem; border-radius: var(--radius); cursor: pointer; margin-left: auto; }

/* ---------- Conteneurs ---------- */
.main-container { flex: 1; width: 100%; max-width: 1200px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
.main-full { flex: 1; width: 100%; }

.footer {
  background: var(--jpt-dark);
  color: #9aa3a9;
  font-size: .82rem;
  text-align: center;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: .2rem;
}
.footer a { color: var(--jpt-blue-light); text-decoration: none; }

/* ---------- Titres et texte ---------- */
h1.page-title { font-size: 1.6rem; margin-bottom: .3rem; }
h1.page-title::after { content: ""; display: block; width: 70px; height: 4px; background: var(--jpt-blue); border-radius: 2px; margin-top: .4rem; }
.page-sub { color: var(--jpt-grey); margin-bottom: 1.4rem; }
.section-title { font-size: 1.15rem; margin: 1.5rem 0 .8rem; color: var(--jpt-blue-dark); }

/* ---------- Cartes ---------- */
.card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.3rem; margin-bottom: 1.2rem; }
.card-title { font-size: 1.05rem; font-weight: 700; margin-bottom: .9rem; color: var(--jpt-dark); }

.grid { display: grid; gap: 1.2rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* Statistiques du tableau de bord */
.stat { background: var(--white); border-left: 5px solid var(--jpt-blue); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.2rem; }
.stat .stat-num { font-size: 1.9rem; font-weight: 800; color: var(--jpt-blue-dark); line-height: 1.2; }
.stat .stat-label { color: var(--jpt-grey); font-size: .88rem; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-block;
  background: var(--jpt-blue);
  color: var(--white);
  border: none;
  border-radius: var(--radius);
  padding: .55rem 1.1rem;
  font-family: var(--font);
  font-size: .95rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s, transform .05s;
  text-align: center;
}
.btn:hover { background: var(--jpt-blue-dark); }
.btn:active { transform: translateY(1px); }
.btn-lg { padding: .8rem 1.6rem; font-size: 1.05rem; }
.btn-sm { padding: .3rem .7rem; font-size: .83rem; }
.btn-secondary { background: var(--white); color: var(--jpt-blue-dark); border: 1px solid var(--jpt-blue); }
.btn-secondary:hover { background: var(--jpt-blue-pale); }
.btn-dark { background: var(--jpt-dark); }
.btn-dark:hover { background: #000; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #8f2a22; }
.btn-success { background: var(--success); }
.btn-success:hover { background: #226741; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- Formulaires ---------- */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .3rem; }
.form-group .hint { font-size: .8rem; color: var(--jpt-grey); margin-top: .2rem; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=url],
select, textarea {
  width: 100%;
  padding: .55rem .7rem;
  border: 1px solid #cbd5e0;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: .95rem;
  background: var(--white);
  color: var(--jpt-dark);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--jpt-blue-light); border-color: var(--jpt-blue); }
textarea { min-height: 100px; resize: vertical; }
.form-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 180px; }
.checkbox-line { display: flex; align-items: center; gap: .5rem; font-size: .93rem; }
.checkbox-line input { width: auto; }

/* ---------- Tableaux ---------- */
.table-wrap { overflow-x: auto; background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); }
table.data { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.data th {
  background: var(--jpt-dark);
  color: var(--white);
  text-align: left;
  padding: .65rem .8rem;
  font-weight: 600;
  white-space: nowrap;
}
table.data td { padding: .6rem .8rem; border-bottom: 1px solid var(--jpt-grey-light); vertical-align: middle; }
table.data tr:hover td { background: var(--jpt-blue-pale); }
table.data .actions { white-space: nowrap; text-align: right; }

/* ---------- Badges et alertes ---------- */
.badge { display: inline-block; padding: .15rem .6rem; border-radius: 999px; font-size: .76rem; font-weight: 700; }
.badge-blue { background: var(--jpt-blue-pale); color: var(--jpt-blue-dark); }
.badge-green { background: var(--success-bg); color: var(--success); }
.badge-red { background: var(--danger-bg); color: var(--danger); }
.badge-grey { background: var(--jpt-grey-light); color: var(--jpt-grey); }
.badge-orange { background: var(--warning-bg); color: var(--warning); }

.flash { padding: .8rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: .93rem; }
.flash-success { background: var(--success-bg); color: var(--success); border: 1px solid #b7e0c8; }
.flash-error { background: var(--danger-bg); color: var(--danger); border: 1px solid #f2c1bb; }
.flash-info { background: var(--jpt-blue-pale); color: var(--jpt-blue-dark); border: 1px solid #bcd9e6; }

/* ---------- Barres de progression ---------- */
.progress { background: var(--jpt-grey-light); border-radius: 999px; height: 12px; overflow: hidden; }
.progress-bar { background: linear-gradient(90deg, var(--jpt-blue-light), var(--jpt-blue-dark)); height: 100%; border-radius: 999px; transition: width .4s; min-width: 0; }
.progress-bar.done { background: linear-gradient(90deg, #3aa06d, var(--success)); }
.progress-label { font-size: .8rem; color: var(--jpt-grey); margin-top: .25rem; }

/* ---------- Page de connexion ---------- */
.login-wrap {
  min-height: calc(100vh - 60px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  background:
    linear-gradient(115deg, rgba(29,29,27,.92) 0%, rgba(29,29,27,.92) 46%, rgba(74,142,168,.25) 46.5%, rgba(247,250,252,.0) 60%),
    var(--jpt-bg);
}
.login-card { background: var(--white); border-radius: 14px; box-shadow: var(--shadow-lg); width: 100%; max-width: 420px; padding: 2.2rem; }
.login-card .login-logo { display: flex; justify-content: center; margin-bottom: 1rem; }
.login-card h1 { font-size: 1.3rem; text-align: center; margin-bottom: .2rem; }
.login-card .login-sub { text-align: center; color: var(--jpt-grey); font-size: .88rem; margin-bottom: 1.5rem; }
.login-card .btn { width: 100%; margin-top: .5rem; }
.login-links { text-align: center; margin-top: 1rem; font-size: .85rem; }

/* ---------- Cartes de formation (étudiant) ---------- */
.course-card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; transition: box-shadow .2s, transform .2s; }
.course-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.course-cover { height: 140px; background: linear-gradient(120deg, var(--jpt-blue-light), var(--jpt-blue-dark)); display: flex; align-items: center; justify-content: center; color: var(--white); font-size: 2.6rem; }
.course-cover img { width: 100%; height: 100%; object-fit: cover; }
.course-body { padding: 1rem 1.2rem 1.3rem; display: flex; flex-direction: column; gap: .6rem; flex: 1; }
.course-body h3 { font-size: 1.02rem; line-height: 1.35; }
.course-meta { font-size: .82rem; color: var(--jpt-grey); }
.course-body .btn { margin-top: auto; }

/* ---------- Lecteur de cours (étudiant) ---------- */
.player { display: flex; min-height: calc(100vh - 64px); }
.player-aside {
  width: 320px;
  min-width: 260px;
  background: var(--white);
  border-right: 1px solid var(--jpt-grey-light);
  overflow-y: auto;
  padding: 1rem;
}
.player-aside h2 { font-size: 1rem; margin-bottom: .2rem; }
.player-aside .progress { margin: .6rem 0 1rem; }
.player-module { margin-bottom: .8rem; }
.player-module-title { font-weight: 700; font-size: .88rem; color: var(--jpt-blue-dark); text-transform: uppercase; letter-spacing: .4px; padding: .35rem 0; }
.player-lesson {
  display: flex; align-items: center; gap: .5rem;
  padding: .45rem .6rem; border-radius: var(--radius);
  text-decoration: none; color: var(--jpt-dark); font-size: .9rem;
}
.player-lesson:hover { background: var(--jpt-blue-pale); }
.player-lesson.current { background: var(--jpt-blue); color: var(--white); font-weight: 600; }
.player-lesson .lp-state { margin-left: auto; font-size: .85rem; }
.player-content { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.player-head { background: var(--white); border-bottom: 1px solid var(--jpt-grey-light); padding: .7rem 1.2rem; display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.player-head h1 { font-size: 1.1rem; flex: 1; min-width: 200px; }
.player-body { flex: 1; padding: 1.5rem; overflow-y: auto; }
.player-body.noscroll { padding: 0; overflow: hidden; display: flex; }
.lesson-html { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 2rem; max-width: 860px; margin: 0 auto; }
.lesson-html h2 { color: var(--jpt-blue-dark); margin: 1.2rem 0 .6rem; }
.lesson-html h3 { margin: 1rem 0 .5rem; }
.lesson-html p { margin-bottom: .8rem; }
.lesson-html ul, .lesson-html ol { margin: 0 0 .9rem 1.4rem; }
.lesson-html img { border-radius: var(--radius); }
.player-nav { background: var(--white); border-top: 1px solid var(--jpt-grey-light); padding: .7rem 1.2rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.pdf-frame, .scorm-frame { width: 100%; height: 100%; border: none; flex: 1; }
.video-box { max-width: 900px; margin: 0 auto; background: #000; border-radius: var(--radius); overflow: hidden; }
.video-box video { width: 100%; display: block; }
.pdf-toolbar { display: flex; gap: .5rem; align-items: center; padding: .4rem .8rem; background: var(--white); border-bottom: 1px solid var(--jpt-grey-light); }

/* ---------- Examens ---------- */
.question-card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.2rem 1.4rem; margin-bottom: 1rem; }
.question-card .q-num { color: var(--jpt-blue-dark); font-weight: 700; font-size: .82rem; text-transform: uppercase; }
.question-card .q-text { font-weight: 600; margin: .3rem 0 .8rem; }
.q-option { display: flex; align-items: flex-start; gap: .6rem; padding: .5rem .7rem; border: 1px solid var(--jpt-grey-light); border-radius: var(--radius); margin-bottom: .45rem; cursor: pointer; transition: background .1s; }
.q-option:hover { background: var(--jpt-blue-pale); }
.q-option input { margin-top: .25rem; }
.q-option.correct { background: var(--success-bg); border-color: var(--success); }
.q-option.wrong { background: var(--danger-bg); border-color: var(--danger); }
.q-explanation { background: var(--jpt-blue-pale); border-left: 4px solid var(--jpt-blue); border-radius: 4px; padding: .6rem .9rem; font-size: .88rem; margin-top: .7rem; }
.exam-result { text-align: center; padding: 2rem 1rem; }
.exam-result .score-circle {
  width: 130px; height: 130px; border-radius: 50%; margin: 0 auto 1rem;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; font-weight: 800; color: var(--white);
}
.score-circle.pass { background: var(--success); }
.score-circle.fail { background: var(--danger); }

/* ---------- Constructeur de cours (admin) ---------- */
.builder-module { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 1rem; overflow: hidden; }
.builder-module-head { background: var(--jpt-blue-pale); padding: .7rem 1rem; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.builder-module-head strong { flex: 1; min-width: 150px; }
.builder-lessons { padding: .4rem .8rem .8rem; }
.builder-lesson { display: flex; align-items: center; gap: .6rem; padding: .5rem .6rem; border-bottom: 1px solid var(--jpt-grey-light); flex-wrap: wrap; }
.builder-lesson:last-child { border-bottom: none; }
.builder-lesson .bl-title { flex: 1; min-width: 160px; }
.builder-lesson .bl-type { font-size: .78rem; color: var(--jpt-grey); }
.order-btns button { background: none; border: 1px solid var(--jpt-grey-light); border-radius: 4px; cursor: pointer; padding: .05rem .4rem; font-size: .8rem; }
.order-btns button:hover { background: var(--jpt-blue-pale); }

.type-picker { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .8rem; margin: .8rem 0; }
.type-pick { border: 2px solid var(--jpt-grey-light); border-radius: var(--radius); background: var(--white); padding: 1rem .6rem; text-align: center; cursor: pointer; text-decoration: none; color: var(--jpt-dark); transition: border-color .15s, background .15s; }
.type-pick:hover { border-color: var(--jpt-blue); background: var(--jpt-blue-pale); }
.type-pick .tp-icon { font-size: 1.8rem; display: block; margin-bottom: .3rem; }
.type-pick .tp-label { font-weight: 600; font-size: .9rem; }
.type-pick small { color: var(--jpt-grey); font-size: .76rem; }

/* Étapes de l'assistant */
.steps { display: flex; gap: .4rem; margin-bottom: 1.4rem; flex-wrap: wrap; }
.step { flex: 1; min-width: 140px; text-align: center; padding: .55rem .4rem; background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--jpt-grey); font-size: .88rem; text-decoration: none; }
.step.active { background: var(--jpt-blue); color: var(--white); font-weight: 700; }
.step.done { background: var(--jpt-blue-pale); color: var(--jpt-blue-dark); }

/* ---------- Éditeur WYSIWYG ---------- */
.wys-toolbar { display: flex; flex-wrap: wrap; gap: .25rem; background: var(--jpt-dark); padding: .4rem; border-radius: var(--radius) var(--radius) 0 0; }
.wys-toolbar button { background: none; border: none; color: var(--white); min-width: 32px; height: 32px; border-radius: 5px; cursor: pointer; font-size: .95rem; }
.wys-toolbar button:hover { background: var(--jpt-blue); }
.wys-toolbar .sep { width: 1px; background: rgba(255,255,255,.25); margin: .2rem .3rem; }
.wys-area {
  min-height: 300px; background: var(--white); border: 1px solid #cbd5e0; border-top: none;
  border-radius: 0 0 var(--radius) var(--radius); padding: 1rem 1.2rem; overflow-y: auto;
}
.wys-area:focus { outline: 2px solid var(--jpt-blue-light); }
.wys-area h2 { color: var(--jpt-blue-dark); margin: .8rem 0 .4rem; }
.wys-area ul, .wys-area ol { margin: 0 0 .8rem 1.4rem; }
.wys-area p { margin-bottom: .6rem; }

/* ---------- Divers ---------- */
.toolbar { display: flex; gap: .6rem; align-items: center; margin-bottom: 1rem; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
.search-box { max-width: 280px; }
.empty { text-align: center; color: var(--jpt-grey); padding: 2.5rem 1rem; }
.empty .empty-icon { font-size: 2.6rem; display: block; margin-bottom: .5rem; }
.mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--jpt-grey); }
.small { font-size: .85rem; }
.inline-form { display: inline; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .player { flex-direction: column; }
  .player-aside { width: 100%; min-width: 0; max-height: 40vh; border-right: none; border-bottom: 1px solid var(--jpt-grey-light); }
}
@media (max-width: 720px) {
  .nav-toggle { display: block; }
  .mainnav { display: none; width: 100%; flex-direction: column; align-items: stretch; }
  .mainnav.open { display: flex; }
  .mainnav a { padding: .7rem .8rem; }
  .lesson-html { padding: 1.2rem; }
  html { font-size: 15px; }
}

@media print {
  .topbar, .footer, .player-aside, .player-nav, .btn { display: none !important; }
}

/* ---------- Enregistreur vidéo intégré ---------- */
.recorder {
  border: 1px dashed var(--jpt-blue);
  border-radius: var(--radius);
  padding: 1rem;
  background: var(--jpt-blue-pale);
}
.rec-sources { display: flex; gap: .6rem; flex-wrap: wrap; }
.rec-blur-opt {
  display: flex;
  align-items: center;
  gap: .45rem;
  margin-top: .6rem;
  font-size: .88rem;
  color: var(--jpt-dark);
  cursor: pointer;
  user-select: none;
}
.rec-blur-opt input { cursor: pointer; }
.rec-preview, .rec-playback {
  width: 100%;
  max-height: 380px;
  background: var(--jpt-dark);
  border-radius: var(--radius);
  display: block;
  margin-bottom: .6rem;
}
.rec-bar { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.rec-timer { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--jpt-dark); }
.rec-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--danger); display: inline-block;
  animation: rec-blink 1s infinite;
}
@keyframes rec-blink { 50% { opacity: .25; } }
.rec-progress {
  margin-top: .6rem; height: 8px; border-radius: 4px;
  background: var(--jpt-grey-light); overflow: hidden;
}
.rec-progress-fill {
  height: 100%; width: 0; border-radius: 4px;
  background: var(--jpt-blue); transition: width .2s;
}
.rec-msg { margin-top: .6rem; }
.rec-msg-ok { color: var(--success); font-weight: 600; }
.rec-msg-error { color: var(--danger); font-weight: 600; }

/* ---------- Messagerie privée ---------- */
.chat-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1rem;
  align-items: start;
}
@media (max-width: 820px) {
  .chat-layout { grid-template-columns: 1fr; }
}
.chat-list { margin: 0; }
.chat-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .5rem;
  padding: .55rem .6rem;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--jpt-dark);
}
.chat-list-item:hover { background: var(--jpt-blue-pale); }
.chat-list-item.active { background: var(--jpt-blue); color: var(--white); }
.chat-list-item.active .text-muted { color: rgba(255,255,255,.8); }
.chat-list-name { font-weight: 600; }
.chat-list-side { display: flex; align-items: center; gap: .4rem; }
.chat-panel { margin: 0; }

.chat-badge {
  display: inline-block;
  min-width: 1.35em;
  padding: .05em .4em;
  margin-left: .35em;
  border-radius: 999px;
  background: var(--danger);
  color: var(--white);
  font-size: .75rem;
  font-weight: 700;
  text-align: center;
}
.chat-badge[hidden] { display: none; }

.chat-scroll {
  height: 420px;
  overflow-y: auto;
  padding: .8rem;
  background: var(--jpt-bg);
  border: 1px solid var(--jpt-grey-light);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: .55rem;
}
.chat-empty { color: var(--jpt-grey); text-align: center; margin: auto; }
.chat-msg {
  max-width: 78%;
  padding: .5rem .7rem;
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.chat-me {
  align-self: flex-end;
  background: var(--jpt-blue);
  color: var(--white);
  border-bottom-right-radius: 4px;
}
.chat-other {
  align-self: flex-start;
  background: var(--white);
  border-bottom-left-radius: 4px;
}
.chat-meta { font-size: .72rem; opacity: .75; margin-bottom: .15rem; }
.chat-body { white-space: pre-wrap; word-break: break-word; }
.chat-form { display: flex; gap: .6rem; margin-top: .7rem; align-items: flex-end; }
.chat-input { flex: 1; resize: vertical; }
.chat-error { color: var(--danger); font-weight: 600; margin-top: .4rem; }

/* ---------- Forum de discussion ---------- */
.forum-topic {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  text-decoration: none;
  color: var(--jpt-dark);
  transition: box-shadow .15s, transform .15s;
}
.forum-topic:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.forum-topic-main { min-width: 0; }
.forum-topic-title { font-weight: 700; margin-bottom: .2rem; word-break: break-word; }
.forum-topic-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .3rem;
  flex-shrink: 0;
  text-align: right;
}
@media (max-width: 640px) {
  .forum-topic { flex-direction: column; align-items: flex-start; }
  .forum-topic-side { align-items: flex-start; text-align: left; }
}
.forum-post-first { border-left: 4px solid var(--jpt-blue); }
.forum-post-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
  padding-bottom: .5rem;
  margin-bottom: .6rem;
  border-bottom: 1px solid var(--jpt-grey-light);
  font-weight: 600;
}
.forum-post-body { word-break: break-word; }

/* Formulaire « Nouveau sujet » replié derrière le bouton ➕ */
.forum-new-card { padding: .7rem 1rem; }
.forum-new summary {
  list-style: none;
  display: inline-block;
  user-select: none;
}
.forum-new summary::-webkit-details-marker { display: none; }
.forum-new[open] summary { margin-bottom: .8rem; }

/* Pagination des sujets */
.forum-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  flex-wrap: wrap;
  margin: .8rem 0;
}
.forum-pager-num {
  min-width: 2.1em;
  padding: .3em .5em;
  border-radius: var(--radius);
  text-align: center;
  text-decoration: none;
  font-weight: 600;
  color: var(--jpt-blue-dark);
  background: var(--jpt-blue-pale);
}
.forum-pager-num:hover { background: var(--jpt-blue-light); color: var(--white); }
.forum-pager-num.current { background: var(--jpt-blue); color: var(--white); }
.forum-pager-dots { color: var(--jpt-grey); padding: 0 .2rem; }

/* ---------- Bannière d'installation PWA ---------- */
.pwa-banner {
  position: fixed;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: .8rem;
  max-width: min(560px, calc(100vw - 2rem));
  padding: .8rem 1rem;
  background: var(--white);
  border: 1px solid var(--jpt-grey-light);
  border-left: 4px solid var(--jpt-blue);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  animation: pwa-slide-up .3s ease-out;
}
@keyframes pwa-slide-up {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}
.pwa-banner-icon { font-size: 1.6rem; }
.pwa-banner-text { flex: 1; font-size: .9rem; line-height: 1.35; }
@media (max-width: 480px) {
  .pwa-banner { flex-wrap: wrap; }
  .pwa-banner .btn { flex: 1; }
}

/* ---------- Bandeau d'alertes défilant ---------- */
.alert-ticker {
  overflow: hidden;
  white-space: nowrap;
  background: var(--warning-bg);
  color: var(--warning);
  border-bottom: 1px solid var(--warning);
  font-weight: 600;
  padding: .45rem 0;
}
.alert-ticker-track {
  display: inline-block;
  white-space: nowrap;
  padding-left: 100vw;                     /* démarre hors écran */
  animation: alert-scroll linear infinite; /* durée en style inline, ~ longueur du texte */
  will-change: transform;
}
@keyframes alert-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-100%); }
}
.alert-ticker:hover .alert-ticker-track { animation-play-state: paused; } /* lecture facile au survol */
@media (prefers-reduced-motion: reduce) {
  .alert-ticker { white-space: normal; padding: .45rem 1rem; }
  .alert-ticker-track { animation: none; padding-left: 0; }
}

/* ---------- Sélecteur de langue ---------- */
.lang-switch { display: inline-flex; gap: .15rem; align-items: center; margin: 0 .4rem; }
.lang-switch a {
  padding: .15rem .45rem;
  border-radius: 6px;
  font-size: .78rem;
  font-weight: 700;
  text-decoration: none;
  color: inherit;
  opacity: .65;
}
.lang-switch a:hover { opacity: 1; }
.lang-switch a.active {
  opacity: 1;
  background: var(--jpt-blue);
  color: var(--white);
}
