/**
 * RTL/LTR Support CSS for MotionSpotter
 * Automatic direction switching based on language
 * 
 * @author MotionSpotter Team
 * @version 1.0.0
 */

/* ===================================================================
   RTL (Right-to-Left) - Arabic
   =================================================================== */

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

/* Text Alignment */
[dir="rtl"] .text-left {
  text-align: right !important;
}

[dir="rtl"] .text-right {
  text-align: left !important;
}

/* Margins */
[dir="rtl"] .mr-1,
[dir="rtl"] .mr-2,
[dir="rtl"] .mr-3,
[dir="rtl"] .mr-4,
[dir="rtl"] .mr-5 {
  margin-right: 0 !important;
}

[dir="rtl"] .ml-1 { margin-right: 0.25rem !important; margin-left: 0 !important; }
[dir="rtl"] .ml-2 { margin-right: 0.5rem !important; margin-left: 0 !important; }
[dir="rtl"] .ml-3 { margin-right: 0.75rem !important; margin-left: 0 !important; }
[dir="rtl"] .ml-4 { margin-right: 1rem !important; margin-left: 0 !important; }
[dir="rtl"] .ml-5 { margin-right: 1.25rem !important; margin-left: 0 !important; }

[dir="rtl"] .mr-1 { margin-left: 0.25rem !important; margin-right: 0 !important; }
[dir="rtl"] .mr-2 { margin-left: 0.5rem !important; margin-right: 0 !important; }
[dir="rtl"] .mr-3 { margin-left: 0.75rem !important; margin-right: 0 !important; }
[dir="rtl"] .mr-4 { margin-left: 1rem !important; margin-right: 0 !important; }
[dir="rtl"] .mr-5 { margin-left: 1.25rem !important; margin-right: 0 !important; }

/* Padding */
[dir="rtl"] .pr-1,
[dir="rtl"] .pr-2,
[dir="rtl"] .pr-3,
[dir="rtl"] .pr-4,
[dir="rtl"] .pr-5 {
  padding-right: 0 !important;
}

[dir="rtl"] .pl-1 { padding-right: 0.25rem !important; padding-left: 0 !important; }
[dir="rtl"] .pl-2 { padding-right: 0.5rem !important; padding-left: 0 !important; }
[dir="rtl"] .pl-3 { padding-right: 0.75rem !important; padding-left: 0 !important; }
[dir="rtl"] .pl-4 { padding-right: 1rem !important; padding-left: 0 !important; }
[dir="rtl"] .pl-5 { padding-right: 1.25rem !important; padding-left: 0 !important; }

[dir="rtl"] .pr-1 { padding-left: 0.25rem !important; padding-right: 0 !important; }
[dir="rtl"] .pr-2 { padding-left: 0.5rem !important; padding-right: 0 !important; }
[dir="rtl"] .pr-3 { padding-left: 0.75rem !important; padding-right: 0 !important; }
[dir="rtl"] .pr-4 { padding-left: 1rem !important; padding-right: 0 !important; }
[dir="rtl"] .pr-5 { padding-left: 1.25rem !important; padding-right: 0 !important; }

/* Float */
[dir="rtl"] .float-left {
  float: right !important;
}

[dir="rtl"] .float-right {
  float: left !important;
}

/* Flexbox */
[dir="rtl"] .flex-row {
  flex-direction: row-reverse !important;
}

/* Border Radius */
[dir="rtl"] .rounded-l,
[dir="rtl"] .rounded-tl,
[dir="rtl"] .rounded-bl {
  border-top-left-radius: 0 !important;
  border-bottom-left-radius: 0 !important;
}

[dir="rtl"] .rounded-r,
[dir="rtl"] .rounded-tr,
[dir="rtl"] .rounded-br {
  border-top-right-radius: 0 !important;
  border-bottom-right-radius: 0 !important;
}

/* Icons */
[dir="rtl"] .fa-chevron-left::before {
  content: "\f054" !important; /* chevron-right */
}

[dir="rtl"] .fa-chevron-right::before {
  content: "\f053" !important; /* chevron-left */
}

[dir="rtl"] .fa-arrow-left::before {
  content: "\f061" !important; /* arrow-right */
}

[dir="rtl"] .fa-arrow-right::before {
  content: "\f060" !important; /* arrow-left */
}

/* Forms */
[dir="rtl"] input[type="text"],
[dir="rtl"] input[type="email"],
[dir="rtl"] input[type="password"],
[dir="rtl"] input[type="tel"],
[dir="rtl"] input[type="number"],
[dir="rtl"] textarea,
[dir="rtl"] select {
  text-align: right;
}

[dir="rtl"] input[type="checkbox"],
[dir="rtl"] input[type="radio"] {
  margin-right: 0;
  margin-left: 0.5rem;
}

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

/* Modals */
[dir="rtl"] .modal-header .close {
  margin: -1rem auto -1rem -1rem;
}

/* Navigation */
[dir="rtl"] .navbar-nav {
  flex-direction: row-reverse;
}

[dir="rtl"] .nav-item {
  margin-left: 0;
  margin-right: 1rem;
}

/* Breadcrumbs */
[dir="rtl"] .breadcrumb-item + .breadcrumb-item::before {
  content: "/";
  padding-right: 0.5rem;
  padding-left: 0;
}

/* Tables */
[dir="rtl"] table {
  direction: rtl;
}

[dir="rtl"] th,
[dir="rtl"] td {
  text-align: right;
}

/* Sidebar */
[dir="rtl"] .sidebar {
  left: auto;
  right: 0;
}

[dir="rtl"] .sidebar-toggle {
  left: 0;
  right: auto;
}

/* Tooltips */
[dir="rtl"] .tooltip {
  direction: rtl;
}

/* ===================================================================
   LTR (Left-to-Right) - English & French
   =================================================================== */

[dir="ltr"] {
  direction: ltr;
  text-align: left;
}

/* Text Alignment */
[dir="ltr"] .text-left {
  text-align: left !important;
}

[dir="ltr"] .text-right {
  text-align: right !important;
}

/* Forms */
[dir="ltr"] input[type="text"],
[dir="ltr"] input[type="email"],
[dir="ltr"] input[type="password"],
[dir="ltr"] input[type="tel"],
[dir="ltr"] input[type="number"],
[dir="ltr"] textarea,
[dir="ltr"] select {
  text-align: left;
}

[dir="ltr"] input[type="checkbox"],
[dir="ltr"] input[type="radio"] {
  margin-left: 0;
  margin-right: 0.5rem;
}

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

/* Navigation */
[dir="ltr"] .navbar-nav {
  flex-direction: row;
}

[dir="ltr"] .nav-item {
  margin-right: 0;
  margin-left: 1rem;
}

/* Tables */
[dir="ltr"] table {
  direction: ltr;
}

[dir="ltr"] th,
[dir="ltr"] td {
  text-align: left;
}

/* Sidebar */
[dir="ltr"] .sidebar {
  left: 0;
  right: auto;
}

[dir="ltr"] .sidebar-toggle {
  right: 0;
  left: auto;
}

/* ===================================================================
   Tailwind CSS RTL Support
   =================================================================== */

/* Tailwind Margin Classes */
[dir="rtl"] .ml-auto { margin-right: auto !important; margin-left: 0 !important; }
[dir="rtl"] .mr-auto { margin-left: auto !important; margin-right: 0 !important; }

/* Tailwind Padding Classes */
[dir="rtl"] .pl-0 { padding-right: 0 !important; padding-left: 0 !important; }
[dir="rtl"] .pr-0 { padding-left: 0 !important; padding-right: 0 !important; }

/* Tailwind Text Alignment */
[dir="rtl"] .text-left { text-align: right !important; }
[dir="rtl"] .text-right { text-align: left !important; }

/* Tailwind Border Radius */
[dir="rtl"] .rounded-l-none { border-top-right-radius: 0 !important; border-bottom-right-radius: 0 !important; }
[dir="rtl"] .rounded-r-none { border-top-left-radius: 0 !important; border-bottom-left-radius: 0 !important; }

/* ===================================================================
   Smooth Transitions
   =================================================================== */

* {
  transition: margin 0.3s ease, padding 0.3s ease, text-align 0.3s ease;
}

/* ===================================================================
   Print Styles
   =================================================================== */

@media print {
  [dir="rtl"] {
    direction: rtl;
  }
  
  [dir="ltr"] {
    direction: ltr;
  }
}

