/* =====================================================================
   ArchiBoard – Support RTL pour l'arabe
   Adaptation propre sans casser le LTR
===================================================================== */

html[dir="rtl"], body[dir="rtl"] {
  direction: rtl;
  text-align: right;
  font-family: 'Cairo', 'Tajawal', 'Noto Sans Arabic', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

html[dir="rtl"] body { font-family: inherit; }

/* === Layout principal === */
html[dir="rtl"] .app-layout { direction: rtl; }
html[dir="rtl"] .sidebar { border-right: none; border-left: 1px solid var(--border); }

/* Mobile : sidebar coulisse depuis la droite */
@media (max-width: 980px) {
  html[dir="rtl"] .sidebar {
    left: auto; right: 0;
    transform: translateX(100%);
  }
  html[dir="rtl"] body.sidebar-open .sidebar { transform: translateX(0); }
}

/* === Sidebar nav === */
html[dir="rtl"] .sidebar-nav a { padding: 9px 12px; }
html[dir="rtl"] .sidebar-nav a.active {
  background: linear-gradient(-120deg, rgba(58,99,245,.12), rgba(124,92,255,.08));
}

/* === Header === */
html[dir="rtl"] .app-header .header-search { margin-right: 0; margin-left: auto; }
html[dir="rtl"] .header-search svg { left: auto; right: 12px; }
html[dir="rtl"] .header-search input { padding-left: 14px; padding-right: 38px; }

/* === Formulaires === */
html[dir="rtl"] .form-control,
html[dir="rtl"] .form-select,
html[dir="rtl"] textarea {
  text-align: right;
}
html[dir="rtl"] input[type="email"],
html[dir="rtl"] input[type="url"],
html[dir="rtl"] input[type="tel"],
html[dir="rtl"] input[type="number"] {
  direction: ltr; text-align: right;
}
html[dir="rtl"] input[type="date"],
html[dir="rtl"] input[type="time"],
html[dir="rtl"] input[type="datetime-local"] {
  direction: ltr; text-align: right;
}
html[dir="rtl"] .input-icon svg { left: auto; right: 10px; }
html[dir="rtl"] .input-icon .form-control { padding-left: 12px; padding-right: 36px; }

/* === Tables === */
html[dir="rtl"] .table th,
html[dir="rtl"] .table td { text-align: right; }
html[dir="rtl"] .text-right { text-align: left !important; }

/* === Avatar stack === */
html[dir="rtl"] .avatar-stack { direction: ltr; }

/* === Cards === */
html[dir="rtl"] .card[style*="border-left"] {
  border-left: none !important;
}
/* On laisse border-right faire le job manuellement quand nécessaire */
html[dir="rtl"] .stat-card .stat-icon { margin-right: 0; margin-left: 14px; }

/* === Boutons === */
html[dir="rtl"] .btn svg { transform: scaleX(-1); }
html[dir="rtl"] .btn svg.no-flip { transform: none; }

/* === Dropdowns === */
html[dir="rtl"] .dropdown-menu { right: auto; left: 0; }

/* === Toast === */
html[dir="rtl"] .toast-host { right: auto; left: 20px; }
html[dir="rtl"] @keyframes slideIn {
  from { transform: translateX(-20px); opacity:0; }
  to   { transform: translateX(0); opacity:1; }
}

/* === Kanban === */
html[dir="rtl"] .kanban { direction: rtl; }
html[dir="rtl"] .kanban-card { border-left: 1px solid var(--border); border-right: 3px solid var(--brand-500); }

/* === Modal === */
html[dir="rtl"] .modal-header { flex-direction: row-reverse; }
html[dir="rtl"] .modal-footer { flex-direction: row-reverse; }
html[dir="rtl"] .modal-footer button:first-child { margin-right: 0; margin-left: auto; }

/* === Progress === */
html[dir="rtl"] .progress > div {
  background: linear-gradient(-135deg, #3a63f5 0%, #7c5cff 50%, #ec4899 100%);
}

/* === Auth pages === */
html[dir="rtl"] .auth-shell { direction: rtl; }
html[dir="rtl"] .auth-hero-col { order: -1; }

/* === Landing === */
html[dir="rtl"] .landing-nav { direction: rtl; }
html[dir="rtl"] .hero { direction: rtl; }
html[dir="rtl"] .feature-grid { direction: rtl; }
html[dir="rtl"] .pricing-grid { direction: rtl; }

/* === Tabs === */
html[dir="rtl"] .tabs { flex-direction: row-reverse; }

/* === Spécifique : devis/factures lignes === */
html[dir="rtl"] [data-k="total"] { text-align: left !important; }

/* === Calendar === */
html[dir="rtl"] #calendar { direction: rtl; }

/* === Gantt === */
html[dir="rtl"] #gantt-tasks { border-right: none; border-left: 2px solid var(--border); }

/* === Chiffres et codes : garder en LTR === */
html[dir="rtl"] .number,
html[dir="rtl"] .badge,
html[dir="rtl"] code,
html[dir="rtl"] .stat-value,
html[dir="rtl"] .price,
html[dir="rtl"] time {
  direction: ltr; unicode-bidi: embed; display: inline-block;
}

/* === Inputs file === */
html[dir="rtl"] input[type="file"] { direction: ltr; }

/* === Search icon === */
html[dir="rtl"] svg[viewBox="0 0 24 24"][stroke*="round"] { /* pas de flip pour icônes neutres */ }
