* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial;
    background: #f4f6f9;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 20px auto;
    padding: 0 16px;
}

.card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, .08);
}

.table-content .card {
    padding-top: 0;
}

h1 {
    margin: 0 0 15px;
    font-size: 26px;
}

a {
    text-decoration: none;
    color: black;
}

a:hover {
    text-decoration: underline;
}

a .box:hover {
    background-color: #ededed;
    transition: all 0.3s ease-in;
}

td:nth-child(3),
td:nth-child(4) {
    text-align: center;
}

/* ===== Tabs ===== */
.tab-wrapper {
    width: 100%;
}

.tabs {
    display: flex;
    border-bottom: 2px solid #ddd;
    margin: 0;
    padding: 0;
    list-style: none;
    margin-bottom: 1rem;
}

.tabs li {
    padding: 10px 16px;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    color: #555;
}

.tabs li:hover {
    background: lightgray;
}

.tabs li.active {
    border-bottom-color: #007bff;
    color: #007bff;
    font-weight: bold;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}


/* ===== Input ===== */
.controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.controls input {
    flex: 1;
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid #ccc;
    font-size: 15px;
}

.controls input:disabled {
    background-color: #e9ecef;
    cursor: not-allowed;
    opacity: 0.7;
}

.controls button {
    padding: 12px 20px;
    border-radius: 8px;
    border: none;
    background: #2563eb;
    color: #fff;
    cursor: pointer;
    font-size: 15px;
}

.controls button:hover {
    background: #1d4ed8;
}

/* ===== Summary ===== */
.summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}

.summary .box {
    background: #f8fafc;
    border-radius: 10px;
    padding: 15px;
    text-align: center;
}

.summary span {
    font-size: 13px;
    color: #666;
}

.summary strong {
    font-size: 22px;
    display: block;
}

/* ===== Progress ===== */
.progress-wrap {
    margin-top: 15px;
    display: none;
    align-items: center;
}

.progress {
    width: 100%;
    height: 30px;
    background: #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #3b82f6, #22c55e);
    transition: width .2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 20px;
    text-shadow: 0px 1px 2px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    white-space: nowrap;
}

/* ===== Table nav buttons ===== */
.table-nav {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.table-nav button {
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid #ddd;
    background: #fff;
    cursor: pointer;
    font-size: 14px;
}

.table-nav button:hover {
    background: #f1f5f9;
}

.table-nav button span {
    font-weight: bold;
}

/* ===== Tables ===== */
.section {
    scroll-margin-top: 170px;
    min-height: 8rem;
    max-height: 40rem;
    overflow: auto;
}

h2 {
    margin: 0;
    position: sticky;
    top: 0;
    padding: 20px 0 10px 0;
    z-index: 1;
    background-color: white;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.dt-controls-hidden .dt-top,
.dt-controls-hidden .dt-bottom,
.dt-controls-hidden .dataTables_length,
.dt-controls-hidden .dataTables_filter,
.dt-controls-hidden .dataTables_info,
.dt-controls-hidden .dataTables_paginate {
    display: none !important;
}

.dt-top,
.dt-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 12px 0;
    background: #fff;
}

.dt-top {
    position: sticky;
    top: 0;
    z-index: 3;
}

.dt-bottom {
    margin-top: 8px;
}

.dt-top .dataTables_length,
.dt-top .dataTables_filter,
.dt-bottom .dataTables_info,
.dt-bottom .dataTables_paginate {
    float: none;
    padding: 0;
}

.dt-top .dataTables_filter input {
    width: min(320px, 55vw);
    margin-left: 8px;
    padding: 8px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 14px;
}

.dt-top .dataTables_filter input:focus {
    border-color: #2563eb;
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

th,
td {
    padding: 10px;
    border-bottom: 1px solid #e5e7eb;
    word-break: break-all;
}

table.dataTable.no-footer {
    border-bottom: 1px solid rgba(0, 0, 0, 0.3)
}

#internal th,
#external th,
#broken-internal th,
#broken-external th {
    background: #f8fafc;
    position: sticky;
    top: 0;
    z-index: 2;
    white-space: nowrap;
}

/* Fixed column widths */
table th:nth-child(1),
table td:nth-child(1) {
    width: 35%;
}

table th:nth-child(2),
table td:nth-child(2) {
    width: 40%;
}

/* Status colors */
.status-ok {
    color: #16a34a;
    font-weight: 600;
}

.status-warn {
    color: #f59e0b;
    font-weight: 600;
}

.status-bad {
    color: #dc2626;
    font-weight: 600;
}

/* Broken row highlight */
tr.broken {
    background-color: #fee2e2 !important;
}

tr.broken-rowgroup {
    background-color: #ffc1c1 !important;
}

tr.broken-rowgroup th {
    color: #dc2626 !important;
}


/* Simple spinner animation */
.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 3px solid #ccc;
    border-top: 3px solid #2563eb;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

#refresh {
    display: none;
    background: #dc2626;
}

#export-csv {
    display: none;
    background: #10b981;
}

#export-pdf {
    display: none;
    background: #dc2626;
}

/* .card:first-child {
    padding-top: 20px;
}

.card:nth-child(2) {
    padding-top: 20px;
    position: sticky;
    top: 0;
    z-index: 10;
} */

#status-message {
    display: none;
    text-align: center;
    margin-top: 15px;
    font-size: 17px;
    color: black;
    font-weight: 500;
}

#status-message.status-error {
    color: #dc2626;
}

#status-message.status-info {
    color: #1e40af;
}

a[href="#broken-internal"] .box,
a[href="#broken-external"] .box {
    background: #fee2e2;
}

a[href="#broken-internal"] .box:hover,
a[href="#broken-external"] .box:hover {
    background: #fed8d8;
}

th[data-sort] {
    cursor: pointer;
    user-select: none;
}

th[data-sort]:after {
    content: " ⇅";
    font-size: 0.8em;
    color: #888;
}