/* ================================================
   INLINE INVOICE DISCOUNTS - Custom Styles
   ================================================ */

/* Discount column styling */
.bill_col_discount {
    min-width: 150px;
}

.bill_col_discount .input-group-append {
    width: 60px;
}

.bill_col_discount .js_item_discount_type {
    font-size: 12px;
    padding: 0.25rem;
}

/* Hide discount column when needed */
.bill_col_discount.hidden {
    display: none !important;
}

/* Disabled button styling */
button.disabled,
a.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* ================================================
   SYSTEM-WIDE TABLE & SCROLLBAR UX IMPROVEMENTS
   Always-visible scrollbars + clean pagination
   ================================================ */

/* ── SCROLLBARS ALWAYS VISIBLE ── */

/* Force scrollbar on EVERY scrollable container — never hidden */
.table-responsive,
.table-wrap,
.dataTables_wrapper,
.dataTables_scrollBody,
.dataTables_scroll,
.card-body .table-responsive,
.tab-content .table-responsive,
.tab-pane .table-responsive,
[class*="table-responsive"],
.table-container,
.scrollable,
.scroll-x,
.scroll-y,
.fx-datatable-wrapper {
    overflow-x: auto !important;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px !important;
    margin-bottom: 0 !important;
}

/* Ensure scroll container doesn't clip the scrollbar */
.card-body,
.tab-pane,
.tab-content,
.modal-body {
    overflow: visible !important;
}

/* DataTables specific — always show scrollbar */
.dataTables_scrollBody {
    overflow-x: auto !important;
    overflow-y: auto !important;
    border-bottom: none !important;
    padding-bottom: 6px !important;
}

/* WebKit scrollbar ALWAYS visible */
.table-responsive::-webkit-scrollbar,
.table-wrap::-webkit-scrollbar,
.dataTables_wrapper::-webkit-scrollbar,
.dataTables_scrollBody::-webkit-scrollbar,
[class*="table-responsive"]::-webkit-scrollbar,
.scrollable::-webkit-scrollbar,
.scroll-x::-webkit-scrollbar {
    height: 14px !important;
    width: 14px !important;
    display: block !important;
    -webkit-appearance: none !important;
    opacity: 1 !important;
    visibility: visible !important;
}
.table-responsive::-webkit-scrollbar-thumb,
.dataTables_scrollBody::-webkit-scrollbar-thumb,
[class*="table-responsive"]::-webkit-scrollbar-thumb {
    background: #999 !important;
    border-radius: 7px !important;
    min-width: 60px !important;
    border: 3px solid transparent !important;
    background-clip: padding-box !important;
}
.table-responsive::-webkit-scrollbar-thumb:hover,
[class*="table-responsive"]::-webkit-scrollbar-thumb:hover {
    background: #888 !important;
    background-clip: padding-box !important;
}
.table-responsive::-webkit-scrollbar-track,
[class*="table-responsive"]::-webkit-scrollbar-track {
    background: #f0f0f0 !important;
    border-radius: 5px !important;
}
/* Hide vertical scrollbar track corner */
.table-responsive::-webkit-scrollbar-corner,
[class*="table-responsive"]::-webkit-scrollbar-corner {
    background: transparent;
}

/* Firefox */
.table-responsive,
.dataTables_scrollBody,
[class*="table-responsive"] {
    scrollbar-width: auto !important;
    scrollbar-color: #999 #e8e8e8 !important;
}

/* Global scrollbar — any scrollable area at all */
html *::-webkit-scrollbar { width: 12px; height: 12px; }
html *::-webkit-scrollbar-thumb { background: #999; border-radius: 6px; }
html *::-webkit-scrollbar-thumb:hover { background: #666; }
html *::-webkit-scrollbar-track { background: #eee; }
html { scrollbar-width: auto; scrollbar-color: #999 #eee; }

/* ── PAGINATION ── */

.pagination .page-link {
    min-width: 40px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 500;
    margin: 0 2px;
    border-radius: 6px;
    transition: all 0.15s ease;
    border: 1px solid #dee2e6;
}
.pagination .page-item.active .page-link {
    background: #5b73e8;
    border-color: #5b73e8;
    color: #fff;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(91,115,232,0.35);
}
.pagination .page-link:hover {
    background: #eef0fc;
    border-color: #5b73e8;
    transform: translateY(-1px);
}
.pagination .page-item.disabled .page-link {
    opacity: 0.4;
}

/* DataTables pagination */
.dataTables_paginate .paginate_button {
    min-width: 36px !important;
    min-height: 36px !important;
    padding: 6px 12px !important;
    font-size: 14px !important;
    border-radius: 6px !important;
    margin: 0 2px !important;
}
.dataTables_paginate .paginate_button.current {
    background: #5b73e8 !important;
    color: #fff !important;
    border-color: #5b73e8 !important;
    font-weight: 700 !important;
}
.dataTables_paginate .paginate_button:hover {
    background: #eef0fc !important;
    border-color: #5b73e8 !important;
}

/* Pagination info */
.dataTables_info,
.dataTables_length label {
    font-size: 13px;
    color: #6c757d;
}
.dataTables_length select {
    padding: 6px 30px 6px 12px;
    font-size: 13px;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

/* ── STICKY TABLE HEADERS ── */

.table-responsive thead th,
.dataTables_scrollHead thead th,
.card-body .table-responsive thead th {
    position: sticky !important;
    top: 0 !important;
    background: #f5f6fa !important;
    z-index: 3 !important;
    box-shadow: 0 2px 3px rgba(0,0,0,0.06) !important;
}

/* ── DUAL HORIZONTAL SCROLLBAR + FLOATING ARROWS ── */
/* Wrapper: position relative so sticky child works relative to this */
.table-scroll-arrows { position: relative; }

/* Top mirror scrollbar — STICKY: stays at top of viewport when scrolling down */
.table-scroll-top {
    overflow-x: auto;
    overflow-y: hidden;
    height: 14px;
    background: #e8e8e8;
    border-radius: 4px;
    margin-bottom: 2px;
    position: sticky;
    top: 50px; /* below the top navbar */
    z-index: 8;
}
.table-scroll-top::-webkit-scrollbar { height: 14px !important; display: block !important; }
.table-scroll-top::-webkit-scrollbar-thumb { background: #999 !important; border-radius: 7px !important; border: 3px solid transparent !important; background-clip: padding-box !important; }
.table-scroll-top::-webkit-scrollbar-track { background: #e8e8e8 !important; border-radius: 4px !important; }
.table-scroll-top-inner { height: 1px; }

/* Floating scroll arrows — always visible on sides of table */
.table-scroll-arrows { position: relative; }
.table-scroll-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(91,115,232,0.85);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: opacity 0.2s, transform 0.2s;
    opacity: 0;
}
.table-scroll-arrows:hover .table-scroll-arrow,
.table-scroll-arrows.scrollable-left .table-scroll-arrow-left,
.table-scroll-arrows.scrollable-right .table-scroll-arrow-right { opacity: 1; }
.table-scroll-arrow-left  { left: -8px; }
.table-scroll-arrow-right { right: -8px; }
.table-scroll-arrow:hover { background: rgba(91,115,232,1); transform: translateY(-50%) scale(1.1); }

/* ── LOAD MORE BUTTON (replaces pagination) ── */

.js-ajax-ux-request.btn-secondary,
.btn.js-ajax-ux-request[href*="void"],
a.btn-secondary.js-ajax-ux-request {
    display: block !important;
    width: 100% !important;
    max-width: 300px !important;
    margin: 20px auto !important;
    padding: 12px 24px !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    border-radius: 8px !important;
    text-align: center !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    background: linear-gradient(135deg, #5b73e8, #4a63d8) !important;
    color: #fff !important;
    border: none !important;
    box-shadow: 0 4px 14px rgba(91,115,232,0.35) !important;
    transition: all 0.2s ease !important;
    cursor: pointer !important;
}
.js-ajax-ux-request.btn-secondary:hover,
a.btn-secondary.js-ajax-ux-request:hover {
    background: linear-gradient(135deg, #4a63d8, #3a53c8) !important;
    box-shadow: 0 6px 20px rgba(91,115,232,0.5) !important;
    transform: translateY(-2px) !important;
}
.js-ajax-ux-request.btn-secondary:active,
a.btn-secondary.js-ajax-ux-request:active {
    transform: translateY(0) !important;
    box-shadow: 0 2px 8px rgba(91,115,232,0.3) !important;
}

/* Loading state for load-more */
.js-ajax-ux-request.loading {
    opacity: 0.7;
    pointer-events: none;
}
