/* 1. Hide unwanted elements during PDF/Print generation */
@media print {
    .no-print, .sidebar, .navbar, .btn, .page-header {
        display: none !important;
    }
    .container-fluid, .main-content {
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
    }
    .card {
        border: none !important;
        box-shadow: none !important;
    }
}

/* 2. Style for the PDF Container to look professional */
.pdf-container {
    padding: 40px !important;
    background-color: white !important;
    color: black !important;
}

/* 3. Ensure tables look crisp in PDFs */
.pdf-container table {
    border-collapse: collapse !important;
    width: 100% !important;
}
.pdf-container th, .pdf-container td {
    border: 1px solid #dee2e6 !important;
    padding: 8px !important;
}

.btn-light {
    background-color: #36898f;
    color: #f4f7f6;
    border: 1px solid #ddd;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.btn-light:hover {
    background-color: #89a1a5;
    border-color: #dae0e5;
    color: #000;
}
.btn-import{
    background:  #f39c12; 
    color: white; 
    border-radius:4px; 
    text-decoration:none; 
    padding:8px 15px;
}
.btn-import:hover{
    background:  #cd9d50; 
    transform: translateY(-1px);
    color: white; 
    border-radius:4px; 
    text-decoration:none; 
    padding:8px 15px;
}

.btn-group {
    position: relative;
    display: inline-flex;
    vertical-align: middle;
}

.btn-group > .btn {
    position: relative;
    flex: 1 1 auto;
}
.btn-icon { background: none; border: none; font-size: 16px; cursor: pointer; padding: 5px 10px; color: #555; }
.btn-icon:hover { background: #eee; border-radius: 4px; }
.pointer-events-none { pointer-events: none; }
.btn-outline-primary {
    color: #0d6efd !important;
    border: 1px solid #0d6efd !important;
    background-color: transparent !important;
}
.btn-outline-primary:hover {
    color: #ffffff !important;
    background-color: #0d6efd !important;
}

/* Info Outline Button (BOM Button) */
.btn-outline-info {
    color: #0dcaf0 !important;
    border: 1px solid #0dcaf0 !important;
    background-color: transparent !important;
}
.btn-outline-info:hover {
    color: #ffffff !important;
    background-color: #0dcaf0 !important;
}

.drawing-container img { 
    max-width: 100%;
    max-height: 100%; 
    object-fit: contain; 
    image-rendering: high-quality; 
}
/* Secondary Outline Button (Disabled No BOM) */
.btn-outline-secondary {
    color: #6c757d !important;
    border: 1px solid #6c757d !important;
    background-color: transparent !important;
}
.btn-outline-secondary.disabled, 
.btn-outline-secondary:disabled {
    color: #6c757d !important;
    background-color: #f8f9fa !important;
    opacity: 0.65;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-export2csv{
    background: #27ae60; 
    color:white; 
    border-radius:4px; 
    text-decoration:none; 
    padding:8px 15px;
}
.btn-export2csv:hover{
    background: #77c196;
    transform: translateY(-1px); 
    color:white; 
    border-radius:4px; 
    text-decoration:none; 
    padding:8px 15px;
}
.global-product-select-wrapper .ts-control {
    border: 1px solid #ced4da !important; /* Visible light gray */
    border-radius: 4px !important;
    background-color: #fff !important;
    min-height: 38px !important;
    display: flex !important;
    align-items: center !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* Focus state (when user clicks) */
.global-product-select-wrapper.focus .ts-control {
    border-color: #86b7fe !important;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25) !important;
}

/* Ensure the internal input doesn't mess up the height */
.global-product-select-wrapper .ts-control > input {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin-left: 5px !important;
}

.btn-branchSwitch {
    background-color: #ffffff;
    color: #36898f;
    border: 1px solid #d21d1d;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.btn-branchSwitch:hover {
    background-color: #d2dfe1;
    border-color: #981717;
    color: #000;
}

/* Advanced Filter Section Styling */
.adv-filter {
    display: none; /* Hidden by default */
    gap: 15px;
    margin-top: 15px;
    padding: 15px;
    border-top: 1px dashed #ccc;
    background: #fff;
    border-radius: 4px;
    flex-wrap: wrap;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Labels inside the filter */
.adv-filter label {
    display: block;
    margin-bottom: 5px;
    color: #965555;
}
/* --- BASE STYLES --- */
html, body { 
    margin: 0; padding: 0;
    width: 100%; height: 100%;
    background: #f4f6f9; 
    overflow: hidden; 
}

body { 
    font-family: 'Segoe UI', sans-serif; 
    display: flex; height: 100vh;
    height: 100dvh; 
    font-size: 13.5px; /* DENSITY: Slightly smaller text makes everything look "zoomed out" */
    -webkit-font-smoothing: antialiased;
}

/* Makes the placeholder text in the search box lighter */
.ts-wrapper .ts-control input::placeholder {
    color: #a0a0a0 !important;
    font-weight: 400;
}

/* Styles the placeholder option in the dropdown list */
.ts-dropdown .option[data-value=""], 
.ts-dropdown .option[data-value="unknown"] {
    color: #999 !important;
    font-style: italic;
    font-size: 0.9em;
}

/* Optional: Make the text inside the select box lighter when nothing is chosen */
.ts-wrapper.placeholder .ts-control {
    color: #a0a0a0 !important;
    font-weight: 300;
}


/* =========================================
   GLOBAL POPUP STYLE (Triggered by body class)
   ========================================= */
body.is-popup .sidebar, 
body.is-popup .brand, 
body.is-popup .topbar { 
    display: none !important; 
}

body.is-popup .main { 
    margin: 0 !important; 
    width: 100% !important; 
    padding: 10px !important; 
}

body.is-popup .page-header { 
    display: none !important; 
}

body.is-popup .card { 
    box-shadow: none !important; 
    border: none !important; 
}

/* --- SIDEBAR CONTAINER --- */
.sidebar { 
    width: 250px; /* Standardized width */
    background: #2c3e50; color: #fff; 
    flex-shrink: 0; 
    position: relative; 
    min-height: 0;
    height: 100vh;
    height: 100dvh; 
    z-index: 1000;
    display:flex;
    box-sizing: border-box;
    flex-direction: column;
    padding-bottom: 0;
    overflow-y: auto;
}


/* Enable transition ONLY when app is ready */
.sidebar.app-ready {
    transition: width 0.3s ease; 
}

/* BRAND HEADER */
.brand { 
    height: 60px; 
    min-height: 60px; 
    background: #1a252f; 
    border-bottom: 1px solid #3e5060; 
    display: flex; 
    align-items: center; 
    justify-content: space-between;
    padding: 0 15px;
    box-sizing: border-box;
    flex-shrink: 0; 
}

.view-mode-popup .hide-on-popup {
    display: none !important;
}
.brand-text { font-size: 18px; font-weight: bold; white-space: nowrap; opacity: 1; transition: opacity 0.2s; }

.collapse-btn { 
    cursor: pointer; color: #ecf0f1; font-size: 20px; width: 35px; height: 35px; 
    display: flex; align-items: center; justify-content: center; border-radius: 4px; transition: background 0.2s;
}
.collapse-btn:hover { background: rgba(255,255,255,0.1); }

/* MENU SCROLL AREA */
.menu { 
    flex: 1; 
    min-height: 0;
    overflow-y: auto; 
    overflow-x: hidden; 
    padding-bottom: 40px; 
    scrollbar-width: thin;
    scrollbar-color: #3e5060 #2c3e50;
}
.menu::-webkit-scrollbar { width: 6px; }
.menu::-webkit-scrollbar-track { background: #2c3e50; }
.menu::-webkit-scrollbar-thumb { background-color: #3e5060; border-radius: 10px; }

.nav-group { position: relative; } 

.menu-item { 
    display: flex; justify-content: space-between; align-items: center; 
    padding: 12px 20px; color: #b8c7ce; cursor: pointer; 
    border-bottom: 1px solid #34495e; transition: 0.2s; 
    text-decoration: none; white-space: nowrap; position: relative; height: 45px; box-sizing: border-box;
    font-size: 14px;
}
.menu-item:hover { background: #1a252f; color: #fff; }

.menu-left { display: flex; align-items: center; gap: 12px; }
.menu-left i { width: 24px; text-align: center; font-size: 16px; flex-shrink: 0; }
.menu-text { transition: opacity 0.2s; }

/* --- SUBMENU EXPANDED (Default) --- */
.submenu-container { display: none; background: #233240; }
.submenu-container.open { display: block; }
.submenu-link { 
display: block; 
padding: 8px 20px 8px 54px; 
color: #a4b0be; 
text-decoration: none; 
font-size: 13.5px; 
border-left: 3px solid transparent; 
white-space: nowrap; 
}
.submenu-link:hover { color: white; background: rgba(255,255,255,0.05); }

/* =========================================
    COLLAPSED STATE STYLES 
    ========================================= */
.sidebar.collapsed { width: 65px; }
.sidebar.collapsed .brand-text { display: none; opacity: 0; }
.sidebar.collapsed .menu-text { display: none; opacity: 0; }
.sidebar.collapsed .arrow { display: none; }

.sidebar.collapsed .brand { justify-content: center; padding: 0; }
.sidebar.collapsed .collapse-btn { display: flex; margin: 0; }

.sidebar.collapsed .menu-item { justify-content: center; padding: 0; }
.sidebar.collapsed .menu-left { gap: 0; }
.sidebar.collapsed .menu-left i { font-size: 18px; margin: 0; }

/* FLOATING SUBMENU (Fixed Position) */
.sidebar.collapsed .submenu-container {
    display: none; 
    position: fixed; 
    left: 65px;
    width: 220px;
    background: #2c3e50;
    border-radius: 0 4px 4px 0;
    box-shadow: 5px 5px 15px rgba(0,0,0,0.3);
    z-index: 10001;
    border: 1px solid #34495e;
}
.sidebar.collapsed .submenu-container.open { display: block; }

.sidebar.collapsed .submenu-link { padding-left: 20px; }
.sidebar.collapsed .submenu-container::before {
    content: attr(data-label); display: block; padding: 12px 20px;
    background: #1a252f; color: #fff; font-weight: bold; border-bottom: 1px solid #444;
}
/* SMART UPWARD OPENING */
.sidebar.collapsed .submenu-container.open-up { top: auto; bottom: 0; }

/* HOVER TOOLTIP */
.sidebar.collapsed .menu-item:hover::after {
    content: attr(data-title);
    position: fixed; 
    left: 65px; 
    background: #1a252f; color: #fff;
    padding: 10px 15px; font-size: 13px; font-weight: bold; white-space: nowrap;
    z-index: 10002; pointer-events: none; box-shadow: 3px 0 5px rgba(0,0,0,0.1); border-radius: 0 4px 4px 0;
}
.sidebar.collapsed .nav-group.active .menu-item::after { display: none; }

.arrow {
    transition: transform 0.4s ease; /* This makes the movement smooth */
}

/* The class that gets added when the menu is open */
.arrow.rotate {
    transform: rotate(180deg); /* This flips the down-arrow to an up-arrow */
}

/* --- MAIN CONTENT --- */
* {
    box-sizing: border-box;
}

.main {  
    flex-grow: 1;
    flex: 1;  
    display: flex;  
    flex-direction: column;  
    height: 100vh;
    height: 100dvh; /* Safely tracks tablet viewports */
    overflow-y: auto;  
    overflow-x: hidden;  
    min-height: 100dvh;
    padding-bottom: 0;
    scrollbar-width: thin;
    scrollbar-color: #3e5060 #2c3e50;
    box-sizing: border-box; 
}


.topbar { 
    background: #fff; 
    height: 55px; /* Slightly tighter topbar */
    display: flex; align-items: center; justify-content: space-between; 
    padding: 0 20px; border-bottom: 1px solid #ddd; 
    flex-shrink: 0; z-index: 2000; /* Stays on top */
}

.content { 
    padding: 15px 20px; /* DENSITY: Reduced padding for a "spacious" look */
    overflow-y: auto; 
    flex-grow: 1; 
}


.card { 
    background: #fff; padding: 15px; border-radius: 4px; 
    box-shadow: 0 1px 3px rgba(0,0,0,0.1); 
    margin-bottom: 15px; 
}

.page-header h2 {
    margin: 0;
    font-size: 22px; /* Slightly smaller to save space */
}

.text-danger {color: #dc3545; border-top: 1px solid #dee2e6; margin-top: 4px; padding-top: 4px; display: block;}

.btn { padding: 8px 16px; border-radius: 4px; border: none; cursor: pointer; color: white; text-decoration: none; display: inline-block; font-weight: 600; font-size: 13px; white-space: nowrap; }
.btn-primary { background: #00b894; }
.btn-primary:hover { background: #039779; transform: translateY(-1px);} 
/* --- FIX FOR BUTTONS & DROPDOWNS --- */
/* Base style for all blue buttons */
.btn-blue { 
    background: #1a0bf3 !important; 
    color: #ffffff !important; 
    padding: 8px 16px !important; 
    font-size: 13px !important;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    font-weight: 600;
    text-shadow: 0 1px 1px rgba(0,0,0,0.2); 
    box-shadow: 0 2px 4px rgba(26, 11, 243, 0.2);
    transition: all 0.3s ease;
    white-space: nowrap; /* Prevents button text from wrapping */
}

/* Primary & Action Colors */
.text-primary   { color: #000000 !important; } /* A crisp, modern blue */
.text-secondary { color: #64748b !important; } /* A slate blue-gray */
.text-dark      { color: #0f172a !important; } /* Near black, great for deep contrast */
.text-muted     { color: #94a3b8 !important; } /* Soft gray, perfect for timestamps/subtext */
.text-white     { color: #ffffff !important; }
.text-grey      { color: #acacb8 !important; }
.text-tertiary  { color: #6d045a !important; }

/* Status Colors (Semantic) */
.text-success   { color: #10b981 !important; } /* Emerald green for approvals/money in */
.text-danger-only    { color: #ef4444 !important; } /* Rose red for rejections/errors/money out */
.text-warning   { color: #f59e0b !important; } /* Amber orange for pending/alerts */
.text-info      { color: #1a8fe8 !important; } /* Sky blue for neutral information */


.btn-blue:hover {
    background: #150ac2 !important;
    box-shadow: 0 4px 8px rgba(26, 11, 243, 0.4);
    transform: translateY(-1px);
}
.btn-blue.btn-sm { 
    background: #1a0bf3 !important; color: #fff !important;
    padding: 6px 12px !important; font-size: 12px !important;
    border-radius: 4px; border: none;
}
.btn-sm.btn-info {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    border-radius: 0.2rem;
    color: #fff !important; /* Forces white text */
    background-color: #0dcaf0;
    border-color: #0dcaf0;
}

.btn-blue.btn-sm:hover {
    background: #150ac2 !important; /* Slightly lighter on hover */
    box-shadow: 0 4px 8px rgba(26, 11, 243, 0.4); /* Stronger glow */
    transform: translateY(-1px);
}
.btn-permissions { background: #0b1c8b; justify-content: center; }
.btn-permissions:hover { background: #0a1662; transform: translateY(-1px); }
.btn-danger { background: #d63031; } 
.btn-danger:hover { background: #d63031; transform: translateY(-1px); } 
.btn-success{background:#28a745; border:none;}
.btn-success:hover{transform:translateY(-1px)}
.btn-secondary {background-color: #6c757d;}
.btn-secondary:hover {background-color: #6c757d; transform:translateY(-1px)}
.btn-pdf { background: #0a576e; }
.download-btn { background-color: #4CAF50;} .download-btn:hover {background-color: #487b4b;}
.btn-warning {background-color: #f1c40f;border-color: #f1c40f;color: #2d3436;font-weight: bold;}
.btn-warning:hover {background-color: #f39c12;}
.dropdown-menu {
    margin-top: -5px;
    /* This ensures that if a menu is near the bottom, it doesn't cause a scrollbar */
    transform-origin: top right;
}
.dropdown-menu { 
        display: none; position: absolute; right: 0; background: #fff;
        top: 100%; /* CRITICAL: Forces it exactly below the button */
        margin-top: 5px; /* Tiny gap so it doesn't touch the button */ 
        min-width: 220px; box-shadow: 0 10px 25px rgba(0,0,0,0.1); 
        z-index: 1000; border-radius: 8px; border: 1px solid #eee; padding: 8px 0; 
}
.dropdown-menu.show { display: block; }
.dropdown-menu a { 
    color: #444; padding: 10px 18px; text-decoration: none; 
    display: flex; align-items: center; font-size: 13px; transition: background 0.2s;
    cursor: pointer;
    }
.icon-permissions {
        color: #6c5ce7; /* A professional purple shade */
        margin-right: 8px; /* Ensure there is space between icon and text */
    }
.dropdown-menu a:hover { background: #f0f7ff; color: #007bff; }
.dropdown-menu i { width: 25px; font-size: 14px; }    
.dropdown-menu:hover {transform: translateY(-1px);}   
.dropdown-menu .fa-eye { color: #00cec9; }
.dropdown-menu .fa-edit { color: #f39c12; }
.fa-edit { color: #f39c12; }
.dropdown-menu .fa-file-pdf { color: #e17055; }
.dropdown-menu .fa-trash { color: #d63031; }
.fa-trash { color: #d63031; }
.bulk-badge { background: #ffeaa7; color: #d35400; font-size: 10px; padding: 2px 6px; border-radius: 10px; font-weight: bold; margin-left: 5px; text-transform: uppercase; border: 1px solid #fab1a0; }
/* Add margin to the icon to separate it from the text */
.download-btn i {
    margin-right: 8px;
}
/* FIX: Removed broken CSS syntax here */
.badge { padding: 4px 8px; border-radius: 4px; font-size: 11px; font-weight: bold; white-space: nowrap; }
.badge-success { background: #e6fffa; color: #00b894; } .badge-warning { background: #fff3cd; color: #856404; } .badge-danger { background: #ffe6e6; color: #d63031; } .badge-blue { background: #0984e3; color: #ffffff; } .badge-secondary { background: #e2e6ea; color: #495057; }
.badge-tertiary { background: #4f134d; color: #ffffff; } .badge-quaternary { background: #631424; color: #ffffff; } .badge-quinary { background: #108937; color: #ffffff; }

.badge-round { background-color: #0d6efd; color: white; padding: 4px 10px; border-radius: 50px; font-size: 12px; font-weight: bold; }
.badge-new {display: inline-block; padding: 4px 8px; font-size: 11px; font-weight: bold; border-radius: 4px; background-color: #f8f9fa; color: #212529; border: 1px solid #dee2e6; }
.badge-info {  background: #fff3cd; color: #856404; display:block; padding:10px; margin-bottom:15px; text-align:left; font-size:13px;}
.badge-highlight-green {     
    display: inline-flex;
    align-items: center;
    padding: 0.25em 0.75em;
    border-radius: 0.4em;
    background-color: rgba(144, 238, 144, 0.2); 
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(144, 238, 144, 0.3);
    color: #1b5e20;
    font-family: inherit;
    font-size: 0.8em; 
    font-weight: 600;
    line-height: 1; 
}

input, select, textarea { padding: 8px; border: 1px solid #dfe6e9; border-radius: 4px; width: 100%; box-sizing: border-box; }

/* FIX: Added table-responsive for mobile scrolling */
.table-responsive { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { 
width: 100%; 
border-collapse: collapse; 
margin-top: 10px; 
font-size: 14px; 
}

dialog#universalNativeDialog {
    padding: 0;
    border: none;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 500px;
    background: #fff;
}

dialog#universalNativeDialog::backdrop {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.native-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
}

.native-modal-header h5 {
    margin: 0;
    font-size: 18px;
    color: #0f172a;
}

.native-modal-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #64748b;
}

.native-modal-body {
    padding: 20px;
}

.native-modal-footer {
    padding: 16px 20px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    border-radius: 0 0 8px 8px;
}
.my-icon-success {
    color: #198754 !important; /* Standard Bootstrap Green */
}
.my-icon-danger {
    color: #dc3545 !important; /* Standard Bootstrap Red */
}
.my-icon-warning {
    color: #f0b410 !important; /* Custom Purple for special actions */
}
.my-icon-purple {
    color: #6f42c1 !important; /* Custom Purple for special actions */
}
.my-icon-blue {
    color: #070da9 !important; /* Custom Purple for special actions */
}
.my-icon-info {
    color: #b62150 !important; /* Custom Purple for special actions */
}
.my-icon-settings {
    color: #791e2d !important; /* Custom Purple for special actions */
}

/* Error Input field Highlighter*/
.is-invalid {
    border-color: #ef4444 !important; 
    background-color: #fef2f2 !important; 
}

.required-field::after {
    content: " *";
    color: #dc2626; /* Pure CSS Red */
    font-weight: bold;
}

/* Optional: If they click back into the red field, give it a red focus ring instead of the default blue */
.is-invalid:focus {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 0.25rem rgba(239, 68, 68, 0.25) !important;
    outline: 0;
}

.my-text-approve { color : #198754 !important;}
.my-text-approve:hover { color : #2d879c !important; }
th { text-align: left; background: #f8f9fa; padding: 12px; border-bottom: 2px solid #ddd; }
td { padding: 12px; border-bottom: 1px solid #eee; vertical-align: middle;}
.dropdown-container { position: relative; display: inline-block; }
.dropdown { position: relative; display: inline-block; }
.dropbtn { background: none; border: none; cursor: pointer; font-size: 18px; color: #0d0f10fe; padding: 5px 10px; }
.dropbtn:hover { background: none; color: #f50808;}
.dropdown-content { display: none; position: absolute; right: 0; background-color: #fff; min-width: 160px; box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); z-index: 1000; border-radius: 4px; border: 1px solid #eee; }
.dropdown-content.show { display: block; animation: fadeIn 0.2s; }
.dropdown-content a { color: #2d3436; padding: 10px 15px; text-decoration: none; display: flex; align-items: center; gap: 10px; font-size: 13px; width: 100%; box-sizing: border-box; }
.dropdown-content a:hover { background-color: #f1f2f6; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }

.sticky-header {
    position: sticky;
    /* top: 0; ensures it hits the top of the .content scroll area */
    top: 0; 
    /* margin-top: -15px; pulls it up to cover the .content padding gaps */
    margin-top: -15px; 
    z-index: 998; 
    background: #f4f7f6; /* Match your body background */
    padding-top: 5px;
    padding-bottom: 10px;
    /* Subtle shadow to create depth when scrolling */
    box-shadow: 0 4px 6px -4px rgba(0,0,0,0.1); 
}
.sticky-header .card {
    padding: 12px 18px !important;
    background: #ffffff !important;
    border: 1px solid #dcdde1 !important;
    margin-bottom: 10px;
}
.form-control, input[type="text"], input[type="date"], select {
    height: 38px; /* Force a standard height */
    font-size: 14px !important; /* Ensure text is readable */
    padding: 8px 12px;
}
.form-control:focus{
    border-color: #38f47a !important;
    box-shadow: 0 0 10px rgba(27, 121, 63, 0.5)!important;
    outline: none!important;
    background-color: #fff9f6!important;
}
.sticky-header label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
    display: block;
    color: #7f8c8d;
}
.page-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    background: #f4f7f6 !important; 
    margin: 0 !important; 
    padding: 4px 0 !important; 
}

.pagination-container {
    margin-top: 25px;
    padding: 15px 0 30px 0; /* Extra bottom padding for the 105% height logic */
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    border-top: 1px solid #eee;
}
.pagination-info {
    font-size: 13px;
    font-weight: 600;
    color: #2c3e50;
    margin: 0 15px;
}
.user-menu-container { position: relative; display: inline-block; }
.user-avatar { width: 35px; height: 35px; background: #2c3e50; color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: bold; cursor: pointer; transition:0.2s; } .user-avatar:hover { background: #34495e; }
.user-dropdown { 
    display: none; 
    position: absolute; 
    right: 0; 
    top: 50px; /* Adjusted to sit nicely below avatar */
    background: #fff; 
    min-width: 200px; 
    box-shadow: 0 10px 25px rgba(0,0,0,0.2); /* Stronger shadow for visibility */
    border-radius: 6px; 
    z-index: 3001; /* Extremely high to stay on top of everything */
    border: 1px solid #eee; 
    transform-origin: top right;
    backface-visibility: hidden;
    overflow-y: auto; /* Allow scroll if the menu items are many */
    max-height: 80vh; /* Prevents the menu from being taller than the screen */
}
.user-dropdown.show { display: block; animation: fadeIn 0.2s; }
.user-dropdown a { display: block; padding: 12px 20px; color: #333; text-decoration: none; font-size: 13px; border-bottom: 1px solid #f4f6f9; transition: 0.2s; display:flex; align-items:center; gap:10px; } 
.user-dropdown a:hover { background: #f8f9fa; color: #00b894; }

.modal { display: none; position: fixed; z-index: 4000; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.5); }
.modal-content { background-color: #fff; margin: 10% auto; padding: 25px; border-radius: 8px; width: 400px; box-shadow: 0 4px 20px rgba(0,0,0,0.2); }
.close { float: right; font-size: 24px; cursor: pointer; color: #aaa; } .close:hover { color: #000; }

.mobile-toggle { display: none; font-size: 20px; cursor: pointer; margin-right: 15px; }

/* --- LOADING OVERLAY STYLES --- */
#loading-overlay {
    display: none; /* Hidden by default */
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(255, 255, 255, 0.8);
    z-index: 10000;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-family: 'Segoe UI', sans-serif;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #00b894; /* Match your btn-primary color */
    border-radius: 50%;
    animation: spin 2s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==========================================================================
   TABLET & MOBILE HARDWARE SAFE ZONE PATCH (APPENDED TO BOTTOM)
   ========================================================================== */
@media (max-width: 1024px) {
    .sidebar {
        padding-bottom: env(safe-area-inset-bottom, 16px) !important;
    }
    .main {
        padding-bottom: calc(65px + env(safe-area-inset-bottom, 0px)) !important;
    }
}

@media screen and (max-width: 768px) {
    .sidebar { 
        position: absolute; 
        left: -260px; 
        height: 100vh; 
        height: 100dvh; 
        z-index: 2000; 
        box-shadow: 2px 0 5px rgba(0,0,0,0.2); 
        transition: transform 0.3s ease; 
    }
    .sidebar.active { transform: translateX(260px); }
    .mobile-toggle { display: block; }
    .page-header { flex-direction: column; align-items: flex-start; }
    div[style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
    .card { padding: 15px; } 
    .collapse-btn { display: none; } 

    .responsive-job-table, 
    .responsive-job-table tbody, 
    .responsive-job-table tr, 
    .responsive-job-table td { 
        display: block !important; 
        width: 100% !important;
        box-sizing: border-box;
    }
    
    /* 2. Completely hide the desktop table header row */
    .responsive-job-table thead { 
        display: none !important; 
    }
    
    /* 3. Convert each row into a clean, floating visual card container */
    .responsive-job-table tr {
        background: #ffffff !important;
        border: 1px solid #e2e8f0 !important;
        border-radius: 8px !important;
        margin-bottom: 16px !important;
        padding: 12px !important;
        box-shadow: 0 2px 4px rgba(0,0,0,0.02) !important;
    }
    
    /* Highlight jobs assigned specifically to the user with a distinct border flag */
    .responsive-job-table tr[style*="background:#e8f8f5"] {
        border-left: 5px solid #2ecc71 !important;
        background: #f4fbf9 !important;
    }

    /* 4. Format each cell to stack cleanly inside the card layout */
    .responsive-job-table td {
        text-align: left !important;
        padding: 8px 4px !important;
        border: none !important;
        border-bottom: 1px dashed #f1f5f9 !important;
        position: relative;
    }
    
    /* Remove the trailing dashed border line from the final cell block */
    .responsive-job-table td:last-child {
        border-bottom: none !important;
        text-align: center !important; /* Center the final primary action button row */
        padding-top: 12px !important;
    }

    /* 5. Handle the Bulk Selection Checkbox positioning area */
    .responsive-job-table td:first-child {
        border-bottom: 1px solid #e2e8f0 !important;
        padding: 12px 4px !important;
        display: flex !important;
        
        /* 🚀 THE CENTERING FIX: Forces the checkbox to stay perfectly centered inside the card row */
        justify-content: center !important; 
        align-items: center !important;
        
        width: 100% !important;
        box-sizing: border-box !important;
        background: #f8f9fa !important; /* Optional: Adds a subtle background header bar to the top of the card */
        border-radius: 6px 6px 0 0 !important;
    }
    
    /* Generate an inline mobile textual tag next to the standalone selection box */
    .responsive-job-table td:first-child::after {
        content: "Select this job for Bulk Operations" !important;
        font-size: 12px !important;
        font-weight: 600 !important;
        color: #64748b !important;
        display: inline-block !important;
        white-space: normal !important; /* 🚀 FIX 2: Overrides any inherited nowrap property so lines break clean */
        word-break: break-word !important; /* 🚀 FIX 3: Forces long string segments to wrap nicely within constraints */
        max-width: calc(100% - 30px) !important;
    }

    .responsive-job-table td:first-child::after {
        /* 🚀 THE TEXT REMOVAL: Completely remove this text snippet. 
        It clutters smaller screens and causes layout shifts. The presence of the box itself is clear enough! */
        content: none !important; 
    }

    /* 6. Enforce dynamic sizing rules for inner element inputs & badges */
    .responsive-job-table td min-width,
    .responsive-job-table td max-width {
        max-width: 100% !important;
        min-width: 100% !important;
    }

    .realtime-clock {
        display: inline-block !important;
        margin-top: 5px;
    }
    
    /* Make the bulk action utility bar layout vertical for responsive button targets */
    #bulkActionBarWrapper {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 12px !important;
    }
    
    #bulkActionBarWrapper div {
        width: 100% !important;
    }

}

