/* outil-cours-tcp-udp.css
   Le layout general (hero, onglets, tab-content, outil-wrap) est fourni par
   outil-memo-ports.css. Ce fichier ajoute uniquement les composants propres
   au contenu TCP vs UDP : accordeon, cartes, ports, schema et quiz.
*/

/* ACCORDEON */
.cours-section {
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 10px;
  overflow: hidden;
  background: var(--bg2);
}
.cours-section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  cursor: pointer;
  user-select: none;
  transition: background .15s;
}
.cours-section-header:hover { background: var(--bg3); }
.cours-section-title { font-size: 15px; font-weight: 700; flex: 1; }
.cours-section-sub { font-size: 12px; color: var(--text3); margin-top: 2px; }
.cours-section-arrow { font-size: 12px; color: var(--text3); transition: transform .2s; }
.cours-section.open .cours-section-arrow { transform: rotate(180deg); }
.cours-section-body { height: 0; overflow: hidden; transition: height .25s ease; }
.cours-section-body-inner { padding: 0 20px 20px; }

.cours-note {
  font-size: 13px;
  color: var(--text2);
  background: var(--bg3);
  border-left: 3px solid var(--accent);
  border-radius: 0 6px 6px 0;
  padding: 10px 14px;
  margin: 12px 0;
  line-height: 1.6;
}

.tu-source {
  font-size: 11px;
  color: var(--text3);
  font-style: italic;
  margin-top: 14px;
}

/* CARTES (TCP, UDP, choix, pratique) */
.tu-card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media(max-width:600px){ .tu-card-grid { grid-template-columns: 1fr; } }

.tu-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
}
.tu-card-label { font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text3); margin-bottom: 6px; }
.tu-card-desc { font-size: 12px; color: var(--text2); line-height: 1.6; }
.tu-card-desc code { font-family: var(--mono); background: var(--bg3); padding: 1px 5px; border-radius: 4px; font-size: 11px; }

/* ETAPES (3-way handshake) */
.step-list { display: flex; flex-direction: column; gap: 10px; }
.step-item { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; display: grid; grid-template-columns: 28px 1fr; gap: 0 12px; align-items: start; }
.step-num { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.step-title { font-size: 13px; font-weight: 700; margin-bottom: 5px; }
.step-code { font-family: var(--mono); font-size: 12px; background: var(--bg3); border-radius: 6px; padding: 8px 10px; line-height: 1.8; word-break: break-all; }
.step-plain { font-size: 12px; color: var(--text2); font-style: italic; margin-top: 6px; }

/* PLAGES DE PORTS */
.info-types { display: flex; flex-direction: column; gap: 8px; }
.info-type { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; display: grid; grid-template-columns: 130px 1fr; gap: 8px 16px; align-items: start; }
@media(max-width:600px){ .info-type { grid-template-columns: 1fr; } }
.info-type-prefix { font-family: var(--mono); font-size: 13px; font-weight: 800; padding: 4px 8px; border-radius: 6px; text-align: center; }
.info-type-title { font-size: 13px; font-weight: 700; margin-bottom: 3px; }
.info-type-desc { font-size: 12px; color: var(--text2); line-height: 1.5; }
.info-type-ex { font-family: var(--mono); font-size: 11px; color: var(--text3); margin-top: 4px; }
.it-a { background: rgba(99,102,241,.12); color: #4f46e5; }
.it-b { background: rgba(16,185,129,.12); color: #059669; }
.it-c { background: rgba(139,92,246,.12); color: #7c3aed; }

/* SCHEMA */
.schema-tu { display: flex; flex-direction: column; gap: 24px; }

.schema-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media(max-width:600px){ .schema-compare { grid-template-columns: 1fr; } }

.schema-box { background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; padding: 18px; }
.schema-box-title { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text3); margin-bottom: 8px; }
.schema-proto-name { font-size: 14px; font-weight: 800; margin-bottom: 12px; }
.schema-proto-tcp { color: #059669; }
.schema-proto-udp { color: #dc2626; }
.schema-attr { font-size: 12px; color: var(--text2); margin-bottom: 6px; display: flex; gap: 8px; }
.schema-attr-key { color: var(--text3); width: 90px; flex-shrink: 0; }

.schema-decompose { background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; padding: 18px; }
.schema-decompose-title { font-size: 13px; font-weight: 700; margin-bottom: 14px; }

.handshake-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-bottom: 12px; }
.handshake-step { cursor: pointer; padding: 7px 12px; border-radius: 6px; font-family: var(--mono); font-size: 12px; font-weight: 700; border: 2px solid var(--border); background: var(--bg); color: var(--text2); transition: all .15s; }
.handshake-step:hover, .handshake-step.active { border-color: var(--accent); color: var(--accent); }
.handshake-arrow { font-size: 13px; color: var(--text3); }

.decompose-detail { min-height: 60px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; font-size: 13px; color: var(--text2); }
.decompose-detail-title { font-weight: 700; color: var(--text); margin-bottom: 4px; font-family: var(--mono); }

/* QUIZ */
.quiz-intro { text-align: center; padding: 40px 20px; }
.quiz-intro-title { font-size: 20px; font-weight: 700; margin-bottom: 10px; }
.quiz-intro-desc { font-size: 14px; color: var(--text2); margin-bottom: 24px; }
.btn-start { background: var(--accent); color: #fff; border: none; padding: 12px 28px; border-radius: 8px; font-size: 15px; font-weight: 700; cursor: pointer; font-family: var(--sans); opacity: 1; pointer-events: all; }
.btn-start:hover { opacity: .85; }
.quiz-progress-bar { height: 4px; background: var(--border); border-radius: 2px; margin-bottom: 6px; }
.quiz-progress-fill { height: 100%; background: var(--accent); border-radius: 2px; transition: width .3s; }
.quiz-top-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.quiz-progress-label { font-size: 12px; color: var(--text3); }
.quiz-card { background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; padding: 24px; }
.quiz-question { font-size: 16px; font-weight: 700; margin-bottom: 16px; line-height: 1.4; }
.quiz-context { font-size: 12px; color: var(--text3); font-family: var(--mono); background: var(--bg3); border-radius: 6px; padding: 8px 10px; margin-bottom: 14px; }
.quiz-choices { display: flex; flex-direction: column; gap: 8px; }
.quiz-choice { text-align: left; padding: 12px 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); font-size: 13px; font-family: var(--sans); cursor: pointer; transition: all .15s; }
.quiz-choice:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.quiz-choice.correct { background: #f0fdf4; border-color: #059669; color: #065f46; font-weight: 700; }
.quiz-choice.wrong   { background: #fef2f2; border-color: #dc2626; color: #991b1b; }
.quiz-choice.reveal  { background: #f0fdf4; border-color: #059669; color: #065f46; font-weight: 700; }
.quiz-feedback { margin-top: 14px; padding: 12px 14px; border-radius: 8px; font-size: 13px; line-height: 1.5; }
.quiz-feedback.ok { background: #f0fdf4; color: #065f46; border: 1px solid #bbf7d0; }
.quiz-feedback.ko { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.btn-next { margin-top: 14px; background: var(--accent); color: #fff; border: none; padding: 10px 22px; border-radius: 8px; font-size: 13px; font-weight: 700; cursor: pointer; font-family: var(--sans); }
.btn-retry, .btn-memo { padding: 10px 20px; border-radius: 8px; font-size: 13px; font-weight: 700; cursor: pointer; font-family: var(--sans); border: 1px solid var(--border); background: var(--bg2); color: var(--text); margin: 4px; }
.btn-retry { background: var(--accent); color: #fff; border-color: var(--accent); }
.quiz-score-wrap { text-align: center; padding: 40px 20px; }
.quiz-score-num { font-size: 56px; font-weight: 800; color: var(--accent); }
.quiz-score-label { font-size: 15px; color: var(--text2); margin-bottom: 10px; }
.quiz-score-detail { font-size: 14px; color: var(--text2); margin-bottom: 24px; max-width: 400px; margin-left: auto; margin-right: auto; }
.quiz-actions { margin-top: 20px; }
