/* Base Styles */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
/* Add this to your CSS file */
[dir="rtl"] .fa-solid, 
[dir="rtl"] .fas {
    font-family: "Font Awesome 6 Free" !important;
    font-weight: 900 !important;
}
/* Responsive Sidebar Styles */
.sidebar {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    transform: translateX(0);
}

/* Sidebar collapsed state */
.sidebar.collapsed {
    width: 4rem;
}

.sidebar.collapsed .sidebar-text {
    opacity: 0;
    visibility: hidden;
    transform: translateX(-10px);
}

.sidebar.collapsed nav {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

.sidebar.collapsed nav a {
    justify-content: center;
    padding-left: 1rem;
    padding-right: 1rem;
}

/* Sidebar text animation */
.sidebar-text {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

/* Mobile sidebar overlay */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 40;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Main content responsive adjustments */
.main-content {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-left: 16rem; /* 64 * 0.25rem = 16rem */
}

.main-content.collapsed {
    margin-left: 4rem;
}

/* Mobile responsive styles */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        z-index: 50;
    }
    
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .main-content.collapsed {
        margin-left: 0;
    }
}

/* Sidebar animation improvements */
.sidebar nav a {
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.sidebar nav a:hover {
    transform: translateX(2px);
}

.sidebar nav a.active {
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* Toggle button styles */
.sidebar-toggle {
    transition: all 0.2s ease;
}

.sidebar-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.sidebar-toggle:active {
    transform: scale(0.95);
}

/* Legacy sidebar ID support */
#sidebar {
    transition: all 0.3s ease;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

/* Dark Mode Styles */
.dark body {
    background-color: #1a202c;
    color: #e2e8f0;
}

.dark .bg-white {
    background-color: #2d3748;
}

.dark .text-gray-800 {
    color: #e2e8f0;
}

.dark .bg-gray-50 {
    background-color: #4a5568;
}

.dark .divide-gray-200 {
    border-color: #4a5568;
}

.dark .text-gray-500 {
    color: #a0aec0;
}

/* DataTables Custom Styles */
.dataTables_wrapper .dataTables_filter input {
    border: 1px solid #e2e8f0;
    border-radius: 0.375rem;
    padding: 0.375rem 0.75rem;
    margin-left: 0.5rem;
    background-color: transparent;
    transition: all 0.2s;
}

.dataTables_wrapper .dataTables_filter input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.dataTables_wrapper .dataTables_length select {
    border: 1px solid #e2e8f0;
    border-radius: 0.375rem;
    padding: 0.375rem 1.75rem 0.375rem 0.75rem;
    background-color: transparent;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.dark ::-webkit-scrollbar-track {
    background: #2d3748;
}

.dark ::-webkit-scrollbar-thumb {
    background: #4a5568;
}

.dark ::-webkit-scrollbar-thumb:hover {
    background: #718096;
}

/* Animation for Alerts */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.alert {
    animation: fadeIn 0.3s ease-out;
}

/* Chart Tooltip Styles */
.chartjs-tooltip {
    background-color: rgba(0, 0, 0, 0.8) !important;
    border-radius: 0.25rem !important;
    padding: 0.5rem 1rem !important;
    color: white !important;
    font-family: 'Inter', sans-serif !important;
}

.chartjs-tooltip-key {
    display: inline-block !important;
    width: 10px !important;
    height: 10px !important;
    margin-right: 5px !important;
}

.loading-indicator {
    min-height: 100px;
}

.action-btn {
    transition: transform 0.2s ease;
}

.action-btn:hover {
    transform: scale(1.1);
}

.modal-overlay {
    transition: opacity 0.3s ease;
}

.modal-content {
    transition: all 0.3s ease;
    transform: translateY(-20px);
}

.modal-active .modal-overlay {
    opacity: 1;
    pointer-events: auto;
}

.modal-active .modal-content {
    transform: translateY(0);
}

/* Arabic RTL Support */
[dir="rtl"] {
    text-align: right;
}

[dir="rtl"] .sidebar {
    left: auto;
    right: 0;
}

[dir="rtl"] .sidebar.collapsed {
    width: 4rem;
}

[dir="rtl"] .main-content {
    margin-left: 0;
    margin-right: 16rem; /* 64 * 0.25rem = 16rem */
}

[dir="rtl"] .main-content.collapsed {
    margin-right: 4rem;
    margin-left: 0;
}

[dir="rtl"] .flex {
    flex-direction: row-reverse;
}

[dir="rtl"] .space-x-2 > :not([hidden]) ~ :not([hidden]) {
    --tw-space-x-reverse: 0;
}

[dir="rtl"] .space-x-3 > :not([hidden]) ~ :not([hidden]) {
    --tw-space-x-reverse: 0;
}

[dir="rtl"] .space-x-4 > :not([hidden]) ~ :not([hidden]) {
    --tw-space-x-reverse: 0;
}

[dir="rtl"] .mr-3 {
    margin-right: 0.75rem;
    margin-left: 0.75rem;
}

[dir="rtl"] .ml-2 {
    margin-left: 0;
    margin-right: 0.5rem;
}

[dir="rtl"] .ml-3 {
    margin-left: 0;
    margin-right: 0.75rem;
}

[dir="rtl"] .pl-4 {
    padding-left: 0;
    padding-right: 1rem;
}

[dir="rtl"] .pr-3 {
    padding-right: 0;
    padding-left: 0.75rem;
}

[dir="rtl"] .text-left {
    text-align: right;
}

[dir="rtl"] .text-right {
    text-align: left;
}

/* Arabic font support */
.arabic {
    font-family: 'Segoe UI', 'Tahoma', 'Arial', sans-serif;
}

.arabic * {
    font-family: 'Segoe UI', 'Tahoma', 'Arial', sans-serif;
}

/* RTL specific adjustments */
[dir="rtl"] .border-l-4 {
    border-left-width: 0;
    border-right-width: 4px;
}

[dir="rtl"] .border-l-blue-500 {
    border-left-color: transparent;
    border-right-color: #3b82f6;
}

[dir="rtl"] .border-l-red-500 {
    border-left-color: transparent;
    border-right-color: #ef4444;
}

[dir="rtl"] .border-l-yellow-500 {
    border-left-color: transparent;
    border-right-color: #eab308;
}

[dir="rtl"] .border-l-green-500 {
    border-left-color: transparent;
    border-right-color: #22c55e;
}

[dir="rtl"] .border-l-purple-500 {
    border-left-color: transparent;
    border-right-color: #a855f7;
}

/* Dropdown positioning for RTL */
[dir="rtl"] .absolute.right-0 {
    right: auto;
    left: 0;
}

/* Mobile RTL adjustments */
@media (max-width: 768px) {
    [dir="rtl"] .sidebar {
        transform: translateX(100%);
        left: auto;
        right: 0;
    }
    
    [dir="rtl"] .sidebar.mobile-open {
        transform: translateX(0);
    }
    
    [dir="rtl"] .main-content {
        margin-right: 0;
    }
    
    [dir="rtl"] .main-content.collapsed {
        margin-right: 0;
    }
}

/* Language toggle button styles */
#language-toggle {
    transition: all 0.2s ease-in-out;
}

#language-toggle:hover {
    transform: scale(1.05);
}

/* Sidebar toggle functionality styles */
.sidebar-collapsed {
    width: 4rem !important;
}

.sidebar-collapsed .sidebar-text {
    display: none;
}

.main-content-expanded {
    margin-left: 4rem !important;
}

.sidebar-open {
    transform: translateX(0) !important;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* Mobile sidebar adjustments */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
    }
    
    .sidebar.sidebar-open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0 !important;
    }
}

/* Arabic number styles */
.arabic .arabic-numbers {
    font-feature-settings: "lnum" 1;
}

/* RTL table adjustments */
[dir="rtl"] table {
    text-align: right;
}

[dir="rtl"] .text-left {
    text-align: right;
}

/* RTL form adjustments */
[dir="rtl"] .form-input,
[dir="rtl"] input,
[dir="rtl"] textarea,
[dir="rtl"] select {
    text-align: right;
}

/* RTL icon adjustments */
[dir="rtl"] .fa-chevron-down {
    transform: scaleX(-1);
}

[dir="rtl"] .fa-arrow-up,
[dir="rtl"] .fa-arrow-down {
    transform: scaleX(-1);
}

/* RTL sidebar hover effect */
[dir="rtl"] .sidebar nav a:hover {
    transform: translateX(-2px);
}

/* RTL DataTables adjustments */
[dir="rtl"] .dataTables_wrapper .dataTables_filter input {
    margin-left: 0;
    margin-right: 0.5rem;
}

/* RTL chart tooltip */
[dir="rtl"] .chartjs-tooltip-key {
    margin-right: 0 !important;
    margin-left: 5px !important;
}

/* RTL sidebar positioning fixes */
[dir="rtl"] .fixed.inset-y-0.left-0 {
    left: auto;
    right: 0;
}

[dir="rtl"] .ml-64 {
    margin-left: 0;
    margin-right: 16rem;
}

/* RTL mobile sidebar adjustments */
@media (max-width: 768px) {
    [dir="rtl"] .sidebar {
        transform: translateX(100%);
        left: auto;
        right: 0;
    }
    
    [dir="rtl"] .sidebar.sidebar-open {
        transform: translateX(0);
    }
    
    [dir="rtl"] .ml-64 {
        margin-left: 0;
        margin-right: 0;
    }
}

/* RTL space adjustments for flex items */
[dir="rtl"] .space-x-2 > :not([hidden]) ~ :not([hidden]) {
    --tw-space-x-reverse: 0;
    margin-right: calc(0.5rem * var(--tw-space-x-reverse));
    margin-left: calc(0.5rem * calc(1 - var(--tw-space-x-reverse)));
}

[dir="rtl"] .space-x-3 > :not([hidden]) ~ :not([hidden]) {
    --tw-space-x-reverse: 0;
    margin-right: calc(0.75rem * var(--tw-space-x-reverse));
    margin-left: calc(0.75rem * calc(1 - var(--tw-space-x-reverse)));
}

[dir="rtl"] .space-x-4 > :not([hidden]) ~ :not([hidden]) {
    --tw-space-x-reverse: 0;
    margin-right: calc(1rem * var(--tw-space-x-reverse));
    margin-left: calc(1rem * calc(1 - var(--tw-space-x-reverse)));
}

[dir="rtl"] .space-x-8 > :not([hidden]) ~ :not([hidden]) {
    --tw-space-x-reverse: 0;
    margin-right: calc(2rem * var(--tw-space-x-reverse));
    margin-left: calc(2rem * calc(1 - var(--tw-space-x-reverse)));
}

/* RTL margin and padding fixes */
[dir="rtl"] .mr-1 {
    margin-right: 0;
    margin-left: 0.25rem;
}

[dir="rtl"] .mr-2 {
    margin-right: 0.5rem;
    margin-left: 0.5rem;
}

[dir="rtl"] .mr-3 {
    margin-right: 0.75rem;
    margin-left: 0.75rem;
}

[dir="rtl"] .ml-2 {
    margin-left: 0;
    margin-right: 0.5rem;
}

[dir="rtl"] .ml-3 {
    margin-left: 0;
    margin-right: 0.75rem;
}

/* RTL border adjustments */
[dir="rtl"] .border-b-2 {
    border-bottom-width: 2px;
}

[dir="rtl"] .-mb-px {
    margin-bottom: -1px;
}

/* RTL flex direction fixes */
[dir="rtl"] .flex.items-center {
    flex-direction: row-reverse;
}

[dir="rtl"] .flex.justify-between {
    flex-direction: row;
}

[dir="rtl"] .flex.justify-between.items-center {
    flex-direction: row;
}
