/* V3NITY Data Table Styles */

.table-container {
    overflow: auto;
    position: relative;
    font-size: smaller;
    scrollbar-gutter: stable;
    max-height: 100%;
}

table.datatable {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 100%;
}

.table-fixed {
    table-layout: fixed;
}

.datatable th, 
.datatable td {
    text-align: left;
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.datatable th:last-child, 
.datatable td:last-child {
    border-right: none;
}

.datatable th {
    background-color: #f1f3f5;
    position: sticky;
    top: 0;
    z-index: 10;
    min-width: 50px;
    overflow: hidden !important;
    user-select: none;
    padding: 0;
}

.header-content {
    padding: 12px;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
}

/* Stable Header Pattern */
.table-stable-headers th {
    position: relative;
    height: 45px;
}

.table-stable-headers .header-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    box-sizing: border-box;
}

.table-stable-headers .ghost-header {
    display: block;
    padding: 12px;
    visibility: hidden;
    pointer-events: none;
    white-space: nowrap;
    height: 100%;
    box-sizing: border-box;
}

/* Sticky Columns */
.sticky-col-left {
    position: sticky !important;
    left: 0;
    z-index: 5;
    background-color: white;
}

.sticky-col-right {
    position: sticky !important;
    right: 0;
    z-index: 5;
    background-color: white;
    border-left: 1px solid var(--border-color) !important;
}

thead th.sticky-col-left {
    z-index: 15;
    background-color: #f1f3f5;
}

thead th.sticky-col-right {
    z-index: 15;
    background-color: #f1f3f5;
}

/* Expansion Logic */
th:not(.actions-column):hover {
    z-index: 100;
    overflow: visible !important;
}

th:not(.actions-column):hover .header-content {
    position: absolute;
    top: 0;
    left: 0;
    width: max-content;
    min-width: 100%;
    background-color: #f1f3f5 !important;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    z-index: 101;
}

th:not(.actions-column):nth-last-child(-n+3):hover .header-content {
    left: auto;
    right: 0;
}

.resizer {
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    width: 8px;
    cursor: col-resize;
    user-select: none;
    z-index: 110;
    background-color: transparent;
    pointer-events: auto;
}

.resizer::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    width: 2px;
    background-color: transparent;
    transition: background-color 0.2s;
}

.resizer:hover::after, .resizer.resizing::after {
    background-color: var(--primary-color);
}

.sortable-header {
    user-select: none;
    transition: background-color 0.2s;
    cursor: pointer;
}

.sortable-header:hover {
    background-color: #e9ecef;
}

.sort-icon {
    margin-left: 5px;
    font-size: 0.8rem;
    color: var(--accent-blue);
    pointer-events: none;
}

.empty-table-msg {
    text-align: center;
    padding: 60px 40px;
    color: var(--accent-blue);
    font-style: italic;
    font-size: 1.1rem;
    border-right: none !important;
}

.actions-column {
    width: 150px !important;
    min-width: 150px !important;
    max-width: 150px !important;
    text-align: left !important;
    overflow: hidden !important;
}

.actions-cell {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    width: 100%;
    height: 100%;
}

.actions-column-cell {
    padding: 0 !important;
}

.btn-icon-only {
    width: 32px;
    height: 32px;
    padding: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    flex-shrink: 0;
}

.btn-icon-only .material-icons {
    font-size: 20px;
}
