/* 
 * 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: 260px;
    --sidebar-collapsed-width: 70px;
    --header-height: 70px;
    
    --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.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-weight: 700;
    font-size: 1.25rem;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
}
#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.7;
}
#sidebar .border-top {
    border-top-color: rgba(255, 255, 255, 0.1) !important;
}
.sidebar-menu {
    padding: 1rem 0.75rem;
    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.75rem 1rem;
    color: var(--sidebar-text);
    border-radius: var(--radius-md);
    margin-bottom: 0.25rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
}
.menu-item i {
    font-size: 1.25rem;
    min-width: 30px;
    text-align: center;
    margin-right: 0.75rem;
    transition: all 0.2s;
}
#sidebar.collapsed .menu-item i {
    margin-right: 0;
}
#sidebar.collapsed .menu-item {
    justify-content: center;
    padding: 0.75rem 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;
}

/* 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;
}
#page-content.expanded {
    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;
    }
}

/* 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;
    }
}
