/* ============================================================
   tp.css — Page Travaux Pratiques
   Dépend de : variables.css, layout.css, components.css
   ============================================================ */

/* ── Navbar placeholder (remplace par la tienne) ── */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 56px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-lg);
  z-index: 100;
}

.nav-links {
  display: flex;
  gap: var(--space-lg);
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 1px;
  transition: color 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--accent);
}

/* ══════════════════════════════════════════
   LAYOUT GLOBAL : sidebar + main + toc-right
   ══════════════════════════════════════════ */
.tp-layout {
  display: grid;
  grid-template-columns: 220px 1fr 160px;
  grid-template-areas: "sidebar main toc-right";
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-xl) var(--space-lg);
  gap: var(--space-xl);
  min-height: calc(100vh - 56px);
}

/* ══════════════════════════════════════════
   SIDEBAR GAUCHE
   ══════════════════════════════════════════ */
.tp-sidebar {
  grid-area: sidebar;
}

.tp-sidebar-inner {
  position: sticky;
  top: calc(56px + var(--space-lg));
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.tp-sidebar-group {}

.tp-sidebar-heading {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: var(--space-sm);
  padding-bottom: var(--space-xs);
  border-bottom: 1px solid var(--border);
}

.tp-sidebar-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tp-sidebar-link {
  display: block;
  padding: 5px 10px;
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.tp-sidebar-link:hover {
  color: var(--text);
  background: var(--bg-3);
  border-left-color: var(--border);
}

.tp-sidebar-link.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--bg-3);
}

/* ══════════════════════════════════════════
   CONTENU PRINCIPAL
   ══════════════════════════════════════════ */
.tp-main {
  grid-area: main;
  min-width: 0;
}

/* ── Fil d'ariane ── */
.tp-breadcrumb {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.5px;
  margin-bottom: var(--space-lg);
  display: flex;
  align-items: center;
  gap: 8px;
}

.tp-bc-sep {
  color: var(--border);
  font-size: 14px;
}

/* ── En-tête TP ── */
.tp-header {
  margin-bottom: var(--space-xl);
  padding-bottom: var(--space-xl);
  border-bottom: 1px solid var(--border);
}

.tp-subject-badge {
  display: inline-block;
  margin-bottom: var(--space-sm);
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.tp-title {
  font-family: var(--font-mono);
  font-size: 1.6rem;
  color: #fff;
  letter-spacing: 1px;
  line-height: 1.2;
  margin-bottom: var(--space-sm);
}

.tp-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  font-family: var(--font-mono);
}

.tp-meta-sep {
  color: var(--border);
}

/* ── Sommaire intégré (haut de page) ── */
.tp-toc {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  padding: var(--space-md) 1.2rem;
  margin-bottom: var(--space-xl);
}

.tp-toc-title {
  margin-bottom: var(--space-sm);
}

.tp-toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  counter-reset: toc-counter;
}

.tp-toc-list li a {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
}

.tp-toc-list li a:hover {
  color: var(--accent);
}

.tp-toc-list li a .toc-num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  min-width: 22px;
}

/* ── Sections du TP ── */
.tp-section {
  margin-bottom: calc(var(--space-xl) * 1.5);
  scroll-margin-top: calc(56px + var(--space-lg));
}

.tp-section-title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 3px;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: var(--space-md);
  display: flex;
  align-items: center;
  gap: 12px;
}

.tp-section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.tp-section-num {
  color: var(--muted);
  font-size: 0.7rem;
}

.tp-text {
  font-size: 14px;
  color: var(--text);
  line-height: 1.75;
  margin-bottom: var(--space-md);
}

/* ── Code ── */
.tp-code-wrap {
  margin-bottom: var(--space-md);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.tp-code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-3);
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
}

.tp-code-lang {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 1px;
}

.tp-copy-btn {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  background: none;
  border: 1px solid var(--border);
  padding: 2px 10px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: color 0.2s, border-color 0.2s;
}

.tp-copy-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.tp-copy-btn.copied {
  color: var(--accent);
  border-color: var(--accent);
}

.tp-code {
  background: var(--bg-2);
  margin: 0;
  padding: var(--space-md) 1.2rem;
  overflow-x: auto;
}

.tp-code code {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
  line-height: 1.7;
  white-space: pre;
}

.tp-inline-code {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  background: var(--bg-3);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: var(--radius-sm);
}

/* ── Screenshots ── */
.tp-screenshot {
  border: 1px solid var(--border);
  background: var(--bg-2);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: var(--space-md);
}

.tp-screenshot-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-3);
  letter-spacing: 0.5px;
}

.tp-img {
  display: block;
  width: 100%;
  height: auto;
}

/* Placeholder quand l'image n'existe pas encore */
.tp-screenshot--placeholder .tp-img {
  display: none;
}

.tp-screenshot-placeholder-text {
  display: none;
  padding: var(--space-xl);
  text-align: center;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--border);
  border: 2px dashed var(--border);
  margin: var(--space-md);
  border-radius: var(--radius-sm);
}

.tp-screenshot--placeholder .tp-screenshot-placeholder-text {
  display: block;
}

/* ── Tableau ── */
.tp-table-wrap {
  overflow-x: auto;
  margin-bottom: var(--space-md);
}

.tp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.tp-table th {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.tp-table td {
  padding: 9px 12px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

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

.tp-table tr:hover td {
  background: var(--bg-2);
}

/* ── Notes / Encadrés ── */
.tp-note {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: var(--space-md) 1.2rem;
  border-left: 3px solid var(--border);
  background: var(--bg-2);
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: var(--space-md);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.tp-note strong {
  color: var(--text);
}

.tp-note-icon {
  font-size: 16px;
  flex-shrink: 0;
  margin-top: 1px;
}

.tp-note--info {
  border-left-color: var(--accent-2);
  background: rgba(0, 120, 255, 0.06);
}

.tp-note--info .tp-note-icon {
  color: var(--accent-2);
}

.tp-note--warn {
  border-left-color: #f0a500;
  background: rgba(240, 165, 0, 0.06);
}

.tp-note--warn .tp-note-icon {
  color: #f0a500;
}

.tp-note--success {
  border-left-color: var(--accent);
  background: rgba(0, 212, 170, 0.06);
}

.tp-note--success .tp-note-icon {
  color: var(--accent);
}

/* ── Pied de page du TP ── */
.tp-footer {
  border-top: 1px solid var(--border);
  margin-top: var(--space-xl);
  padding-top: var(--space-md);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ══════════════════════════════════════════
   SOMMAIRE FLOTTANT DROIT
   ══════════════════════════════════════════ */
.tp-toc-right {
  grid-area: toc-right;
}

.tp-toc-right-title {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: var(--space-sm);
  position: sticky;
  top: calc(56px + var(--space-lg));
}

.tp-toc-right-list {
  list-style: none;
  padding: 0;
  margin: 0;
  position: sticky;
  top: calc(56px + var(--space-lg) + 28px);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tp-toc-right-list li a {
  display: block;
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
  padding: 4px 8px;
  border-left: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
  line-height: 1.4;
}

.tp-toc-right-list li a:hover {
  color: var(--text);
  border-left-color: var(--border);
}

.tp-toc-right-list li a.active {
  color: var(--accent);
  border-left-color: var(--accent);
}

/* ══════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════ */
@media (max-width: 1024px) {
  .tp-layout {
    grid-template-columns: 200px 1fr;
    grid-template-areas:
      "sidebar main";
  }
  .tp-toc-right {
    display: none;
  }
}

@media (max-width: 700px) {
  .tp-layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "main";
    padding: var(--space-md);
  }

  .tp-sidebar {
    display: none;
  }

  .tp-title {
    font-size: 1.2rem;
  }

  .tp-meta {
    flex-wrap: wrap;
  }
}
