/* Surcharge des variables Bootstrap + système de design du backoffice SOCA
   Académie (sidebar, cartes, tableaux, badges). Chargé après bootstrap.min.css. */

:root {
  --bs-primary: #0f6e56;
  --bs-primary-rgb: 15, 110, 86;
  --bs-primary-text-emphasis: #085041;
  --bs-primary-bg-subtle: #e1f5ee;
  --bs-primary-border-subtle: #9fe1cb;

  --bs-link-color: #0f6e56;
  --bs-link-color-rgb: 15, 110, 86;
  --bs-link-hover-color: #085041;
  --bs-link-hover-color-rgb: 8, 80, 65;

  --bs-body-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  --bs-body-color: #1b2a2e;
  --bs-body-bg: #f7f8f7;

  --bs-border-radius: 8px;
  --bs-border-radius-sm: 6px;
  --bs-border-radius-lg: 10px;

  /* Tokens propres au backoffice (sidebar, cartes, tableaux). */
  --bo-brand-dark: #04342c;
  --bo-border: #e5e9e8;
  --bo-border-subtle: #f0f2f1;
  --bo-text-muted: #5b6a6e;
  --bo-text-subtle: #9aa8a4;
  --bo-shadow-sm: 0 1px 2px rgba(15, 20, 18, 0.04), 0 2px 8px rgba(15, 20, 18, 0.05);
  --bo-warn-bg: #faeeda;
  --bo-warn-text: #ba7517;
  --bo-info-bg: #e6eef5;
  --bo-info-text: #2c5a82;
}

.btn-primary {
  --bs-btn-bg: #0f6e56;
  --bs-btn-border-color: #0f6e56;
  --bs-btn-hover-bg: #085041;
  --bs-btn-hover-border-color: #085041;
  --bs-btn-active-bg: #085041;
  --bs-btn-active-border-color: #085041;
  --bs-btn-disabled-bg: #0f6e56;
  --bs-btn-disabled-border-color: #0f6e56;
}

.btn-outline-primary {
  --bs-btn-color: #0f6e56;
  --bs-btn-border-color: #0f6e56;
  --bs-btn-hover-bg: #0f6e56;
  --bs-btn-hover-border-color: #0f6e56;
  --bs-btn-active-bg: #0f6e56;
  --bs-btn-active-border-color: #0f6e56;
}

.form-control:focus,
.form-select:focus {
  border-color: #1d9e75;
  box-shadow: 0 0 0 0.25rem rgba(15, 110, 86, 0.15);
}

/* Bootstrap code en dur le bleu #0d6efd sur les cases à cocher/boutons
   radio cochés (ne suit pas la surcharge de --bs-primary ci-dessus). */
.form-check-input:checked,
.form-check-input[type="checkbox"]:indeterminate {
  background-color: #0f6e56;
  border-color: #0f6e56;
}

.form-check-input:focus {
  border-color: #1d9e75;
  box-shadow: 0 0 0 0.25rem rgba(15, 110, 86, 0.15);
}

.badge.text-bg-success,
.badge.bg-success {
  background-color: #e1f5ee !important;
  color: #085041 !important;
}

.badge.text-bg-warning,
.badge.bg-warning {
  background-color: #faeeda !important;
  color: #ba7517 !important;
}

/* Le cyan Bootstrap par défaut de .text-bg-info ne fait pas partie de la
   charte — on le remplace par le même bleu-ardoise sourd que le badge
   "Entreprise", plutôt que d'introduire une nouvelle couleur. */
.badge.text-bg-info,
.badge.bg-info,
.badge-soft-info {
  background-color: var(--bo-info-bg) !important;
  color: var(--bo-info-text) !important;
}

.table > :not(caption) > * > * {
  vertical-align: middle;
}

/* Cartes Bootstrap natives (formulaires, pages secondaires) alignées sur
   le même langage visuel que .bo-card, sans toucher au balisage. */
.card {
  border-color: var(--bo-border);
  border-radius: 10px;
  box-shadow: var(--bo-shadow-sm);
}

.card-body {
  padding: 22px 24px;
}

/* Habillage carte pour les tableaux HTML natifs des pages secondaires
   (mêmes codes visuels que .bo-table-panel, sans réécriture en grille). */
.bo-table-card {
  background: #ffffff;
  border: 1px solid var(--bo-border);
  border-radius: 10px;
  box-shadow: var(--bo-shadow-sm);
  overflow: hidden;
}

.bo-table-card .table {
  margin-bottom: 0;
}

.bo-table-card .table thead th {
  background: #fafbfa;
  border-top: none;
  border-bottom: 1px solid var(--bo-border);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--bo-text-subtle);
  font-weight: 700;
  padding: 14px 24px;
}

.bo-table-card .table td {
  padding: 14px 24px;
  border-color: var(--bo-border-subtle);
  font-size: 13.5px;
}

.bo-table-card .table tbody tr:last-child td {
  border-bottom: none;
}

.border-dashed {
  border-style: dashed !important;
}

/* Onglets d'édition de formation (_course_tabs.html) en pilules, cohérents
   avec les filtres de la page Utilisateurs. */
.nav-tabs {
  border-bottom: none;
  gap: 4px;
}

.nav-tabs .nav-link {
  color: var(--bo-text-muted);
  border: none;
  border-radius: 999px;
  padding: 0.45rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
}

.nav-tabs .nav-link.active {
  color: #085041 !important;
  background-color: #e1f5ee !important;
}

/* ---------- Coquille (sidebar + topbar) ---------- */

.bo-shell {
  display: flex;
  min-height: 100vh;
}

.bo-sidebar {
  width: 240px;
  flex: 0 0 240px;
  background: #ffffff;
  border-right: 1px solid var(--bo-border);
  display: flex;
  flex-direction: column;
}

.bo-sidebar-brand {
  background: var(--bo-brand-dark);
  padding: 22px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #ffffff;
  text-decoration: none;
}

.bo-sidebar-brand:hover {
  color: #ffffff;
}

.bo-sidebar-brand-name {
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.2;
}

.bo-sidebar-brand-sub {
  color: rgba(255, 255, 255, 0.62);
  font-size: 11px;
  letter-spacing: 0.02em;
}

.bo-nav {
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.bo-nav-group-label {
  text-transform: uppercase;
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--bo-text-subtle);
  font-weight: 700;
  margin: 16px 0 4px 12px;
}

.bo-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--bo-text-muted);
  font-size: 13.5px;
  text-decoration: none;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.bo-nav-item:hover {
  background: #f2f4f3;
  color: var(--bo-text-muted);
}

.bo-nav-item.active {
  background: #e1f5ee;
  color: #085041;
  font-weight: 600;
}

.bo-nav-item svg {
  flex: 0 0 auto;
}

.bo-topbar {
  height: 64px;
  flex: 0 0 64px;
  background: #ffffff;
  border-bottom: 1px solid var(--bo-border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 32px;
  gap: 12px;
}

.bo-user-name {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
}

.bo-user-role {
  font-size: 11.5px;
  color: var(--bo-text-muted);
}

.bo-avatar {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: #e1f5ee;
  color: #085041;
  font-size: 12.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.bo-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.bo-content {
  padding: 32px 40px 48px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.bo-page-title {
  margin: 0 0 4px;
  font-size: 24px;
  font-weight: 700;
}

.bo-page-subtitle {
  font-size: 14px;
  color: var(--bo-text-muted);
}

@media (max-width: 767.98px) {
  .bo-shell {
    flex-direction: column;
  }

  .bo-sidebar {
    width: 100%;
    flex: 0 0 auto;
  }
}

/* ---------- Cartes ---------- */

.bo-card {
  background: #ffffff;
  border: 1px solid var(--bo-border);
  border-radius: 10px;
  box-shadow: var(--bo-shadow-sm);
  padding: 22px 24px;
}

.bo-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.bo-card-header-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15.5px;
  font-weight: 700;
}

.bo-card-link {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
  color: #0f6e56;
  text-decoration: none;
}

.bo-card-link:hover {
  color: #085041;
}

.bo-card-link svg {
  transition: transform 0.12s ease;
}

.bo-card-link:hover svg {
  transform: translateX(2px);
}

.bo-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

@media (max-width: 991.98px) {
  .bo-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.bo-stat-card {
  background: #ffffff;
  border: 1px solid var(--bo-border);
  border-radius: 10px;
  box-shadow: var(--bo-shadow-sm);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.bo-stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #e1f5ee;
  color: #085041;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bo-stat-value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
}

.bo-stat-label {
  font-size: 13px;
  color: var(--bo-text-muted);
  margin-top: 6px;
}

.bo-stat-caption {
  font-size: 12px;
  color: var(--bo-text-muted);
}

.bo-stat-caption.positive {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #0f6e56;
  font-weight: 600;
}

/* ---------- État vide ---------- */

.bo-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 28px 0 12px;
  text-align: center;
}

.bo-empty-icon {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: #f0f2f1;
  color: var(--bo-text-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
}

.bo-empty-text {
  font-size: 13.5px;
  color: var(--bo-text-muted);
}

.bo-empty-panel {
  background: #ffffff;
  border: 1px dashed #d8dfdd;
  border-radius: 10px;
  padding: 56px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.bo-empty-panel-icon {
  width: 52px;
  height: 52px;
  border-radius: 999px;
  background: #e1f5ee;
  color: #085041;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bo-empty-panel-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
}

.bo-empty-panel-text {
  font-size: 13.5px;
  color: var(--bo-text-muted);
  max-width: 320px;
}

/* ---------- Tableaux ---------- */

.bo-table-panel {
  background: #ffffff;
  border: 1px solid var(--bo-border);
  border-radius: 10px;
  box-shadow: var(--bo-shadow-sm);
  overflow: hidden;
}

.bo-table-head,
.bo-table-row {
  display: grid;
  gap: 8px;
  align-items: center;
}

.bo-table-head {
  padding: 14px 24px;
  background: #fafbfa;
  border-bottom: 1px solid var(--bo-border);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--bo-text-subtle);
  font-weight: 700;
}

.bo-table-row {
  padding: 14px 24px;
  border-bottom: 1px solid var(--bo-border-subtle);
}

.bo-table-row:last-child {
  border-bottom: none;
}

.bo-table-row:hover {
  background: #fafbfa;
}

.bo-avatar-sm {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: #e1f5ee;
  color: #085041;
  font-size: 11.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.bo-icon-tile {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #e1f5ee;
  color: #085041;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.bo-pill-group {
  display: inline-flex;
  gap: 6px;
  background: #ffffff;
  border: 1px solid var(--bo-border);
  border-radius: 999px;
  padding: 4px;
  width: fit-content;
}

.bo-pill {
  color: var(--bo-text-muted);
  font-size: 12.5px;
  font-weight: 600;
  padding: 7px 16px;
  border-radius: 999px;
  text-decoration: none;
}

.bo-pill:hover {
  color: var(--bo-text-muted);
  text-decoration: none;
}

.bo-pill.active {
  background: #0f6e56;
  color: #ffffff;
}

/* ---------- Graphique en barres (statistiques) ---------- */

.bo-bar-row + .bo-bar-row {
  margin-top: 20px;
}

.bo-bar-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 7px;
  font-size: 13.5px;
}

.bo-bar-track {
  height: 10px;
  border-radius: 999px;
  background: #f0f2f1;
  overflow: hidden;
}

.bo-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: #0f6e56;
}

@media (max-width: 767.98px) {
  aside.min-vh-100 {
    min-height: 0 !important;
  }
}
