/* Table Layout */
.table-responsive {
    width: 100%;
}

.preview-table {
    width: 100% !important;
}

/* Header Styling */
table.dataTable thead th {
    position: relative;
    padding-right: 20px !important;  /* Space for sort icon */
    background-color: #f8f9fa;       /* Light gray background */
    border-bottom: 2px solid #dee2e6; /* Distinct bottom border */
}

/* Sort Indicators */
table.dataTable thead .sorting:before,
table.dataTable thead .sorting:after,
table.dataTable thead .sorting_asc:before,
table.dataTable thead .sorting_desc:before,
table.dataTable thead .sorting_asc:after,
table.dataTable thead .sorting_desc:after {
    display: none !important;
}

table.dataTable thead .sorting:after,
table.dataTable thead .sorting_asc:after,
table.dataTable thead .sorting_desc:after {
    display: inline-block !important;
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    opacity: 0.5;
}

/* Sort States */
table.dataTable thead .sorting:after {
    content: "\f0dc";  /* fa-sort */
    opacity: 0.2;
}

table.dataTable thead .sorting_asc:after {
    content: "\f0d8";  /* fa-sort-up */
    opacity: 1;
}

table.dataTable thead .sorting_desc:after {
    content: "\f0d7";  /* fa-sort-down */
    opacity: 1;
}

/* Cell Styling */
table.dataTable tbody td {
    padding: 8px 12px;
    vertical-align: middle;
}

/* Numeric Column Alignment */
table.dataTable td.text-end {
    text-align: right;
}

/* Pagination Styling */
.dataTables_paginate {
    margin-top: 1rem;
}

.paginate_button {
    padding: 0.375rem 0.75rem;
    margin-left: 2px;
    margin-right: 2px;
    border-radius: 0.25rem;
}

.paginate_button.current {
    background-color: #0d6efd;
    color: white !important;
}

/* Responsive Behavior */
@media screen and (max-width: 767px) {
    table.dataTable {
        display: block;
        width: 100%;
        overflow-x: auto;
    }
}

/* Readonly Fields Styling */
.readonly-field {
    background-color: #f5f5f5;
    cursor: not-allowed;
    font-family: monospace;
    color: #495057;
    border: 1px solid #ced4da;
}

.readonly-field:focus {
    background-color: #f5f5f5;
    box-shadow: none;
}

/* Collapsible Section Styling */
.btn-link {
    text-decoration: none;
    color: #6c757d;
}

.btn-link:hover {
    color: #0d6efd;
}

/* Animation for collapse */
.collapse {
    transition: all 0.2s ease;
}

/* Readonly Fields */
textarea.readonly-field {
    resize: none;
}

/* Consistent spacing */
.form-label {
    margin-bottom: 0.5rem;
    color: #212529;
}
