/* ====================================
   ERP System - Custom Styles
   ==================================== */

/* Scale down entire page by 20% using root font-size */
html {
    font-size: 12.8px; /* 80% of 16px (browser default) */
}

/* Modern Color Scheme & Root Variables */
:root {
    /* Primary Brand Colors */
    --primary-color: #667eea;
    --primary-dark: #764ba2;
    --primary-light: #e0e7ff;
    
    /* Secondary Colors */
    --secondary-color: #718096;
    --secondary-dark: #4a5568;
    --secondary-light: #edf2f7;
    
    /* Status Colors */
    --success-color: #48bb78;
    --success-dark: #38a169;
    --success-light: #c6f6d5;
    
    --danger-color: #fc8181;
    --danger-dark: #e53e3e;
    --danger-light: #fed7d7;
    
    --warning-color: #ecc94b;
    --warning-dark: #d69e2e;
    --warning-light: #fef5e7;
    
    --info-color: #4299e1;
    --info-dark: #3182ce;
    --info-light: #bee3f8;
    
    /* Neutral Colors */
    --gray-50: #f7fafc;
    --gray-100: #edf2f7;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e0;
    --gray-400: #a0aec0;
    --gray-500: #718096;
    --gray-600: #4a5568;
    --gray-700: #2d3748;
    --gray-800: #1a202c;
    --gray-900: #171923;
    
    /* Layout Variables - Scaled down by 20% */
    --sidebar-width: 240px; /* widened slightly for labels and favorite star */
    --navbar-height: 45px; /* was 56px */
    
    /* Shadows - Scaled down by 20% */
    --shadow-sm: 0 0.8px 2.4px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 3.2px 6.4px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 20px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 16px 32px rgba(0, 0, 0, 0.12);
    
    /* Border Radius - Scaled down by 20% */
    --radius-sm: 4.8px; /* was 6px */
    --radius-md: 6.4px; /* was 8px */
    --radius-lg: 9.6px; /* was 12px */
    --radius-xl: 12.8px; /* was 16px */
    --radius-full: 9999px;
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-base: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* Global Styles */
body {
    font-family: "Tajawal", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    font-size: 0.875rem; /* 14px at 80% scale = 11.2px */
    line-height: 1.6;
    color: var(--gray-700);
    background: var(--gray-50);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

* {
    box-sizing: border-box;
}

a {
    text-decoration: none;
    transition: var(--transition-fast);
}

/* Headings - Scaled down by 20% */
h1, h2, h3, h4, h5, h6 {
    color: var(--gray-800);
    font-weight: 700;
    line-height: 1.3;
}

h1 { font-size: 1.8rem; } /* was 2.25rem */
h2 { font-size: 1.5rem; } /* was 1.875rem */
h3 { font-size: 1.2rem; } /* was 1.5rem */
h4 { font-size: 1rem; } /* was 1.25rem */
h5 { font-size: 0.9rem; } /* was 1.125rem */
h6 { font-size: 0.8rem; } /* was 1rem */

/* Layout with Sidebar */
#main-navbar {
    height: var(--navbar-height);
    z-index: 1030;
    background: linear-gradient(135deg, #0d6efd 0%, #0a58ca 100%) !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

#main-navbar .navbar-brand {
    font-weight: 600;
    transition: all 0.3s ease;
}

#main-navbar .navbar-brand:hover {
    transform: scale(1.05);
}

#main-navbar .btn-outline-light:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

#main-navbar .btn-outline-light {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-color: rgba(255, 255, 255, 0.3);
}

#main-navbar .dropdown-menu {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    border: none;
    border-radius: 8px;
    margin-top: 0.5rem;
}

#main-navbar .dropdown-item {
    padding: 0.6rem 1.25rem;
    transition: all 0.2s ease;
}

#main-navbar .dropdown-item:hover {
    background: linear-gradient(90deg, rgba(13, 110, 253, 0.1) 0%, transparent 100%);
    padding-left: 1.5rem;
}

#sidebarToggle {
    transition: all 0.3s ease;
}

#sidebarToggle:hover {
    background: rgba(255, 255, 255, 0.2) !important;
    transform: rotate(90deg);
}

.sidebar {
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    height: calc(100vh - var(--navbar-height));
    background: linear-gradient(180deg, #2c3e50 0%, #1a252f 100%);
    color: #ecf0f1;
    overflow-y: auto;
    overflow-x: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    box-shadow: 3px 0 20px rgba(0, 0, 0, 0.2);
    padding: 0;
    width: var(--sidebar-width);
}

.sidebar-header {
    padding: 1.5rem 1.25rem;
    border-bottom: 2px solid rgba(52, 152, 219, 0.2);
    background: linear-gradient(135deg, #34495e 0%, #2c3e50 100%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.sidebar-header h5 {
    color: #ecf0f1;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.95rem;
    margin: 0;
}

.sidebar-header i {
    color: #3498db;
    margin-right: 0.5rem;
}

.sidebar-menu {
    padding: 0;
    margin: 0;
}

/* Removed - using #app-content instead */

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1010;
    display: none;
}

/* Sidebar Menu Styles - Enhanced Modern Design */
.sidebar-menu {
    padding: 0.5rem 0;
}

.sidebar-menu-item {
    margin: 0;
    padding: 0;
    list-style: none;
}

.sidebar-menu-item > a,
.sidebar-menu-item > .sidebar-menu-toggle {
    display: flex;
    align-items: center;
    padding: 0.875rem 1.25rem;
    color: #ecf0f1;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 3px solid transparent;
    cursor: pointer;
    background: transparent;
    border: none;
    border-bottom: none;
    width: 100%;
    text-align: left;
    font-size: 0.95rem;
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

/* Hover effect with slide-in background */
.sidebar-menu-item > a::before,
.sidebar-menu-item > .sidebar-menu-toggle::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0;
    background: linear-gradient(90deg, rgba(52, 152, 219, 0.15) 0%, transparent 100%);
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: -1;
}

.sidebar-menu-item > a:hover::before,
.sidebar-menu-item > .sidebar-menu-toggle:hover::before {
    width: 100%;
}

.sidebar-menu-item > a:hover,
.sidebar-menu-item > .sidebar-menu-toggle:hover {
    background: rgba(52, 73, 94, 0.5);
    border-left-color: #3498db;
    color: #fff;
    padding-left: 1.4rem;
}

.sidebar-menu-item > a.active {
    background: linear-gradient(90deg, rgba(52, 152, 219, 0.2) 0%, transparent 100%);
    border-left-color: #3498db;
    color: #fff;
    font-weight: 600;
    box-shadow: inset 0 0 20px rgba(52, 152, 219, 0.1);
}

.sidebar-menu-item i {
    width: 28px;
    min-width: 28px;
    margin-right: 0.875rem;
    font-size: 1.2rem;
    text-align: center;
    transition: transform 0.3s ease;
}

.sidebar-menu-item > a:hover i,
.sidebar-menu-item > .sidebar-menu-toggle:hover i {
    transform: scale(1.1);
}

.menu-label {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Submenu Styles */
.sidebar-submenu {
    list-style: none;
    padding: 0;
    margin: 0;
    background: linear-gradient(to bottom, #1a252f 0%, #1e2a38 100%);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 2px solid rgba(52, 152, 219, 0.2);
}

.sidebar-submenu.show {
    max-height: 2000px;
    padding: 0.5rem 0;
}

.sidebar-submenu li {
    margin: 0;
    padding: 0;
}

.sidebar-submenu li a {
    display: flex;
    align-items: center;
    padding: 0.65rem 1.25rem 0.65rem 3.25rem;
    color: #bdc3c7;
    text-decoration: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.875rem;
    font-weight: 400;
    position: relative;
}

.sidebar-submenu li a::before {
    content: '';
    position: absolute;
    left: 2.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 4px;
    background: #3498db;
    border-radius: 50%;
    opacity: 0;
    transition: all 0.25s ease;
}

.sidebar-submenu li a:hover::before {
    opacity: 1;
    left: 2.5rem;
}

.sidebar-submenu li a:hover {
    background: rgba(52, 152, 219, 0.1);
    color: #fff;
    padding-left: 3.5rem;
}

.sidebar-submenu li a.active {
    color: #3498db;
    font-weight: 600;
    background: rgba(52, 152, 219, 0.15);
    border-left: 3px solid #3498db;
}

.submenu-icon {
    font-size: 0.7rem;
    margin-right: 0.5rem;
    opacity: 0.7;
    transition: transform 0.2s ease;
}

.sidebar-submenu li a:hover .submenu-icon {
    transform: translateX(3px);
}

/* Toggle Icon Animation */
.sidebar-menu-toggle-icon {
    margin-left: auto;
    font-size: 0.85rem;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.7;
}

.sidebar-menu-toggle.active .sidebar-menu-toggle-icon {
    transform: rotate(180deg);
    opacity: 1;
}

/* Table Sorting and Pagination Info Styles */
/* Sorting Icons */
.table thead th:not(.no-sort):not([data-translate*="action"]):not(:has(input[type="checkbox"])) {
    cursor: pointer;
    position: relative;
    padding-right: 25px !important;
    user-select: none;
    transition: background-color 0.2s ease;
}

.table thead th:not(.no-sort):not([data-translate*="action"]):not(:has(input[type="checkbox"])):hover {
    background-color: var(--gray-100);
}

/* Sorting Icons (Official DataTables 2.0 SVG Style - Fixed Overlap) */
.table thead th:not(.no-sort):not([data-translate*="action"]):not(:has(input[type="checkbox"])) {
    cursor: pointer;
    position: relative;
    padding-right: 26px !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='rgba(0, 0, 0, 0.15)' d='M8 1L12 7H4L8 1z'/%3E%3Cpath fill='rgba(0, 0, 0, 0.15)' d='M8 15L4 9H12L8 15z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 14px;
    user-select: none;
}

/* Ascending State (Up arrow active) */
.table thead th.sort-asc {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='rgba(0, 0, 0, 0.8)' d='M8 1L12 7H4L8 1z'/%3E%3Cpath fill='rgba(0, 0, 0, 0.15)' d='M8 15L4 9H12L8 15z'/%3E%3C/svg%3E") !important;
}

/* Descending State (Down arrow active) */
.table thead th.sort-desc {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='rgba(0, 0, 0, 0.15)' d='M8 1L12 7H4L8 1z'/%3E%3Cpath fill='rgba(0, 0, 0, 0.8)' d='M8 15L4 9H12L8 15z'/%3E%3C/svg%3E") !important;
}

[dir="rtl"] .table thead th:not(.no-sort):not([data-translate*="action"]):not(:has(input[type="checkbox"])) {
    padding-right: 12px !important;
    padding-left: 26px !important;
    background-position: left 8px center;
}

/* Remove old pseudo-elements entirely */
.table thead th:not(.no-sort):not([data-translate*="action"]):not(:has(input[type="checkbox"]))::before,
.table thead th:not(.no-sort):not([data-translate*="action"]):not(:has(input[type="checkbox"]))::after {
    display: none !important;
    content: none !important;
}

[dir="rtl"] .table thead th:not(.no-sort):not([data-translate*="action"]):not(:has(input[type="checkbox"])) {
    padding-right: 12px !important;
    padding-left: 26px !important;
    background-position: left 8px center;
}

.table-info-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.table-record-count {
    font-size: 0.85rem;
    color: var(--gray-600);
}

.pagination-wrapper {
    margin-left: auto;
}

[dir="rtl"] .pagination-wrapper {
    margin-left: 0;
    margin-right: auto;
}

/* Bootstrap Nav Menu Styles in Sidebar */
#sidebar .nav {
    padding: 0.5rem 0;
    display: flex;
    flex-direction: column;
    width: 100%;
}

#sidebar .nav-item {
    margin: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    flex-shrink: 0;
    width: 100%;
}

#sidebar .nav-item:first-child {
    border-top: none;
}

#sidebar .nav-link {
    color: #ecf0f1;
    padding: 0.875rem 1.25rem;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 3px solid transparent;
    position: relative;
    display: flex;
    align-items: center;
    overflow: hidden;
    width: 100%;
    white-space: nowrap;
}

#sidebar .nav-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0;
    background: linear-gradient(90deg, rgba(52, 152, 219, 0.15) 0%, transparent 100%);
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: -1;
}

#sidebar .nav-link:hover::before {
    width: 100%;
}

#sidebar .nav-link:hover {
    background: rgba(52, 73, 94, 0.5);
    border-left-color: #3498db;
    color: #fff;
    padding-left: 1.4rem;
}

#sidebar .nav-link.active {
    background: linear-gradient(90deg, rgba(52, 152, 219, 0.2) 0%, transparent 100%);
    border-left-color: #3498db;
    color: #fff;
    font-weight: 600;
    box-shadow: inset 0 0 20px rgba(52, 152, 219, 0.1);
}

#sidebar .nav-link i {
    width: 28px;
    min-width: 28px;
    margin-right: 0.75rem;
    font-size: 1.2rem;
    text-align: center;
    transition: transform 0.3s ease;
}

#sidebar .nav-link:hover i {
    transform: scale(1.1);
}

#sidebar .nav-link .bi-chevron-down {
    margin-left: auto;
    margin-right: 0;
    font-size: 0.85rem;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.7;
    width: auto;
    min-width: auto;
}

#sidebar .nav-link:not(.collapsed) .bi-chevron-down {
    transform: rotate(180deg);
    opacity: 1;
}

/* Submenu Styles */
#sidebar .collapse,
#sidebar .collapsing {
    background: linear-gradient(to bottom, #1a252f 0%, #1e2a38 100%);
    border-left: 2px solid rgba(52, 152, 219, 0.2);
    overflow: hidden;
    width: 100% !important;
    max-width: none !important;
    min-width: none !important;
}

#sidebar .collapsing {
    transition: height 0.3s ease !important;
    width: 100% !important;
}

#sidebar .collapse .nav,
#sidebar .collapsing .nav {
    padding: 0.5rem 0;
    display: block !important;
    width: 100%;
}

#sidebar .collapse .nav-item,
#sidebar .collapsing .nav-item {
    border-top: none;
    width: 100%;
}

#sidebar .collapse .nav-link,
#sidebar .collapsing .nav-link {
    padding: 0.65rem 1.25rem 0.65rem 3.25rem;
    color: #bdc3c7;
    font-size: 0.875rem;
    font-weight: 400;
    border-left: none;
    position: relative;
    width: 100%;
    white-space: nowrap;
}

#sidebar .collapse .nav-link::before,
#sidebar .collapsing .nav-link::before {
    content: '';
    position: absolute;
    left: 2.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 4px;
    background: #3498db;
    border-radius: 50%;
    opacity: 0;
    transition: all 0.25s ease;
}

#sidebar .collapse .nav-link:hover::before,
#sidebar .collapsing .nav-link:hover::before {
    opacity: 1;
    left: 2.5rem;
}

#sidebar .collapse .nav-link:hover,
#sidebar .collapsing .nav-link:hover {
    background: rgba(52, 152, 219, 0.1);
    color: #fff;
    padding-left: 3.5rem;
    border-left: none;
}

#sidebar .collapse .nav-link.active,
#sidebar .collapsing .nav-link.active {
    color: #3498db;
    font-weight: 600;
    background: rgba(52, 152, 219, 0.15);
    border-left: 3px solid #3498db;
    padding-left: 3.25rem;
}

/* Scrollbar styling for sidebar */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: #1a252f;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #3498db;
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: #2980b9;
}

/* Mobile Responsiveness */
@media (max-width: 991.98px) {
    .sidebar {
        position: fixed;
        top: var(--navbar-height);
        left: 0;
        transform: translateX(-100%);
        height: calc(100vh - var(--navbar-height));
        z-index: 1050;
    }
    
    body.rtl .sidebar {
        left: auto;
        right: 0;
        transform: translateX(100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    body.rtl .sidebar.show {
        transform: translateX(0);
    }
    
    .sidebar-overlay.show {
        display: block;
    }
    
    /* Content on mobile */
    body:not(.auth-page) #app-content {
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding: 1rem;
    }
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-overlay .spinner-border {
    width: 3rem;
    height: 3rem;
}

/* Modern Navbar */
.navbar-modern {
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    padding: 0.5rem 0;
    border-bottom: 1px solid #e2e8f0;
    z-index: 1030;
    height: var(--navbar-height);
}

.navbar-brand-modern {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    transition: transform 0.2s ease;
}

.navbar-brand-modern:hover {
    transform: translateY(-1px);
}

.brand-icon {
    width: auto;
    height: 45px;
    background: transparent;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 1.25rem;
    box-shadow: none;
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-name {
    font-size: 1rem;
    font-weight: 700;
    color: #2d3748;
    line-height: 1.2;
}

.brand-tagline {
    font-size: 0.65rem;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nav-icon-link {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4a5568;
    transition: all 0.2s ease;
    font-size: 1.1rem;
}

.nav-icon-link:hover {
    background: #f7fafc;
    color: #667eea;
}

.topbar-dropdown-trigger {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    min-height: 36px;
    padding: 0.35rem 0.7rem;
    border-radius: 10px;
    color: #4a5568;
    text-decoration: none;
    transition: all 0.2s ease;
}

.topbar-dropdown-trigger:hover {
    background: #f7fafc;
    color: #667eea;
}

.topbar-dropdown-chevron {
    font-size: 0.75rem;
    color: #718096;
    transition: transform 0.2s ease;
}

.topbar-dropdown-trigger[aria-expanded="true"] .topbar-dropdown-chevron {
    transform: rotate(180deg);
}

.topbar-dropdown-trigger::after {
    display: none !important;
}

.favorites-dropdown-toggle {
    padding-inline-end: 0.8rem;
}

.favorites-dropdown-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: #2d3748;
    line-height: 1;
}

.notification-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 2px solid #ffffff;
}

.user-dropdown {
    gap: 0.4rem;
    color: #2d3748;
}

.user-dropdown:hover {
    background: #f7fafc;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 1.2rem;
}

.user-info {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: #2d3748;
    line-height: 1.2;
}

.user-role {
    font-size: 0.75rem;
    color: #718096;
}

.dropdown-menu-modern {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    padding: 0.5rem;
    min-width: 240px;
    margin-top: 0.5rem;
}

.dropdown-menu-modern .dropdown-header {
    padding: 1rem;
    background: #f7fafc;
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.avatar-lg {
    font-size: 2.5rem;
    color: #667eea;
}

.dropdown-menu-modern .dropdown-item {
    padding: 0.625rem 1rem;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #2d3748;
}

.dropdown-menu-modern .dropdown-item i {
    width: 20px;
    text-align: center;
    color: #667eea;
}

.dropdown-menu-modern .dropdown-item:hover {
    background: #f7fafc;
    padding-left: 1.25rem;
}

.dropdown-menu-modern .dropdown-item.text-danger {
    color: #e53e3e !important;
}

.dropdown-menu-modern .dropdown-item.text-danger i {
    color: #e53e3e;
}

.dropdown-menu-modern .dropdown-item.text-danger:hover {
    background: #fff5f5;
}

.dropdown-menu-modern .dropdown-divider {
    margin: 0.5rem 0;
    border-color: #e2e8f0;
}

#language-selector .language-dropdown-trigger {
    color: #2d3748;
}

#language-selector .language-trigger-label {
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1;
    color: #2d3748;
}

#language-selector .dropdown-menu {
    min-width: 150px;
}

#language-selector .dropdown-item {
    font-size: 0.9rem;
}

#language-selector .dropdown-item.active {
    background-color: var(--primary-color);
    color: white;
}

/* Removed - duplicate definition below */

/* Fix for container-fluid with sidebar */
.container-fluid {
    padding-left: 0;
    padding-right: 0;
    padding-top: 0;
}

.container-fluid > .row {
    margin-left: 0;
    margin-right: 0;
}

/* Main content area - offset for fixed sidebar */
#app-content {
    min-height: calc(100vh - var(--navbar-height));
    margin-top: var(--navbar-height);
    transition: margin 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Apply sidebar margin and padding only for non-auth pages */
body:not(.auth-page) #app-content {
    margin-left: var(--sidebar-width);
    margin-right: 0;
    padding: 1.5rem 2rem 2rem; /* Top, horizontal, bottom padding */
}

/* RTL layout adjustment */
body.rtl:not(.auth-page) #app-content {
    margin-left: 0;
    margin-right: var(--sidebar-width);
}

/* Auth pages have no sidebar margin or padding */
body.auth-page #app-content {
    margin-left: 0;
    margin-right: 0;
    margin-top: 0;
    padding: 0;
}

/* Modern Cards */
.card {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.card-header {
    background: linear-gradient(to right, #f7fafc 0%, #ffffff 100%);
    border-bottom: 1px solid #e2e8f0;
    font-weight: 600;
    padding: 1.25rem 1.5rem;
    border-radius: 12px 12px 0 0;
}

.card-header h6 {
    color: #2d3748;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-header h6 i {
    color: #667eea;
}

.card-body {
    padding: 1.5rem;
}

/* Modern Tables */
.table {
    font-size: 0.9rem;
    color: var(--gray-700);
}

.table thead th {
    background: var(--gray-50);
    border-bottom: 2px solid var(--gray-200);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    color: var(--gray-600);
    padding: 1rem;
}

.table tbody td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
}

.table-hover tbody tr {
    transition: all var(--transition-fast);
}

.table-hover tbody tr:hover {
    background-color: var(--gray-50);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

/* Modern Buttons */
.btn {
    font-weight: 500;
    padding: 0.625rem 1.25rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    border-width: 1px;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: transparent;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5568d3 0%, #63408a 100%);
}

.btn-success {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    border-color: transparent;
}

.btn-danger {
    background: linear-gradient(135deg, #fc8181 0%, #e53e3e 100%);
    border-color: transparent;
}

.btn-warning {
    background: linear-gradient(135deg, #ecc94b 0%, #d69e2e 100%);
    border-color: transparent;
}

.btn-info {
    background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
    border-color: transparent;
}

.btn-outline-primary {
    border-color: #667eea;
    color: #667eea;
}

.btn-outline-primary:hover {
    background: #667eea;
    border-color: #667eea;
    color: #ffffff;
}

.btn-sm {
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
    border-radius: 6px;
}

.btn-lg {
    font-size: 1.125rem;
    padding: 0.875rem 1.5rem;
    border-radius: 10px;
}

.btn-icon {
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

/* Modern Forms */
.form-label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: #2d3748;
}

.form-control,
.form-select {
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.625rem 1rem;
    transition: all 0.3s ease;
    background: #f7fafc;
}

.form-control:focus,
.form-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
    background: #ffffff;
}

.form-control-lg {
    padding: 0.875rem 1.25rem;
    border-radius: 10px;
    font-size: 1rem;
}

.form-control-sm {
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.875rem;
}

.form-control.is-invalid,
.form-select.is-invalid {
    border-color: #fc8181;
}

.form-control.is-invalid:focus,
.form-select.is-invalid:focus {
    border-color: #e53e3e;
    box-shadow: 0 0 0 4px rgba(229, 62, 62, 0.1);
}

.form-control.is-valid,
.form-select.is-valid {
    border-color: #48bb78;
}

.form-control.is-valid:focus,
.form-select.is-valid:focus {
    border-color: #38a169;
    box-shadow: 0 0 0 4px rgba(72, 187, 120, 0.1);
}

.input-group {
    border-radius: 8px;
}

.input-group-text {
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    color: #718096;
    font-weight: 500;
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

/* Modern Badges */
.badge {
    font-weight: 600;
    padding: 0.35em 0.75em;
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.bg-primary-subtle {
    background-color: var(--primary-light) !important;
    color: var(--primary-dark) !important;
}

.bg-success-subtle {
    background-color: var(--success-light) !important;
    color: var(--success-dark) !important;
}

.bg-danger-subtle {
    background-color: var(--danger-light) !important;
    color: var(--danger-dark) !important;
}

.bg-warning-subtle {
    background-color: var(--warning-light) !important;
    color: var(--warning-dark) !important;
}

.bg-info-subtle {
    background-color: var(--info-light) !important;
    color: var(--info-dark) !important;
}

.text-primary { color: var(--primary-color) !important; }
.text-success { color: var(--success-color) !important; }
.text-danger { color: var(--danger-color) !important; }
.text-warning { color: var(--warning-color) !important; }
.text-info { color: var(--info-color) !important; }

/* Dashboard Header */
.dashboard-header {
    margin-bottom: 1.5rem;
}

.dashboard-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #2d3748;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dashboard-title i {
    color: #667eea;
}

.dashboard-date-filter {
    max-width: 450px;
}

.dashboard-date-filter .input-group-text {
    border-color: #e2e8f0;
}

.dashboard-date-filter .form-control {
    border-color: #e2e8f0;
}

.dashboard-date-filter .form-control:focus {
    border-color: #667eea;
    box-shadow: none;
}

/* Modern Stat Cards */
.stat-card-modern {
    background: #ffffff;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #f0f0f0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.stat-card-modern:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.stat-card-icon {
    margin-bottom: 1rem;
}

.stat-icon-wrapper {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: transform 0.3s ease;
}

.stat-card-modern:hover .stat-icon-wrapper {
    transform: scale(1.1);
}

.stat-card-primary .stat-icon-wrapper {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.stat-card-success .stat-icon-wrapper {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(72, 187, 120, 0.3);
}

.stat-card-warning .stat-icon-wrapper {
    background: linear-gradient(135deg, #ed8936 0%, #dd6b20 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(237, 137, 54, 0.3);
}

.stat-card-info .stat-icon-wrapper {
    background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(66, 153, 225, 0.3);
}

.stat-card-danger .stat-icon-wrapper {
    background: linear-gradient(135deg, #f56565 0%, #e53e3e 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(229, 62, 62, 0.3);
}

.stat-card-content {
    position: relative;
    z-index: 1;
}

.stat-card-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.stat-card-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 0.75rem;
    line-height: 1.2;
}

.stat-card-footer {
    margin-top: 0.75rem;
}

.stat-card-footer .badge {
    font-weight: 500;
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
}

/* Old Dashboard Cards (Legacy) */
.stat-card {
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.stat-card .card-body {
    padding: 1.5rem;
}

/* Additional Sidebar Enhancements */
#sidebar {
    background: linear-gradient(180deg, #2c3e50 0%, #1a252f 100%);
}

#sidebar .position-sticky {
    padding: 1rem 0;
    width: 100%;
    min-width: var(--sidebar-width);
}

/* Navbar Improvements */
.navbar {
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.navbar .dropdown-menu {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    border: none;
    border-radius: 0.375rem;
}

.navbar .dropdown-item {
    padding: 0.5rem 1rem;
    transition: all 0.2s ease;
}

.navbar .dropdown-item:hover {
    background-color: rgba(13, 110, 253, 0.1);
    padding-left: 1.25rem;
}

.navbar .dropdown-item i {
    width: 20px;
    margin-right: 0.5rem;
}

/* Notification Badge */
#notification-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    font-size: 0.65rem;
    padding: 0.25em 0.5em;
    border-radius: 10px;
}

/* Better scrollbar for main content */
#app-content::-webkit-scrollbar {
    width: 8px;
}

#app-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

#app-content::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

#app-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.stat-card .stat-icon {
    font-size: 2.5rem;
    opacity: 0.8;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin: 0.5rem 0;
}

.stat-card .stat-label {
    font-size: 0.9rem;
    color: var(--secondary-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Auth Pages */
.auth-card {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.auth-card .card-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #0a58ca 100%);
    color: white;
    text-align: center;
    padding: 1.5rem;
    font-size: 1.5rem;
    font-weight: 600;
}

/* Search and Filter Bar */
.search-filter-bar, .filter-bar {
    background-color: #ffffff;
    padding: 1.25rem;
    border-radius: var(--radius-lg);
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
}

.filter-item {
    flex: 1;
    min-width: 200px;
}

.filter-item-sm {
    flex: 0 0 150px;
}

.filter-item-md {
    flex: 0 0 250px;
}

.filter-item-lg {
    flex: 0 0 350px;
}

.filter-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-600);
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    display: block;
}

.filter-bar .form-control,
.filter-bar .form-select,
.filter-bar .input-group-text,
.filter-control {
    height: 38px;
    border-radius: var(--radius-md);
    border: 1.5px solid var(--gray-200);
    background-color: var(--gray-50);
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.filter-bar .input-group > .form-control,
.filter-bar .input-group > .input-group-text {
    height: 38px;
}

.filter-control:focus,
.filter-bar .form-control:focus,
.filter-bar .form-select:focus {
    border-color: var(--primary-color);
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.filter-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
}

/* Select2 Height Fix to match System Filter Inputs (38px) */
.filter-bar .form-select + .select2-container--default .select2-selection--single,
.filter-bar .form-select + .select2-container--default .select2-selection--multiple,
.filter-control + .select2-container--default .select2-selection--single,
.form-select-sm + .select2-container--default .select2-selection--single,
.ih-small + .select2-container--default .select2-selection--single,
.filter-control + .select2-container--default .select2-selection--multiple,
.form-select-sm + .select2-container--default .select2-selection--multiple,
.ih-small + .select2-container--default .select2-selection--multiple {
    height: 38px !important;
    display: flex !important;
    align-items: center !important;
    border: 1.5px solid var(--gray-200) !important;
    border-radius: var(--radius-md) !important;
    background-color: var(--gray-50) !important;
}

/* Fix Select2 Multiple Choice Gap */
.select2-container--default .select2-selection--multiple .select2-selection__choice {
    padding-right: 2px !important;
    margin-right: 4px !important;
    display: flex !important;
    align-items: center !important;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    margin-right: 0 !important;
    padding-right: 0 !important;
    margin-left: 4px !important;
    border-right: none !important;
    line-height: 1 !important;
}

/* Fix Select2 Single Selection Clear Button and Arrow Gap */
.select2-container--default .select2-selection--single .select2-selection__clear {
    position: absolute !important;
    right: 10px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    margin-right: 0 !important;
    padding: 0 !important;
    z-index: 1 !important;
    font-weight: bold !important;
    font-size: 14px !important;
}

.filter-bar .form-select + .select2-container--default .select2-selection--single .select2-selection__rendered,
.filter-control + .select2-container--default .select2-selection--single .select2-selection__rendered,
.form-select-sm + .select2-container--default .select2-selection--single .select2-selection__rendered,
.ih-small + .select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 38px !important;
    padding-left: 12px !important;
    padding-right: 40px !important;
    color: var(--gray-700) !important;
}

.filter-bar .form-select + .select2-container--default .select2-selection--single .select2-selection__placeholder,
.filter-control + .select2-container--default .select2-selection--single .select2-selection__placeholder,
.form-select-sm + .select2-container--default .select2-selection--single .select2-selection__placeholder,
.ih-small + .select2-container--default .select2-selection--single .select2-selection__placeholder {
    line-height: 38px !important;
    color: var(--gray-400) !important;
}

.filter-bar .form-select + .select2-container--default .select2-selection--single .select2-selection__arrow,
.filter-control + .select2-container--default .select2-selection--single .select2-selection__arrow,
.form-select-sm + .select2-container--default .select2-selection--single .select2-selection__arrow,
.ih-small + .select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 38px !important;
    top: 0 !important;
    right: 2px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transform: none !important;
    width: 20px !important;
}

.filter-bar .form-select + .select2-container--default .select2-selection--single .select2-selection__arrow b,
.filter-control + .select2-container--default .select2-selection--single .select2-selection__arrow b,
.form-select-sm + .select2-container--default .select2-selection--single .select2-selection__arrow b,
.ih-small + .select2-container--default .select2-selection--single .select2-selection__arrow b {
    display: none !important;
}

.filter-bar .form-select + .select2-container--default .select2-selection--single .select2-selection__arrow:after,
.filter-control + .select2-container--default .select2-selection--single .select2-selection__arrow:after,
.form-select-sm + .select2-container--default .select2-selection--single .select2-selection__arrow:after,
.ih-small + .select2-container--default .select2-selection--single .select2-selection__arrow:after {
    margin-top: 0 !important;
}

.filter-bar .form-select + .select2-container--default.select2-container--focus .select2-selection--single,
.filter-bar .form-select + .select2-container--default.select2-container--focus .select2-selection--multiple,
.filter-control + .select2-container--default.select2-container--focus .select2-selection--single,
.filter-control + .select2-container--default.select2-container--focus .select2-selection--multiple,
.form-select-sm + .select2-container--default.select2-container--focus .select2-selection--single,
.form-select-sm + .select2-container--default.select2-container--focus .select2-selection--multiple,
.ih-small + .select2-container--default.select2-container--focus .select2-selection--single,
.ih-small + .select2-container--default.select2-container--focus .select2-selection--multiple {
    border-color: var(--primary-color) !important;
    background-color: #fff !important;
}

.btn-filter-clear {
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    white-space: nowrap;
}

/* Action Buttons Bar */
.action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.action-bar h1,
.action-bar h2,
.action-bar h3 {
    margin: 0;
}

/* Pagination */
.pagination {
    margin-bottom: 0;
}

/* Alert Messages */
.alert {
    border: none;
    border-radius: 0.375rem;
}

.alert-dismissible .btn-close {
    padding: 0.75rem;
}

/* Toast Notifications */
.toast {
    min-width: 300px;
}

.toast-header {
    font-weight: 600;
}

/* Modal Enhancements */
.modal-header {
    background-color: var(--light-color);
    border-bottom: 1px solid #dee2e6;
}

.modal-title {
    font-weight: 600;
}

/* Utility Classes */
.text-muted {
    color: var(--secondary-color) !important;
}

.cursor-pointer {
    cursor: pointer;
}

.hover-shadow {
    transition: box-shadow 0.2s;
}

.hover-shadow:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    body {
        font-size: 13px;
    }
    
    .navbar-brand {
        font-size: 1.1rem;
    }
    
    .stat-card .stat-value {
        font-size: 1.5rem;
    }
    
    .stat-card .stat-icon {
        font-size: 2rem;
    }
    
    .action-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .action-bar > * {
        width: 100%;
        text-align: center;
    }
}

/* Print Styles */
@media print {
    .navbar,
    .action-bar,
    .btn,
    .search-filter-bar {
        display: none !important;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #dee2e6;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

/* Status Indicators */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.85rem;
    font-weight: 500;
}

.status-draft {
    background-color: #e9ecef;
    color: #495057;
}

.status-pending {
    background-color: #fff3cd;
    color: #856404;
}

.status-confirmed {
    background-color: #d1ecf1;
    color: #0c5460;
}

.status-completed {
    background-color: #d4edda;
    color: #155724;
}

.status-cancelled {
    background-color: #f8d7da;
    color: #721c24;
}

.status-paid {
    background-color: #d4edda;
    color: #155724;
}

.status-overdue {
    background-color: #f8d7da;
    color: #721c24;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--secondary-color);
}

.empty-state i {
    font-size: 4rem;
    opacity: 0.5;
    margin-bottom: 1rem;
}

.empty-state p {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
}

/* ====================================
   Translation System Styles
   ==================================== */

/* Sidebar RTL Support */
body.rtl .sidebar {
    left: auto;
    right: 0;
    box-shadow: -3px 0 20px rgba(0, 0, 0, 0.2);
    border-left: none;
    border-right: 3px solid transparent;
}

body.rtl .sidebar-menu-item > a,
body.rtl .sidebar-menu-item > .sidebar-menu-toggle {
    border-left: none;
    border-right: 3px solid transparent;
    text-align: right;
}

body.rtl .sidebar-menu-item > a:hover,
body.rtl .sidebar-menu-item > .sidebar-menu-toggle:hover {
    border-left-color: transparent;
    border-right-color: #3498db;
    padding-left: 1.25rem;
    padding-right: 1.4rem;
}

body.rtl .sidebar-menu-item > a.active {
    border-left-color: transparent;
    border-right-color: #3498db;
}

body.rtl .sidebar-menu-item i {
    margin-right: 0;
    margin-left: 0.875rem;
}

body.rtl .sidebar-submenu {
    border-left: none;
    border-right: 2px solid rgba(52, 152, 219, 0.2);
}

body.rtl .sidebar-submenu li a {
    padding: 0.65rem 3.25rem 0.65rem 1.25rem;
}

body.rtl .sidebar-submenu li a::before {
    left: auto;
    right: 2.75rem;
}

body.rtl .sidebar-submenu li a:hover::before {
    left: auto;
    right: 2.5rem;
}

body.rtl .sidebar-submenu li a.active {
    border-left: none;
    border-right: 3px solid #3498db;
}

body.rtl .sidebar-menu-toggle-icon {
    margin-left: 0;
    margin-right: auto;
}

body.rtl .sidebar-menu-item > a::before,
body.rtl .sidebar-menu-item > .sidebar-menu-toggle::before {
    left: auto;
    right: 0;
    background: linear-gradient(-90deg, rgba(52, 152, 219, 0.15) 0%, transparent 100%);
}

body.rtl .sidebar-overlay {
    left: auto;
    right: 0;
}

/* RTL Support */
body.rtl {
    direction: rtl;
    text-align: right;
}

body.rtl .navbar-nav {
    flex-direction: row-reverse;
}

body.rtl .dropdown-menu {
    text-align: right;
}

body.rtl .form-label {
    text-align: right;
}

body.rtl .table {
    text-align: right;
}

body.rtl .table thead th {
    text-align: right;
}

body.rtl .pagination {
    flex-direction: row-reverse;
}

body.rtl .breadcrumb {
    /* Correct breadcrumb order in RTL */
    flex-direction: row;
    padding-left: 0;
    padding-right: 0;
}

body.rtl .breadcrumb-item {
    display: flex !important;
    flex-direction: row !important;
    padding-left: 0 !important;
}

body.rtl .breadcrumb-item + .breadcrumb-item {
    padding-right: 0.5rem !important;
}

body.rtl .breadcrumb-item + .breadcrumb-item::before {
    content: var(--bs-breadcrumb-divider, "/") !important;
    float: none !important;
    padding-left: 0.5rem !important;
    padding-right: 0 !important;
}

body.rtl .btn i {
    margin-right: 0;
    margin-left: 0.5rem;
}

body.rtl .navbar-brand i {
    margin-right: 0;
    margin-left: 0.5rem;
}

/* Fix for alignment in RTL */
body.rtl .text-end {
    text-align: left !important;
}

body.rtl .text-start {
    text-align: right !important;
}

body.rtl .me-auto {
    margin-left: auto !important;
    margin-right: 0 !important;
}

body.rtl .ms-auto {
    margin-right: auto !important;
    margin-left: 0 !important;
}

body.rtl .stat-card-modern {
    text-align: right;
}

body.rtl .stat-card-icon {
    margin-right: 0;
}

body.rtl .stat-card-footer .badge i {
    margin-left: 0.25rem;
    margin-right: 0;
}

body.rtl .dashboard-header .d-flex {
    flex-direction: row-reverse;
}

body.rtl .dashboard-date-filter {
    flex-direction: row-reverse;
}

body.rtl .input-group > :not(:first-child):not(.dropdown-menu):not(.valid-tooltip):not(.valid-feedback):not(.invalid-tooltip):not(.invalid-feedback) {
    margin-right: -1px;
    margin-left: 0;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-top-left-radius: var(--radius-md);
    border-bottom-left-radius: var(--radius-md);
}

body.rtl .input-group > :not(:last-child):not(.dropdown-menu):not(.valid-tooltip):not(.valid-feedback):not(.invalid-tooltip):not(.invalid-feedback) {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-top-right-radius: var(--radius-md);
    border-bottom-right-radius: var(--radius-md);
}

/* Fix for CRM stats cards in RTL */
body.rtl #statsCards .col-md-2 {
    text-align: right;
}

body.rtl .modal-header .btn-close {
    margin-right: auto;
    margin-left: -0.5rem;
}

body.rtl .modal-footer > :not(:first-child) {
    margin-right: 0.5rem;
    margin-left: 0;
}

body.rtl .form-check-input {
    float: right;
    margin-right: -1.5em;
    margin-left: 0;
}

body.rtl .form-check {
    padding-right: 1.5em;
    padding-left: 0;
}

/* Selection Highlight */
::selection {
    background-color: rgba(13, 110, 253, 0.3);
    color: inherit;
}

::-moz-selection {
    background-color: rgba(13, 110, 253, 0.3);
    color: inherit;
}

/* Custom Styles for Line Items Table (Compact) */
#linesTable,
#orderLinesTable,
#poLinesTable,
#invoice-lines-table {
    border: 0 !important;
}

#linesTable th, 
#linesTable td,
#orderLinesTable th,
#orderLinesTable td,
#poLinesTable th,
#poLinesTable td,
#invoice-lines-table th,
#invoice-lines-table td {
    padding: 0.5rem 0.4rem;
    vertical-align: middle;
    border: 0 !important;
    border-bottom: 1px solid var(--gray-200) !important;
}

#linesTable .form-control-sm,
#linesTable .form-select-sm,
#orderLinesTable .form-control-sm,
#orderLinesTable .form-select-sm,
#poLinesTable .form-control-sm,
#poLinesTable .form-select-sm,
#invoice-lines-table .form-control-sm,
#invoice-lines-table .form-select-sm {
    padding: 0.2rem 0.75rem;
    height: 41px !important; /* Force 41px height */
    line-height: 41px;
}

/* Ensure Select2 also matches this height */
#linesTable .select2-container--default .select2-selection--single,
#orderLinesTable .select2-container--default .select2-selection--single,
#poLinesTable .select2-container--default .select2-selection--single,
#invoice-lines-table .select2-container--default .select2-selection--single {
    height: 41px !important;
    display: flex;
    align-items: center;
    border: 2px solid #e2e8f0 !important;
    border-radius: 8px !important;
    background-color: #f7fafc !important;
}

#linesTable .select2-container--default .select2-selection--single .select2-selection__rendered,
#orderLinesTable .select2-container--default .select2-selection--single .select2-selection__rendered,
#poLinesTable .select2-container--default .select2-selection--single .select2-selection__rendered,
#invoice-lines-table .select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 38px !important;
    padding-left: 0.75rem !important;
    color: #2d3748;
}

#linesTable .select2-container--default .select2-selection--single .select2-selection__arrow,
#orderLinesTable .select2-container--default .select2-selection--single .select2-selection__arrow,
#poLinesTable .select2-container--default .select2-selection--single .select2-selection__arrow,
#invoice-lines-table .select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 38px !important;
}

.line-description {
    font-size: 0.85rem;
}

/* Red Delete Button Styling - Outline Style */
.btn-delete-line {
    background-color: transparent !important;
    border: 1px solid #f87171 !important;
    color: #f87171 !important;
    height: 41px;
    width: 41px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.2s ease;
}

.btn-delete-line:hover {
    background-color: #f87171 !important;
    color: white !important;
}

@media (min-width: 1200px) {
    .modal-xl {
        max-width: 95% !important;
    }
}
