/* Column Resize Styles */

/* Force table to respect column widths */
.mud-table table {
    table-layout: fixed !important;
    width: 100%;
}

.mud-table th {
    position: relative;
    user-select: none;
    overflow: hidden;
    min-width: 70px !important;
}

.mud-table td {
    overflow: hidden;
    min-width: 70px !important;
}

/* Prevent wrapping in all cell content */
.mud-table td,
.mud-table td > div,
.mud-table td > * {
    white-space: nowrap !important;
}

/* Apply overflow to header content with ellipsis */
.mud-table th > div:not(.column-resize-handle),
.mud-table th .mud-table-sort-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
}

/* Ensure all header text gets ellipsis - even plain text headers */
.mud-table th {
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Fix chip overflow in cells */
.mud-table td .mud-chip {
    max-width: 100%;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
}

.mud-table td .mud-chip .mud-chip-content {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: flex;
    align-items: center;
}

/* Ensure flex containers in cells don't wrap */
.mud-table td .d-flex {
    flex-wrap: nowrap !important;
    overflow: hidden;
}

.mud-table td .d-flex > div {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.column-resize-handle {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 8px;
    cursor: col-resize;
    z-index: 10;
    border-right: 1px solid rgba(0, 0, 0, 0.12);
    transition: border-color 0.2s;
}

.column-resize-handle:hover {
    border-right: 2px solid rgb(94, 53, 177);
    background-color: rgba(94, 53, 177, 0.05);
}

th.resizing {
    background-color: rgba(var(--mud-palette-primary-rgb), 0.05);
}

th.resizing .column-resize-handle {
    background-color: rgba(var(--mud-palette-primary-rgb), 0.3);
}

/* Prevent text selection during resize */
body.resizing {
    user-select: none !important;
    cursor: col-resize !important;
}

/* Add padding to th content to avoid overlap with resize handle */
.mud-table th > div {
    padding-right: 12px;
}

/* Ensure Actions column is not resizable */
.mud-table th:last-child .column-resize-handle {
    display: none;
}

/* Actions column styling */
.mud-table th:last-child,
.mud-table td:last-child {
    text-align: right !important;
}

.mud-table th:last-child > div,
.mud-table td:last-child > div {
    justify-content: flex-end;
}
