/* =====================================================
   FORMATIONS ENRICHIES - STYLES UNIVERSELS
   Version 2.0 | Design System pour toutes les formations
   ===================================================== */

/* ============ BACK TO TOP BUTTON ============ */
.btn-back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--cream);
  border: none;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  z-index: 95;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-back-to-top.show {
  display: flex;
  animation: slideUp 0.4s ease;
}

.btn-back-to-top:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
  background: var(--gold-dark);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============ FLOATING BUTTONS ============ */
.floating-actions {
  position: fixed;
  bottom: 90px;
  right: 30px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 94;
}

.float-action-btn {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.float-action-btn.notes {
  background: #FFB85C;
  color: #fff;
}

.float-action-btn.share {
  background: #4A90E2;
  color: #fff;
}

.float-action-btn.glossary {
  background: #7B68EE;
  color: #fff;
}

.float-action-btn:hover {
  transform: scale(1.15);
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

/* ============ INFOBOXES / CALLOUTS ============ */
.infobox {
  border-radius: 8px;
  padding: 20px 24px;
  margin: 24px 0;
  border-left: 4px solid;
  font-size: 15px;
  line-height: 1.6;
}

.infobox h4 {
  margin: 0 0 8px 0;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.infobox p {
  margin: 0;
}

.infobox.callout {
  background: rgba(184, 145, 90, 0.08);
  border-left-color: var(--gold);
  color: var(--fg-soft);
}

.infobox.callout h4 {
  color: var(--gold);
}

.infobox.success {
  background: rgba(74, 143, 74, 0.08);
  border-left-color: #4a8f4a;
  color: #2a5c2a;
}

.infobox.success h4 {
  color: #2a5c2a;
}

.infobox.warning {
  background: rgba(192, 57, 43, 0.08);
  border-left-color: #c0392b;
  color: #5a2020;
}

.infobox.warning h4 {
  color: #c0392b;
}

.infobox.tip {
  background: rgba(52, 152, 219, 0.08);
  border-left-color: #3498db;
  color: #1a3a4a;
}

.infobox.tip h4 {
  color: #3498db;
}

[data-theme="dark"] .infobox {
  background: rgba(255, 255, 255, 0.05);
}

/* ============ HERO IMAGE ============ */
.module-hero {
  width: 100%;
  height: 280px;
  object-fit: cover;
  border-radius: 8px;
  margin: 32px 0;
  display: block;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 80px;
  color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

/* ============ GLOSSAIRE MODAL ============ */
.glossary-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 500;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.glossary-modal.open {
  display: flex;
  animation: fadeIn 0.3s ease;
}

.glossary-content {
  background: var(--bg);
  border-radius: 12px;
  width: 100%;
  max-width: 700px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 32px;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.glossary-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--fg-mute);
  transition: color 0.2s;
}

.glossary-close:hover {
  color: var(--fg);
}

.glossary-header {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--line);
}

.glossary-header h2 {
  margin: 0 0 12px 0;
  color: var(--fg);
  font-size: 28px;
}

.glossary-search {
  width: 100%;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--fg);
  background: var(--bg-alt);
}

.glossary-search:focus {
  outline: none;
  border-color: var(--gold);
}

.glossary-items {
  display: grid;
  gap: 20px;
}

.glossary-item {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.glossary-item:last-child {
  border-bottom: none;
}

.glossary-term {
  font-size: 16px;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 8px;
  font-family: var(--serif);
}

.glossary-def {
  font-size: 14px;
  color: var(--fg-soft);
  line-height: 1.6;
}

/* ============ COMPLETION PAGE ============ */
.completion-page {
  display: none;
  text-align: center;
  padding: 80px 40px;
  animation: fadeIn 0.5s ease;
}

.completion-page.show {
  display: block;
}

.completion-icon {
  font-size: 80px;
  margin-bottom: 24px;
  animation: bounce 0.6s ease;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-20px); }
}

.completion-title {
  font-family: var(--serif);
  font-size: 42px;
  font-weight: 700;
  color: var(--fg);
  margin-bottom: 16px;
  line-height: 1.2;
}

.completion-text {
  font-size: 17px;
  color: var(--fg-soft);
  max-width: 500px;
  margin: 0 auto 40px;
  line-height: 1.6;
}

.completion-buttons {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-completion {
  padding: 14px 32px;
  border: none;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-completion.primary {
  background: var(--gold);
  color: var(--black);
}

.btn-completion.primary:hover {
  background: var(--gold-dark);
  transform: scale(1.05);
}

.btn-completion.secondary {
  background: transparent;
  border: 2px solid var(--gold);
  color: var(--gold);
}

.btn-completion.secondary:hover {
  background: var(--gold);
  color: var(--black);
}

/* ============ BADGES & ACHIEVEMENTS ============ */
.badge-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 16px;
  margin: 32px 0;
}

.badge {
  background: var(--bg-alt);
  border: 2px solid var(--line);
  border-radius: 50%;
  width: 120px;
  height: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.badge.unlocked {
  border-color: var(--gold);
  background: rgba(184, 145, 90, 0.15);
  box-shadow: 0 0 12px rgba(184, 145, 90, 0.3);
}

.badge:hover {
  transform: translateY(-4px);
}

.badge-icon {
  font-size: 40px;
  margin-bottom: 8px;
}

.badge-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-soft);
}

.badge.unlocked .badge-name {
  color: var(--gold);
}

/* ============ TABLES ============ */
.lesson-table {
  width: 100%;
  border-collapse: collapse;
  margin: 32px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.lesson-table th {
  background: var(--gold);
  color: var(--black);
  padding: 14px 16px;
  text-align: left;
  font-weight: 700;
  font-family: var(--sans);
  font-size: 14px;
}

.lesson-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--fg-soft);
  font-size: 14px;
}

.lesson-table tr:hover td {
  background: var(--bg-alt);
}

.lesson-table tr:last-child td {
  border-bottom: none;
}

[data-theme="dark"] .lesson-table {
  border-color: rgba(255,255,255,0.1);
}

/* ============ RESOURCE CARDS ============ */
.resources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin: 32px 0;
}

.resource-card {
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.resource-card:hover {
  border-color: var(--gold);
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}

.resource-icon {
  font-size: 40px;
}

.resource-title {
  font-weight: 700;
  color: var(--fg);
  font-size: 15px;
}

.resource-desc {
  font-size: 13px;
  color: var(--fg-mute);
  line-height: 1.5;
}

.resource-btn {
  margin-top: auto;
  padding: 8px 16px;
  background: var(--gold);
  color: var(--black);
  border: none;
  border-radius: 4px;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.resource-btn:hover {
  background: var(--gold-dark);
}

/* ============ FLASHCARDS ============ */
.flashcard-container {
  perspective: 1000px;
  cursor: pointer;
  margin: 24px 0;
  max-width: 500px;
}

.flashcard {
  position: relative;
  width: 100%;
  min-height: 200px;
  background: var(--bg-alt);
  border: 2px solid var(--gold);
  border-radius: 8px;
  padding: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition: transform 0.6s;
  transform-style: preserve-3d;
  cursor: pointer;
}

.flashcard.flipped {
  transform: rotateY(180deg);
}

.flashcard-front,
.flashcard-back {
  backface-visibility: hidden;
  position: absolute;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

.flashcard-back {
  transform: rotateY(180deg);
}

.flashcard-question {
  font-weight: 600;
  font-size: 16px;
  color: var(--gold);
}

.flashcard-answer {
  font-size: 15px;
  color: var(--fg-soft);
  line-height: 1.6;
}

/* ============ HIGHLIGHTER ============ */
.highlightable {
  position: relative;
}

.highlight {
  background: rgba(184, 145, 90, 0.3);
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.highlight:hover {
  background: rgba(184, 145, 90, 0.5);
}

/* ============ PROGRESS STATS ============ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
  margin: 32px 0;
}

.stat-box {
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  text-align: center;
}

.stat-value {
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 700;
  color: var(--gold);
  line-height: 1;
  margin-bottom: 8px;
}

.stat-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-mute);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ============ COMPARISON TABLES ============ */
.comparison-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin: 32px 0;
}

.comparison-item {
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
}

.comparison-item h4 {
  margin-top: 0;
  color: var(--gold);
}

.comparison-item ul {
  margin: 12px 0 0 0;
  padding-left: 20px;
  font-size: 14px;
}

.comparison-item li {
  margin-bottom: 8px;
  color: var(--fg-soft);
}

/* ============ MINDMAP ============ */
.mindmap {
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 32px;
  margin: 32px 0;
  text-align: center;
}

.mindmap-center {
  font-weight: 700;
  font-size: 18px;
  color: var(--gold);
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--gold);
}

.mindmap-branches {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 16px;
}

.mindmap-item {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-soft);
  transition: all 0.2s ease;
}

.mindmap-item:hover {
  border-color: var(--gold);
  color: var(--fg);
}

/* ============ RESPONSIVE ============ */
@media (max-width: 1024px) {
  .floating-actions {
    bottom: 70px;
    right: 20px;
  }

  .btn-back-to-top {
    bottom: 20px;
    right: 20px;
  }

  .glossary-content {
    max-width: 90vw;
    padding: 24px;
  }
}

@media (max-width: 640px) {
  .completion-title {
    font-size: 28px;
  }

  .completion-buttons {
    flex-direction: column;
  }

  .btn-completion {
    width: 100%;
  }

  .badge-container {
    grid-template-columns: repeat(2, 1fr);
  }

  .badge {
    width: 100px;
    height: 100px;
  }

  .badge-icon {
    font-size: 32px;
  }

  .resources-grid {
    grid-template-columns: 1fr;
  }

  .lesson-table {
    font-size: 12px;
  }

  .lesson-table th,
  .lesson-table td {
    padding: 10px 8px;
  }
}

/* ============ ANIMATIONS ============ */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideIn {
  from {
    transform: translateX(-20px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
