/* Table styles */

.files-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg);
}

/* Table Header */
.files-table thead {
    position: sticky;
    top: 0;
    background: var(--bg);
    z-index: 10;
}

.files-table th {
    position: relative;
    text-align: left;
    font-weight: 600;
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--border);
    user-select: none;
}

.th-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    cursor: default;
}

/* Variant: content packs at the start instead of distributing across the
   column header. Used by the Revisions column where a leading "select all"
   checkbox sits beside the column title. */
.th-content--start {
    justify-content: flex-start;
}

.th-content--start .select-all-checkbox {
    margin-right: 0.5rem;
}

.sortable .th-content {
    cursor: pointer;
}

.sortable .th-content:hover {
    background: var(--bg-hover);
}

/* Sort Indicators */
.sort-indicator {
    display: inline-block;
    width: 0.75rem;
    height: 1rem;
    margin-left: 0.5rem;
    position: relative;
}

.sort-indicator::before,
.sort-indicator::after {
    content: '';
    position: absolute;
    left: 0;
    width: 0;
    height: 0;
    border-style: solid;
}

.sort-indicator::before {
    top: 0;
    border-width: 0 0.375rem 0.375rem 0.375rem;
    border-color: transparent transparent var(--border-dark) transparent;
}

.sort-indicator::after {
    bottom: 0;
    border-width: 0.375rem 0.375rem 0 0.375rem;
    border-color: var(--border-dark) transparent transparent transparent;
}

th[data-sort="asc"] .sort-indicator::before {
    border-bottom-color: var(--text);
}

th[data-sort="desc"] .sort-indicator::after {
    border-top-color: var(--text);
}

/* Resize Handle */
.resize-handle {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    cursor: col-resize;
    background: transparent;
}

.resize-handle:hover {
    background: var(--primary);
}

/* Table Body */
.files-table tbody tr {
    transition: background-color 0.1s;
}

.files-table tbody tr.group-last {
    border-bottom: 1px solid var(--border);
}

.files-table tbody tr:hover {
    background: var(--bg-hover);
}

/* Preview-active highlight: marks the row + specific file (when there are
   multiple files per revision) that the preview popup is currently showing,
   so the user can match what's on screen to its location in the table. */
.files-table tbody tr.is-previewing {
    background: var(--bg-selected, rgba(42, 90, 138, 0.10));
    box-shadow: inset 3px 0 0 var(--primary);
}
.files-table tbody tr.is-previewing:hover {
    background: var(--bg-selected-hover, rgba(42, 90, 138, 0.18));
}
.revision-file.is-previewing {
    outline: 1.5px solid var(--primary);
    outline-offset: 2px;
    border-radius: 3px;
}

.files-table td {
    padding: 0.25rem 1rem;
    vertical-align: top;
}

/* Tracking Number Column */
td[data-field="trackingNumber"],
th[data-sort="trackingNumber"] {
    white-space: nowrap;
}

td[data-field="trackingNumber"] {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9em;
}

/* Revisions Column */
.revision-group {
    margin-bottom: 0.5rem;
}

.revision-group:last-child {
    margin-bottom: 0;
}

.revision-item {
    display: flex;
    align-items: center;
    margin-bottom: 0.25rem;
}

.revision-item:last-child {
    margin-bottom: 0;
}

.revision-info {
    display: inline-flex;
    align-items: center;
    margin-right: 0.5rem;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9em;
}

.revision-id {
    font-weight: 600;
    margin-right: 0.25rem;
}

.revision-status {
    color: var(--text-muted);
    font-size: 0.85em;
}

.revision-file {
    display: inline-flex;
    align-items: center;
    margin-left: 0.25rem;
}

.file-link,
.file-link-disabled {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    margin-right: 0.25rem;
    line-height: 1.1;
}

.file-link {
    color: var(--primary);
    text-decoration: none;
}

.file-link:hover {
    text-decoration: underline;
}


.file-ext {
    color: var(--text-muted);
    font-size: 0.85em;
    text-transform: uppercase;
}

/* Empty Table State */
.empty-table {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

/* Column Widths */
.files-table th:nth-child(1),
.files-table td:nth-child(1) {
    width: 240px;
    min-width: 220px;
}

.files-table th:nth-child(2),
.files-table td:nth-child(2) {
    width: 40%;
    min-width: 200px;
}

.files-table th:nth-child(3),
.files-table td:nth-child(3) {
    width: auto;
    min-width: 300px;
}

/* File size — half the height of the extension badge, left-aligned below it */
.file-size {
    color: var(--text-muted);
    font-size: 0.5em;
    line-height: 1;
    margin-top: 0.15em;
}

/* Active column filter highlight */
.column-filter.filter-active {
    background: rgba(234, 179, 8, 0.18);
    border-color: rgba(234, 179, 8, 0.7);
}
