/* ============================================================
   4F — Espace Formateur
   ============================================================ */

/* Masquer les éléments thème sur la page espace formateur */
.banner-simple-C,
.breadcrumb-scroller,
.entry-header {
  display: none;
}
.entry-content {
  margin-top: 4px !important;
}

.ff-formateur-wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px 16px;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #333;
}

/* Header */
.ff-formateur-header {
  margin-bottom: 24px;
}
.ff-formateur-header h2 {
  font-size: 1.6rem;
  margin: 0 0 4px;
}
.ff-formateur-header .ff-subtitle {
  color: #666;
  margin: 0;
}

/* Cartes sessions — grille */
.ff-sessions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.ff-session-card {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  display: flex;
  flex-direction: column;
}
.ff-session-card--en-cours {
  border-left: 4px solid #2271b1;
}
.ff-session-card--a-venir {
  border-left: 4px solid #8bc34a;
}
.ff-session-card--terminee {
  border-left: 4px solid #999;
}

.ff-session-card-header {
  padding: 14px 16px 8px;
}
.ff-session-statut {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #666;
  display: block;
  margin-bottom: 4px;
}
.ff-session-nom {
  font-size: 1rem;
  display: block;
}

.ff-session-card-body {
  padding: 4px 16px 12px;
  flex: 1;
}
.ff-session-card-body p {
  margin: 4px 0;
  font-size: 0.9rem;
  color: #555;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ff-session-card-footer {
  padding: 12px 16px;
  border-top: 1px solid #f0f0f0;
}

/* Carte générique */
.ff-card {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
}
.ff-card--error {
  border-color: #c0392b;
  background: #fff5f5;
}

/* Onglets session */
.ff-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid #ddd;
  margin-bottom: 0;
  flex-wrap: wrap;
}
.ff-tab {
  padding: 10px 18px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  font-size: 0.9rem;
  color: #555;
  transition: color 0.15s;
}
.ff-tab:hover {
  color: #2271b1;
}
.ff-tab-active {
  color: #2271b1;
  border-bottom-color: #2271b1;
  font-weight: 600;
}
.ff-badge {
  background: #e9ecef;
  border-radius: 10px;
  padding: 1px 7px;
  font-size: 11px;
  margin-left: 4px;
}

.ff-stab {
  display: none;
}
.ff-stab-active {
  display: block;
}

/* Tableau stagiaires */
.ff-table-stagiaires {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.ff-table-stagiaires th,
.ff-table-stagiaires td {
  padding: 8px 10px;
  border-bottom: 1px solid #f0f0f0;
  text-align: left;
}
.ff-table-stagiaires th {
  background: #f8f9fa;
  font-weight: 600;
  font-size: 0.82rem;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.ff-table-stagiaires code {
  background: #f0f0f0;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.85rem;
}

/* Tableau émargements */
.ff-table-emargements {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  table-layout: fixed;
}
.ff-col-participant {
  width: 180px;
}
.ff-col-signature {
  width: calc((100% - 180px) / 2);
}
.ff-table-emargements th,
.ff-table-emargements td {
  padding: 8px 10px;
  border: 1px solid #e5e5e5;
  text-align: center;
  vertical-align: middle;
}
.ff-table-emargements th {
  background: #f8f9fa;
  font-weight: 600;
}
.ff-table-emargements td:first-child {
  text-align: left;
}

/* Nom participant dans émargements */
.ff-em-pname-cell {
  font-weight: 600;
}
.ff-em-pname-text {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.3;
  max-height: 2.6em;
  word-break: break-word;
}
.ff-em-pcode {
  display: block;
  margin-top: 3px;
  font-size: 0.78rem;
  color: #888;
  font-weight: 400;
  background: #f0f0f0;
  padding: 1px 5px;
  border-radius: 3px;
}

/* Cellules émargement */
.ff-em-cell {
  position: relative;
  height: 90px;
}
.ff-em-cell .ff-sig-preview {
  width: 100%;
  height: 70px;
  overflow: hidden;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}
.ff-em-cell .ff-sig-preview svg {
  max-width: 100%;
  max-height: 68px;
  display: block;
}
.ff-em-cell--signe {
  background: #f0fff4;
}
.ff-em-cell--absent {
  background: #fff0f0;
}
.ff-em-cell--vide {
  background: #fafafa;
}

.ff-btn-absence {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  font-size: 0.78rem;
  border: 1px solid #ccc;
  border-radius: 3px;
  background: #fff;
  cursor: pointer;
  vertical-align: middle;
}
.ff-btn-marquer-absent {
  color: #c0392b;
  border-color: #e57373;
}
.ff-btn-retirer-absence {
  color: #555;
}

/* Onglets jours émargement */
.ff-em-day-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.ff-em-day-tab {
  padding: 7px 14px;
  background: #f0f0f0;
  border: 1px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  color: #555;
}
.ff-em-day-tab-active {
  background: #2271b1;
  color: #fff;
  border-color: #2271b1;
}
.ff-em-day-content {
  display: none;
}
.ff-em-day-active {
  display: block;
  margin-top: 16px;
}

/* Satisfaction */
.ff-table-sat-avg {
  border-collapse: collapse;
  font-size: 0.9rem;
  max-width: 420px;
}
.ff-table-sat-avg th,
.ff-table-sat-avg td {
  padding: 6px 10px;
  border-bottom: 1px solid #f0f0f0;
  text-align: left;
}
.ff-table-sat-avg th {
  color: #555;
  font-weight: normal;
}
.ff-table-sat-avg td {
  font-weight: 600;
  color: #2271b1;
}

.ff-sat-item {
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  padding: 12px 14px;
  margin-bottom: 10px;
  font-size: 0.9rem;
}
.ff-sat-smileys {
  margin: 6px 0;
  font-size: 1.2rem;
  letter-spacing: 4px;
}
.ff-sat-verbatim {
  margin: 4px 0;
  color: #555;
  font-size: 0.85rem;
}

/* Détail satisfaction par stagiaire (version enrichie) */
.ff-sat-detail {
  padding: 16px 18px;
  border: 1px solid #dde1e7;
  border-radius: 8px;
  background: #fff;
  margin-bottom: 14px;
}
.ff-sat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 10px;
  border-bottom: 1px solid #eee;
  margin-bottom: 12px;
}
.ff-sat-header strong {
  font-size: 1.05rem;
  color: #1a3a6b;
}
.ff-sat-note {
  font-size: 1.6rem;
  font-weight: 700;
  color: #2271b1;
}
.ff-sat-note small {
  font-size: 0.9rem;
  font-weight: 400;
  color: #888;
}
.ff-sat-criteres {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 12px;
  font-size: 0.88rem;
}
.ff-sat-criteres th {
  text-align: left;
  font-weight: 500;
  color: #444;
  padding: 5px 8px 5px 0;
  border-bottom: 1px solid #f0f0f0;
  width: 60%;
}
.ff-sat-criteres td {
  padding: 5px 0;
  border-bottom: 1px solid #f0f0f0;
}
.ff-sat-smiley-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ff-sat-smiley {
  font-size: 1.3rem;
  line-height: 1;
}
.ff-sat-smiley-text {
  font-size: 0.85rem;
  color: #555;
}
.ff-sat-resp {
  margin: 10px 0;
  font-size: 0.9rem;
}
.ff-sat-resp p {
  margin: 4px 0;
}
.ff-badge-yes {
  display: inline-block;
  background: #e8f5e9;
  color: #2e7d32;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.82rem;
  font-weight: 600;
}
.ff-badge-no {
  display: inline-block;
  background: #ffebee;
  color: #c62828;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.82rem;
  font-weight: 600;
}
.ff-sat-empty {
  color: #aaa;
  font-style: italic;
  font-size: 0.85rem;
}
.ff-sat-verbatim-block {
  margin-top: 10px;
  padding: 8px 12px;
  background: #f8f9fb;
  border-left: 3px solid #2271b1;
  border-radius: 3px;
}
.ff-sat-verbatim-block strong {
  font-size: 0.85rem;
  color: #1a3a6b;
}
.ff-sat-verbatim-block p {
  margin: 4px 0 0;
  color: #444;
  font-size: 0.88rem;
  line-height: 1.5;
}
.ff-sat-verbatim-mot {
  border-left-color: #e85d04;
  background: #fff8f0;
}
.ff-sat-verbatim-mot strong {
  color: #e85d04;
}

/* Boutons */
.ff-btn {
  display: inline-block;
  padding: 9px 18px;
  border-radius: 5px;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  text-align: center;
  touch-action: manipulation;
  transition:
    background 0.15s,
    opacity 0.15s;
}
.ff-btn-primary {
  background: #2271b1;
  color: #fff;
}
.ff-btn-primary:hover {
  background: #135e96;
}
.ff-btn-outline {
  background: #fff;
  color: #2271b1;
  border: 1px solid #2271b1;
}
.ff-btn-outline:hover {
  background: #f0f6fc;
}
.ff-btn-small {
  padding: 5px 12px;
  font-size: 0.82rem;
}

/* Inputs */
.ff-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.9rem;
  box-sizing: border-box;
}
.ff-input:focus {
  border-color: #2271b1;
  outline: none;
  box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.15);
}

/* Messages */
.ff-error {
  color: #c0392b;
  background: #fff5f5;
  border: 1px solid #e57373;
  border-radius: 4px;
  padding: 8px 12px;
  font-size: 0.875rem;
  margin-top: 8px;
}
.ff-info {
  color: #555;
  background: #f8f9fa;
  border: 1px solid #e5e5e5;
  border-radius: 4px;
  padding: 10px 14px;
  font-size: 0.9rem;
}

/* Modal */
.ff-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.ff-modal-box {
  background: #fff;
  border-radius: 8px;
  padding: 28px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
}
.ff-modal-box h3 {
  margin: 0 0 20px;
  font-size: 1.1rem;
}
.ff-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.ff-form-grid .ff-field:last-child {
  grid-column: 1 / -1;
}
.ff-field label {
  display: block;
  font-size: 0.85rem;
  color: #555;
  margin-bottom: 4px;
}
.ff-modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  justify-content: flex-end;
}

/* ============================================================
   Signatures formateur
   ============================================================ */

.ff-formateur-sigs {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 2px dashed #dde1e7;
}

.ff-formateur-sig-block {
  flex: 1;
  min-width: 260px;
  background: #f8f9fb;
  border: 1px solid #dde1e7;
  border-radius: 8px;
  padding: 14px 16px;
}

.ff-formateur-sig-title {
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0 0 12px;
  color: #444;
}

.ff-formateur-sig-canvas {
  display: block;
  width: 100%;
  height: 120px;
  border: 1.5px solid #b0b8c6;
  border-radius: 6px;
  background: #fff;
  cursor: crosshair;
  touch-action: none;
}

.ff-formateur-sig-btns {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.ff-formateur-sig-hint {
  font-size: 0.78rem;
  color: #888;
  margin: 6px 0 0;
}

.ff-formateur-sig-done {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ff-formateur-sig-svg svg {
  width: 100%;
  height: auto;
  max-height: 100px;
  border: 1.5px solid #27ae60;
  border-radius: 6px;
  background: #fff;
  padding: 4px;
  display: block;
  box-sizing: border-box;
}

.ff-em-locked-label {
  font-size: 0.82rem;
  color: #27ae60;
  font-weight: 600;
  margin: 0;
}

.ff-btn-sm {
  padding: 5px 12px;
  font-size: 0.82rem;
}

/* Responsive */
@media (max-width: 600px) {
  .ff-sessions-grid {
    grid-template-columns: 1fr;
  }
  .ff-tabs {
    gap: 0;
  }
  .ff-tab {
    padding: 8px 12px;
    font-size: 0.82rem;
  }
  .ff-form-grid {
    grid-template-columns: 1fr;
  }
  .ff-form-grid .ff-field:last-child {
    grid-column: auto;
  }
  .ff-table-stagiaires th:nth-child(3),
  .ff-table-stagiaires td:nth-child(3) {
    display: none;
  }
}

/* ── QR Codes ── */
.ff-qr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  margin-top: 12px;
}
.ff-qr-item {
  text-align: center;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  padding: 12px;
  background: #fafafa;
}
.ff-qr-item strong {
  display: block;
  margin-top: 8px;
  font-size: 0.85rem;
}
.ff-qr-item code {
  display: block;
  margin-top: 4px;
  font-size: 0.8rem;
  color: #888;
}

/* ============================================================
   Modal signature stagiaire sur place (plein écran)
   ============================================================ */

.ff-modal-signature-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
}
.ff-modal-signature-box {
  background: #fff;
  border-radius: 12px;
  padding: 24px 28px;
  width: 95vw;
  max-width: 700px;
  max-height: 95vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.25);
}
.ff-modal-signature-header {
  text-align: center;
  margin-bottom: 16px;
}
.ff-modal-signature-header h2 {
  margin: 0 0 4px;
  font-size: 1.5rem;
  color: #1a3a6b;
}
.ff-modal-sig-info {
  margin: 0;
  font-size: 0.95rem;
  color: #666;
}
.ff-modal-signature-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
#ff-modal-sig-canvas {
  display: block;
  width: 100%;
  height: 220px;
  border: 2px solid #b0b8c6;
  border-radius: 8px;
  background: #fafbfc;
  cursor: crosshair;
  touch-action: none;
}
.ff-modal-signature-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  justify-content: center;
  flex-wrap: wrap;
}
.ff-modal-signature-actions .ff-btn {
  min-width: 140px;
}

/* Bouton signer dans les cellules émargement */
.ff-btn-signer-surplace {
  color: #2271b1;
  border-color: #2271b1;
  font-weight: 600;
}
.ff-btn-signer-surplace:hover {
  background: #f0f6fc;
}

@media (max-width: 600px) {
  .ff-modal-signature-box {
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    padding: 16px;
  }
  #ff-modal-sig-canvas {
    height: 180px;
  }
  .ff-modal-signature-actions .ff-btn {
    min-width: 100px;
    font-size: 0.82rem;
  }
}

/* ─── Envoi email CR + AFF (formateur) ─────────────────────────────────── */
.ff-mail-status {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  font-size: 12px;
  vertical-align: middle;
}
.ff-mail-sent {
  color: #0a7d2c;
  background: #e7f6ec;
  border: 1px solid #b8e0c5;
  border-radius: 3px;
  padding: 1px 6px;
  font-size: 11px;
  white-space: nowrap;
}
.ff-mail-failed {
  color: #a30015;
  background: #fdecee;
  border: 1px solid #f0b8c0;
  border-radius: 3px;
  padding: 1px 6px;
  font-size: 11px;
  cursor: help;
}

.ff-mail-modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 100000;
  align-items: flex-start;
  justify-content: center;
  padding: 60px 20px 20px;
  overflow-y: auto;
}
.ff-mail-modal {
  background: #fff;
  border-radius: 6px;
  width: 100%;
  max-width: 700px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
}
.ff-mail-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #ddd;
}
.ff-mail-modal-close-f {
  background: none;
  border: 0;
  font-size: 18px;
  cursor: pointer;
  color: #555;
  padding: 4px 8px;
}
.ff-mail-modal-close-f:hover {
  color: #000;
}
.ff-mail-modal-body {
  padding: 20px;
  overflow-y: auto;
  max-height: calc(100vh - 220px);
}
.ff-mail-modal-body label {
  display: block;
  margin-top: 12px;
  margin-bottom: 4px;
}
.ff-mail-modal-body input[type="text"],
.ff-mail-modal-body textarea {
  border: 1px solid #c8c8c8;
  border-radius: 4px;
  padding: 8px 10px;
  box-sizing: border-box;
}
.ff-mail-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid #eee;
  background: #fafafa;
  border-radius: 0 0 6px 6px;
}
.ff-mail-recipients {
  background: #f6f8fa;
  border: 1px solid #e1e4e8;
  border-radius: 4px;
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 13px;
}
.ff-mail-recipients code {
  background: #fff;
  border: 1px solid #ddd;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 11px;
}
.ff-mail-vars {
  font-size: 12px;
  color: #555;
  margin: 0 0 14px;
}
.ff-mail-vars code {
  background: #f3f4f6;
  padding: 1px 5px;
  border-radius: 3px;
  margin: 0 2px;
  font-size: 11px;
}
.ff-mail-results {
  margin-top: 16px;
  font-size: 13px;
}
.ff-mail-result-ok {
  background: #e7f6ec;
  border: 1px solid #b8e0c5;
  color: #0a7d2c;
  padding: 8px 12px;
  border-radius: 4px;
  margin-bottom: 6px;
}
.ff-mail-result-err {
  background: #fdecee;
  border: 1px solid #f0b8c0;
  color: #a30015;
  padding: 8px 12px;
  border-radius: 4px;
}
.ff-mail-result-err ul {
  margin: 6px 0 0 18px;
}

/* Habilitations électriques — cellule dans le tableau Stagiaires */
.ff-hab-cell {
  white-space: nowrap;
  min-width: 130px;
}
.ff-hab-label {
  display: block;
  font-size: 11px;
  line-height: 1.5;
  cursor: pointer;
  user-select: none;
}
.ff-hab-label input[type="checkbox"] {
  margin-right: 4px;
  vertical-align: middle;
}
