/* backtest_heb.css - Adaptations RTL pour l'hébreu */

/* === Configuration RTL globale === */
[dir="rtl"] {
  direction: rtl;
  text-align: right;
}

[dir="rtl"] body {
  font-family: 'Segoe UI', 'Arial Hebrew', 'David', 'Tahoma', sans-serif;
}

/* === Header === */
[dir="rtl"] .logo {
  text-align: right;
}

[dir="rtl"] .language-selector {
  left: 20px;
  right: auto;
}

/* Espacement entre boutons dans le header en hébreu */
[dir="rtl"] .header-actions > *:not(:last-child),
body.rtl .header-actions > *:not(:last-child) {
  margin-left: 15px !important;
  margin-right: 0 !important;
}

/* Force l'espacement du bouton langue spécifiquement */
[dir="rtl"] .header-actions .language-selector,
body.rtl .header-actions .language-selector {
  margin-left: 15px !important;
}

/* === Titres des sections RTL === */
[dir="rtl"] .accordion-header,
body.rtl .accordion-header {
  direction: rtl !important;
  text-align: right !important;
  display: flex !important;
  flex-direction: row-reverse !important;
  justify-content: space-between !important;
  align-items: center !important;
}

[dir="rtl"] .accordion-icon,
body.rtl .accordion-icon {
  margin-left: 0 !important;
  margin-right: auto !important;
  order: -1 !important;
}

/* === Section Marché RTL === */
[dir="rtl"] .bt-section .bt-marche-top,
body.rtl .bt-section .bt-marche-top {
  direction: rtl !important;
  text-align: right !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 8px !important;
}

/* Grouper label et select ensemble à droite */
[dir="rtl"] .bt-section .bt-marche-top label[for="token-list-select"],
body.rtl .bt-section .bt-marche-top label[for="token-list-select"] {
  order: 3 !important;
  margin-left: 8px !important;
  margin-right: 0 !important;
}

[dir="rtl"] .bt-section .bt-marche-top #token-list-select,
body.rtl .bt-section .bt-marche-top #token-list-select {
  order: 2 !important;
}

[dir="rtl"] .bt-section .bt-marche-top label,
body.rtl .bt-section .bt-marche-top label {
  text-align: center !important;
}

[dir="rtl"] .bt-section .bt-marche-row,
body.rtl .bt-section .bt-marche-row {
  direction: rtl !important;
}

[dir="rtl"] .bt-section .bt-marche-row > div,
body.rtl .bt-section .bt-marche-row > div {
  text-align: center !important;
}

[dir="rtl"] .bt-section .bt-marche-row label,
body.rtl .bt-section .bt-marche-row label {
  text-align: center !important;
}

[dir="rtl"] .bt-section .bt-btn-reset,
body.rtl .bt-section .bt-btn-reset {
  margin-left: 0 !important;
  margin-right: 0 !important;
  order: 1 !important;
}

/* === Contenu des accordéons RTL === */
[dir="rtl"] .bt-section .accordion-content,
body.rtl .bt-section .accordion-content {
  direction: rtl !important;
  text-align: right !important;
}

[dir="rtl"] .bt-section .indicator-card,
body.rtl .bt-section .indicator-card {
  direction: rtl !important;
  text-align: right !important;
}

[dir="rtl"] .bt-section .ind-vars,
body.rtl .bt-section .ind-vars {
  direction: rtl !important;
}

[dir="rtl"] .bt-section .ind-vars > div,
body.rtl .bt-section .ind-vars > div {
  text-align: right !important;
}

[dir="rtl"] .bt-section .ind-vars label,
body.rtl .bt-section .ind-vars label {
  text-align: center !important;
  display: block !important;
}

/* === Préserver les styles des inputs/selects en RTL === */
[dir="rtl"] input,
[dir="rtl"] select,
body.rtl input,
body.rtl select {
  text-align: center !important;
  direction: ltr !important;
  display: flex !important;
  align-items: center !important;
  height: 36px !important;
  font-size: 15px !important;
  padding: 6px 12px !important;
  line-height: 1.2 !important;
  vertical-align: middle !important;
  box-sizing: border-box !important;
}

/* Exception pour les inputs de date en RTL */
[dir="rtl"] input[type="date"],
body.rtl input[type="date"] {
  display: inline-block !important;
  text-align: left !important;
  padding-right: 10px !important;
  min-width: 140px !important;
}

/* === Section Indicateurs RTL - FORCE === */
/* Header indicateur ATR spécifique */
[dir="rtl"] #atr-card .ind-header,
body.rtl #atr-card .ind-header {
  flex-direction: row !important;
  display: flex !important;
  justify-content: flex-start !important;
  text-align: right !important;
  direction: rtl !important;
}

/* Header indicateur MACD spécifique */
[dir="rtl"] #macd-card .ind-header,
body.rtl #macd-card .ind-header {
  flex-direction: row !important;
  display: flex !important;
  justify-content: flex-start !important;
  text-align: right !important;
  direction: rtl !important;
}

/* Variables MACD spécifiques */
[dir="rtl"] #macd-card .ind-vars label,
body.rtl #macd-card .ind-vars label {
  flex-direction: row !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
}

/* Labels avec seulement checkbox + texte (pas d'input) dans MACD */
[dir="rtl"] #macd-card .ind-vars label[style*="gap: 8px"],
body.rtl #macd-card .ind-vars label[style*="gap: 8px"] {
  justify-content: flex-start !important;
  gap: 8px !important;
  margin-bottom: 6px !important;
  line-height: 1.1 !important;
}

/* Variables ATR spécifiques */
[dir="rtl"] #atr-card .ind-vars label,
body.rtl #atr-card .ind-vars label {
  flex-direction: row !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
}

/* === RSI SPÉCIFIQUE === */
/* Header RSI */
[dir="rtl"] #rsi-card .ind-header,
body.rtl #rsi-card .ind-header {
  flex-direction: row !important;
  display: flex !important;
  justify-content: flex-start !important;
  text-align: right !important;
  direction: rtl !important;
}

/* Variables RSI */
[dir="rtl"] #rsi-card .ind-vars label,
body.rtl #rsi-card .ind-vars label {
  flex-direction: row !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
}

/* Checkboxes dans RSI (SMA active) */
[dir="rtl"] #rsi-card .ind-vars label[style*="gap: 8px"],
body.rtl #rsi-card .ind-vars label[style*="gap: 8px"] {
  justify-content: flex-start !important;
  gap: 8px !important;
}

/* === EMA SPÉCIFIQUE === */
/* Header EMA */
[dir="rtl"] #ema-card .ind-header,
body.rtl #ema-card .ind-header {
  flex-direction: row !important;
  display: flex !important;
  justify-content: flex-start !important;
  text-align: right !important;
  direction: rtl !important;
}

/* Variables EMA */
[dir="rtl"] #ema-card .ind-vars label,
body.rtl #ema-card .ind-vars label {
  flex-direction: row !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
}

/* Checkboxes dans EMA (cross et trend) */
[dir="rtl"] #ema-card .ind-vars label[style*="gap: 8px"],
body.rtl #ema-card .ind-vars label[style*="gap: 8px"] {
  justify-content: flex-start !important;
  gap: 8px !important;
  margin-bottom: 6px !important;
}

/* === BOLLINGER BANDS SPÉCIFIQUE === */
/* Header Bollinger */
[dir="rtl"] #bb-card .ind-header,
body.rtl #bb-card .ind-header {
  flex-direction: row !important;
  display: flex !important;
  justify-content: flex-start !important;
  text-align: right !important;
  direction: rtl !important;
}

/* Variables Bollinger avec inputs */
[dir="rtl"] #bb-card .ind-vars label[style*="space-between"],
body.rtl #bb-card .ind-vars label[style*="space-between"] {
  flex-direction: row !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
}

/* Labels avec selects dans Bollinger */
[dir="rtl"] #bb-card .ind-vars label:not([style*="space-between"]),
body.rtl #bb-card .ind-vars label:not([style*="space-between"]) {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  text-align: right !important;
  margin-bottom: 5px !important;
}

/* Selects dans Bollinger */
[dir="rtl"] #bb-card select,
body.rtl #bb-card select {
  width: 100% !important;
  text-align: right !important;
  direction: rtl !important;
  margin-top: 3px !important;
}

/* === FIBONACCI SPÉCIFIQUE === */
/* Header Fibonacci */
[dir="rtl"] #fibo-card .ind-header,
body.rtl #fibo-card .ind-header {
  flex-direction: row !important;
  display: flex !important;
  justify-content: flex-start !important;
  text-align: right !important;
  direction: rtl !important;
}

/* Variables Fibonacci avec inputs text */
[dir="rtl"] #fibo-card .ind-vars label[style*="space-between"],
body.rtl #fibo-card .ind-vars label[style*="space-between"] {
  flex-direction: row !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
}

/* Inputs text spécifiques Fibonacci (plus larges) */
[dir="rtl"] #fibo-card input[type="text"],
body.rtl #fibo-card input[type="text"] {
  width: 120px !important;
  height: 24px !important;
  text-align: center !important;
  direction: ltr !important;
}

/* Labels avec select dans Fibonacci */
[dir="rtl"] #fibo-card .ind-vars label:not([style*="space-between"]),
body.rtl #fibo-card .ind-vars label:not([style*="space-between"]) {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  text-align: right !important;
  margin-bottom: 5px !important;
}

/* Select dans Fibonacci */
[dir="rtl"] #fibo-card select,
body.rtl #fibo-card select {
  width: 100% !important;
  text-align: right !important;
  direction: rtl !important;
  margin-top: 3px !important;
}

/* === SUPPORT/RESISTANCE SPÉCIFIQUE === */
/* Header Support/Resistance */
[dir="rtl"] #sr-card .ind-header,
body.rtl #sr-card .ind-header {
  flex-direction: row !important;
  display: flex !important;
  justify-content: flex-start !important;
  text-align: right !important;
  direction: rtl !important;
}

/* Variables Support/Resistance */
[dir="rtl"] #sr-card .ind-vars label,
body.rtl #sr-card .ind-vars label {
  flex-direction: row !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
}

/* Conteneur bouton Support/Resistance */
[dir="rtl"] #sr-card .sr-button-container,
body.rtl #sr-card .sr-button-container {
  text-align: right !important;
  direction: rtl !important;
}

/* Bouton réglage visuel Support/Resistance */
[dir="rtl"] #sr-card .sr-tune-btn,
body.rtl #sr-card .sr-tune-btn {
  direction: rtl !important;
  text-align: right !important;
}

/* === ICHIMOKU SPÉCIFIQUE === */
/* Header Ichimoku */
[dir="rtl"] #ichimoku-card .ind-header,
body.rtl #ichimoku-card .ind-header {
  flex-direction: row !important;
  display: flex !important;
  justify-content: flex-start !important;
  text-align: right !important;
  direction: rtl !important;
}

/* Variables Ichimoku spécifiques */
[dir="rtl"] #ichimoku-card .ind-vars label,
body.rtl #ichimoku-card .ind-vars label {
  flex-direction: row !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
}

/* Labels avec seulement checkbox + texte (pas d'input) dans Ichimoku */
[dir="rtl"] #ichimoku-card .ind-vars label[style*="gap: 8px"],
body.rtl #ichimoku-card .ind-vars label[style*="gap: 8px"] {
  justify-content: flex-start !important;
  gap: 8px !important;
  margin-bottom: 6px !important;
  line-height: 1.1 !important;
}

/* Préserver la hauteur des inputs dans les indicateurs */
[dir="rtl"] .indicator-card input[type="number"],
body.rtl .indicator-card input[type="number"] {
  height: 24px !important;
  width: 100px !important;
  text-align: center !important;
  padding: 0 !important;
}

/* === SECTION INDICATEURS RTL - RÈGLES GLOBALES === */

/* Conteneurs généraux */
[dir="rtl"] .bt-indicator-strip { direction: rtl !important; }
[dir="rtl"] .bt-indicator-cards { direction: rtl !important; }
[dir="rtl"] .indicator-card { direction: rtl !important; }

/* TOUS les headers d'indicateurs */
[dir="rtl"] .indicator-card .ind-header {
  flex-direction: row !important;
  justify-content: flex-start !important;
  text-align: right !important;
  direction: rtl !important;
}

/* TOUS les labels avec space-between (label + input) */
[dir="rtl"] .indicator-card .ind-vars label[style*="space-between"] {
  flex-direction: row !important;
  justify-content: space-between !important;
}

/* TOUS les labels avec gap (checkbox + texte) */
[dir="rtl"] .indicator-card .ind-vars label[style*="gap"] {
  flex-direction: row !important;
  justify-content: flex-start !important;
  gap: 8px !important;
  margin-bottom: 6px !important;
  line-height: 1.1 !important;
}

/* TOUS les inputs d'indicateurs */
[dir="rtl"] .indicator-card input[type="number"],
[dir="rtl"] .indicator-card input[type="text"] {
  height: 24px !important;
  width: 100px !important;
  text-align: center !important;
}

/* TOUTES les checkboxes d'indicateurs */
[dir="rtl"] .indicator-card input[type="checkbox"] {
  width: 18px !important;
  height: 18px !important;
}

/* === SECTION TAKE PROFIT RTL === */
/* Headers des cartes Take Profit */
[dir="rtl"] #tp-strip .indicator-card .ind-header,
body.rtl #tp-strip .indicator-card .ind-header {
  flex-direction: row !important;
  display: flex !important;
  justify-content: flex-start !important;
  text-align: right !important;
  direction: rtl !important;
}

/* Variables Take Profit avec inputs */
[dir="rtl"] #tp-strip .indicator-card .ind-vars label[style*="space-between"],
body.rtl #tp-strip .indicator-card .ind-vars label[style*="space-between"] {
  flex-direction: row !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
}

/* Descriptions et textes dans Take Profit */
[dir="rtl"] #tp-strip .indicator-card .ind-vars span,
body.rtl #tp-strip .indicator-card .ind-vars span {
  text-align: right !important;
  direction: rtl !important;
}

/* === SECTION STOP LOSS RTL === */
/* Headers des cartes Stop Loss */
[dir="rtl"] #sl-strip .indicator-card .ind-header,
body.rtl #sl-strip .indicator-card .ind-header {
  flex-direction: row !important;
  display: flex !important;
  justify-content: flex-start !important;
  text-align: right !important;
  direction: rtl !important;
}

/* Variables Stop Loss avec inputs */
[dir="rtl"] #sl-strip .indicator-card .ind-vars label[style*="space-between"],
body.rtl #sl-strip .indicator-card .ind-vars label[style*="space-between"] {
  flex-direction: row !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
}

/* Descriptions et textes dans Stop Loss */
[dir="rtl"] #sl-strip .indicator-card .ind-vars span,
body.rtl #sl-strip .indicator-card .ind-vars span {
  text-align: right !important;
  direction: rtl !important;
}

/* === Sections Long/Short dans les indicateurs === */
[dir="rtl"] .indicator-card div[style*="strong"] {
  text-align: right !important;
}

/* === Sections et accordéons === */
[dir="rtl"] .accordion-header {
  text-align: right;
}

[dir="rtl"] .accordion-icon {
  margin-left: 10px;
  margin-right: 0;
}

/* === Formulaires et inputs === */
[dir="rtl"] label {
  text-align: right;
  margin-left: 5px;
  margin-right: 0;
}

[dir="rtl"] input,
[dir="rtl"] select,
[dir="rtl"] textarea {
  text-align: right;
  padding: 10px 15px 10px 10px;
}

[dir="rtl"] input[type="number"] {
  text-align: center;
}

/* === Grilles et layouts === */
[dir="rtl"] .bt-marche-row {
  flex-direction: row-reverse;
}

[dir="rtl"] .bt-advcat-row {
  direction: rtl;
}

[dir="rtl"] .bt-stats-grid {
  direction: rtl;
}

/* === Cartes d'indicateurs === */
[dir="rtl"] .indicator-card {
  text-align: right;
}

[dir="rtl"] .ind-header {
  justify-content: flex-end;
  gap: 8px;
}

[dir="rtl"] .ind-header input[type="checkbox"] {
  margin-left: 8px;
  margin-right: 0;
}

[dir="rtl"] .ind-vars {
  text-align: right;
}

[dir="rtl"] .ind-vars label {
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  gap: 8px;
  text-align: right;
}

[dir="rtl"] .ind-vars input[type="checkbox"] {
  margin-left: 5px;
  margin-right: 0;
}

/* === Strips scrollables === */
[dir="rtl"] .bt-indicator-strip {
  flex-direction: row-reverse;
}

[dir="rtl"] .bt-indicator-cards {
  scroll-behavior: smooth;
}

[dir="rtl"] .bt-scroll-btn.left {
  order: 1;
}

[dir="rtl"] .bt-scroll-btn.right {
  order: -1;
}

/* === Boutons === */
[dir="rtl"] .bt-btn,
[dir="rtl"] .primary-btn,
[dir="rtl"] .secondary-btn {
  direction: rtl;
}

[dir="rtl"] .bt-btn-row {
  flex-direction: row-reverse;
  justify-content: flex-start;
}

[dir="rtl"] .bt-btn-row .bt-btn:not(:last-child) {
  margin-left: 24px;
  margin-right: 0;
}

/* === Tables === */
[dir="rtl"] .bt-results-table,
[dir="rtl"] .bt-config-table {
  direction: rtl;
}

[dir="rtl"] .bt-results-table th,
[dir="rtl"] .bt-results-table td,
[dir="rtl"] .bt-config-table th,
[dir="rtl"] .bt-config-table td {
  text-align: right;
}

[dir="rtl"] .bt-results-table th:first-child,
[dir="rtl"] .bt-results-table td:first-child,
[dir="rtl"] .bt-config-table th:first-child,
[dir="rtl"] .bt-config-table td:first-child {
  text-align: center;
}

/* === Navigation et toggle === */
[dir="rtl"] .trades-toggle {
  flex-direction: row-reverse;
}

[dir="rtl"] .toggle-switch {
  margin-left: 8px;
  margin-right: 0;
}

/* === Statistiques === */
[dir="rtl"] .bt-stat-card {
  text-align: center;
}

[dir="rtl"] .stat-label {
  direction: rtl;
}

/* === Gestion avancée === */
[dir="rtl"] .bt-trade-side {
  flex-direction: row-reverse;
}

[dir="rtl"] .bt-trade-side label {
  flex-direction: row-reverse;
}

[dir="rtl"] .bt-trade-side input[type="radio"] {
  margin-left: 5px;
  margin-right: 0;
}

[dir="rtl"] .bt-help {
  text-align: right;
  margin-top: 3px;
}

/* === Support/Résistance fenêtre flottante === */
[dir="rtl"] .sr-floating-panel {
  right: auto;
  left: 20px;
}

[dir="rtl"] .sr-floating-header {
  flex-direction: row-reverse;
}

[dir="rtl"] .sr-slider-label {
  flex-direction: row-reverse;
}

[dir="rtl"] .sr-stats-floating {
  direction: rtl;
}

[dir="rtl"] .sr-stat-box {
  text-align: center;
}

[dir="rtl"] .sr-stat-box.support-stat {
  border-right: 3px solid var(--success-color);
  border-left: none;
}

[dir="rtl"] .sr-stat-box.resistance-stat {
  border-right: 3px solid var(--danger-color);
  border-left: none;
}

/* === Bulles d'explication === */
[dir="rtl"] .explanation-bubble {
  direction: rtl;
  text-align: right;
}

[dir="rtl"] .bubble-title {
  flex-direction: row-reverse;
  padding-right: 30px;
  padding-left: 0;
}

[dir="rtl"] .bubble-guru {
  left: 15px;
  right: auto;
}

[dir="rtl"] .guru-control {
  flex-direction: row-reverse;
}

[dir="rtl"] .guru-checkbox {
  flex-direction: row-reverse;
}

/* === Corrections spécifiques pour les nombres === */
[dir="rtl"] .stat-value,
[dir="rtl"] .sr-stat-number {
  direction: ltr; /* Les nombres restent LTR même en hébreu */
  text-align: center;
}

[dir="rtl"] input[type="number"],
[dir="rtl"] input[type="date"],
[dir="rtl"] input[readonly] {
  direction: ltr; /* Les champs numériques et dates restent LTR */
  text-align: center;
}

/* === Fix pour le reset button === */
[dir="rtl"] .bt-marche-top {
  flex-direction: row-reverse;
}

[dir="rtl"] #reset-backtest-btn {
  margin-right: 8px;
  margin-left: 0;
}

/* === Ajustements pour les sélecteurs === */
[dir="rtl"] select option {
  direction: rtl;
  text-align: right;
}

/* === Responsive RTL === */
@media (max-width: 768px) {
  [dir="rtl"] .bt-marche-row {
    flex-direction: column;
  }
  
  [dir="rtl"] .language-selector {
    position: static;
    margin-bottom: 10px;
    text-align: right;
  }
  
  [dir="rtl"] .sr-floating-panel {
    left: 5%;
    right: 5%;
    width: 90%;
  }
}


/* === Corrections pour les flex === */
[dir="rtl"] .bt-section .accordion-header {
  justify-content: space-between;
  flex-direction: row-reverse;
}

[dir="rtl"] .bt-indicator-strip {
  direction: rtl;
}

/* === Police spéciale pour l'hébreu === */
[dir="rtl"] * {
  font-family: 'Segoe UI', 'Arial Hebrew', 'David', 'Noto Sans Hebrew', 'Times New Roman', sans-serif;
}

/* === Exception pour les icônes FontAwesome === */
[dir="rtl"] .fas,
[dir="rtl"] .far,
[dir="rtl"] .fab,
[dir="rtl"] .fa,
[dir="rtl"] i[class*="fa-"] {
  font-family: "Font Awesome 6 Free", "Font Awesome 6 Pro", "Font Awesome 6 Brands" !important;
}

/* === Corrections pour les icônes === */
[dir="rtl"] .accordion-icon,
[dir="rtl"] .indicator-icon {
  transform: scaleX(-1); /* Inverse les flèches */
}

[dir="rtl"] .bt-scroll-btn {
  transform: scaleX(-1); /* Inverse les boutons de navigation */
}

/* === Fix pour les gaps et marges === */
[dir="rtl"] .guru-control {
  gap: 10px;
}

[dir="rtl"] .bt-marche-top {
  gap: 8px;
}

/* === Corrections pour la gestion avancée === */
[dir="rtl"] .bt-advcat-title {
  text-align: right;
  margin-bottom: 10px;
}

/* Effet hover RTL - titre devient blanc quand on survole la zone de contenu */
[dir="rtl"] .indicator-card:hover .bt-advcat-title,
body.rtl .indicator-card:hover .bt-advcat-title {
  color: #ffffff !important; /* Titre en blanc quand on survole la card */
  transition: color 0.3s ease !important; /* Transition fluide */
}

[dir="rtl"] .bt-row-full {
  direction: rtl;
}

/* ===============================================
   NOUVELLES ADAPTATIONS RTL 2025
   Adaptations pour les dernières modifications
   =============================================== */

/* === Grilles statistiques RTL === */
[dir="rtl"] .bt-stats-grid {
  direction: rtl;
  text-align: center; /* Centré pour la grille */
}

[dir="rtl"] .bt-stat-card {
  text-align: center; /* Les cartes centrées */
}

[dir="rtl"] .bt-stat-card .stat-value {
  text-align: center; /* Les valeurs centrées */
}

[dir="rtl"] .bt-stat-card .stat-label {
  text-align: center; /* Les labels centrés */
}

/* === Gestion avancée - Grilles RTL === */
[dir="rtl"] .bt-section .accordion-content .indicator-card .ind-vars .bt-advcat-row {
  direction: rtl;
  text-align: right;
}

[dir="rtl"] .bt-section .accordion-content .indicator-card .ind-vars .bt-advcat-row > div {
  text-align: right;
}

[dir="rtl"] .bt-advcat-row label {
  text-align: right;
  margin-left: 8px;
  margin-right: 0;
}

[dir="rtl"] .bt-advcat-row input[type="number"] {
  width: 100% !important; /* Largeur complète comme dans backtest.css */
  text-align: center; /* Les nombres restent centrés */
}

[dir="rtl"] .bt-advcat-row .bt-help {
  text-align: right;
  margin-left: 5px;
  margin-right: 0;
}

/* === Checkboxes et radios RTL === */
[dir="rtl"] .checkbox-container,
[dir="rtl"] .radio-container {
  flex-direction: row-reverse;
  text-align: right;
}

[dir="rtl"] .checkbox-container label,
[dir="rtl"] .radio-container label {
  margin-left: 8px;
  margin-right: 0;
}

/* === Tables et boutons RTL === */
[dir="rtl"] .bt-results-table,
[dir="rtl"] .bt-config-table {
  direction: rtl;
}

[dir="rtl"] .bt-results-table th,
[dir="rtl"] .bt-config-table th,
[dir="rtl"] .bt-results-table td,
[dir="rtl"] .bt-config-table td {
  text-align: right;
}

[dir="rtl"] .bt-results-table th:first-child,
[dir="rtl"] .bt-config-table th:first-child,
[dir="rtl"] .bt-results-table td:first-child,
[dir="rtl"] .bt-config-table td:first-child {
  text-align: right;
}

/* === Boutons dans les tables RTL === */
[dir="rtl"] .bt-btn-small {
  margin-left: 5px;
  margin-right: 0;
}

[dir="rtl"] .bt-btn-small:last-child {
  margin-left: 0;
}

[dir="rtl"] .bt-btn-small:first-child {
  margin-left: 5px;
}

/* === Footer RTL === */
[dir="rtl"] footer {
  text-align: right;
  direction: rtl;
}

/* === Panneau flottant S/R RTL === */
[dir="rtl"] .sr-floating-panel {
  right: 20px;
  left: auto;
}

[dir="rtl"] .sr-floating-header {
  direction: rtl;
  text-align: right;
}

[dir="rtl"] .sr-close-btn {
  left: 15px;
  right: auto;
}

[dir="rtl"] .sr-slider-label {
  direction: rtl;
  text-align: right;
}

[dir="rtl"] .sr-stat-label {
  text-align: right;
}

[dir="rtl"] .sr-actions-floating {
  direction: rtl;
}

/* === Icônes et emojis RTL === */
[dir="rtl"] .indicator-icon,
[dir="rtl"] .stat-icon {
  margin-left: 8px;
  margin-right: 0;
}

/* === Bulles d'aide RTL === */
[dir="rtl"] .explanation-bubble {
  /* right: 20px; */ /* SUPPRIMÉ - laisse le JavaScript positionner */
  /* left: auto; */ /* SUPPRIMÉ - laisse le JavaScript positionner */
  text-align: right;
  direction: rtl;
}

[dir="rtl"] .bubble-title {
  direction: rtl;
  text-align: right;
}

[dir="rtl"] .bubble-content {
  text-align: right;
}

[dir="rtl"] .bubble-tip {
  text-align: right;
}

/* === Corrections pour les marges et espacements === */
[dir="rtl"] .bt-section {
  margin-left: 0;
  margin-right: 0;
}

[dir="rtl"] .indicator-card {
  margin-left: auto;
  margin-right: auto;
}

/* === Accordion spécifique RTL === */
[dir="rtl"] .accordion-content {
  text-align: right;
}

[dir="rtl"] .accordion-header .accordion-icon {
  margin-left: 10px;
  margin-right: 0;
  transform: scaleX(-1);
}

/* === Corrections responsive RTL === */
@media (max-width: 768px) {
  [dir="rtl"] .bt-section .accordion-content .indicator-card .ind-vars .bt-advcat-row {
    direction: rtl;
  }
  
  [dir="rtl"] .bt-section .accordion-content .indicator-card .ind-vars .bt-advcat-row > div {
    text-align: right;
  }
  
  [dir="rtl"] .bt-stats-grid {
    direction: rtl;
  }
  
  [dir="rtl"] .sr-floating-panel {
    right: 10px;
    left: auto;
    width: calc(100% - 20px);
  }
  
  [dir="rtl"] .explanation-bubble {
    /* right: 10px; */ /* SUPPRIMÉ - laisse le JavaScript positionner */
    /* left: auto; */ /* SUPPRIMÉ - laisse le JavaScript positionner */
    width: calc(100% - 20px);
  }
}

/* === Sidebar RTL === */
[dir="rtl"] .sidebar {
  right: 0;
  left: auto;
  border-left: none;
  border-right: 2px solid var(--glass-border);
}

[dir="rtl"] main {
  padding-right: 80px;
  padding-left: 20px;
}

/* === Corrections pour les inputs et selects === */
[dir="rtl"] .bt-input,
[dir="rtl"] .bt-select {
  text-align: right;
  padding-right: 12px;
  padding-left: 8px;
}

[dir="rtl"] .bt-input[type="number"],
[dir="rtl"] .bt-select option {
  text-align: center;
}

/* === Corrections pour les grilles flex === */
[dir="rtl"] .bt-flex-row {
  flex-direction: row-reverse;
}

[dir="rtl"] .bt-flex-col {
  align-items: flex-end;
}

/* === Scrollbars RTL (pour les navigateurs qui le supportent) === */
[dir="rtl"] ::-webkit-scrollbar {
  direction: rtl;
}

/* === Animation des icônes d'accordéon en RTL === */
[dir="rtl"] .accordion-icon,
body.rtl .accordion-icon {
  transition: transform 0.3s ease !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  font-size: 14px !important;
}

[dir="rtl"] .accordion-section.collapsed .accordion-icon,
body.rtl .accordion-section.collapsed .accordion-icon {
  transform: rotate(90deg) !important; /* 90deg au lieu de -90deg pour RTL */
}

/* Pas d'animation permanente - juste la transition normale */

/* === GESTION AVANCÉE RTL - Organisation des variables sur une seule ligne === */
[dir="rtl"] .bt-section .accordion-content .indicator-card .ind-vars .bt-advcat-row,
body.rtl .bt-section .accordion-content .indicator-card .ind-vars .bt-advcat-row {
  direction: rtl !important;
  display: flex !important;
  flex-direction: row-reverse !important;
  flex-wrap: nowrap !important;
  gap: 15px !important;
  margin-bottom: 20px !important;
  justify-content: center !important;
  padding: 0 10px !important;
  overflow-x: auto !important;
}

[dir="rtl"] .bt-section .accordion-content .indicator-card .ind-vars .bt-advcat-row > div,
body.rtl .bt-section .accordion-content .indicator-card .ind-vars .bt-advcat-row > div {
  direction: rtl !important;
  text-align: right !important;
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  border-radius: 12px !important;
  padding: 15px !important;
  min-width: 250px !important;
  max-width: 250px !important;
  width: 250px !important;
  flex: none !important;
  margin: 0 !important;
}

[dir="rtl"] .bt-advcat-row label,
body.rtl .bt-advcat-row label {
  direction: rtl !important;
  text-align: right !important;
  font-size: 16px !important;
  font-weight: 600 !important;
  margin-bottom: 8px !important;
  color: #e2e8f0 !important;
  display: block !important;
}

[dir="rtl"] .bt-advcat-row input[type="number"],
body.rtl .bt-advcat-row input[type="number"] {
  direction: ltr !important;
  text-align: center !important;
  width: 100% !important;
  height: 32px !important;
  padding: 8px 12px !important;
  background: rgba(255, 255, 255, 0.1) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  border-radius: 8px !important;
  color: #ffffff !important;
}

[dir="rtl"] .bt-advcat-row input[type="checkbox"],
body.rtl .bt-advcat-row input[type="checkbox"] {
  margin-left: 8px !important;
  margin-right: 0 !important;
}

[dir="rtl"] .bt-help,
body.rtl .bt-help {
  direction: rtl !important;
  text-align: right !important;
  font-size: 12px !important;
  color: #94a3b8 !important;
  margin-top: 5px !important;
  line-height: 1.3 !important;
}

[dir="rtl"] .bt-advcat-title,
body.rtl .bt-advcat-title {
  direction: rtl !important;
  text-align: right !important;
  font-size: 20px !important;
  font-weight: bold !important;
  color: #8B5CF6 !important;
  margin-bottom: 15px !important;
  padding-bottom: 8px !important;
  border-bottom: 2px solid rgba(139, 92, 246, 0.3) !important;
}

/* Pour les labels avec checkbox (Sens du Trade) */
[dir="rtl"] .bt-advcat-row label[style*="display: flex"],
body.rtl .bt-advcat-row label[style*="display: flex"] {
  display: flex !important;
  flex-direction: row-reverse !important;
  align-items: center !important;
  gap: 8px !important;
  text-align: right !important;
}

/* Responsive pour mobile - passer en colonne si nécessaire */
@media (max-width: 768px) {
  [dir="rtl"] .bt-section .accordion-content .indicator-card .ind-vars .bt-advcat-row,
  body.rtl .bt-section .accordion-content .indicator-card .ind-vars .bt-advcat-row {
    flex-direction: column !important;
    flex-wrap: wrap !important;
  }
  
  [dir="rtl"] .bt-section .accordion-content .indicator-card .ind-vars .bt-advcat-row > div,
  body.rtl .bt-section .accordion-content .indicator-card .ind-vars .bt-advcat-row > div {
    min-width: 100% !important;
    max-width: 100% !important;
    width: 100% !important;
  }
}