/* --- Global Reset & Premium Native Variables --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    margin: 0 !important;
    padding: 0 !important;
    width: 100%;
    overflow-x: hidden;
}

:root {
    --app-bg: #f8fafc;
    --app-card-bg: rgba(255, 255, 255, 0.85);
    --app-blur: blur(12px);
    --app-shadow: 0 4px 20px -5px rgba(0, 0, 0, 0.08);
    --app-accent: #206bc4;
}


/* Global Mobile Responsiveness Enhancements */

/* DataTable Mobile Adjustments */
.dataTables_wrapper .dt-buttons {
    margin-bottom: 1rem;
}

@media (max-width: 767.98px) {

    /* Stack search and buttons on mobile */
    .dataTables_wrapper .d-flex {
        flex-direction: column !important;
        align-items: stretch !important;
    }

    .dataTables_filter {
        margin-top: 1rem;
        text-align: left !important;
    }

    .dataTables_filter input {
        width: 100% !important;
        margin-left: 0 !important;
    }

    .dt-buttons {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }

    .dt-buttons .btn {
        flex: 1;
        margin-right: 0 !important;
        border-radius: 10px;
    }
}

/* Tabler Card Adjustments for Small Screens */
@media (max-width: 575.98px) {
    .card-body {
        padding: 0.75rem;
    }

    .page-header {
        margin-bottom: 1.5rem;
    }

    .page-title {
        font-size: 1.5rem;
        font-weight: 800;
    }
}

/* Responsive Table child row styling */
table.dataTable.dtr-inline.collapsed>tbody>tr>td.dtr-control:before {
    background-color: #206bc4;
    border-radius: 5px;
}

/* --- Premium Custom Scrollbar --- */
/* For Webkit Browsers (Chrome, Safari, Edge) */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
    border: 2px solid transparent;
    /* Creates a gap effect */
    background-clip: content-box;
    transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: #2b67af;
    /* Primary Brand Blue on hover */
    border: 1px solid transparent;
}

/* For Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

/* --- Premium Loader & Overlay System --- */
.app-loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    transition: all 0.3s ease-in-out;
}

/* Component Level Loader */
.component-loader {
    position: absolute !important;
    border-radius: inherit;
}

.loader-content {
    text-align: center;
    animation: loader-fade-in 0.5s ease-out;
}

.loader-logo-container {
    position: relative;
    width: 100px;
    height: 100px;
    margin: 0 auto 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loader-logo {
    width: 60px;
    height: auto;
    z-index: 2;
    filter: drop-shadow(0 0 10px rgba(43, 103, 175, 0.2));
    animation: loader-pulse 2s ease-in-out infinite;
}

.loader-spinner {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 3px solid transparent;
    border-top-color: #2b67af;
    border-right-color: #2b67af;
    border-radius: 50%;
    animation: loader-spin 1s linear infinite;
}

.loader-spinner::before {
    content: '';
    position: absolute;
    inset: 5px;
    border: 3px solid transparent;
    border-top-color: #64748b;
    border-radius: 50%;
    opacity: 0.5;
    animation: loader-spin 2s linear infinite;
}

.loader-message {
    color: #1e293b;
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: 0.025em;
    margin-top: 0.5rem;
    min-height: 1.5rem;
}

/* Animations */
@keyframes loader-spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes loader-pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.9;
    }

    50% {
        transform: scale(1.1);
        opacity: 1;
    }
}

@keyframes loader-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Dark Mode Support (if needed) */
[data-bs-theme='dark'] .app-loader-overlay {
    background: rgba(15, 23, 42, 0.8);
}

[data-bs-theme='dark'] .loader-message {
    color: #f1f5f9;
}

/* --- Premium Responsive Modal (DataTables) --- */
.dtr-bs-modal .modal-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.dtr-bs-modal .modal-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 1.5rem;
}

.dtr-bs-modal .modal-title {
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.025em;
}

.dtr-bs-modal .modal-body {
    padding: 0;
}

.dtr-bs-modal table.table {
    margin: 0;
}

.dtr-bs-modal table.table tr {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.dtr-bs-modal table.table td {
    padding: 1rem 1.5rem;
    vertical-align: middle;
}

.dtr-bs-modal table.table td:first-child {
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    width: 40%;
}

/* --- File Preview System --- */
#toolImagePreview, #proofFilePreview {
    gap: 10px;
}

.file-preview-wrapper {
    position: relative;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
    overflow: visible;
}

.file-delete-btn {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.file-delete-btn:hover {
    transform: scale(1.1);
    background-color: #d63939 !important;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* --- Search Highlight System --- */
.search-highlight {
    background-color: #fff3bf; /* Tabler yellow-100 */
    color: #000;
    padding: 0 2px;
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    font-weight: 600;
    transition: all 0.2s ease;
    animation: highlightPulse 1.5s infinite alternate;
}

@keyframes highlightPulse {
    from { background-color: #fff3bf; }
    to { background-color: #ffe066; }
}

/* --- Badge Color Contrast Fixes --- */
.badge {
    font-weight: 600;
    text-shadow: none;
}

/* Primary badges - ensure text is visible */
.bg-primary {
    background-color: #206bc4 !important;
    color: #ffffff !important;
}

.bg-primary-subtle {
    background-color: rgba(32, 107, 196, 0.1) !important;
    color: #206bc4 !important;
    border: 1px solid rgba(32, 107, 196, 0.2);
}

.text-primary {
    color: #206bc4 !important;
}

/* Secondary badges - ensure text is visible */
.bg-secondary {
    background-color: #64748b !important;
    color: #ffffff !important;
}

.bg-secondary-subtle {
    background-color: rgba(100, 116, 139, 0.1) !important;
    color: #475569 !important;
    border: 1px solid rgba(100, 116, 139, 0.2);
}

.text-secondary {
    color: #475569 !important;
}

/* Success badges - ensure text is visible */
.bg-success {
    background-color: #229954 !important;
    color: #ffffff !important;
}

.bg-success-subtle {
    background-color: rgba(34, 153, 84, 0.1) !important;
    color: #229954 !important;
    border: 1px solid rgba(34, 153, 84, 0.2);
}

.text-success {
    color: #229954 !important;
}

/* Warning badges - ensure text is visible */
.bg-warning {
    background-color: #f39c12 !important;
    color: #000000 !important;
}

.bg-warning-subtle {
    background-color: rgba(243, 156, 18, 0.1) !important;
    color: #d68910 !important;
    border: 1px solid rgba(243, 156, 18, 0.2);
}

.text-warning {
    color: #d68910 !important;
}

/* Danger badges - ensure text is visible */
.bg-danger {
    background-color: #e74c3c !important;
    color: #ffffff !important;
}

.bg-danger-subtle {
    background-color: rgba(231, 76, 60, 0.1) !important;
    color: #c0392b !important;
    border: 1px solid rgba(231, 76, 60, 0.2);
}

.text-danger {
    color: #c0392b !important;
}

/* Info badges - ensure text is visible */
.bg-info {
    background-color: #3498db !important;
    color: #ffffff !important;
}

.bg-info-subtle {
    background-color: rgba(52, 152, 219, 0.1) !important;
    color: #2980b9 !important;
    border: 1px solid rgba(52, 152, 219, 0.2);
}

.text-info {
    color: #2980b9 !important;
}

/* Light badges - ensure text is visible */
.bg-light {
    background-color: #f8f9fa !important;
    color: #495057 !important;
    border: 1px solid #dee2e6;
}

.text-light {
    color: #f8f9fa !important;
}

/* Dark badges - ensure text is visible */
.bg-dark {
    background-color: #212529 !important;
    color: #ffffff !important;
}

.text-dark {
    color: #212529 !important;
}

/* --- Validation Summary Fix --- */
/* Hide validation summary when there are no errors */
.validation-summary-valid {
    display: none !important;
}

/* Show validation summary only when there are errors */
.validation-summary-errors {
    display: block !important;
}

/* TomSelect Stock Badge Styles */
.stock-badge {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 12px;
    font-weight: 500;
    display: inline-block;
}

.stock-available {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    font-weight: 600;
}

.stock-low {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
    font-weight: 600;
}

.stock-out {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    font-weight: 600;
}

.adv-select-item-details {
    display: flex;
    align-items: center;
    gap: 8px;
}

.adv-select-item-details small {
    font-size: 11px;
    opacity: 0.8;
}

