/*
 * Wide All Links / Broken Links table.
 * Gives URL and Error columns real horizontal space.
 * Shared frontend means this applies to admin and every regular user.
 */

#dataTable.htw-link-table-wide {
    table-layout: fixed !important;
    border-collapse: collapse !important;
    overflow: visible !important;
}

#dataTable.htw-link-table-all {
    width: 2100px !important;
    min-width: 2100px !important;
}

#dataTable.htw-link-table-broken {
    width: 2050px !important;
    min-width: 2050px !important;
}

#dataTable.htw-link-table-wide thead tr,
#dataTable.htw-link-table-wide tbody tr {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
}

#dataTable.htw-link-table-wide th,
#dataTable.htw-link-table-wide td {
    box-sizing: border-box !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    padding: 10px 12px !important;
    vertical-align: top !important;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    line-height: 1.35 !important;
}

/* All Links columns:
 * select, owner, URL, destination, added, last check,
 * status, error, actions.
 */
#dataTable.htw-link-table-all th:nth-child(1),
#dataTable.htw-link-table-all td:nth-child(1) {
    width: 42px !important;
}

#dataTable.htw-link-table-all th:nth-child(2),
#dataTable.htw-link-table-all td:nth-child(2) {
    width: 145px !important;
}

#dataTable.htw-link-table-all th:nth-child(3),
#dataTable.htw-link-table-all td:nth-child(3) {
    width: 540px !important;
    min-width: 540px !important;
}

#dataTable.htw-link-table-all th:nth-child(4),
#dataTable.htw-link-table-all td:nth-child(4) {
    width: 260px !important;
}

#dataTable.htw-link-table-all th:nth-child(5),
#dataTable.htw-link-table-all td:nth-child(5),
#dataTable.htw-link-table-all th:nth-child(6),
#dataTable.htw-link-table-all td:nth-child(6) {
    width: 125px !important;
}

#dataTable.htw-link-table-all th:nth-child(7),
#dataTable.htw-link-table-all td:nth-child(7) {
    width: 100px !important;
}

#dataTable.htw-link-table-all th:nth-child(8),
#dataTable.htw-link-table-all td:nth-child(8) {
    width: 585px !important;
}

#dataTable.htw-link-table-all th:nth-child(9),
#dataTable.htw-link-table-all td:nth-child(9) {
    width: 150px !important;
}

/* Broken Links columns:
 * select, user, URL, destination, last check, error, actions.
 */
#dataTable.htw-link-table-broken th:nth-child(1),
#dataTable.htw-link-table-broken td:nth-child(1) {
    width: 42px !important;
}

#dataTable.htw-link-table-broken th:nth-child(2),
#dataTable.htw-link-table-broken td:nth-child(2) {
    width: 145px !important;
}

#dataTable.htw-link-table-broken th:nth-child(3),
#dataTable.htw-link-table-broken td:nth-child(3) {
    width: 570px !important;
    min-width: 570px !important;
}

#dataTable.htw-link-table-broken th:nth-child(4),
#dataTable.htw-link-table-broken td:nth-child(4) {
    width: 300px !important;
}

#dataTable.htw-link-table-broken th:nth-child(5),
#dataTable.htw-link-table-broken td:nth-child(5) {
    width: 140px !important;
}

#dataTable.htw-link-table-broken th:nth-child(6),
#dataTable.htw-link-table-broken td:nth-child(6) {
    width: 690px !important;
}

#dataTable.htw-link-table-broken th:nth-child(7),
#dataTable.htw-link-table-broken td:nth-child(7) {
    width: 160px !important;
}

/*
 * Prevent the URL from collapsing into one character per line.
 * Long URLs wrap only when required.
 */
#dataTable.htw-link-table-wide .url-col,
#dataTable.htw-link-table-wide .url-col a,
#dataTable.htw-link-table-wide .url-col button,
#dataTable.htw-link-table-wide .link-url,
#dataTable.htw-link-table-wide .link-url-copyable,
#dataTable.htw-link-table-wide td:nth-child(3) a,
#dataTable.htw-link-table-wide td:nth-child(3) button {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    word-break: normal !important;
    line-break: auto !important;
    text-align: left !important;
    line-height: 1.4 !important;
}

/* Keep Owner, dates, status and actions compact. */
#dataTable.htw-link-table-wide td:nth-child(2),
#dataTable.htw-link-table-wide .status-badge,
#dataTable.htw-link-table-wide .actions,
#dataTable.htw-link-table-wide .action-btn {
    word-break: normal !important;
}

#dataTable.htw-link-table-wide .actions {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 6px !important;
    width: 100% !important;
}

#dataTable.htw-link-table-wide .actions button,
#dataTable.htw-link-table-wide .actions .action-btn {
    width: 100% !important;
    white-space: nowrap !important;
}

@media (max-width: 900px) {
    #dataTable.htw-link-table-all {
        width: 1960px !important;
        min-width: 1960px !important;
    }

    #dataTable.htw-link-table-broken {
        width: 1900px !important;
        min-width: 1900px !important;
    }
}
