/* UPDATED responsive professional data table styles */

:root {
    --dt-bg: #ffffff;
    --dt-bg-alt: #f5f7fa;
    --dt-header-bg: linear-gradient(180deg,#1f3b57,#1c3348);
    --dt-header-color: #ffffff;
    --dt-border-color: #d8e1ea;
    --dt-hover: #e9f2fb;
    --dt-focus-ring: 0 0 0 3px rgba(47,111,173,.25);
    --dt-font-size: 12px;
    --dt-header-font-size: 11px;
    --dt-radius: 10px;
}

/* Remove any previous background image globally */
html, body {
    background: #eef1f4 !important;
    background-image: none !important;
    margin: 0;
    padding: 0;
    overscroll-behavior: none;
    font-family: system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif;
}

.data-table-shell {
    max-width: 100%;
    margin-inline: auto;
    padding: 6px 10px 14px;
}

.data-table-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
    align-items: center;
}

    .data-table-toolbar .search-box {
        min-width: 240px;
        padding: 6px 10px;
        font-size: 13px;
        border: 1px solid var(--dt-border-color);
        border-radius: 6px;
        background: #fff;
        transition: border-color .15s, box-shadow .15s;
    }

        .data-table-toolbar .search-box:focus {
            outline: none;
            border-color: #2f6fad;
            box-shadow: var(--dt-focus-ring);
        }

/* Container */
.data-table-container {
    background: var(--dt-bg);
    border: 1px solid var(--dt-border-color);
    border-radius: var(--dt-radius);
    box-shadow: 0 4px 14px -2px rgba(0,0,0,.08);
    overflow: hidden;
    position: relative;
}

/* Scroll wrapper ensures no overflow beyond viewport */
.data-table-scroll {
    width: 100%;
    overflow: auto; /* existing */
    overflow-x: auto; /* ensure horizontal scroll */
    overflow-y: auto;
    max-width: 100vw;
    scrollbar-color: #b9c4cf transparent;
}

.data-table {
    width: 100%;
    min-width: 1200px; /* was 1100px: give more room so Actions fit */
    border-collapse: separate;
    border-spacing: 0;
    font-size: var(--dt-font-size);
    table-layout: fixed; /* force columns to respect width classes */
}

/* Column width utility classes */
.col-narrow {
    width: 70px;
}

.col-xn {
    width: 54px;
}

.col-mid {
    width: 120px;
}

.col-wide {
    width: 180px;
}

.col-remarks {
    width: 220px;
}

.data-table thead th {
    background: var(--dt-header-bg);
    color: var(--dt-header-color);
    font-size: var(--dt-header-font-size);
    font-weight: 600;
    letter-spacing: .35px;
    padding: 5px 8px 6px;
    text-align: left;
    position: sticky;
    top: 0;
    z-index: 3;
    border-right: 1px solid #284960;
    white-space: nowrap;
}

    .data-table thead th:last-child {
        border-right: none;
    }

.data-table tbody td {
    padding: 6px 8px;
    border-bottom: 1px solid var(--dt-border-color);
    vertical-align: top;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.data-table tbody tr:nth-child(even) td {
    background: var(--dt-bg-alt);
}

.data-table tbody tr:hover td {
    background: var(--dt-hover);
}

/* Status coloring (soft flags) */
tr.status-Warehouse td {
    background: #f2f4f6 !important;
}

tr.status-Expected td {
    background: #fff7db !important;
}

/* Foot */
.data-table tfoot td {
    background: #f0f3f6;
    font-weight: 600;
    padding: 7px 8px;
    border-top: 2px solid var(--dt-border-color);
}

/* Truncated cells with tooltip */
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Action buttons inline */
.actions-cell {
    display: flex;
    gap: 4px;
    flex-wrap: nowrap;
    white-space: nowrap; /* keep buttons on one line */
}

.btn-table {
    font-size: 10px;
    padding: 3px 6px;
    line-height: 1.1;
    display: inline-flex; /* prevent collapse */
    align-items: center;
    flex: 0 0 auto; /* don't shrink */
}

/* Make the Actions column sticky on the right so Edit/Del are always visible */
.data-table thead th:last-child,
.data-table tbody td:last-child {
    position: sticky;
    right: 0;
    z-index: 4; /* above normal cells */
    background: var(--dt-bg);
    width: 150px; /* ensure enough width for 2 buttons */
    min-width: 150px;
    border-left: 1px solid var(--dt-border-color);
}

/* Preserve zebra/hover for sticky Actions column */
.data-table tbody tr:nth-child(even) td:last-child {
    background: var(--dt-bg-alt);
}

.data-table tbody tr:hover td:last-child {
    background: var(--dt-hover);
}

/* Pagination */
.data-table-pagination {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 10px;
    font-size: 12px;
}

/* Responsive column hiding for narrower widths */
@media (max-width: 1500px) {
    .hide-xl {
        display: none;
    }
}

@media (max-width: 1300px) {
    .hide-lg {
        display: none;
    }
}

@media (max-width: 1120px) {
    .hide-md {
        display: none;
    }
}

/* Scrollbar styling */
.data-table-scroll::-webkit-scrollbar {
    height: 12px;
    width: 12px;
}

.data-table-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.data-table-scroll::-webkit-scrollbar-thumb {
    background: #c2ccd4;
    border-radius: 6px;
}

    .data-table-scroll::-webkit-scrollbar-thumb:hover {
        background: #a9b5bf;
    }

/* Modal refinements */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(24,36,46,.55);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 4vh;
    z-index: 1000;
}

.modal-panel, .confirm-panel {
    background: #fff;
    border-radius: 12px;
    padding: 18px 20px 20px;
    width: min(1000px, 96vw);
    max-height: 90vh;
    overflow: auto;
    box-shadow: 0 14px 38px -8px rgba(0,0,0,.3);
    border: 1px solid #d9e2ea;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill,minmax(180px,1fr));
    gap: 10px 14px;
    margin-bottom: 14px;
}

    .form-grid input, .form-grid select {
        font-size: 12px;
        padding: 5px 7px;
        border: 1px solid #c5ced6;
        border-radius: 5px;
        background: #fff;
    }

        .form-grid input:focus {
            outline: none;
            border-color: #2f6fad;
            box-shadow: var(--dt-focus-ring);
        }

/* NEW: page title and file link look */
.page-title {
    margin: 6px 0 10px;
    font-size: 26px;
    line-height: 1.25;
    font-weight: 600;
    color: #2d3a4b;
}

.file-link {
    color: #2f6fad;
    text-decoration: none;
    font-weight: 600;
}

    .file-link:hover {
        text-decoration: underline;
    }
