/* RTL-specific overrides for bilingual support */
[dir="rtl"] {
  /* Arabic font fallback */
  font-family: "Noto Sans Arabic", Inter, system-ui, sans-serif;
}

/* Navbar RTL */
[dir="rtl"] .navbar-nav {
  direction: rtl;
}

[dir="rtl"] .navbar-brand .navbar-brand-icon {
  margin-inline-end: 0;
  margin-inline-start: 0.5rem;
}

[dir="rtl"] .navbar-collapse {
  border-inline-start: 1px solid rgba(255, 255, 255, 0.12);
  border-inline-end: none;
}

/* Notification toast - RTL flip */
[dir="rtl"] .notification-toast-container {
  left: 1rem !important;
  right: auto !important;
}

/* Chat Widget RTL - Move to left side */
[dir="rtl"] .chat-sticky-button {
  left: 28px !important;
  right: auto !important;
}

[dir="rtl"] .chat-panel {
  left: 28px !important;
  right: auto !important;
}

/* Chat tooltip RTL */
[dir="rtl"] .chat-sticky-button::before {
  left: 68px !important;
  right: auto !important;
}

[dir="rtl"] .chat-sticky-button::after {
  left: 62px !important;
  right: auto !important;
  border-right-color: #1e3a8a;
  border-left-color: transparent;
}

/* Chat panel header RTL */
[dir="rtl"] .chat-panel-header {
  flex-direction: row-reverse;
}

[dir="rtl"] .chat-panel-header-left {
  margin-inline-end: auto;
}

/* Chat messages RTL bubble corners */
[dir="rtl"] .chat-msg--bot .chat-bubble {
  border-bottom-right-radius: 4px !important;
  border-bottom-left-radius: 16px !important;
}

[dir="rtl"] .chat-msg--user .chat-bubble {
  border-bottom-left-radius: 4px !important;
  border-bottom-right-radius: 16px !important;
}

[dir="rtl"] .chat-typing {
  border-bottom-right-radius: 4px !important;
  border-bottom-left-radius: 16px !important;
}

/* Forms RTL */
[dir="rtl"] .form-label {
  text-align: right;
}

[dir="rtl"] .input-group > .form-control {
  text-align: right;
}

/* Tables RTL */
[dir="rtl"] .table {
  direction: rtl;
}

[dir="rtl"] .table th,
[dir="rtl"] .table td {
  text-align: right;
}

[dir="rtl"] .table th:first-child,
[dir="rtl"] .table td:first-child {
  border-inline-end: 1px solid rgba(226, 232, 240, 0.95);
  border-inline-start: none;
}

/* Dropdown RTL */
[dir="rtl"] .dropdown-menu {
  text-align: right;
}

[dir="rtl"] .dropdown-menu-start {
  --bs-position: end;
}

[dir="rtl"] .dropdown-menu-end {
  --bs-position: start;
}

/* Buttons and general RTL margins */
[dir="rtl"] .me-2 {
  margin-inline-start: 0.5rem !important;
  margin-inline-end: 0 !important;
}
[dir="rtl"] .ms-2 {
  margin-inline-end: 0.5rem !important;
  margin-inline-start: 0 !important;
}
[dir="rtl"] .me-lg-3 {
  margin-inline-start: 1rem !important;
  margin-inline-end: 0 !important;
}
[dir="rtl"] .ms-lg-3 {
  margin-inline-end: 1rem !important;
  margin-inline-start: 0 !important;
}

/* Profile avatar RTL */
[dir="rtl"] .avatar-nav + span {
  margin-inline-start: 0 !important;
  margin-inline-end: 0.5rem !important;
}

/* Logical properties for future-proofing */
[dir="rtl"] .text-end {
  text-align: left !important;
}
[dir="rtl"] .text-start {
  text-align: right !important;
}
[dir="rtl"] .float-end {
  float: left !important;
}
[dir="rtl"] .float-start {
  float: right !important;
}
[dir="rtl"] .border-end {
  border-inline-start: 1px solid !important;
  border-inline-end: none !important;
}
[dir="rtl"] .border-start {
  border-inline-end: 1px solid !important;
  border-inline-start: none !important;
}
