/* ============================================================
   GB360 — RTL Hebrew Overrides
   Applies on top of NiceAdmin style.css
   ============================================================ */

/* Font */
body, .sidebar, .header, input, select, textarea, button {
  font-family: 'Rubik', 'Arial', sans-serif !important;
}

/* RTL direction fixes */
html[dir="rtl"] .sidebar {
  right: 0;
  left: auto;
}

html[dir="rtl"] #main {
  margin-right: 300px;
  margin-left: 0;
}

html[dir="rtl"] .header .toggle-sidebar-btn {
  order: -1;
}

/* Sidebar collapse (desktop) — mirrors style.css's LTR .toggle-sidebar rules,
   which hide the sidebar via `left: -300px`. That has no effect once RTL
   repositions the sidebar via `right: 0` above, since nothing ever told the
   RTL layout what "collapsed" looks like — this is why the hamburger button
   toggled the class correctly but nothing visibly happened. */
@media (min-width: 1200px) {
  html[dir="rtl"] .toggle-sidebar .sidebar {
    right: -300px;
  }
  html[dir="rtl"] .toggle-sidebar #main,
  html[dir="rtl"] .toggle-sidebar #footer {
    margin-right: 0;
  }
}

/* Sidebar nav items — flip chevrons */
html[dir="rtl"] .sidebar-nav .nav-link .bi-chevron-down {
  margin-right: auto !important;
  margin-left: 0 !important;
}

html[dir="rtl"] .sidebar-nav .nav-content a {
  padding-right: 35px;
  padding-left: 10px;
}

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

/* Cards and text alignment */
html[dir="rtl"] .card-title {
  text-align: right;
}

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

/* Dropdowns — open to the right side */
html[dir="rtl"] .dropdown-menu-end {
  right: auto;
  left: 0;
}

/* Badges in list-group */
html[dir="rtl"] .list-group-item .ms-auto {
  margin-right: auto !important;
  margin-left: 0 !important;
}

/* Sidebar heading */
html[dir="rtl"] .nav-heading {
  text-align: right;
  padding-right: 15px;
}

/* Soon badges */
html[dir="rtl"] .sidebar-nav li .badge.ms-auto {
  margin-right: auto !important;
  margin-left: 6px !important;
}

/* Form labels */
html[dir="rtl"] .form-label {
  display: block;
  text-align: right;
}

/* Activity items in dashboard */
html[dir="rtl"] .activity-item {
  flex-direction: row-reverse;
}

html[dir="rtl"] .activite-label {
  text-align: right;
  margin-left: 1rem;
  margin-right: 0;
}

/* Alert close button */
html[dir="rtl"] .alert-dismissible .btn-close {
  left: 0;
  right: auto;
}

/* Modal */
html[dir="rtl"] .modal-header .btn-close {
  margin-left: 0;
  margin-right: auto;
}

/* Profile/bell block (.header-nav) — force it to the true left edge.
   Correction from a prior attempt: in flexbox, `margin-left: auto` pushes
   an item's LEFT margin to absorb free space, which moves the item
   RIGHTWARD (docks it to the right, gap appears on its left) — that's
   correct for LTR navbars but was backwards here. To dock at the LEFT
   edge, it's `margin-right: auto` that needs to absorb the space instead.
   Bootstrap's `.ms-auto` utility may already compile to `margin-left: auto`
   regardless of direction (if the vendor build predates full RTL logical-
   property support), which is precisely the wrong physical side here —
   hence the explicit override rather than relying on it. */
html[dir="rtl"] .header-nav.ms-auto {
  margin-right: auto !important;
  margin-left: 0 !important;
}

/* Header logo */
html[dir="rtl"] .header .logo span {
  margin-right: 8px;
  margin-left: 0;
}

/* Profile dropdown */
html[dir="rtl"] .header-nav .dropdown-toggle::after {
  margin-right: 4px;
  margin-left: 0;
}

/* Sidebar collapsed state on mobile.
   Base template inverts the logic at this breakpoint: sidebar is hidden
   by default and .toggle-sidebar *reveals* it. The previous rule here
   referenced `.sidebar-show`, a class the JS never actually sets (main.js
   only ever toggles `.toggle-sidebar` on <body>) — so the hamburger was
   silently broken on mobile too. */
@media (max-width: 1199px) {
  html[dir="rtl"] #main {
    margin-right: 0;
  }
  html[dir="rtl"] .sidebar {
    right: -300px;
  }
  html[dir="rtl"] .toggle-sidebar .sidebar {
    right: 0;
  }
}

/* Quick links chevron flip */
html[dir="rtl"] .list-group-item .bi-chevron-right {
  transform: scaleX(-1);
}

/* Permission matrix RTL */
html[dir="rtl"] .matrix-sticky-col {
  left: auto;
  right: 0;
}

html[dir="rtl"] .matrix-sticky-col::after {
  right: auto;
  left: -5px;
  background: linear-gradient(to left, rgba(0,0,0,.13), transparent);
}

/* Status badge colors */
.badge-status-open      { background-color: #dc3545; }
.badge-status-progress  { background-color: #ffc107; color:#212529; }
.badge-status-answered  { background-color: #6f42c1; }
.badge-status-closed    { background-color: #198754; }
