* { 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 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: flex;
    align-items: center;
}

#pct {
    width: 5%;
    text-align: center;
    font-weight: bold;
}

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

.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #3b82f6, #22c55e);
    transition: width .2s ease;
}

/* ===== 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: 15rem;
    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;
}

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

#internal th,
#external th,
#broken-internal th {
    background: #f8fafc;
    position: sticky;
    top: 62px;
    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; }
#broken-external-table th:nth-child(3),
#broken-external-table td:nth-child(3) {
    display: none;
}

/* 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,
#done {
    display: none;
}

#refresh {
    background: #dc2626;
}

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

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

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;
}