/* =========================================================
   module-electronique-numerique.css — Module Électronique numérique
   MonMiniLab
   Couleur accent : violet #7c3aed
   ========================================================= */

:root {
  --accent:    #7c3aed;
  --accent2:   #a78bfa;
  --accent-bg: #f5f3ff;
}

/* Sidebar hover spécifique (fond violet clair) */
.lesson-link:hover { background: #ede9fe; }

/* ── Table de vérité ── */
.truth-table {
  width: 100%; border-collapse: collapse; margin: 1rem 0 1.5rem;
  font-family: 'IBM Plex Mono', monospace; font-size: 0.88rem;
}
.truth-table th {
  background: var(--navy); color: var(--white);
  padding: 0.55rem 1rem; text-align: center; font-weight: 600;
}
.truth-table td {
  padding: 0.5rem 1rem; border-bottom: 1px solid var(--border); text-align: center;
}
.truth-table tr:last-child td { border-bottom: none; }
.truth-table tr:nth-child(even) td { background: var(--off); }
.truth-table .one { color: #16a34a; font-weight: 700; }
.truth-table .zero { color: var(--muted); }

/* ── Gate cards ── */
.gate-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem; margin: 1.5rem 0;
}
.gate-card {
  background: var(--off); border: 1px solid var(--border);
  border-radius: 10px; padding: 1rem; text-align: center;
  transition: border-color 0.15s;
}
.gate-card:hover { border-color: var(--accent); }
.gate-card svg { display: block; margin: 0 auto 0.6rem; }
.gate-card h4 { font-size: 0.87rem; font-weight: 700; color: var(--navy); }
.gate-card p { font-size: 0.76rem; color: var(--muted); margin-top: 0.3rem; }
.gate-expr {
  font-family: 'IBM Plex Mono', monospace; font-size: 0.78rem;
  color: var(--accent); margin-top: 0.4rem; font-weight: 600;
}

/* ── Bit display ── */
.bit-display {
  display: flex; gap: 0.4rem; flex-wrap: wrap;
  margin: 1rem 0; align-items: center;
}
.bit {
  width: 36px; height: 36px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'IBM Plex Mono', monospace; font-weight: 700; font-size: 1rem;
  border: 1.5px solid var(--border);
}
.bit.one { background: #f0fdf4; border-color: #86efac; color: #16a34a; }
.bit.zero { background: var(--off); color: var(--muted); }
.bit-label { font-size: 0.75rem; color: var(--muted); margin-left: 0.5rem; }

/* ── Binary conversion box ── */
.conv-box {
  background: #0f172a; border-radius: 12px;
  padding: 1.5rem; margin: 1.25rem 0 1.75rem;
  border: 1px solid #1e293b;
}
.conv-row {
  display: flex; align-items: baseline; gap: 1rem;
  margin-bottom: 0.75rem; flex-wrap: wrap;
}
.conv-label {
  font-family: 'IBM Plex Mono', monospace; font-size: 0.72rem;
  color: #94a3b8; min-width: 100px;
}
.conv-value {
  font-family: 'IBM Plex Mono', monospace; font-size: 1.1rem;
  color: #a78bfa; font-weight: 700; letter-spacing: 0.1em;
}
.conv-value .highlight { color: #7dd3fc; }

/* ── Composants grid ── */
.composants-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 1rem; margin: 1.5rem 0;
}
.composant-card {
  background: var(--off); border: 1px solid var(--border);
  border-radius: 10px; padding: 1rem 0.75rem; text-align: center;
  transition: border-color 0.15s, background 0.15s;
}
.composant-card:hover { border-color: var(--accent); background: var(--accent-bg); }
.composant-card svg { display: block; margin: 0 auto 0.6rem; overflow: visible; }
.composant-card h4 { font-size: 0.87rem; font-weight: 700; color: var(--navy); }
.composant-card p { font-size: 0.76rem; color: var(--muted); margin-top: 0.25rem; line-height: 1.5; }
.composant-symbol { font-family: 'IBM Plex Mono', monospace; font-size: 0.68rem; color: var(--accent); margin-top: 0.3rem; }

/* ── Circuit diagram ── */
.circuit-diagram {
  text-align: center; margin: 1.75rem 0;
  background: var(--off); border: 1px solid var(--border);
  border-radius: 12px; padding: 1.5rem 1rem 1rem;
}
.circuit-diagram svg { max-width: 100%; height: auto; display: block; margin: 0 auto; }
.circuit-caption {
  font-size: 0.78rem; color: var(--muted); margin-top: 0.75rem;
  font-style: italic;
}

/* ── Table grandeurs ── */
.grandeurs-table {
  width: 100%; border-collapse: collapse; margin: 1rem 0 1.5rem;
  font-size: 0.88rem;
}
.grandeurs-table th {
  background: var(--navy); color: var(--white);
  padding: 0.6rem 1rem; text-align: left; font-weight: 600; font-size: 0.8rem;
}
.grandeurs-table td { padding: 0.55rem 1rem; border-bottom: 1px solid var(--border); }
.grandeurs-table tr:last-child td { border-bottom: none; }
.grandeurs-table tr:nth-child(even) td { background: var(--off); }
.grandeurs-table .symbol {
  font-family: 'IBM Plex Mono', monospace; font-weight: 700; color: var(--accent);
  font-size: 1rem;
}
.grandeurs-table .unit {
  font-family: 'IBM Plex Mono', monospace; color: var(--muted); font-size: 0.82rem;
}

@media (max-width: 680px) {
  .composants-grid { grid-template-columns: repeat(2, 1fr); }
}
