/**
 * Formation styles — chargés conditionnellement via category-formation.php.
 *
 * Ce fichier était initialement inclus dans style.css (~510 lignes) qui était
 * servi sur toute le site même quand le template formation n'est pas utilisé.
 * Maintenant chargé uniquement sur les pages template_categorie=formation
 * via wp_enqueue_style().
 */

/* ============================
   Template Formation
   ============================ */

.formation-wrapper {
  display: flex;
  min-height: calc(100vh - 200px);
  background: #f9fafb;
  position: relative;
}

/* --- Formation header (titre + progression) --- */
.formation-header {
  display: flex;
  align-items: center;
  gap: 24px;
}

.formation-header-title {
  flex: 0 0 25%;
  margin: 0 !important;
}

.formation-header-progress {
  flex: 0 0 75%;
  max-width: 75%;
}

/* --- Overlay mobile --- */
.formation-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 998;
}

.formation-overlay.is-visible {
  display: block;
}

/* --- Sidebar --- */
.formation-sidebar {
  width: 320px;
  min-width: 320px;
  background: white;
  border-right: 1px solid #e5e7eb;
  border-left: 1px solid #e5e7eb;
}

.formation-sidebar-sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.formation-sidebar-close {
  display: none;
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  border-radius: 8px;
  color: #6b7280;
}

.formation-sidebar-close:hover {
  background: #f3f4f6;
}

/* --- Sidebar header --- */
.formation-sidebar-header {
  padding: 20px;
  border-bottom: 1px solid #e5e7eb;
}

.formation-progress-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.formation-progress-label {
  font-size: 13px;
  color: #6b7280;
}

.formation-progress-count {
  font-size: 13px;
  font-weight: 600;
  color: #111827;
}

.formation-progress-bar-wrapper {
  width: 100%;
  height: 8px;
  background: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
}

.formation-progress-bar {
  height: 100%;
  background: var(--button-color, #555);
  border-radius: 4px;
  transition: width 0.3s ease;
}

/* --- Search --- */
.formation-search-wrapper {
  position: relative;
  margin-top: 16px;
}

.formation-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
  pointer-events: none;
}

.formation-sidebar .formation-search {
  width: 100%;
  padding: 10px 12px 10px 44px !important;
  font-size: 14px;
  background: white;
  outline: none;
  box-sizing: border-box;
}

.formation-search:focus {
  border-color: var(--button-color, #555);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

/* --- Modules --- */
.formation-modules {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.formation-module {
  margin-bottom: 16px;
}

.formation-module-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: none;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: #111827;
  text-align: left;
}

.formation-module-toggle:hover {
  background: #f3f4f6;
}

.formation-chevron {
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.formation-module-title {
  flex: 1;
}

/* --- Lessons --- */
.formation-lessons {
  margin-top: 4px;
}

.formation-lesson {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  background: none;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease;
}

.formation-lesson:hover:not([disabled]) {
  background: #f3f4f6;
}

.formation-lesson.is-active {
  background: #eff6ff;
  border-left: 4px solid var(--button-color, #555);
}

.formation-lesson[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.formation-lesson-status {
  margin-top: 2px;
  flex-shrink: 0;
}

.formation-lesson-info {
  flex: 1;
  min-width: 0;
}

.formation-lesson-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}

.formation-lesson-title {
  font-size: 13px;
  font-weight: 500;
  color: #111827;
  overflow: hidden;
  text-overflow: ellipsis;
}

.formation-lesson.is-active .formation-lesson-title {
  color: var(--button-color, #555);
}

.formation-lesson-unlock {
  display: block;
  font-size: 12px;
  color: var(--title-color);
  margin-top: 2px;
}

.formation-lesson-progression {
  color: #9ca3af;
}

/* --- Colonne droite (contenu + nav) --- */
/* --- Contenu principal --- */
.formation-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.formation-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  padding: 40px;
}

.formation-welcome h2 {
  font-size: 24px;
  font-weight: 700;
  color: #111827;
  margin-bottom: 8px;
}

.formation-welcome p {
  font-size: 16px;
  color: #6b7280;
}

.formation-lesson-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.formation-lesson-container {
  flex: 1;
  max-width: 900px;
  margin: 0 auto;
  padding: 32px;
  width: 100%;
  box-sizing: border-box;
}

.formation-lesson-main-title {
  font-size: 28px;
  font-weight: 700;
  color: #111827;
  margin-bottom: 24px;
  line-height: 1.3;
}

/* --- Locked message --- */
.formation-locked-msg {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  margin-bottom: 24px;
}

.formation-locked-msg svg {
  color: var(--title-color);
  flex-shrink: 0;
  margin-top: 2px;
}

.formation-locked-title {
  font-weight: 600;
  color: #9a3412;
  margin-bottom: 4px;
}

.formation-locked-text {
  font-size: 14px;
  color: #c2410c;
}

/* --- Video --- */
.formation-video-wrapper {
  margin-bottom: 32px;
}

.formation-video-wrapper iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  background: #111827;
  border: none;
}

/* --- Article --- */
.formation-article {
  margin-bottom: 32px;
  line-height: 1.7;
}

/* --- Navigation --- */
.formation-nav {
  padding: 16px 24px;
  background: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.formation-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: white;
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  cursor: pointer;
  transition: all 0.15s ease;
}

.formation-nav-btn:hover:not([disabled]) {
  background: #f3f4f6;
  border-color: #9ca3af;
}

.formation-nav-complete {
  background: var(--button-color, #555);
  color: white;
  border-color: var(--button-color, #555);
}

.formation-nav-complete:hover:not([disabled]) {
  background: transparent !important;
  border-color: var(--button-color, #555) !important;
  color: var(--button-color, #555) !important;
}

.formation-nav-btn[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}

.formation-empty {
  text-align: center;
  color: #6b7280;
  font-size: 14px;
  padding: 32px 0;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
  .formation-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .formation-header-title {
    flex: none;
    width: 100%;
  }

  .formation-header-progress {
    flex: none;
    width: 100%;
    max-width: 100%;
  }

  .formation-wrapper {
    flex-direction: column;
    height: auto;
    min-height: calc(100vh - 80px);
  }

  .formation-header-progress {
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
  }

  .formation-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    min-height: 100vh;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

  .formation-sidebar.is-open {
    transform: translateX(0);
  }

  .formation-sidebar-sticky {
    position: static;
    height: auto;
    overflow-y: visible;
  }

  .formation-sidebar-close {
    display: block;
  }

  .formation-content {
    min-height: calc(100vh - 140px);
  }

  .formation-lesson-container {
    padding: 20px 16px;
  }

  .formation-lesson-main-title {
    font-size: 22px;
  }

  .formation-nav {
    padding: 12px 16px;
    flex-wrap: wrap;
  }

  .formation-nav-btn {
    padding: 10px 12px;
    font-size: 13px;
    gap: 6px;
    justify-content: center;
  }

  .formation-nav-btn svg {
    width: 14px;
    height: 14px;
  }
}

