/**
 * Data Tables CSS
 * 
 * This file contains CSS styles for data tables.
 */

/* Table Styles */
.table {
    width: 100%;
    margin-bottom: 1rem;
    color: #212529;
    border-collapse: collapse;
}

.table th {
    position: relative;
    padding: 0.75rem;
    vertical-align: middle;
    border-top: 1px solid #dee2e6;
    background-color: #f8f9fa;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.table td {
    padding: 0.75rem;
    vertical-align: middle;
    border-top: 1px solid #dee2e6;
}

/* Striped Rows */
.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(0, 0, 0, 0.02);
}

/* Hover Effect */
.table-hover tbody tr:hover {
    background-color: rgba(13, 110, 253, 0.05);
}

/* Bordered Table */
.table-bordered {
    border: 1px solid #dee2e6;
}

.table-bordered th,
.table-bordered td {
    border: 1px solid #dee2e6;
}

/* Small Table */
.table-sm th,
.table-sm td {
    padding: 0.3rem;
}

/* Responsive Table */
.table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Table Controls */
.table-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.table-search {
    width: 100%;
    max-width: 300px;
}

.table-items-per-page {
    width: auto;
    display: inline-block;
}

/* Pagination */
.table-pagination-info {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
}

.table-info {
    font-size: 0.9rem;
    color: #6c757d;
}

.pagination {
    display: flex;
    padding-left: 0;
    list-style: none;
    border-radius: 0.25rem;
}

.page-item:first-child .page-link {
    margin-left: 0;
    border-top-left-radius: 0.25rem;
    border-bottom-left-radius: 0.25rem;
}

.page-item:last-child .page-link {
    border-top-right-radius: 0.25rem;
    border-bottom-right-radius: 0.25rem;
}

.page-item.active .page-link {
    z-index: 3;
    color: #fff;
    background-color: #0d6efd;
    border-color: #0d6efd;
}

.page-item.disabled .page-link {
    color: #6c757d;
    pointer-events: none;
    cursor: auto;
    background-color: #fff;
    border-color: #dee2e6;
}

.page-link {
    position: relative;
    display: block;
    padding: 0.5rem 0.75rem;
    margin-left: -1px;
    line-height: 1.25;
    color: #0d6efd;
    background-color: #fff;
    border: 1px solid #dee2e6;
    text-decoration: none;
}

.page-link:hover {
    z-index: 2;
    color: #0a58ca;
    text-decoration: none;
    background-color: #e9ecef;
    border-color: #dee2e6;
}

.page-link:focus {
    z-index: 3;
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Sortable Headers */
th[data-sortable="true"] {
    cursor: pointer;
    user-select: none;
}

th[data-sortable="true"]:hover {
    background-color: #e9ecef;
}

th[data-sortable="true"] i.fas {
    margin-left: 0.25rem;
    color: #adb5bd;
}

th.sort-asc i.fas,
th.sort-desc i.fas {
    color: #0d6efd;
}

/* Table Actions */
.table-actions {
    white-space: nowrap;
}

.table-actions .btn {
    margin-right: 0.25rem;
}

.table-actions .btn:last-child {
    margin-right: 0;
}

/* Badge Styling */
.table .badge {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.35em 0.65em;
    border-radius: 0.25rem;
}

/* Status Colors */
.status-active {
    color: #198754;
}

.status-pending {
    color: #fd7e14;
}

.status-expired {
    color: #dc3545;
}

.status-draft {
    color: #6c757d;
}

.status-accepted {
    color: #0d6efd;
}

.status-rejected {
    color: #dc3545;
}

/* Responsive Adjustments */
@media (max-width: 767.98px) {
    .table-pagination-info .row {
        flex-direction: column;
    }
    
    .table-pagination-info .col-md-6 {
        text-align: center !important;
        margin-bottom: 1rem;
    }
    
    .pagination {
        justify-content: center !important;
    }
    
    .table-controls .row {
        flex-direction: column;
    }
    
    .table-controls .col-md-6 {
        margin-bottom: 1rem;
    }
}
