/* 
 * Premium SaaS ERP CSS
 * Typography: Inter
 * UI Pattern: Clean, modern, glassmorphism hints, subtle shadows
 */

 :root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #3b82f6;
    
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --bg-sidebar: #0f172a;
    
    --sidebar-text: #94a3b8;
    --sidebar-text-hover: #ffffff;
    --sidebar-active-bg: rgba(79, 70, 229, 0.4);
    
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    
    --sidebar-width: 295px;
    --sidebar-collapsed-width: 75px;
    --header-height: 72px;
    
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.025);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.05), 0 4px 6px -2px rgba(0,0,0,0.025);
    
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    overflow-x: hidden;
}

/* Typography Enhancements */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: var(--text-main);
    letter-spacing: -0.02em;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: all 0.2s ease;
}
a:hover {
    color: var(--primary-hover);
}

/* Layout */
#wrapper {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* Sidebar */
#sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: fixed;
    top: 0;
    bottom: 0;
    z-index: 1000;
}
#sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}
.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 1.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-weight: 700;
    font-size: 1.35rem;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    letter-spacing: 0.5px;
}
#sidebar.collapsed .sidebar-header span {
    display: none;
}
#sidebar.collapsed .sidebar-header {
    justify-content: center;
    padding: 0;
}
#sidebar.collapsed .sidebar-menu p.text-uppercase {
    display: none;
}
#sidebar p.text-muted {
    color: #ffffff !important;
    opacity: 0.75;
    font-size: 0.78rem !important;
    letter-spacing: 0.06em;
}
#sidebar .border-top {
    border-top-color: rgba(255, 255, 255, 0.1) !important;
}
.sidebar-menu {
    padding: 1.25rem 0.95rem;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
}

/* Custom Scrollbar for Sidebar */
.sidebar-menu::-webkit-scrollbar {
    width: 4px;
}
.sidebar-menu::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar-menu::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}
.sidebar-menu:hover::-webkit-scrollbar-thumb {
    background: #cbd5e1;
}
.menu-item {
    display: flex;
    align-items: center;
    padding: 0.8rem 1.15rem;
    color: var(--sidebar-text);
    border-radius: var(--radius-md);
    margin-bottom: 0.35rem;
    font-weight: 500;
    font-size: 0.965rem;
    white-space: nowrap;
    overflow: hidden;
    transition: all 0.2s ease;
}
.menu-item i {
    font-size: 1.3rem;
    min-width: 32px;
    text-align: center;
    margin-right: 0.85rem;
    transition: all 0.2s;
}
#sidebar.collapsed .menu-item i {
    margin-right: 0;
}
#sidebar.collapsed .menu-item {
    justify-content: center;
    padding: 0.85rem 0;
}
#sidebar.collapsed .menu-item span {
    display: none;
}
.menu-item:hover, .menu-item.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-text-hover);
}
.menu-item.active {
    font-weight: 600;
    color: #ffffff;
}
.menu-item.active i {
    color: #ffffff;
}

/* Submenu & Accordion Dropdown Styles */
.menu-dropdown-toggle {
    cursor: pointer;
    user-select: none;
}
.menu-dropdown-toggle .menu-arrow {
    transition: transform 0.25s ease;
    font-size: 0.85rem !important;
    min-width: auto !important;
    margin-right: 0 !important;
    margin-left: auto;
    opacity: 0.75;
}
.menu-dropdown-toggle[aria-expanded="true"] .menu-arrow {
    transform: rotate(180deg);
    opacity: 1;
}
.menu-dropdown-toggle[aria-expanded="true"] {
    background: rgba(255, 255, 255, 0.07);
    color: #ffffff;
}
.submenu-list {
    list-style: none;
    padding: 0.3rem 0 0.55rem 2.85rem;
    margin: 0;
}
.submenu-item {
    display: flex;
    align-items: center;
    padding: 0.52rem 0.85rem;
    color: var(--sidebar-text);
    font-size: 0.915rem;
    font-weight: 400;
    border-radius: var(--radius-sm);
    margin-bottom: 0.2rem;
    text-decoration: none;
    transition: all 0.2s ease;
    position: relative;
}
.submenu-item::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--sidebar-text);
    opacity: 0.45;
    margin-right: 0.75rem;
    transition: all 0.2s ease;
}
.submenu-item:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.06);
}
.submenu-item:hover::before {
    background-color: #38bdf8;
    opacity: 1;
    transform: scale(1.3);
}
.submenu-item.active {
    color: #38bdf8;
    font-weight: 600;
    background: rgba(56, 189, 248, 0.12);
}
.submenu-item.active::before {
    background-color: #38bdf8;
    opacity: 1;
    transform: scale(1.4);
    box-shadow: 0 0 6px rgba(56, 189, 248, 0.8);
}
#sidebar.collapsed .submenu-list,
#sidebar.collapsed .menu-arrow {
    display: none !important;
}

/* Main Content Area */
#page-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
#sidebar.collapsed ~ #page-content {
    margin-left: var(--sidebar-collapsed-width);
}

/* Top Navbar */
.top-navbar {
    height: var(--header-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 900;
}
.toggle-sidebar-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--radius-sm);
    transition: background 0.2s;
}
.toggle-sidebar-btn:hover {
    background: var(--bg-body);
    color: var(--text-main);
}

/* Main Container */
.main-container {
    padding: 2rem;
    flex: 1;
}

/* Premium UI Kit Components */

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-sm) !important;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.card.hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md) !important;
}
.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem 1.5rem;
}
.card-body {
    padding: 1.5rem;
}

/* Buttons */
.btn {
    font-weight: 500;
    border-radius: var(--radius-md);
    padding: 0.5rem 1rem;
    transition: all 0.2s ease;
}
.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}
.btn-primary:hover, .btn-primary:focus {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
    transform: translateY(-1px);
}
.btn-soft-primary {
    background-color: rgba(79, 70, 229, 0.1);
    color: var(--primary-color);
    border: none;
}
.btn-soft-primary:hover {
    background-color: rgba(79, 70, 229, 0.2);
    color: var(--primary-hover);
}
.btn-soft-success {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
    border: none;
}
.btn-soft-success:hover {
    background-color: rgba(16, 185, 129, 0.2);
}
.btn-soft-danger {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
    border: none;
}
.btn-soft-danger:hover {
    background-color: rgba(239, 68, 68, 0.2);
}
.btn-soft-secondary {
    background-color: rgba(100, 116, 139, 0.1);
    color: var(--secondary-color);
    border: none;
}
.btn-soft-secondary:hover {
    background-color: rgba(100, 116, 139, 0.2);
}

/* Form Controls with bg-light */
.form-control.bg-light.border-0, 
.form-select.bg-light.border-0 {
    background-color: #f1f5f9 !important; /* Slightly darker slate gray for contrast */
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.02);
    transition: all 0.2s ease;
}
.form-control.bg-light.border-0:focus, 
.form-select.bg-light.border-0:focus {
    background-color: #ffffff !important;
    border: 1px solid var(--primary-color) !important;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1) !important;
}

/* Badges */
.badge {
    font-weight: 500;
    padding: 0.35em 0.8em;
    border-radius: 20px;
}
.badge-soft-success { background: rgba(16, 185, 129, 0.15); color: #059669; }
.badge-soft-warning { background: rgba(245, 158, 11, 0.15); color: #d97706; }
.badge-soft-danger { background: rgba(239, 68, 68, 0.15); color: #dc2626; }
.badge-soft-primary { background: rgba(79, 70, 229, 0.15); color: #4338ca; }
.badge-soft-secondary { background: rgba(100, 116, 139, 0.15); color: #475569; }

/* Forms */
.form-control, .form-select {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.6rem 1rem;
    font-size: 0.95rem;
    color: var(--text-main);
    background-color: #fff;
    transition: all 0.2s ease;
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}
.form-label {
    font-weight: 500;
    color: var(--text-main);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

/* Tables (DataTables Overrides) */
.table {
    margin-bottom: 0;
    color: var(--text-main);
}
.table > :not(caption) > * > * {
    padding: 1rem 1.5rem;
    border-bottom-color: var(--border-color);
}
.table > thead {
    background-color: rgba(248, 250, 252, 0.8);
}
.table > thead th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
}
.table-hover tbody tr:hover {
    background-color: rgba(248, 250, 252, 0.6);
}
.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.4rem 0.8rem;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: #fff !important;
    border-radius: var(--radius-sm);
}

/* Utilities */
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.fw-medium { font-weight: 500; }
.fw-semibold { font-weight: 600; }
.text-primary { color: var(--primary-color) !important; }
.bg-primary-soft { background-color: rgba(79, 70, 229, 0.05); }

/* Avatar / Profile Images */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}
.avatar-lg {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: var(--shadow-sm);
    object-fit: cover;
}

/* Tabs */
.nav-tabs .nav-link {
    border: none;
    color: var(--text-muted);
    font-weight: 500;
    padding: 1rem 1.5rem;
    border-bottom: 2px solid transparent;
}
.nav-tabs .nav-link.active {
    border: none;
    color: var(--primary-color);
    background: transparent;
    border-bottom: 2px solid var(--primary-color);
}
.nav-tabs .nav-link:hover:not(.active) {
    border-bottom-color: var(--border-color);
}

/* Auth / Login Page Styles */
.auth-wrapper {
    display: flex;
    min-height: 100vh;
    overflow: hidden;
}

.auth-left {
    flex: 1;
    background: linear-gradient(135deg, var(--primary-color) 0%, #312e81 100%);
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 5rem;
    position: relative;
    overflow: hidden;
}

.auth-right {
    flex: 1;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.glass-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-xl);
    padding: 3rem;
    width: 100%;
    max-width: 450px;
    box-shadow: 0 20px 40px -10px rgba(0,0,0,0.1);
}

@media (max-width: 991px) {
    .auth-wrapper {
        flex-direction: column;
    }
    .auth-left {
        padding: 3rem 2rem;
        text-align: center;
    }
    .auth-left .d-flex {
        justify-content: center;
    }
}

/* Mobile Bottom Navigation (App-like feel) */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: #ffffff;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-around;
    padding: 10px 0;
    z-index: 1000;
    border-top: 1px solid var(--border-color);
}
.bottom-nav-item {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 500;
    flex: 1;
    text-decoration: none;
    transition: var(--transition);
}
.bottom-nav-item i {
    display: block;
    font-size: 1.5rem;
    margin-bottom: 2px;
}
.bottom-nav-item.active,
.bottom-nav-item:hover {
    color: var(--primary-color);
}
body.has-bottom-nav {
    padding-bottom: 80px; /* offset for bottom nav */
}

/* Global Select2 Full Width and SaaS Styling */
.select2-container {
    width: 100% !important;
    display: block !important;
}
.select2-container .select2-selection--single {
    height: 42px !important;
    padding: 6px 12px !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--border-radius) !important;
    background-color: #ffffff !important;
    display: flex !important;
    align-items: center !important;
}
.select2-container--bootstrap-5 .select2-selection {
    width: 100% !important;
    min-height: 42px !important;
}
.select2-container .select2-selection--single .select2-selection__rendered {
    padding-left: 0 !important;
    color: var(--text-main) !important;
    font-size: 0.95rem !important;
    line-height: normal !important;
}
.select2-container .select2-selection--single .select2-selection__arrow {
    height: 40px !important;
    right: 10px !important;
}
.select2-dropdown {
    border: 1px solid var(--border-color) !important;
    border-radius: var(--border-radius) !important;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1) !important;
    z-index: 1055 !important;
}

/* 80% Zoom on Desktop */
@media (min-width: 992px) {
    body {
        zoom: 80%;
    }
    #wrapper, .auth-wrapper {
        min-height: 125vh;
    }
    .modal-backdrop, .modal {
        width: 125vw !important;
        height: 125vh !important;
    }
}

/* Mobile Responsiveness for Layout */
@media (max-width: 991px) {
    #sidebar {
        transform: translateX(-100%); /* Hide sidebar off-screen */
        box-shadow: 4px 0 10px rgba(0,0,0,0.1);
    }
    #sidebar.show {
        transform: translateX(0); /* Slide in sidebar */
    }
    #page-content,
    #sidebar.collapsed ~ #page-content {
        margin-left: 0 !important; /* Force remove margin */
        width: 100% !important;
    }
    .top-navbar {
        padding: 0 1rem;
    }
    .main-container {
        padding: 1rem;
        overflow-x: hidden; /* Prevent horizontal overflow from DataTables/Rows */
    }
    .table-responsive {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

 / *   M o b i l e   B o t t o m   N a v i g a t i o n   ( A p p - l i k e   f e e l )   * / 
 . b o t t o m - n a v   { 
         p o s i t i o n :   f i x e d ; 
         b o t t o m :   0 ; 
         l e f t :   0 ; 
         r i g h t :   0 ; 
         b a c k g r o u n d - c o l o r :   # f f f f f f ; 
         b o x - s h a d o w :   0   - 2 p x   1 0 p x   r g b a ( 0 , 0 , 0 , 0 . 0 5 ) ; 
         d i s p l a y :   f l e x ; 
         j u s t i f y - c o n t e n t :   s p a c e - a r o u n d ; 
         p a d d i n g :   1 0 p x   0 ; 
         z - i n d e x :   1 0 0 0 ; 
         b o r d e r - t o p :   1 p x   s o l i d   v a r ( - - b o r d e r - c o l o r ) ; 
 } 
 . b o t t o m - n a v - i t e m   { 
         t e x t - a l i g n :   c e n t e r ; 
         c o l o r :   v a r ( - - t e x t - m u t e d ) ; 
         f o n t - s i z e :   0 . 7 5 r e m ; 
         f o n t - w e i g h t :   5 0 0 ; 
         f l e x :   1 ; 
         t e x t - d e c o r a t i o n :   n o n e ; 
         t r a n s i t i o n :   v a r ( - - t r a n s i t i o n ) ; 
 } 
 . b o t t o m - n a v - i t e m   i   { 
         d i s p l a y :   b l o c k ; 
         f o n t - s i z e :   1 . 5 r e m ; 
         m a r g i n - b o t t o m :   2 p x ; 
 } 
 . b o t t o m - n a v - i t e m . a c t i v e , 
 . b o t t o m - n a v - i t e m : h o v e r   { 
         c o l o r :   v a r ( - - p r i m a r y - c o l o r ) ; 
 } 
 b o d y . h a s - b o t t o m - n a v   { 
         p a d d i n g - b o t t o m :   8 0 p x ;   / *   o f f s e t   f o r   b o t t o m   n a v   * / 
 } 
  
 