/* ==========================================================================
   Styles pour le taux de variation d'une fonction affine (p2_l4_t3)
   Écoles Pionnières - 2AC Mathématiques
   ========================================================================== */

.rtv-section {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  padding: 24px;
  margin: 24px 0;
  box-shadow: 0 4px 16px -2px rgba(15, 23, 42, 0.05);
}

.rtv-header-card {
  background: linear-gradient(135deg, #f0fdfa 0%, #ecfeff 100%);
  border: 1.5px solid #99f6e4;
  border-radius: 16px;
  padding: 20px 22px;
  margin-bottom: 24px;
}

.rtv-intro-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.rtv-badge-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ea580c;
  color: #ffffff;
  font-size: 13.5px;
  font-weight: 700;
  padding: 4px 14px;
  border-radius: 999px;
}

.rtv-intro-desc {
  font-size: 15px;
  color: #334155;
  line-height: 1.6;
  margin: 0;
}

/* Carte de cas d'étude (1, 2, 3, 4) */
.rtv-case-card {
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 24px;
  transition: all 0.2s ease;
}

.rtv-case-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
}

.rtv-case-card:last-child {
  margin-bottom: 0;
}

.rtv-case-header {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 16px;
  line-height: 1.5;
}

.rtv-case-num {
  color: #ea580c;
  font-weight: 800;
  margin-right: 4px;
}

.rtv-case-func {
  color: #1e40af;
  font-weight: 700;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  padding: 2px 8px;
  border-radius: 6px;
  white-space: nowrap;
}

/* Conteneur principal flex du cas : Tableau + Interprétation + Grille graphique */
.rtv-case-layout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 18px 20px;
}

/* 1. Bloc Tableau avec arcs de variation */
.rtv-table-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  min-width: 130px;
}

.rtv-table-arc-top {
  display: flex;
  justify-content: flex-end;
  width: 100%;
  padding-right: 14px;
  margin-bottom: 2px;
}

.rtv-table-arc-bottom {
  display: flex;
  justify-content: flex-end;
  width: 100%;
  padding-right: 14px;
  margin-top: 2px;
}

.rtv-arc-badge {
  font-size: 15px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.5px;
}

.rtv-arc-pos {
  color: #0284c7;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
}

.rtv-arc-neg {
  color: #0284c7;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
}

.rtv-mini-table {
  border-collapse: collapse;
  border: 1.5px solid #f97316;
  border-radius: 8px;
  overflow: hidden;
  text-align: center;
  background: #ffffff;
}

.rtv-mini-table td, 
.rtv-mini-table th {
  border: 1px solid #fed7aa;
  padding: 8px 14px;
  font-size: 15px;
}

.rtv-mini-table th {
  background: #fff7ed;
  color: #9a3412;
  font-weight: 700;
}

.rtv-mini-val {
  font-size: 17px;
  color: #1e293b;
}

/* 2. Bloc du milieu : Texte sémiotique + Formule taux de variation */
.rtv-middle-block {
  flex: 1;
  min-width: 260px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rtv-semiotic-box {
  background: #fff7ed;
  border: 1.5px solid #fed7aa;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 14.5px;
  color: #7c2d12;
  line-height: 1.5;
}

.rtv-kw-inc {
  color: #0284c7;
  font-weight: 700;
}

.rtv-kw-dec {
  color: #0284c7;
  font-weight: 700;
}

.rtv-formula-box {
  background: #f0fdf4;
  border: 1.5px solid #bbf7d0;
  border-radius: 10px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  color: #166534;
  flex-wrap: wrap;
}

.rtv-rate-label {
  font-weight: 600;
}

.rtv-rate-calc {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  font-weight: 700;
}

.rtv-frac-math {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  font-size: 0.95em;
  line-height: 1.15;
  vertical-align: middle;
}

.rtv-frac-n {
  border-bottom: 1.5px solid currentColor;
  padding-bottom: 2px;
}

.rtv-frac-d {
  padding-top: 2px;
}

.rtv-rate-ans {
  color: #15803d;
  font-size: 20px;
}

/* Flèche de liaison */
.rtv-trans-arr {
  color: #64748b;
  font-size: 24px;
  font-weight: bold;
}

/* 3. Bloc Graphique sur quadrillage SVG */
.rtv-graph-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 200px;
}

.rtv-grid-svg {
  width: 190px;
  height: 150px;
  background: #ffffff;
  border-radius: 8px;
}

/* Responsive */
@media (max-width: 768px) {
  .rtv-section {
    padding: 16px;
  }
  .rtv-case-layout {
    flex-direction: column;
    align-items: center;
    gap: 16px;
  }
  .rtv-trans-arr {
    transform: rotate(90deg);
  }
  .rtv-middle-block {
    width: 100%;
  }
}
