/*
 * Shared DataTables chrome, list tables, and filter inputs.
 * Wrap page content (or container) with class `app-data-ui`.
 * Add `app-data-ui__table` to each styled table.
 */
@import url('datatables-pagination.css');

.app-data-ui {
    --app-border: #e2e8f0;
    --app-muted: #64748b;
    --app-heading: #0f172a;
    --app-accent: #3730a3;
}

/* Standard Reusable Edit Icon Styling */
.edit-icon, a.edit-icon i, i.edit-icon {
    color: #0d6efd;
    transition: color 0.15s ease-in-out;
}
.edit-icon:hover, a.edit-icon:hover i, i.edit-icon:hover {
    color: #0a58ca;
}

/* Filter row: dates, selects, text */
.app-data-ui .form-label {
    font-size: 0.875rem;
    font-weight: 600;
    /* color: var(--app-muted); */
    color: #000;
    margin-bottom: 0.35rem;
}

.app-data-ui .form-control,
.app-data-ui .form-select {
    font-size: 0.9375rem;
    /* border: 1px solid var(--app-border); */
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    color: var(--app-heading);
    background-color: #fff;
}

.app-data-ui .form-control:focus,
.app-data-ui .form-select:focus {
    border-color: #a5b4fc;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
    outline: none;
}

/* DataTables toolbar */
.app-data-ui .dataTables_wrapper .dataTables_length,
.app-data-ui .dataTables_wrapper .dataTables_filter {
    margin-bottom: 1rem;
}

.app-data-ui .dataTables_wrapper .dataTables_length label,
.app-data-ui .dataTables_wrapper .dataTables_filter label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--app-muted);
    margin-bottom: 0;
}

.app-data-ui .dataTables_wrapper .dataTables_length select {
    min-width: 4.5rem;
    padding: 0.45rem 2rem 0.45rem 0.65rem;
    font-size: 0.9375rem;
    border: 1px solid var(--app-border);
    border-radius: 0.5rem;
    background-color: #fff;
    color: var(--app-heading);
}

.app-data-ui .dataTables_wrapper .dataTables_filter input {
    margin-left: 0.5rem;
    min-width: 12rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.9375rem;
    border: 1px solid var(--app-border);
    border-radius: 0.5rem;
    background: #fff;
    color: var(--app-heading);
}

.app-data-ui .dataTables_wrapper .dataTables_filter input:focus {
    outline: none;
    border-color: #a5b4fc;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* Pagination + info: see assets/css/datatables-pagination.css (linked after DataTables CSS) */

/* List table */
.app-data-ui .app-data-ui__table {
    font-size: 0.9375rem;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid var(--app-border);
    border-radius: 0.65rem;
    overflow: hidden;
}

.app-data-ui .app-data-ui__table thead th {
    font-size: 0.8125rem;
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0.02em;
    color: #1e293b;
    background: linear-gradient(180deg, #f1f5f9 0%, #e2e8f0 100%) !important;
    border-bottom: 1px solid var(--app-border) !important;
    padding: 0.85rem 0.75rem;
    vertical-align: middle;
}

.app-data-ui .app-data-ui__table thead tr.table-success th,
.app-data-ui .app-data-ui__table thead tr.table-weight-header th {
    background: linear-gradient(180deg, #eef2ff 0%, #e0e7ff 100%) !important;
    color: #312e81;
    border-color: #c7d2fe !important;
}

.app-data-ui .app-data-ui__table tbody td {
    padding: 0.75rem 0.75rem;
    vertical-align: middle;
    border-color: #f1f5f9 !important;
    color: #334155;
}

.app-data-ui .app-data-ui__table tbody a {
    color: #2563eb;
    font-weight: 600;
    text-decoration: none;
}

.app-data-ui .app-data-ui__table tbody a:hover {
    text-decoration: underline;
}

.app-data-ui .app-data-ui__table tbody tr:nth-child(even) td {
    background: #fafbfc;
}

.app-data-ui .app-data-ui__table tbody tr:hover td {
    background: #f8fafc;
}

.app-data-ui .app-data-ui__table tfoot td,
.app-data-ui .app-data-ui__table tfoot th {
    font-size: 0.9375rem;
    padding: 0.85rem 0.75rem;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%) !important;
    color: var(--app-heading);
    border-top: 2px solid var(--app-border) !important;
    font-weight: 700;
    vertical-align: middle;
}

.app-data-ui .app-data-ui__table tfoot tr.table-info td,
.app-data-ui .app-data-ui__table tfoot tr.table-info th {
    background: linear-gradient(180deg, #eff6ff 0%, #e0f2fe 100%) !important;
    color: #0c4a6e;
    border-color: #bae6fd !important;
}

.app-data-ui .app-data-ui__table.dataTable {
    margin-top: 0 !important;
}

.app-data-ui table.dataTable.no-footer {
    border-bottom: 1px solid var(--app-border) !important;
}

.app-data-ui .dataTables_wrapper .dataTables_scrollHead table,
.app-data-ui .dataTables_wrapper .dataTables_scrollBody table {
    border-radius: 0;
}

.app-data-ui .dataTables_wrapper .dataTables_scrollBody table thead,
.app-data-ui .dataTables_wrapper .dataTables_scrollBody table thead tr,
.app-data-ui .dataTables_wrapper .dataTables_scrollBody table thead th,
.app-data-ui .dataTables_wrapper .dataTables_scrollBody table thead td {
    height: 0 !important;
    min-height: 0 !important;
    max-height: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    margin: 0 !important;
    border-top: none !important;
    border-bottom: none !important;
    border-color: transparent !important;
    background: transparent !important;
    font-size: 0 !important;
    line-height: 0 !important;
    visibility: hidden !important;
}

.app-data-ui .dataTables_empty {
    padding: 2rem 1rem !important;
    font-size: 0.9375rem;
    color: var(--app-muted);
}

.app-data-ui .app-data-ui__table.dataTable {
    margin-top: 0 !important;
}

.app-data-ui table.dataTable.no-footer {
    border-bottom: 1px solid var(--app-border) !important;
}

.app-data-ui .dataTables_wrapper .dataTables_scrollHead table,
.app-data-ui .dataTables_wrapper .dataTables_scrollBody table {
    border-radius: 0;
}

.app-data-ui .dataTables_empty {
    padding: 2rem 1rem !important;
    font-size: 0.9375rem;
    color: var(--app-muted);
}

/* -------------------------------------------------------------------------- */
/* Flatpickr: use type="text" + class app-data-ui__date (not native type=date) */
/* -------------------------------------------------------------------------- */
.app-data-ui .app-data-ui__date {
    cursor: pointer;
    background-color: #fff;
}

.flatpickr-calendar.open {
    z-index: 2005;
}

/* -------------------------------------------------------------------------- */
/* Select2: pass dropdownCssClass: 'app-data-ui-select2-dropdown' in JS       */
/* -------------------------------------------------------------------------- */
.app-data-ui .select2-container--default .select2-selection--single {
    min-height: 2.35rem;
    border: 1px solid var(--app-border);
    border-radius: 0.5rem;
    background-color: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.app-data-ui .select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 2.2rem;
    padding-left: 0.75rem;
    padding-right: 2rem;
    font-size: 0.875rem;
    color: var(--app-heading);
    text-transform: none;
}

.app-data-ui .select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 2.2rem;
}

.app-data-ui .select2-container--default.select2-container--focus .select2-selection--single {
    border-color: #a5b4fc;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.select2-container--open .app-data-ui-select2-dropdown {
    z-index: 2005 !important;
    border-color: var(--app-border);
    border-radius: 0.5rem;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
    overflow: hidden;
}

.app-data-ui-select2-dropdown .select2-results__option {
    font-size: 0.875rem;
    padding: 0.45rem 0.75rem;
    text-transform: none;
}

.app-data-ui-select2-dropdown .select2-search--dropdown .select2-search__field {
    border-radius: 0.35rem;
    border-color: var(--app-border);
    font-size: 0.875rem;
}

.app-data-ui-select2-dropdown .select2-results__option--highlighted.select2-results__option--selectable {
    background: linear-gradient(90deg, #4f46e5 0%, #4338ca 100%) !important;
    color: #fff !important;
}
