/*
 * E4S Background Jobs layout repair
 * Scoped only to the detected Background Jobs table.
 */

.e4s-bg-jobs-scroll {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
}

table.e4s-bg-jobs-table {
    width: 100% !important;
    min-width: 1180px !important;
    table-layout: fixed !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
}

table.e4s-bg-jobs-table th,
table.e4s-bg-jobs-table td {
    box-sizing: border-box !important;
    vertical-align: top !important;
}

table.e4s-bg-jobs-table thead th {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    padding-left: 14px !important;
    padding-right: 14px !important;
}

/* JOB */
table.e4s-bg-jobs-table th:nth-child(1),
table.e4s-bg-jobs-table td:nth-child(1) {
    width: 64px !important;
    min-width: 64px !important;
    max-width: 64px !important;
}

/* ACCOUNT */
table.e4s-bg-jobs-table th:nth-child(2),
table.e4s-bg-jobs-table td:nth-child(2) {
    width: 175px !important;
    min-width: 175px !important;
}

/* STATUS */
table.e4s-bg-jobs-table th:nth-child(3),
table.e4s-bg-jobs-table td:nth-child(3) {
    width: 112px !important;
    min-width: 112px !important;
}

/* ATTEMPTS */
table.e4s-bg-jobs-table th:nth-child(4),
table.e4s-bg-jobs-table td:nth-child(4) {
    width: 92px !important;
    min-width: 92px !important;
    text-align: center !important;
}

/* QUEUED */
table.e4s-bg-jobs-table th:nth-child(5),
table.e4s-bg-jobs-table td:nth-child(5) {
    width: 125px !important;
    min-width: 125px !important;
}

/* PROGRESS / ERROR */
table.e4s-bg-jobs-table th:nth-child(6),
table.e4s-bg-jobs-table td:nth-child(6) {
    width: auto !important;
    min-width: 440px !important;
}

/* CONTROL */
table.e4s-bg-jobs-table th:nth-child(7),
table.e4s-bg-jobs-table td:nth-child(7) {
    width: 122px !important;
    min-width: 122px !important;
    max-width: 122px !important;
}

table.e4s-bg-jobs-table td:nth-child(6) {
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
    white-space: normal !important;
    line-height: 1.35 !important;
}

table.e4s-bg-jobs-table td:nth-child(7) {
    white-space: normal !important;
}

table.e4s-bg-jobs-table td:nth-child(7) button,
table.e4s-bg-jobs-table td:nth-child(7) a {
    width: 100% !important;
    max-width: 92px !important;
    margin: 0 0 8px auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/*
 * Prevent the three problematic headers from visually touching.
 */
table.e4s-bg-jobs-table th:nth-child(5) {
    padding-right: 20px !important;
}

table.e4s-bg-jobs-table th:nth-child(6) {
    padding-left: 20px !important;
    padding-right: 20px !important;
}

table.e4s-bg-jobs-table th:nth-child(7) {
    padding-left: 20px !important;
}

/*
 * Large desktop
 */
@media (min-width: 1500px) {
    table.e4s-bg-jobs-table {
        min-width: 100% !important;
    }

    table.e4s-bg-jobs-table th:nth-child(6),
    table.e4s-bg-jobs-table td:nth-child(6) {
        min-width: 520px !important;
    }
}

/*
 * Smaller screens:
 * scroll the table only, never squeeze the headers.
 */
@media (max-width: 1200px) {
    .e4s-bg-jobs-scroll {
        overflow-x: auto !important;
    }

    table.e4s-bg-jobs-table {
        min-width: 1180px !important;
    }
}
