/* Base Styles */
body {
    font-family: "Tahoma", "Arial", sans-serif;
    background: #f4f6f9;
}

.brand-link .brand-image {
    float: none;
    margin-left: .5rem;
    margin-right: 0;
}

.table-actions {
    white-space: nowrap;
}

.required::after {
    color: #dc3545;
    content: " *";
}

.login-page {
    min-height: 100vh;
}

.card-tools .btn {
    min-width: 2.1rem;
}

/* --- RTL Support for AdminLTE 3 --- */
html[dir="rtl"] body {
    direction: rtl;
    text-align: right;
    overflow-x: hidden;
}

/* Sidebar Alignment */
html[dir="rtl"] .main-sidebar {
    right: 0 !important;
    left: auto !important;
}

/* Main Layout Offsets */
html[dir="rtl"] .content-wrapper,
html[dir="rtl"] .main-footer,
html[dir="rtl"] .main-header {
    margin-left: 0 !important;
    margin-right: 250px !important;
}

/* Navbar (Header) Specifics */
html[dir="rtl"] .main-header .navbar-nav {
    padding: 0;
}

html[dir="rtl"] .nav-link {
    display: inline-block;
}

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

html[dir="rtl"] .dropdown-menu {
    text-align: right;
}

/* Fixed Layout Support */
html[dir="rtl"] body.layout-navbar-fixed .main-header {
    right: 250px !important;
    left: 0 !important;
    margin-right: 0 !important;
}

html[dir="rtl"] body.layout-footer-fixed .main-footer {
    right: 250px !important;
    left: 0 !important;
    margin-right: 0 !important;
}

/* Sidebar Collapse Handling */
html[dir="rtl"] body.sidebar-collapse .content-wrapper,
html[dir="rtl"] body.sidebar-collapse .main-footer,
html[dir="rtl"] body.sidebar-collapse .main-header {
    margin-right: 4.6rem !important;
    margin-left: 0 !important;
}

html[dir="rtl"] body.layout-navbar-fixed.sidebar-collapse .main-header {
    right: 4.6rem !important;
    left: 0 !important;
}

html[dir="rtl"] body.layout-footer-fixed.sidebar-collapse .main-footer {
    right: 4.6rem !important;
    left: 0 !important;
}

/* Small Box RTL */
html[dir="rtl"] .small-box {
    text-align: right;
}

html[dir="rtl"] .small-box .inner {
    padding-left: 5.75rem;
    padding-right: 1rem;
}

html[dir="rtl"] .small-box .icon {
    left: 1rem;
    right: auto;
}

html[dir="rtl"] .small-box .small-box-footer i {
    margin-right: .25rem;
    margin-left: 0;
}

/* Card RTL */
html[dir="rtl"] .card-title {
    float: right;
}

html[dir="rtl"] .card-tools {
    float: left;
    margin-left: -.625rem;
    margin-right: 0;
}

/* Callout RTL */
html[dir="rtl"] .callout {
    border-left: 0;
    border-right: 5px solid #eee;
}

html[dir="rtl"] .callout.callout-info {
    border-right-color: #117a8b;
}

/* Sidebar Menu RTL Icons */
html[dir="rtl"] .nav-sidebar .nav-link > .right, 
html[dir="rtl"] .nav-sidebar .nav-link > p > .right {
    left: 1rem;
    right: auto;
}

html[dir="rtl"] .nav-sidebar .nav-icon {
    margin-left: .2rem;
    margin-right: .05rem;
}

/* Grid & Utilities RTL */
html[dir="rtl"] .ml-auto, 
html[dir="rtl"] .navbar-nav.ml-auto {
    margin-right: auto !important;
    margin-left: 0 !important;
}

html[dir="rtl"] .mr-auto, 
html[dir="rtl"] .navbar-nav.mr-auto {
    margin-left: auto !important;
    margin-right: 0 !important;
}

/* Responsive Fixes */
@media (max-width: 991.98px) {
    html[dir="rtl"] .content-wrapper,
    html[dir="rtl"] .main-footer,
    html[dir="rtl"] .main-header {
        margin-right: 0 !important;
    }

    html[dir="rtl"] body.layout-navbar-fixed .main-header,
    html[dir="rtl"] body.layout-footer-fixed .main-footer {
        right: 0 !important;
        left: 0 !important;
    }
}

/* Form Groups & Inputs */
html[dir="rtl"] .form-check {
    padding-left: 0;
    padding-right: 1.25rem;
}

html[dir="rtl"] .form-check-input {
    margin-left: 0;
    margin-right: -1.25rem;
}

/* DataTables RTL */
html[dir="rtl"] .dataTables_wrapper {
    direction: rtl;
}

html[dir="rtl"] div.dataTables_wrapper div.dataTables_filter {
    text-align: left;
}

html[dir="rtl"] .pagination {
    padding-right: 0;
}

/* --- Fix for the specific overlap in the screenshot --- */
/* In RTL, AdminLTE's .main-header has left: 0; right: 0; by default when fixed.
   We need to ensure it doesn't overlap the sidebar on the right. */
html[dir="rtl"] body.layout-navbar-fixed .main-header {
    border-bottom: 1px solid #dee2e6;
}

/* Align hamburger icon and navbar items correctly */
html[dir="rtl"] .navbar-nav > .nav-item {
    float: right;
}
