/* data-table demo */

/* ── Data table ──────────────────────────────────── */

.table-container {
    width: 960px;
    max-width: 100%;
    margin: 0 auto;
}

.table-toolbar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

.table-toolbar input[type="text"] {
    background: #161b22;
    border: 1px solid #30363d;
    color: #c9d1d9;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    width: 220px;
}

.table-toolbar input[type="text"]::placeholder {
    color: #484f58;
}

.table-toolbar select {
    background: #161b22;
    border: 1px solid #30363d;
    color: #c9d1d9;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.85rem;
}

.table-toolbar label {
    font-size: 0.8rem;
    color: #8b949e;
}

/* Virtual scroll viewport */
.table-viewport {
    height: 560px;
    overflow-y: auto;
    border: 1px solid #30363d;
    border-radius: 4px;
    background: #0d1117;
    position: relative;
}

/* display: contents lets the sticky thead use the whole scroll area
   (the table box itself is only header-tall; rows are absolutely positioned). */
.table-viewport table {
    display: contents;
}

/* Header and rows share the same flex layout so columns line up.
   (A block tbody inside a real table gets squeezed into the first column.) */
.table-viewport thead {
    display: block;
    position: sticky;
    top: 0;
    z-index: 2;
}

.table-viewport tbody {
    position: relative;
    display: block;
}

.table-viewport thead tr,
.table-viewport tbody tr {
    display: flex;
    align-items: center;
    width: 100%;
    left: 0;
    right: 0;
}

.table-viewport th,
.table-viewport td {
    flex: none;
    text-align: left;
}

.table-viewport th {
    background: #161b22;
    padding: 10px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #c9d1d9;
    text-align: left;
    border-bottom: 1px solid #30363d;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

@media (hover: hover) {
    .table-viewport th:hover {
        color: #f0883e;
    }
}

.table-viewport th .sort-arrow {
    font-size: 0.7rem;
    margin-left: 4px;
}

.table-viewport td {
    padding: 8px 12px;
    font-size: 0.82rem;
    border-bottom: 1px solid #161b22;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (hover: hover) {
    .table-viewport tr:hover td {
        background: #161b22;
    }
}

/* Column widths */
.col-name { width: 17%; }
.col-email { width: 22%; }
.col-age { width: 6%; }
.col-city { width: 14%; }
.col-salary { width: 12%; }
.col-dept { width: 14%; }
.col-phone { width: 15%; }

.table-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: #8b949e;
}

.table-status #perf-info {
    font-size: 0.8rem;
}

@media (pointer: coarse) {
    /* Outranks the shared 16px rule's specificity; iOS zooms on focus below 16px */
    .table-toolbar input[type="text"],
    .table-toolbar select {
        font-size: 16px;
    }
}
