/* Custom RTL and Arabic Support for Greeva Theme */

/* RTL Direction Support */
[dir="rtl"] {
    direction: rtl;
    text-align: right;
}

/* Arabic Font Improvements */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* RTL Sidebar Adjustments */
[dir="rtl"] .side-nav-link {
    text-align: right;
}

[dir="rtl"] .menu-icon {
    margin-left: 0.75rem;
    margin-right: 0;
}

[dir="rtl"] .menu-arrow {
    margin-left: 0;
    margin-right: auto;
}

/* RTL Header Adjustments */
[dir="rtl"] .topbar-search {
    text-align: right;
}

[dir="rtl"] .topbar-search .me-2 {
    margin-left: 0.5rem !important;
    margin-right: 0 !important;
}

[dir="rtl"] .topbar-search .ms-auto {
    margin-left: 0 !important;
    margin-right: auto !important;
}

/* RTL Dropdown Adjustments */
[dir="rtl"] .dropdown-menu {
    text-align: right;
}

[dir="rtl"] .dropdown-item i {
    margin-left: 0.5rem;
    margin-right: 0;
}

/* RTL Table Adjustments */
[dir="rtl"] .table th,
[dir="rtl"] .table td {
    text-align: right;
}

[dir="rtl"] .table .text-center {
    text-align: center !important;
}

/* RTL Card Adjustments */
[dir="rtl"] .card-header .header-title {
    text-align: right;
}

[dir="rtl"] .card-header .d-flex {
    justify-content: space-between;
}

/* RTL Form Adjustments */
[dir="rtl"] .form-label {
    text-align: right;
}

[dir="rtl"] .form-control {
    text-align: right;
}

/* RTL Button Adjustments */
[dir="rtl"] .btn i {
    margin-left: 0.5rem;
    margin-right: 0;
}

[dir="rtl"] .btn .me-1 {
    margin-left: 0.25rem !important;
    margin-right: 0 !important;
}

[dir="rtl"] .btn .ms-1 {
    margin-left: 0 !important;
    margin-right: 0.25rem !important;
}

/* RTL Badge Adjustments */
[dir="rtl"] .badge i {
    margin-left: 0.25rem;
    margin-right: 0;
}

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

/* RTL Modal Adjustments */
[dir="rtl"] .modal-header .btn-close {
    margin: -0.5rem auto -0.5rem -0.5rem;
}

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

/* RTL Pagination Adjustments */
[dir="rtl"] .pagination .page-link {
    margin-left: 0;
    margin-right: -1px;
}

/* RTL Progress Bar Adjustments */
[dir="rtl"] .progress-bar {
    float: right;
}

/* RTL List Group Adjustments */
[dir="rtl"] .list-group-item {
    text-align: right;
}

/* RTL Nav Adjustments */
[dir="rtl"] .nav-link {
    text-align: right;
}

/* RTL Tabs Adjustments */
[dir="rtl"] .nav-tabs .nav-link {
    border-radius: 0.375rem 0.375rem 0 0;
}

/* RTL Accordion Adjustments */
[dir="rtl"] .accordion-button {
    text-align: right;
}

[dir="rtl"] .accordion-button::after {
    margin-left: 0;
    margin-right: auto;
}

/* RTL Tooltip Adjustments */
[dir="rtl"] .tooltip {
    text-align: right;
}

/* RTL Popover Adjustments */
[dir="rtl"] .popover {
    text-align: right;
}

/* RTL Offcanvas Adjustments */
[dir="rtl"] .offcanvas-header .btn-close {
    margin: -0.5rem auto -0.5rem -0.5rem;
}

/* Custom Arabic Typography */
.arabic-text {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
}

/* Arabic Number Formatting */
.arabic-numbers {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* RTL Specific Utilities */
[dir="rtl"] .text-start {
    text-align: right !important;
}

[dir="rtl"] .text-end {
    text-align: left !important;
}

[dir="rtl"] .float-start {
    float: right !important;
}

[dir="rtl"] .float-end {
    float: left !important;
}

/* RTL Margin and Padding Adjustments */
[dir="rtl"] .me-auto {
    margin-left: auto !important;
    margin-right: 0 !important;
}

[dir="rtl"] .ms-auto {
    margin-right: auto !important;
    margin-left: 0 !important;
}

/* Custom Scrollbar for RTL */
[dir="rtl"] ::-webkit-scrollbar {
    width: 8px;
}

[dir="rtl"] ::-webkit-scrollbar-track {
    background: #f1f1f1;
}

[dir="rtl"] ::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

[dir="rtl"] ::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Arabic Content Specific Styles */
.arabic-content {
    direction: rtl;
    text-align: right;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* RTL DataTables Adjustments */
[dir="rtl"] .dataTables_wrapper .dataTables_filter {
    text-align: left;
}

[dir="rtl"] .dataTables_wrapper .dataTables_length {
    text-align: right;
}

[dir="rtl"] .dataTables_wrapper .dataTables_info {
    text-align: right;
}

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

/* RTL Select2 Adjustments */
[dir="rtl"] .select2-container--default .select2-selection--single .select2-selection__rendered {
    text-align: right;
}

[dir="rtl"] .select2-container--default .select2-selection--single .select2-selection__arrow {
    left: 1px;
    right: auto;
}

/* RTL SweetAlert2 Adjustments */
[dir="rtl"] .swal2-popup {
    text-align: right;
}

[dir="rtl"] .swal2-title {
    text-align: right;
}

[dir="rtl"] .swal2-content {
    text-align: right;
}

/* RTL ApexCharts Adjustments */
[dir="rtl"] .apexcharts-canvas {
    direction: ltr;
}

/* Custom Arabic Icons */
.arabic-icon {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* RTL Responsive Adjustments */
@media (max-width: 768px) {
    [dir="rtl"] .topbar-search {
        display: none;
    }
    
    [dir="rtl"] .d-none.d-md-block {
        display: block !important;
    }
}

/* Arabic Loading Spinner */
.arabic-spinner {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* RTL Animation Adjustments */
[dir="rtl"] .fade-in-right {
    animation: fadeInLeft 0.5s ease-in-out;
}

[dir="rtl"] .fade-in-left {
    animation: fadeInRight 0.5s ease-in-out;
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* RTL Layout Adjustments */
[dir="rtl"] .page-container {
    margin-right: 260px;
    margin-left: 0;
}

[dir="rtl"] .page-container.sidebar-collapse {
    margin-right: 70px;
    margin-left: 0;
}

[dir="rtl"] .sidenav-menu {
    right: 0;
    left: auto;
}

[dir="rtl"] .topnav {
    right: 260px;
    left: 0;
}

[dir="rtl"] .topnav.sidebar-collapse {
    right: 70px;
    left: 0;
}

/* RTL Sidebar - Updated for Dropdown Structure */
[dir="rtl"] .side-nav .side-nav-link {
    padding: 12px 20px 12px 15px;
}

[dir="rtl"] .side-nav .menu-arrow {
    right: auto;
    left: 15px;
    transform: rotate(180deg);
}

[dir="rtl"] .side-nav .menu-arrow.show {
    transform: rotate(0deg);
}

/* RTL Dropdown Menu for Sidebar */
[dir="rtl"] .side-nav .dropdown-menu {
    right: auto;
    left: 100%;
    top: 0;
    margin-right: 0;
    margin-left: 0;
    border-radius: 0.375rem 0 0 0.375rem;
    border-right: 1px solid rgba(0, 0, 0, 0.125);
    border-left: none;
}

[dir="rtl"] .side-nav .dropdown-menu .dropdown-item {
    padding: 0.5rem 1rem;
    text-align: right;
}

[dir="rtl"] .side-nav .dropdown-menu .dropdown-item:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

[dir="rtl"] .side-nav .dropdown-menu .dropdown-item.active {
    background-color: #3b7ddd;
    color: white;
}

/* RTL Dropdown */
[dir="rtl"] .dropdown-menu {
    right: auto;
    left: 0;
    text-align: right;
}

[dir="rtl"] .dropdown-menu-end {
    right: 0;
    left: auto;
}

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

[dir="rtl"] .table th.text-center,
[dir="rtl"] .table td.text-center {
    text-align: center;
}

/* RTL Forms */
[dir="rtl"] .form-check {
    padding-right: 1.5em;
    padding-left: 0;
}

[dir="rtl"] .form-check-input {
    margin-right: -1.5em;
    margin-left: 0;
}

[dir="rtl"] .form-check-label {
    margin-right: 0.5em;
    margin-left: 0;
}

/* RTL Buttons */
[dir="rtl"] .btn-group > .btn:not(:last-child):not(.dropdown-toggle) {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-top-right-radius: 0.375rem;
    border-bottom-right-radius: 0.375rem;
}

[dir="rtl"] .btn-group > .btn:not(:first-child) {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-top-left-radius: 0.375rem;
    border-bottom-left-radius: 0.375rem;
}

/* RTL Breadcrumb */
[dir="rtl"] .breadcrumb-item + .breadcrumb-item {
    padding-right: 0.5rem;
    padding-left: 0;
}

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

/* RTL Alerts */
[dir="rtl"] .alert-dismissible {
    padding-right: 1rem;
    padding-left: 4rem;
}

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

/* RTL Modal */
[dir="rtl"] .modal-header .btn-close {
    margin: -0.5rem auto -0.5rem -0.5rem;
}

/* RTL Pagination */
[dir="rtl"] .pagination .page-link {
    margin-right: -1px;
    margin-left: 0;
}

[dir="rtl"] .pagination .page-item:first-child .page-link {
    border-top-right-radius: 0.375rem;
    border-bottom-right-radius: 0.375rem;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

[dir="rtl"] .pagination .page-item:last-child .page-link {
    border-top-left-radius: 0.375rem;
    border-bottom-left-radius: 0.375rem;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

/* RTL Input Groups */
[dir="rtl"] .input-group > .form-control:not(:last-child) {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-top-right-radius: 0.375rem;
    border-bottom-right-radius: 0.375rem;
}

[dir="rtl"] .input-group > .form-control:not(:first-child) {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-top-left-radius: 0.375rem;
    border-bottom-left-radius: 0.375rem;
}

/* RTL Nav Tabs */
[dir="rtl"] .nav-tabs .nav-link {
    border-top-right-radius: 0.375rem;
    border-bottom-right-radius: 0.375rem;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

/* RTL Progress */
[dir="rtl"] .progress-bar {
    float: right;
}

/* RTL Badges */
[dir="rtl"] .badge {
    margin-right: 0;
    margin-left: 0.25em;
}

/* RTL Icons */
[dir="rtl"] .ti {
    margin-right: 0;
    margin-left: 0.25em;
}

[dir="rtl"] .btn .ti {
    margin-right: 0;
    margin-left: 0.5em;
}

/* RTL Cards */
[dir="rtl"] .card-header-tabs {
    margin-right: -1.25rem;
    margin-left: -1.25rem;
    padding-right: 1.25rem;
    padding-left: 1.25rem;
}

/* RTL List Groups */
[dir="rtl"] .list-group-item {
    text-align: right;
}

/* RTL Tooltips */
[dir="rtl"] .tooltip {
    text-align: right;
}

/* RTL Popovers */
[dir="rtl"] .popover {
    text-align: right;
}

/* RTL DataTables */
[dir="rtl"] .dataTables_wrapper .dataTables_filter {
    text-align: left;
}

[dir="rtl"] .dataTables_wrapper .dataTables_length {
    text-align: right;
}

[dir="rtl"] .dataTables_wrapper .dataTables_info {
    text-align: right;
}

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

/* RTL Select2 */
[dir="rtl"] .select2-container--default .select2-selection--single .select2-selection__rendered {
    text-align: right;
}

[dir="rtl"] .select2-container--default .select2-results__option {
    text-align: right;
}

/* RTL SweetAlert */
[dir="rtl"] .swal2-popup {
    text-align: right;
}

/* RTL Custom Components */
[dir="rtl"] .page-title-head {
    flex-direction: row-reverse;
}

[dir="rtl"] .card-header.d-flex {
    flex-direction: row-reverse;
}

[dir="rtl"] .d-flex.align-items-center.gap-2 {
    flex-direction: row-reverse;
}

/* RTL Responsive */
@media (max-width: 768px) {
    [dir="rtl"] .page-container {
        margin-right: 0;
        margin-left: 0;
    }
    
    [dir="rtl"] .topnav {
        right: 0;
        left: 0;
    }
    
    [dir="rtl"] .sidenav-menu {
        right: -260px;
        left: auto;
    }
    
    [dir="rtl"] .sidenav-menu.show {
        right: 0;
        left: auto;
    }
    
    /* Mobile dropdown positioning */
    [dir="rtl"] .side-nav .dropdown-menu {
        right: auto;
        left: 0;
        top: 100%;
        position: static;
        border-radius: 0.375rem;
        border: 1px solid rgba(0, 0, 0, 0.125);
        margin-top: 0.25rem;
    }
}

/* Custom Arabic Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
}

/* RTL Specific Spacing */
[dir="rtl"] .me-1 { margin-right: 0 !important; margin-left: 0.25rem !important; }
[dir="rtl"] .me-2 { margin-right: 0 !important; margin-left: 0.5rem !important; }
[dir="rtl"] .me-3 { margin-right: 0 !important; margin-left: 1rem !important; }
[dir="rtl"] .me-4 { margin-right: 0 !important; margin-left: 1.5rem !important; }
[dir="rtl"] .me-5 { margin-right: 0 !important; margin-left: 3rem !important; }

[dir="rtl"] .ms-1 { margin-left: 0 !important; margin-right: 0.25rem !important; }
[dir="rtl"] .ms-2 { margin-left: 0 !important; margin-right: 0.5rem !important; }
[dir="rtl"] .ms-3 { margin-left: 0 !important; margin-right: 1rem !important; }
[dir="rtl"] .ms-4 { margin-left: 0 !important; margin-right: 1.5rem !important; }
[dir="rtl"] .ms-5 { margin-left: 0 !important; margin-right: 3rem !important; }

[dir="rtl"] .pe-1 { padding-right: 0 !important; padding-left: 0.25rem !important; }
[dir="rtl"] .pe-2 { padding-right: 0 !important; padding-left: 0.5rem !important; }
[dir="rtl"] .pe-3 { padding-right: 0 !important; padding-left: 1rem !important; }
[dir="rtl"] .pe-4 { padding-right: 0 !important; padding-left: 1.5rem !important; }
[dir="rtl"] .pe-5 { padding-right: 0 !important; padding-left: 3rem !important; }

[dir="rtl"] .ps-1 { padding-left: 0 !important; padding-right: 0.25rem !important; }
[dir="rtl"] .ps-2 { padding-left: 0 !important; padding-right: 0.5rem !important; }
[dir="rtl"] .ps-3 { padding-left: 0 !important; padding-right: 1rem !important; }
[dir="rtl"] .ps-4 { padding-left: 0 !important; padding-right: 1.5rem !important; }
[dir="rtl"] .ps-5 { padding-left: 0 !important; padding-right: 3rem !important; }

/* Sidebar Dropdown Enhancements */
.side-nav .dropdown-menu {
    min-width: 200px;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.125);
}

.side-nav .dropdown-item {
    color: #6c757d;
    transition: all 0.2s ease;
}

.side-nav .dropdown-item:hover {
    background-color: rgba(59, 125, 221, 0.1);
    color: #3b7ddd;
}

.side-nav .dropdown-item.active {
    background-color: #3b7ddd;
    color: white;
}

/* Hover Effects */
.side-nav .side-nav-link:hover {
    background-color: rgba(59, 125, 221, 0.1);
}

.side-nav .side-nav-link.active {
    background-color: #3b7ddd;
    color: white;
}

.side-nav .side-nav-link.active .menu-icon {
    color: white;
}

/* Smooth Transitions */
.side-nav .dropdown-menu {
    transition: all 0.3s ease;
    transform-origin: top left;
}

.side-nav .dropdown-menu.show {
    transform: scale(1);
    opacity: 1;
}

.side-nav .dropdown-menu:not(.show) {
    transform: scale(0.95);
    opacity: 0;
    pointer-events: none;
} 