/* Pioneer Auto Spares ERP - NextGen Modern SaaS Design System */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400&display=swap');

:root {
    --primary: #2563eb;
    --primary-gradient: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    --primary-soft: rgba(37, 99, 235, 0.08);
    
    --success: #10b981;
    --success-gradient: linear-gradient(135deg, #34d399 0%, #059669 100%);
    --success-soft: rgba(16, 185, 129, 0.1);
    
    --danger: #ef4444;
    --danger-gradient: linear-gradient(135deg, #f87171 0%, #dc2626 100%);
    --danger-soft: rgba(239, 68, 68, 0.1);
    
    --warning: #f59e0b;
    --warning-gradient: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
    --warning-soft: rgba(245, 158, 11, 0.1);
    
    --purple: #8b5cf6;
    --purple-gradient: linear-gradient(135deg, #a78bfa 0%, #6d28d9 100%);
    
    --sidebar-bg: #090d16;
    --sidebar-border: #1e293b;
    --sidebar-hover: #1e293b;
    --body-bg: #f1f5f9;
    --card-bg: #ffffff;
    --sidebar-width: 275px;
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    
    --shadow-subtle: 0 4px 20px -2px rgba(0, 0, 0, 0.03), 0 2px 6px -1px rgba(0, 0, 0, 0.02);
    --shadow-card: 0 10px 30px -5px rgba(0, 0, 0, 0.05), 0 4px 10px -2px rgba(0, 0, 0, 0.02);
    --shadow-hover: 0 20px 40px -15px rgba(0, 0, 0, 0.1), 0 8px 16px -4px rgba(0, 0, 0, 0.04);
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--body-bg);
    color: #1e293b;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    letter-spacing: -0.01em;
}

/* Sidebar Styling */
#sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1040;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
}

#sidebar .sidebar-brand {
    padding: 1.35rem 1.5rem;
    background: rgba(15, 23, 42, 0.6);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

#sidebar .sidebar-brand-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    color: #ffffff;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.4);
}

#sidebar .nav-section-title {
    color: #475569;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 1.25rem 1.5rem 0.4rem 1.5rem;
}

#sidebar .nav-link {
    color: #94a3b8;
    padding: 0.75rem 1.15rem;
    margin: 0.15rem 0.85rem;
    font-weight: 600;
    font-size: 0.9rem;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 0.85rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

#sidebar .nav-link i {
    font-size: 1.15rem;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s ease;
}

#sidebar .nav-link:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.05);
    transform: translateX(3px);
}

#sidebar .nav-link.active {
    color: #ffffff;
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.2) 0%, rgba(59, 130, 246, 0.05) 100%);
    border-left: 3px solid #3b82f6;
    border-top-left-radius: 4px;
    border-bottom-left-radius: 4px;
}

#sidebar .nav-link.active i {
    color: #60a5fa !important;
}

/* Sidebar Overlay Backdrop for Mobile */
.sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(6px);
    z-index: 1030;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-backdrop.show {
    display: block;
    opacity: 1;
}

/* Main Layout Area */
#main-content {
    margin-left: var(--sidebar-width);
    padding: 1.75rem 2.25rem;
    min-height: 100vh;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Glassmorphism Top Navbar */
.top-navbar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 0.85rem 1.75rem;
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.04), 0 2px 6px -1px rgba(0, 0, 0, 0.02);
    margin-bottom: 1.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid rgba(226, 232, 240, 0.8);
    position: relative;
    z-index: 1020;
}

/* Header Buttons */
.nav-alert-btn {
    background-color: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
    font-weight: 700;
    font-size: 0.85rem;
    padding: 0.45rem 1rem;
    border-radius: 30px;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.nav-alert-btn:hover {
    background-color: #fee2e2;
    color: #b91c1c;
    border-color: #fca5a5;
    transform: translateY(-1px);
}

.nav-btn-sale {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    border: none;
    font-weight: 700;
    font-size: 0.85rem;
    padding: 0.45rem 1.15rem;
    border-radius: 30px;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    transition: all 0.2s ease;
    white-space: nowrap;
}

.nav-btn-sale:hover {
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}

/* User Profile Dropdown Pill */
.nav-user-pill {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    padding: 0.3rem 0.85rem 0.3rem 0.4rem;
    border-radius: 30px;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    color: #1e293b;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
    white-space: nowrap;
}

.nav-user-pill:hover, .nav-user-pill[aria-expanded="true"] {
    background-color: #f8fafc;
    border-color: #cbd5e1;
}

.nav-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #ffffff;
    font-weight: 800;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.nav-role-badge {
    background-color: #f1f5f9;
    color: #475569;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 0.25em 0.55em;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid #e2e8f0;
}

/* Header Dropdown Menu Styling */
.top-navbar .dropdown-menu {
    position: absolute !important;
    z-index: 1050 !important;
    border-radius: 14px !important;
    box-shadow: 0 14px 35px -5px rgba(0, 0, 0, 0.15), 0 6px 12px -2px rgba(0, 0, 0, 0.05) !important;
    border: 1px solid #e2e8f0 !important;
    padding: 0.5rem !important;
    min-width: 220px !important;
    margin-top: 0.6rem !important;
    background: #ffffff !important;
}

.top-navbar .dropdown-item {
    padding: 0.65rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.875rem;
    color: #334155;
    transition: all 0.15s ease;
}

.top-navbar .dropdown-item:hover {
    background-color: #f1f5f9;
    color: #0f172a;
}

/* KPI Cards (3D Glass Accent Feeling) */
.kpi-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 1.4rem 1.6rem;
    box-shadow: var(--shadow-card);
    border: 1px solid rgba(226, 232, 240, 0.8);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.kpi-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: #cbd5e1;
}

.kpi-icon-wrapper {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.45rem;
    color: #ffffff;
    flex-shrink: 0;
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}

.icon-bg-primary { background: var(--primary-gradient); }
.icon-bg-success { background: var(--success-gradient); }
.icon-bg-danger { background: var(--danger-gradient); }
.icon-bg-warning { background: var(--warning-gradient); }
.icon-bg-purple { background: var(--purple-gradient); }

/* Buttons & Action Items */
.btn-action-lg {
    padding: 0.75rem 1.4rem;
    font-size: 0.95rem;
    font-weight: 700;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    transition: all 0.25s ease;
    border: none;
    white-space: nowrap;
}

.btn-action-lg:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.btn-primary-gradient {
    background: var(--primary-gradient);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

.btn-success-gradient {
    background: var(--success-gradient);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
}

.btn-warning-gradient {
    background: var(--warning-gradient);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35);
}

/* Custom Cards & Tables */
.custom-table-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    border: 1px solid rgba(226, 232, 240, 0.8);
    overflow: hidden;
}

.table th {
    background-color: #f8fafc;
    color: #475569;
    font-weight: 800;
    font-size: 0.775rem;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    padding: 1.1rem 1.35rem;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
}

.table td {
    padding: 1.05rem 1.35rem;
    vertical-align: middle;
    font-size: 0.925rem;
    border-bottom: 1px solid #f1f5f9;
    white-space: nowrap; /* Prevent phone numbers, state, prices, dates & action buttons from wrapping */
}

/* Graceful text wrapping class for long customer/product names */
.table td.wrap-text, .table th.wrap-text {
    white-space: normal !important;
    min-width: 220px;
}

.table tbody tr {
    transition: background-color 0.15s ease;
}

.table tbody tr:hover {
    background-color: #f8fafc;
}

.btn-sm {
    white-space: nowrap !important;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

/* Custom Soft Status Badges with Pulsing Dot */
.badge-soft-success {
    background-color: var(--success-soft);
    color: #047857;
    font-weight: 700;
    font-size: 0.8rem;
    padding: 0.4em 0.85em;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
}

.badge-soft-danger {
    background-color: var(--danger-soft);
    color: #b91c1c;
    font-weight: 700;
    font-size: 0.8rem;
    padding: 0.4em 0.85em;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
}

.badge-soft-warning {
    background-color: var(--warning-soft);
    color: #b45309;
    font-weight: 700;
    font-size: 0.8rem;
    padding: 0.4em 0.85em;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
}

.badge-soft-info {
    background-color: rgba(6, 182, 212, 0.1);
    color: #0e7490;
    font-weight: 700;
    font-size: 0.8rem;
    padding: 0.4em 0.85em;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
}

.badge-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
}

.badge-dot-success { background-color: #10b981; box-shadow: 0 0 6px rgba(16, 185, 129, 0.6); }
.badge-dot-danger { background-color: #ef4444; box-shadow: 0 0 6px rgba(239, 68, 68, 0.6); }
.badge-dot-warning { background-color: #f59e0b; box-shadow: 0 0 6px rgba(245, 158, 11, 0.6); }

/* Autocomplete Suggestion Dropdown */
.autocomplete-suggestions {
    border: 1px solid #cbd5e1;
    max-height: 320px;
    overflow-y: auto;
    background: #ffffff;
    position: absolute;
    z-index: 9999;
    width: 100%;
    border-radius: var(--radius-md);
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.15);
}

.autocomplete-item {
    padding: 0.85rem 1.35rem;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    transition: background-color 0.15s ease;
}

.autocomplete-item:hover {
    background-color: #f0f7ff;
}

/* Responsive Media Queries */
@media (max-width: 991.98px) {
    #sidebar {
        transform: translateX(-100%);
    }

    #sidebar.show {
        transform: translateX(0);
    }

    #main-content {
        margin-left: 0;
        padding: 1.25rem 1rem;
    }

    .top-navbar {
        padding: 0.75rem 1.25rem;
        border-radius: var(--radius-md);
    }

    .btn-action-lg {
        width: 100%;
        justify-content: center;
    }

    .table th, .table td {
        padding: 0.85rem 1rem;
        font-size: 0.85rem;
    }
}

@media (max-width: 575.98px) {
    #main-content {
        padding: 0.75rem 0.5rem;
    }

    .kpi-card {
        padding: 1.15rem;
    }

    .kpi-icon-wrapper {
        width: 48px;
        height: 48px;
        font-size: 1.25rem;
    }
}

/* Floating Low Stock Recurring Toast Notification */
.low-stock-toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999;
    max-width: 380px;
    width: calc(100% - 48px);
    pointer-events: none;
}

.low-stock-toast {
    pointer-events: auto;
    background: #ffffff;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 40px -10px rgba(239, 68, 68, 0.25), 0 10px 20px -5px rgba(0, 0, 0, 0.1);
    border: 1px solid #fecaca;
    border-left: 5px solid #ef4444;
    overflow: hidden;
    transform: translateY(120%);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
}

.low-stock-toast.show {
    transform: translateY(0);
    opacity: 1;
}

@keyframes pulseGlow {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.toast-pulse-icon {
    animation: pulseGlow 2s infinite;
}

/* Quantity Stepper & Responsive Table Input Controls */
.qty-stepper {
    width: 130px !important;
    min-width: 125px !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #cbd5e1;
}

.qty-stepper .btn {
    background-color: #f8fafc;
    border: none;
    color: #1e293b;
    font-weight: 800;
    transition: all 0.15s ease-in-out;
    padding: 0.4rem 0.65rem !important;
}

.qty-stepper .btn:hover {
    background-color: #2563eb;
    color: #ffffff;
}

.qty-stepper .btn:active {
    transform: scale(0.92);
}

.qty-input, input.qty-input[type="number"] {
    width: 65px !important;
    min-width: 60px !important;
    height: 38px;
    text-align: center;
    font-weight: 800 !important;
    font-size: 1.05rem !important;
    color: #0f172a !important;
    border: none !important;
    border-left: 1px solid #e2e8f0 !important;
    border-right: 1px solid #e2e8f0 !important;
    background-color: #ffffff !important;
    padding: 0.25rem 0.25rem;
}

.qty-input:focus {
    background-color: #eff6ff !important;
    box-shadow: none !important;
    outline: none;
}

/* Hide default browser WebKit number spinners for a sleek SaaS UI */
input.qty-input::-webkit-outer-spin-button,
input.qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input.qty-input[type=number] {
    -moz-appearance: textfield;
}

