/**
 * iFinance Table Styling
 * Extracted from inline styles and unified across templates
 */

/* Enhanced table styling */
.enhanced-table .table th {
    border-top: none;
    font-weight: 600;
    color: #495057;
    vertical-align: middle;
    padding: 12px 1rem;
    background-color: #f8f9fa;
}

.enhanced-table .table td {
    vertical-align: middle;
    padding: 12px 1rem;
    border-bottom: 1px solid #f8f9fa;
}

.enhanced-table .table tbody tr:hover {
    background-color: rgba(92, 189, 189, 0.1);
    transition: background-color var(--ideal-transition-fast);
}

/* Column width definitions for bill tables */
.bill-table th:nth-child(1), .bill-table td:nth-child(1) { width: 10%; } /* FD Ticket ID */
.bill-table th:nth-child(2), .bill-table td:nth-child(2) { width: 12%; } /* PO No. */
.bill-table th:nth-child(3), .bill-table td:nth-child(3) { width: 15%; } /* Invoice Date */
.bill-table th:nth-child(4), .bill-table td:nth-child(4) { width: 15%; } /* Participant */
.bill-table th:nth-child(5), .bill-table td:nth-child(5) { width: 10%; } /* Status */
.bill-table th:nth-child(6), .bill-table td:nth-child(6) { width: 15%; } /* Amount Due */
.bill-table th:nth-child(7), .bill-table td:nth-child(7) { width: 23%; } /* Amount Applied */

/* Sortable table headers */
.sort-header {
    cursor: pointer;
    user-select: none;
    text-decoration: none !important;
    color: inherit !important;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sort-header:hover {
    background-color: rgba(92, 189, 189, 0.1);
    color: var(--ideal-teal) !important;
}

.sort-header.sort-asc .sort-icon,
.sort-header.sort-desc .sort-icon {
    color: var(--ideal-teal);
}

.sort-icon {
    margin-left: 0.5rem;
    transition: color var(--ideal-transition-fast);
}

/* Table search and filter bar */
.table-search-filter {
    background: white;
    padding: var(--ideal-spacing-md);
    border-radius: var(--ideal-border-radius-md);
    box-shadow: var(--ideal-shadow-sm);
    border: 1px solid var(--ideal-gray-medium);
    margin-bottom: var(--ideal-spacing-lg);
}

.table-search-filter .input-group-text {
    background-color: #f8f9fa;
    border-color: #ced4da;
    color: #6c757d;
}

.table-search-filter .form-control:focus {
    border-color: var(--ideal-teal);
    box-shadow: 0 0 0 0.2rem rgba(92, 189, 189, 0.25);
}

/* Table action buttons */
.table-actions {
    display: flex;
    gap: var(--ideal-spacing-xs);
    justify-content: flex-end;
}

.table-actions .btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    border-radius: var(--ideal-border-radius-sm);
}


/* Responsive table wrapper */
.table-responsive-wrapper {
    border-radius: var(--ideal-border-radius-md);
    box-shadow: var(--ideal-shadow-sm);
    overflow: hidden;
    border: 1px solid var(--ideal-gray-medium);
}

.table-responsive-wrapper .table {
    margin-bottom: 0;
    border: none;
}

/* Table pagination */
.table-pagination {
    background: white;
    border-top: 1px solid var(--ideal-gray-medium);
    padding: var(--ideal-spacing-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-pagination .pagination {
    margin-bottom: 0;
}

.table-pagination .page-info {
    color: var(--ideal-text-muted);
    font-size: var(--ideal-font-size-sm);
}

/* Data table component styling */
.data-table-container {
    background: white;
    border-radius: var(--ideal-border-radius-md);
    box-shadow: var(--ideal-shadow-sm);
    border: 1px solid var(--ideal-gray-medium);
    overflow: hidden;
    margin-bottom: var(--ideal-spacing-lg);
}

.data-table-container .search-filter-bar {
    background: #f8f9fa;
    padding: var(--ideal-spacing-md);
    border-bottom: 1px solid var(--ideal-gray-medium);
}

.data-table-container .table {
    margin-bottom: 0;
    border: none;
}

/* Hierarchy table styling */
.hierarchy-table .hierarchy-indent {
    padding-left: 20px;
}

.hierarchy-table .hierarchy-indent::before {
    content: '↳ ';
    color: var(--ideal-text-muted);
    font-weight: normal;
}

/* Empty table state */
.table-empty-state {
    text-align: center;
    padding: var(--ideal-spacing-xl);
    color: var(--ideal-text-muted);
}

.table-empty-state i {
    font-size: 3rem;
    margin-bottom: var(--ideal-spacing-md);
    color: var(--ideal-gray-medium);
}

/* Table loading state */
.table-loading {
    position: relative;
}

.table-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

/* Export button styling */
.table-export-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--ideal-spacing-xs);
}

.table-export-btn i {
    font-size: 0.875rem;
}

/* Mobile responsive tables */
@media (max-width: 768px) {
    .table-responsive-wrapper {
        margin-left: -15px;
        margin-right: -15px;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .table-search-filter {
        margin-left: -15px;
        margin-right: -15px;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .table-actions {
        flex-direction: column;
        gap: var(--ideal-spacing-sm);
    }

    .table-actions .btn {
        width: 100%;
        justify-content: center;
    }
}
