/* =====================================================
   VICSER ERP - SAAS TABLE 2026
===================================================== */

:root {
    --erp-border: #e8edf4;
    --erp-bg: #f7f9fc;
    --erp-card: #ffffff;
    --erp-text: #172033;
    --erp-muted: #7c879b;
    --erp-hover: #f8fbff;
}

/* Card bao ngoài bảng */
.fi-ta {
    border: 1px solid var(--erp-border) !important;
    border-radius: 16px !important;
    background: var(--erp-card) !important;
    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.02),
        0 8px 28px rgba(15, 23, 42, 0.045) !important;
    overflow: hidden;
}

/* Header bảng, tìm kiếm, nút */
.fi-ta-header {
    padding: 14px 16px !important;
    border-bottom: 1px solid var(--erp-border) !important;
    background: rgba(255, 255, 255, 0.96) !important;
}

/* Khung cuộn riêng */
.fi-ta-content {
    max-height: calc(100vh - 330px);
    min-height: 280px;
    overflow: auto !important;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    background: #fff;
}

/* Bảng rộng thì cuộn ngang trong khung */
.fi-ta-table {
    min-width: max-content !important;
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

/* Header cột luôn nằm trên */
.fi-ta-table thead {
    position: sticky;
    top: 0;
    z-index: 30;
}

/* Header cột gọn */
.fi-ta-table thead th {
    background: #f8fafc !important;
    color: #5f6b7d !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    letter-spacing: 0.02em;
    text-transform: none;
    white-space: nowrap;
    padding: 10px 12px !important;
    border-bottom: 1px solid var(--erp-border) !important;
}

/* Ô dữ liệu gọn */
.fi-ta-table tbody td {
    padding: 9px 12px !important;
    font-size: 12px !important;
    line-height: 1.35 !important;
    color: var(--erp-text);
    border-bottom: 1px solid #f0f3f7 !important;
    vertical-align: middle;
}

/* Không để dòng quá cao */
.fi-ta-table tbody tr {
    min-height: 44px !important;
    transition:
        background-color 0.16s ease,
        box-shadow 0.16s ease;
}

/* Hover kiểu SaaS */
.fi-ta-table tbody tr:hover td {
    background: var(--erp-hover) !important;
}

/* Dòng cuối */
.fi-ta-table tbody tr:last-child td {
    border-bottom: 0 !important;
}

/* Badge nhỏ, gọn */
.fi-badge {
    font-size: 10.5px !important;
    line-height: 1.15 !important;
    padding: 4px 7px !important;
    border-radius: 7px !important;
    font-weight: 600 !important;
    white-space: nowrap;
}

/* Checkbox gọn */
.fi-ta-row-checkbox,
.fi-ta-header-cell-checkbox {
    width: 38px !important;
    min-width: 38px !important;
}

/* Nút hành động Xem / Sửa */
.fi-ta-actions {
    gap: 8px !important;
    white-space: nowrap;
}

.fi-ta-actions .fi-link {
    font-size: 11px !important;
    font-weight: 600 !important;
}

/* Phân trang */
.fi-ta-footer {
    padding: 11px 16px !important;
    border-top: 1px solid var(--erp-border) !important;
    background: #fff !important;
}

/* Thanh cuộn */
.fi-ta-content::-webkit-scrollbar {
    width: 9px;
    height: 9px;
}

.fi-ta-content::-webkit-scrollbar-track {
    background: #f1f4f8;
}

.fi-ta-content::-webkit-scrollbar-thumb {
    background: #b8c2d1;
    border: 2px solid #f1f4f8;
    border-radius: 999px;
}

.fi-ta-content::-webkit-scrollbar-thumb:hover {
    background: #8f9bad;
}

/* Ô tìm kiếm */
.fi-ta-header .fi-input-wrp {
    border-radius: 10px !important;
    box-shadow: none !important;
    border: 1px solid var(--erp-border) !important;
}

/* Nút header */
.fi-ta-header .fi-btn {
    min-height: 36px !important;
    border-radius: 9px !important;
    font-size: 11.5px !important;
    font-weight: 650 !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
}

/* Tablet */
@media (max-width: 1200px) {
    .fi-ta-content {
        max-height: calc(100vh - 300px);
    }

    .fi-ta-table tbody td {
        padding: 8px 10px !important;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .fi-ta {
        border-radius: 12px !important;
    }

    .fi-ta-content {
        max-height: calc(100vh - 250px);
        min-height: 300px;
    }

    .fi-ta-table thead th {
        font-size: 10px !important;
        padding: 9px 8px !important;
    }

    .fi-ta-table tbody td {
        font-size: 11px !important;
        padding: 8px !important;
    }

    .fi-ta-header {
        padding: 11px !important;
    }
}

/* ==========================================================
   HQC_TABLE_SCROLL_UX_V1
   Sprint 9 - horizontal table scroll usability
   UI ONLY
   ========================================================== */

body.fi-body:not(.fi-simple-layout) .fi-main .fi-ta-content {
    overflow-x: auto !important;
    overflow-y: auto !important;
    scrollbar-width: auto;
    scrollbar-color: #94a3b8 #eef2f7;
    scrollbar-gutter: stable;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
}

/*
 * Chỉ .fi-ta-content làm scroll owner.
 * Tránh nested horizontal scrollbar.
 */
body.fi-body:not(.fi-simple-layout) .fi-main .fi-ta-ctn,
body.fi-body:not(.fi-simple-layout) .fi-main .fi-ta-table {
    overflow-x: visible !important;
}

body.fi-body:not(.fi-simple-layout)
.fi-main .fi-ta-content::-webkit-scrollbar {
    width: 12px;
    height: 14px;
}

body.fi-body:not(.fi-simple-layout)
.fi-main .fi-ta-content::-webkit-scrollbar-track {
    background: #eef2f7;
    border-radius: 999px;
}

body.fi-body:not(.fi-simple-layout)
.fi-main .fi-ta-content::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border: 3px solid #eef2f7;
    border-radius: 999px;
    min-width: 48px;
}

body.fi-body:not(.fi-simple-layout)
.fi-main .fi-ta-content::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

@media (min-width: 769px) {
    body.fi-body:not(.fi-simple-layout) .fi-main .fi-ta-content {
        padding-bottom: 2px;
    }
}

@media (max-width: 768px) {
    body.fi-body:not(.fi-simple-layout)
    .fi-main .fi-ta-content::-webkit-scrollbar {
        width: 8px;
        height: 8px;
    }

    body.fi-body:not(.fi-simple-layout)
    .fi-main .fi-ta-content::-webkit-scrollbar-thumb {
        border-width: 2px;
    }
}

/* HQC_TABLE_SCROLL_UX_V1_END */
