/* 
* Reusable Table Styles
* These styles are specifically for the enhanced reusable table component with 
* pagination, search, and row selection functionality.
*/

/* Table Container */
.table-container {
    margin: 15px 0;
    position: relative;
    overflow-y: hidden;
    overflow-x: auto;
}

/* Table Actions Row */
.table-actions {
    margin-bottom: 15px;
}

/* Search Input */
.table-search {
    margin: 0;
    width: 300px;
}

.table-search .md-errors-spacer {
    display: none;
}

/* Selected Items Actions */
.selected-actions {
    background-color: #f5f5f5;
    border-radius: 4px;
    padding: 5px 10px;
    margin-bottom: 10px;
}

/* Reusable Table */
.reusable-table {
    width: 100%;
    border-collapse: collapse;
    background-color: white;
}

.reusable-table thead th {
    padding: 22px 8px;
    text-align: left;
    font-weight: 500;
    border-bottom: 2px solid #e0e0e0;
    position: sticky;
    top: 0;
    z-index: 10;
}

/* Sortable headers */
.sortable-header {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

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

/* Non-sortable headers */
.non-sortable {
    cursor: default;
}

.reusable-table td {
    padding: 8px;
    border-bottom: 1px solid #e0e0e0;
    vertical-align: middle;
}

/* Checkbox Column */
.checkbox-column {
    width: 20px;
    text-align: center;
}

/* Row Hover and Selection */
.reusable-table tbody tr:hover {
    background-color: #f9f9f9;
}

.reusable-table tbody tr.selected {
    background-color: #e8f0fe;
}

.reusable-table tbody tr.selected:hover {
    background-color: #d8e8fd;
}

/* Pagination Controls */
.pagination-controls {
    margin-top: 15px;
    padding: 10px 0;
}

.pagination-info {
    margin: 0 15px;
    line-height: 36px;
}

.page-size-select {
    margin: 0 0 0 15px;
    min-width: 80px;
}

.page-size-select .md-select-value {
    min-width: 80px;
}

/* Center Aligned Text */
.text-center {
    text-align: center;
}

/* Responsive Table: Keep rows/columns, enable horizontal scroll */
@media screen and (max-width: 768px) {
    .table-search {
        width: 100%;
        margin-top: 10px;
    }
    .pagination-info {
        display: none;
    }
    
    .reusable-table {
        min-width: 600px;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .responsive-table-actions {
        flex-direction: column !important;
        -webkit-flex-direction: column !important;
        align-items: stretch !important;
        gap: 10px;
    }
    .responsive-table-actions > div {
        width: 100%;
        margin-bottom: 8px;
    }
    .responsive-table-actions md-input-container,
    .responsive-table-actions .md-input-container {
        width: 100%;
    }
}

/* Extra: Prevent vertical header text on mobile */
@media screen and (max-width: 480px) {
    .reusable-table {
        min-width: 700px;
    }
    .reusable-table thead th,
    .reusable-table td {
        font-size: 13px;
        padding: 8px 4px;
    }
}