/* ==========================================================================
   Styles pour Règles d'addition des nombres relatifs (1AC - p1_l2_t2)
   Écoles Pionnières - AlloNajah
   (Fonds 100% blancs purs selon consigne de l'utilisateur)
   ========================================================================== */

.rar-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);
}

.rar-cards-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Cartes principales de chaque règle */
.rar-card {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-left: 5px solid #0284c7;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

.rar-card.theme-same {
  border-left-color: #0284c7;
}

.rar-card.theme-different {
  border-left-color: #0d9488;
}

.rar-card.theme-opposite {
  border-left-color: #6366f1;
}

.rar-card-title {
  font-size: 17px;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 16px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.rar-card.theme-same .rar-card-title {
  color: #0369a1;
}

.rar-card.theme-different .rar-card-title {
  color: #0f766e;
}

.rar-card.theme-opposite .rar-card-title {
  color: #4338ca;
}

/* Grille interne : Formule à gauche, Démonstrations fléchées à droite */
.rar-rule-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(0, 2fr);
  gap: 16px;
  align-items: stretch;
}

@media (max-width: 1000px) {
  .rar-rule-grid {
    grid-template-columns: 1fr;
  }
}

/* Boîte formule générale avec formes géométriques */
.rar-formula-box {
  background: #ffffff;
  border: 1.5px solid #bae6fd;
  border-radius: 14px;
  padding: 16px 10px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.rar-card.theme-different .rar-formula-box {
  border-color: #99f6e4;
}

.rar-card.theme-opposite .rar-formula-box {
  border-color: #c7d2fe;
}

.rar-formula-line {
  font-family: 'Segoe Print', 'Comic Sans MS', cursive, sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  /* Inline layout keeps text and shapes on the same mathematical baseline. */
  display: block;
  text-align: center;
  white-space: nowrap;
  direction: ltr;
  unicode-bidi: isolate;
  line-height: 2;
}

/* Formes géométriques (carré bleu, triangle bleu) */
.rar-shape-square {
  display: inline-block;
  width: 17px;
  height: 17px;
  background: #93c5fd;
  border: 1.5px solid #3b82f6;
  border-radius: 3px;
  vertical-align: middle;
  margin: 0 2px;
}

.rar-shape-triangle {
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-bottom: 17px solid #93c5fd;
  vertical-align: middle;
  margin: 0 2px;
}

.rar-shape-square.rar-shape-large {
  width: 23px;
  height: 23px;
}

@media (max-width: 480px) {
  .rar-section { padding: 10px; }
  .rar-card { padding: 12px 8px; }
  .rar-formula-line { font-size: 14px; }
  .rar-rule-grid { grid-template-columns: minmax(0, 1fr); }
  .rar-shape-square { width: 14px; height: 14px; margin: 0 1px; }
  .rar-shape-square.rar-shape-large { width: 20px; height: 20px; }
  .rar-shape-triangle {
    border-left-width: 7px;
    border-right-width: 7px;
    border-bottom-width: 14px;
    margin: 0 1px;
  }
}

/* Boîtes des diagrammes fléchés */
.rar-diagrams-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 680px) {
  .rar-diagrams-row {
    grid-template-columns: 1fr;
  }
}

.rar-diagram-box {
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 14px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.rar-svg {
  width: 100%;
  max-width: 290px;
  height: auto;
  display: block;
}

/* Nombres opposés : rangée d'exemples */
.rar-opposites-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: flex-start;
  align-items: center;
}

.rar-pill-ex {
  white-space: nowrap;
  direction: ltr;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 999px;
  padding: 8px 20px;
  font-family: 'Segoe Print', cursive, sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: #1e293b;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

/* ========================================================
   Section "J'étudie l'exemple" (Style Cahier d'exercices)
   ======================================================== */
.rar-examples-card {
  background: #ffffff;
  border: 1.5px solid #fed7aa;
  border-left: 5px solid #f97316;
  border-radius: 16px;
  padding: 22px;
  margin-top: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

.rar-examples-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.rar-examples-pill {
  background: #ffffff;
  border: 1.5px solid #f97316;
  color: #ea580c;
  font-size: 16px;
  font-weight: 700;
  padding: 6px 16px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.rar-examples-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.rar-example-item {
  background: #ffffff;
  border: 1px solid #f1f5f9;
  border-radius: 12px;
  padding: 14px 18px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.rar-example-title {
  font-weight: 700;
  font-size: 15.5px;
  color: #c2410c;
  margin-bottom: 6px;
}

.rar-example-desc {
  font-size: 14px;
  color: #334155;
  margin-bottom: 6px;
  line-height: 1.5;
}

.rar-example-calc {
  font-family: 'Segoe Print', 'Comic Sans MS', cursive, sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: #0284c7;
}

/* Accordéon Arabe */
.rar-arabic-card {
  margin-top: 20px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 14px 18px;
}

.rar-arabic-summary {
  cursor: pointer;
  font-weight: 700;
  color: #0f766e;
  font-size: 14.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.rar-arabic-content {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e2e8f0;
  line-height: 1.8;
  color: #334155;
  font-size: 14.5px;
  direction: rtl;
  text-align: right;
  background: #ffffff;
}
