/* RTL Styles for Hebrew language support */

/* Import Hebrew font */
@import url('https://fonts.googleapis.com/css2?family=Heebo:wght@300;400;500;600;700&display=swap');

/* Basic RTL styles */
body.rtl {
    direction: rtl;
    text-align: right;
    font-family: "Heebo", "Arial Hebrew", "David", sans-serif !important;
    unicode-bidi: embed;
}

html[dir="rtl"] {
    direction: rtl;
    font-family: "Heebo", "Arial Hebrew", "David", sans-serif !important;
}

/* Global RTL text direction fix */
html[dir="rtl"] * {
    text-align: inherit;
    direction: inherit;
}

/* Hebrew text rendering optimization */
body.rtl p, body.rtl span, body.rtl div, body.rtl h1, body.rtl h2, 
body.rtl h3, body.rtl h4, body.rtl h5, body.rtl h6, body.rtl a,
body.rtl label, body.rtl button, body.rtl input, body.rtl textarea,
body.rtl .menu-title, body.rtl .menu-item, body.rtl .submenu-item,
body.rtl .sidebar-menu, body.rtl .btn, body.rtl .dropdown-item,
body.rtl .card-title, body.rtl .alert {
    direction: rtl;
    text-align: right;
    unicode-bidi: embed;
    font-family: "Heebo", "Arial Hebrew", "David", sans-serif !important;
}

/* Fix for menu items display */
body.rtl .menu-item a {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-direction: row-reverse;
}

body.rtl .submenu-item a {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-direction: row-reverse;
    padding-right: 40px;
    padding-left: 20px;
}

body.rtl .menu-item a i:first-child,
body.rtl .submenu-item a i:first-child {
    margin-left: 10px;
    margin-right: 0;
}

/* Reverse text align */
body.rtl .text-left {
    text-align: right !important;
}

body.rtl .text-right {
    text-align: left !important;
}

/* Reverse float */
body.rtl .float-left {
    float: right !important;
}

body.rtl .float-right {
    float: left !important;
}

/* Reverse margins */
body.rtl .ml-auto {
    margin-left: 0 !important;
    margin-right: auto !important;
}

body.rtl .mr-auto {
    margin-right: 0 !important;
    margin-left: auto !important;
}

body.rtl .ml-1, body.rtl .ml-2, body.rtl .ml-3, body.rtl .ml-4, body.rtl .ml-5 {
    margin-left: 0 !important;
}

body.rtl .mr-1, body.rtl .mr-2, body.rtl .mr-3, body.rtl .mr-4, body.rtl .mr-5 {
    margin-right: 0 !important;
}

body.rtl .ml-1 { margin-right: 0.25rem !important; }
body.rtl .ml-2 { margin-right: 0.5rem !important; }
body.rtl .ml-3 { margin-right: 1rem !important; }
body.rtl .ml-4 { margin-right: 1.5rem !important; }
body.rtl .ml-5 { margin-right: 3rem !important; }

body.rtl .mr-1 { margin-left: 0.25rem !important; }
body.rtl .mr-2 { margin-left: 0.5rem !important; }
body.rtl .mr-3 { margin-left: 1rem !important; }
body.rtl .mr-4 { margin-left: 1.5rem !important; }
body.rtl .mr-5 { margin-left: 3rem !important; }

/* Reverse padding */
body.rtl .pl-1, body.rtl .pl-2, body.rtl .pl-3, body.rtl .pl-4, body.rtl .pl-5 {
    padding-left: 0 !important;
}

body.rtl .pr-1, body.rtl .pr-2, body.rtl .pr-3, body.rtl .pr-4, body.rtl .pr-5 {
    padding-right: 0 !important;
}

body.rtl .pl-1 { padding-right: 0.25rem !important; }
body.rtl .pl-2 { padding-right: 0.5rem !important; }
body.rtl .pl-3 { padding-right: 1rem !important; }
body.rtl .pl-4 { padding-right: 1.5rem !important; }
body.rtl .pl-5 { padding-right: 3rem !important; }

body.rtl .pr-1 { padding-left: 0.25rem !important; }
body.rtl .pr-2 { padding-left: 0.5rem !important; }
body.rtl .pr-3 { padding-left: 1rem !important; }
body.rtl .pr-4 { padding-left: 1.5rem !important; }
body.rtl .pr-5 { padding-left: 3rem !important; }

/* Reverse borders */
body.rtl .border-left {
    border-left: none !important;
    border-right: 1px solid rgba(0, 0, 0, 0.125) !important;
}

body.rtl .border-right {
    border-right: none !important;
    border-left: 1px solid rgba(0, 0, 0, 0.125) !important;
}

/* Reverse text-decoration */
body.rtl .text-decoration-rtl {
    text-decoration: rtl;
}

/* Form controls */
body.rtl .form-control {
    text-align: right;
}

body.rtl .input-group > .input-group-prepend > .input-group-text,
body.rtl .input-group > .input-group-prepend > .btn {
    border-radius: 0 0.25rem 0.25rem 0;
}

body.rtl .input-group > .input-group-append > .input-group-text,
body.rtl .input-group > .input-group-append > .btn {
    border-radius: 0.25rem 0 0 0.25rem;
}

body.rtl .input-group > .form-control:not(:last-child) {
    border-radius: 0 0.25rem 0.25rem 0;
}

body.rtl .input-group > .form-control:not(:first-child) {
    border-radius: 0.25rem 0 0 0.25rem;
}

/* Sidebar specific adjustments */
body.rtl .sidebar {
    left: auto !important;
    right: 0 !important;
    /* transform removed: translateX(0) crée un containing block pour position:fixed descendants → dropdown hors écran */
}

body.rtl .main-content {
    margin-left: 0 !important;
    margin-right: 280px !important;
}

body.rtl .sidebar-toggle {
    left: 15px !important;
    right: auto !important;
}

/* User menu dropdown fix */
body.rtl .sidebar-footer .dropdown-menu {
    right: auto !important;
    left: 0 !important;
}

/* Sidebar search fix */
body.rtl .sidebar-search .input-group {
    flex-direction: row-reverse;
}

body.rtl .sidebar-search .input-group-append {
    margin-left: 0;
    margin-right: -1px;
}

body.rtl .sidebar-search .form-control {
    border-radius: 0 0.25rem 0.25rem 0;
}

body.rtl .sidebar-search .btn-search {
    border-radius: 0.25rem 0 0 0.25rem;
}

@media (max-width: 768px) {
    body.rtl .sidebar {
        transform: translateX(100%) !important;
    }
    
    body.rtl .sidebar.active {
        transform: translateX(0) !important;
    }

    body.rtl .main-content {
        margin-right: 0 !important;
    }
}

/* Dropdown menus */
body.rtl .dropdown-menu {
    right: 0;
    left: auto;
    text-align: right;
}

body.rtl .dropdown-item {
    text-align: right;
}

/* Tables */
body.rtl .table th,
body.rtl .table td {
    text-align: right;
}

/* List groups */
body.rtl .list-group {
    padding-right: 0;
}

/* Badges */
body.rtl .badge {
    margin-right: 0;
    margin-left: 0.5rem;
}

/* Nav tabs */
body.rtl .nav-tabs {
    padding-right: 0;
}

/* Modal dialogs */
body.rtl .modal-header .close {
    margin: -1rem auto -1rem -1rem;
}

/* Cards */
body.rtl .card-header-tabs {
    margin-right: -1.25rem;
    margin-left: -1.25rem;
    padding-right: 1.25rem;
    padding-left: 1.25rem;
}

/* Fixes for Font Awesome icons */
body.rtl .fa-chevron-right:before {
    content: "\f053"; /* fa-chevron-left */
}

body.rtl .fa-chevron-left:before {
    content: "\f054"; /* fa-chevron-right */
}

body.rtl .fa-arrow-right:before {
    content: "\f060"; /* fa-arrow-left */
}

body.rtl .fa-arrow-left:before {
    content: "\f061"; /* fa-arrow-right */
}

/* Specific fixes for the sidebar submenu icons */
body.rtl .menu-item .fa-chevron-down,
body.rtl .menu-item .fa-chevron-right {
    float: left !important;
}

/* Fixes for active calls modal */
body.rtl .active-call-info .info-item .info-icon {
    margin-right: 0;
    margin-left: 10px;
}

/* Language switcher specific fixes */
body.rtl .language-toggle {
    margin-left: 0;
    margin-right: auto;
}

body.rtl .language-label {
    margin-right: 0;
    margin-left: 8px;
}

/* Pagination fixes */
body.rtl .pagination {
    flex-direction: row-reverse;
}

body.rtl .page-link {
    margin-left: 0;
    margin-right: -1px;
}

/* Alert and notification fixes */
body.rtl .alert-dismissible .close {
    right: auto;
    left: 1.25rem;
}

/* Breadcrumb fixes */
body.rtl .breadcrumb-item + .breadcrumb-item::before {
    content: "\\";
    transform: scaleX(-1);
}

/* Progress bar fixes */
body.rtl .progress {
    direction: ltr;
}

/* Custom scrollbar for RTL */
body.rtl ::-webkit-scrollbar {
    position: absolute;
    left: 0;
    right: auto;
}

/* Fix for icons rotation in RTL */
body.rtl .fa-chevron-down,
body.rtl .fa-chevron-up {
    transform: none !important;
}

/* Add more specific RTL adjustments as needed for the application */
