/* =====================================================================
   AdminLTE 3.2 — پشتیبانی کامل RTL (راست‌به‌چپ) برای پنل کوشه
   بارگذاری بعد از adminlte.min.css
   ===================================================================== */

/* --- اسکلت اصلی: سایدبار به راست، محتوا به چپ --- */
body, .wrapper { direction: rtl; }

.main-sidebar {
  right: 0 !important;
  left: auto !important;
}

.content-wrapper,
.main-header,
.main-footer {
  margin-right: 250px !important;
  margin-left: 0 !important;
}

/* هنگام جمع شدن سایدبار (sidebar-collapse): محتوا تمام عرض می‌شود */
body.sidebar-collapse:not(.sidebar-mini-md):not(.sidebar-mini-xs) .content-wrapper,
body.sidebar-collapse:not(.sidebar-mini-md):not(.sidebar-mini-xs) .main-header,
body.sidebar-collapse:not(.sidebar-mini-md):not(.sidebar-mini-xs) .main-footer {
  margin-right: 0 !important;
}

.layout-fixed .main-sidebar {
  right: 0;
  left: auto;
}

/* --- منوی بالای صفحه --- */
.main-header .navbar-nav { flex-direction: row; }
.navbar-expand .navbar-nav .nav-item { margin-right: .25rem; margin-left: .5rem; }

/* --- سایدبار: لوگو (آیکن + متن) --- */
.brand-link {
  display: flex !important;
  align-items: center;
  flex-direction: row-reverse;
  justify-content: flex-start;
  width: 250px !important;
  padding: 0 .75rem !important;
}
.brand-link i.nav-icon { margin-left: .55rem !important; margin-right: 0 !important; }
.brand-link span.brand-text { white-space: nowrap; }
body.sidebar-collapse .brand-link { justify-content: center; padding: 0 !important; width: 4.6rem !important; }
body.sidebar-collapse .brand-link span.brand-text { display: none; }

/* --- سایدبار: آیتم‌های منو --- */
.main-sidebar .nav-link {
  display: flex;
  align-items: center;
  flex-direction: row-reverse;
  justify-content: flex-start;
  text-align: right;
  direction: rtl;
}
.main-sidebar .nav-link p {
  margin: 0 !important;
  margin-right: .5rem !important;
  white-space: nowrap;
}
.main-sidebar .nav-link i.nav-icon { margin: 0 !important; }
.nav-sidebar { padding: .5rem .5rem .5rem 0; }

/* --- پنل کاربر (در صورت استفاده) --- */
.user-panel { text-align: right; }
.user-panel .image { float: right; margin-left: .8rem; margin-right: 0; }
.user-panel .image img { height: 2.1rem; width: 2.1rem; }

/* --- دراپ‌داون‌ها --- */
.dropdown-menu {
  right: auto !important;
  left: 0 !important;
  text-align: right;
  direction: rtl;
}
.dropdown-menu-right { right: 0 !important; left: auto !important; }
.dropdown-menu-lg { min-width: 20rem; }
.main-header .navbar-nav .dropdown > .dropdown-menu {
  left: 0 !important;
  right: auto !important;
}
.dropdown-toggle::after { margin-right: .255em; margin-left: 0; }

/* --- فرم‌ها و ورودی‌ها --- */
.form-control, .input-group, select.form-control { direction: rtl; text-align: right; }
.input-group-prepend { margin-right: -1px; margin-left: 0; }
.input-group-append { margin-left: -1px; margin-right: 0; }
.input-group-prepend .input-group-text { border-radius: .25rem 0 0 .25rem; }
.input-group-append .input-group-text { border-radius: 0 .25rem .25rem 0; }
.input-group .form-control:first-child { border-radius: 0 .25rem .25rem 0 !important; }

/* --- جداول --- */
.table, .table-responsive { direction: rtl; text-align: right; }
.table thead th, .table td { text-align: right !important; }

/* --- کارت‌ها --- */
.card { direction: rtl; }
.card-title { text-align: right; }
.card-header { display: flex; align-items: center; justify-content: space-between; }
.card-tools { margin-right: auto; margin-left: -.625rem; }
.card-tools .btn-group .btn { margin-right: 0; margin-left: .25rem; }

/* --- دکمه‌ها --- */
.btn { direction: rtl; }
.btn-group .btn:not(:last-child):not(.dropdown-toggle) { border-radius: 0 .25rem .25rem 0; }
.btn-group .btn:last-child { border-radius: .25rem 0 0 .25rem; }

/* --- badge / toast / modal / alert --- */
.badge { direction: rtl; }
.badge-pill { padding-right: .6em; padding-left: .6em; }
.toast, .alert, .modal-content { direction: rtl; text-align: right; }
.modal-header .close { margin: -1rem auto -1rem -1rem; }

/* --- آیکن‌ها و متن‌های inline --- */
.mr-1, .mr-2 { margin-right: 0 !important; margin-left: .25rem !important; }
.ml-1, .ml-2 { margin-left: 0 !important; margin-right: .25rem !important; }

/* --- footer --- */
.main-footer, .footer { direction: rtl; text-align: center; }

/* --- جعبه‌های مسابقه و انتخابگر (picker.js) --- */
.fixture-item, .match-box, .online-feed-box, .tpl-grid, .form-grid { direction: rtl; }

/* --- استایل select نتایج تسویه --- */
#active-rounds-list select.form-control { text-align: center; direction: ltr; }

/* --- موبایل: سایدبار کشویی از سمت راست --- */
@media (max-width: 991.98px) {
  .main-sidebar {
    right: 0 !important;
    left: auto !important;
    margin-right: 0 !important;
    margin-left: 0 !important;
    transform: translate(100%, 0) !important;
  }
  body.sidebar-open .main-sidebar { transform: translate(0, 0) !important; }
  .content-wrapper, .main-header, .main-footer { margin-right: 0 !important; }
}

/* --- عناصر لاتین داخل کد را LTR نگه می‌داریم --- */
code, pre, kbd, samp {
  direction: ltr;
  text-align: left;
  display: inline-block;
}

/* --- کلاس‌های کمکی --- */
.list-inline, .pagination, .breadcrumb, .nav, .navbar, .carousel,
.card-deck, .card-group, .btn-toolbar, .input-group, .form-check {
  direction: rtl;
}
