/* ========================================================
   NoSeumCode - Page Cours & Catalogue (Thème Lumineux & Hero Sombre)
   ======================================================== */

.cours-page {
  background-color: #f8fafc;
  color: #1e293b;
  min-height: 100vh;
}

#cours-content {
  padding-top: calc(var(--header-height, 80px) + 20px);
  padding-bottom: 5rem;
}

/* ========================================================
   Course Header & Banner (Hero Sombre Contrasté)
   ======================================================== */
.course-header-banner {
  max-width: 1300px;
  margin: 0 auto 2rem;
  padding: 2.25rem 2.5rem;
  background: linear-gradient(135deg, #0a1628 0%, #16243b 100%);
  border: 1px solid rgba(0, 255, 135, 0.3);
  border-radius: 20px;
  box-shadow: 0 15px 35px rgba(10, 22, 40, 0.15);
  position: relative;
  overflow: hidden;
  color: #ffffff;
}

.course-header-banner::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #00ff87, #00d9ff, #ff3366);
}

.course-header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.course-badge-role {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.95rem;
  border-radius: 9999px;
  font-size: 0.82rem;
  font-weight: 700;
  background: rgba(0, 255, 135, 0.15);
  color: #00ff87;
  border: 1px solid rgba(0, 255, 135, 0.3);
}

.course-title {
  font-family: 'Bangers', cursive;
  font-size: clamp(2rem, 5vw, 3.2rem);
  letter-spacing: 1px;
  color: #ffffff;
  margin: 0 0 0.75rem 0;
  line-height: 1.15;
}

.course-description {
  font-size: 1.05rem;
  line-height: 1.6;
  color: #94a3b8;
  max-width: 950px;
  margin: 0 0 1.5rem 0;
}

.course-metadata-row {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  font-size: 0.88rem;
  color: #94a3b8;
}

.course-metadata-row strong {
  color: #f1f5f9;
}

/* ========================================================
   Classroom Layout (Sidebar + Content)
   ======================================================== */
.course-main-layout {
  max-width: 1300px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 2rem;
  align-items: start;
}

@media (max-width: 960px) {
  .course-main-layout {
    grid-template-columns: 1fr;
  }
}

/* Sidebar Chapters (Carte Blanche Propre) */
.course-sidebar {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 18px;
  padding: 1.5rem;
  position: sticky;
  top: calc(var(--header-height, 80px) + 20px);
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

.course-sidebar-title {
  font-family: 'Bangers', cursive;
  font-size: 1.4rem;
  letter-spacing: 0.5px;
  color: #0a1628;
  margin: 0 0 1rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chapter-nav-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.chapter-nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  color: #334155;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chapter-nav-item:hover {
  background: #f0fdf4;
  border-color: rgba(0, 255, 135, 0.5);
  color: #00a85a;
  transform: translateX(3px);
}

.chapter-nav-item.active {
  background: rgba(0, 255, 135, 0.12);
  border-color: #00ff87;
  color: #059669;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(0, 255, 135, 0.12);
}

.chapter-nav-item.pending {
  border-color: rgba(245, 158, 11, 0.4);
  background: rgba(245, 158, 11, 0.08);
  color: #d97706;
}

/* Main Content Viewer (Panneau Blanc avec Blocs Code Sombres) */
.chapter-content-panel {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 20px;
  padding: 2.5rem;
  box-shadow: 0 4px 25px rgba(0, 0, 0, 0.05);
  min-height: 550px;
}

.chapter-header {
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 1.5rem;
  margin-bottom: 2rem;
}

.chapter-title {
  font-family: 'Bangers', cursive;
  font-size: 2.3rem;
  letter-spacing: 0.5px;
  color: #0a1628;
  margin: 0 0 0.5rem 0;
}

/* Markdown & Code Body Styling */
.rendered-markdown {
  font-size: 1.05rem;
  line-height: 1.8;
  color: #334155;
}

.rendered-markdown h1,
.rendered-markdown h2,
.rendered-markdown h3 {
  font-family: 'Bangers', cursive;
  letter-spacing: 0.5px;
  color: #0a1628;
  margin-top: 2rem;
  margin-bottom: 0.85rem;
}

.rendered-markdown h1 { font-size: 1.9rem; color: #00a85a; }
.rendered-markdown h2 { font-size: 1.6rem; color: #0284c7; }
.rendered-markdown h3 { font-size: 1.35rem; color: #0a1628; }

.rendered-markdown p {
  margin-bottom: 1.25rem;
  color: #334155;
}

.rendered-markdown ul,
.rendered-markdown ol {
  margin: 1rem 0 1.5rem 1.5rem;
  color: #475569;
}

.rendered-markdown li {
  margin-bottom: 0.5rem;
}

.rendered-markdown blockquote {
  background: #f0f9ff;
  border-left: 4px solid #0284c7;
  padding: 1rem 1.25rem;
  border-radius: 0 10px 10px 0;
  margin: 1.5rem 0;
  color: #0369a1;
}

.rendered-markdown pre {
  background: #0a1628;
  border: 1px solid rgba(0, 255, 135, 0.2);
  border-radius: 12px;
  padding: 1.25rem;
  overflow-x: auto;
  margin: 1.5rem 0;
  box-shadow: 0 6px 20px rgba(10, 22, 40, 0.15);
}

.rendered-markdown code {
  font-family: 'Fira Code', Consolas, Monaco, monospace;
  font-size: 0.92rem;
  color: #00ff87;
}

.rendered-markdown p code,
.rendered-markdown li code {
  background: #f1f5f9;
  color: #e11d48;
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
  font-size: 0.88rem;
  border: 1px solid #e2e8f0;
}

/* Action Bars for Roles */
.course-actions-bar {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.role-notice-banner {
  padding: 0.85rem 1.25rem;
  border-radius: 12px;
  font-size: 0.88rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.role-notice-teacher {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #b45309;
}

.role-notice-admin {
  background: rgba(0, 255, 135, 0.12);
  border: 1px solid rgba(0, 255, 135, 0.35);
  color: #059669;
}

/* ========================================================
   Paywall & Access Restricted Gate
   ======================================================== */
.access-gate-card {
  max-width: 800px;
  margin: 3rem auto;
  background: #ffffff;
  border-radius: 24px;
  padding: 3.5rem 2.5rem;
  text-align: center;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.06);
  position: relative;
  overflow: hidden;
}

.access-gate-card.guest {
  border-color: rgba(0, 255, 135, 0.4);
}

.access-gate-card.not-enrolled {
  border-color: rgba(0, 217, 255, 0.4);
}

.access-gate-card.pending {
  border-color: rgba(245, 158, 11, 0.4);
}

.access-gate-icon {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 2.3rem;
  margin-bottom: 1.5rem;
  background: rgba(0, 255, 135, 0.15);
  border: 2px solid #00a85a;
}

.access-gate-card.not-enrolled .access-gate-icon {
  background: rgba(0, 217, 255, 0.15);
  border-color: #0284c7;
}

.access-gate-card.pending .access-gate-icon {
  background: rgba(245, 158, 11, 0.15);
  border-color: #f59e0b;
}

.access-gate-title {
  font-family: 'Bangers', cursive;
  font-size: 2.5rem;
  letter-spacing: 0.5px;
  margin-bottom: 1rem;
  color: #0a1628;
}

.access-gate-desc {
  font-size: 1.1rem;
  line-height: 1.7;
  color: #475569;
  max-width: 620px;
  margin: 0 auto 2.25rem;
}

.access-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.25rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 2rem;
}

/* ========================================================
   Course Catalog / Hub Grid (Cartes Blanches Lumineuses)
   ======================================================== */
.catalog-container {
  max-width: 1300px;
  margin: 0 auto;
  padding: 1rem 1.5rem 5rem;
}

.catalog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 2rem;
}

.course-card-box {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 20px;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.course-card-box:hover {
  transform: translateY(-5px);
  border-color: #00ff87;
  box-shadow: 0 12px 30px rgba(0, 255, 135, 0.15);
}

.course-card-title {
  font-family: 'Bangers', cursive;
  font-size: 1.8rem;
  letter-spacing: 0.5px;
  color: #0a1628;
  margin: 0.75rem 0;
  line-height: 1.2;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: #0284c7;
  font-size: 1.1rem;
  text-decoration: none;
  transition: color 0.2s ease;
  margin-bottom: 1rem;
}

.back-link:hover {
  color: #00a85a;
}

/* Modals */
.course-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 22, 40, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 1.5rem;
}

.course-modal-box {
  background: #0d1b2a;
  border: 1px solid rgba(0, 255, 135, 0.3);
  border-radius: 20px;
  width: 100%;
  max-width: 750px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 2.25rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  color: #ffffff;
}
