/* Modern data table — dashboard style */

.data-table-wrapper {
    position: relative;
}

.data-table-wrapper--embed,
.data-table-wrapper--no-selection {
    padding-bottom: 0;
}

.data-table-card .card-body {
    padding: 0;
}

/* List block: toolbar panel + table card */
.data-table-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.dt-toolbar-panel {
    border: 1px solid #e9ecef;
    border-radius: 12px;
    background: #fff;
}

.dt-toolbar-panel .card-body {
    padding: 0.5rem 0.85rem;
}

.dt-toolbar-inner {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    width: 100%;
}

.dt-toolbar-search-group {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    flex-shrink: 0;
    min-width: 0;
}

.dt-toolbar-filters {
    display: inline-flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
    margin-left: auto;
}

.dt-toolbar-filters .form-select {
    min-width: 9.5rem;
    max-width: 14rem;
    border-radius: 8px;
    border-color: #dee2e6;
    font-size: 0.8125rem;
    padding-top: 0.3rem;
    padding-bottom: 0.3rem;
}

.dt-filter-select-wrap {
    position: relative;
    min-width: 10.5rem;
}

.dt-filter-select-wrap--wide {
    min-width: 12rem;
}

.dt-filter-select-icon {
    position: absolute;
    left: 0.6rem;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
    font-size: 0.85rem;
    pointer-events: none;
    z-index: 2;
}

.dt-filter-select-wrap .form-select {
    padding-left: 1.85rem;
}

.dt-filter-btn,
.dt-toolbar-btn {
    border-radius: 8px;
    padding: 0.28rem 0.65rem;
    min-height: 31px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    flex-shrink: 0;
}

.dt-toolbar-search {
    width: min(28rem, 42vw);
    min-width: 10rem;
}

.dt-search-field {
    position: relative;
    display: flex;
    align-items: center;
}

.dt-search-icon {
    position: absolute;
    left: 0.65rem;
    color: #adb5bd;
    font-size: 0.85rem;
    pointer-events: none;
    z-index: 2;
}

.dt-search-field .form-control {
    border-radius: 999px;
    padding: 0.32rem 2rem 0.32rem 2rem;
    font-size: 0.8125rem;
    border-color: #dee2e6;
    background: #f8f9fb;
}

.dt-search-field .form-control:focus {
    background: #fff;
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.15rem rgba(13, 110, 253, 0.15);
}

.dt-search-clear {
    position: absolute;
    right: 0.35rem;
    border: none;
    background: transparent;
    color: #6c757d;
    width: 1.65rem;
    height: 1.65rem;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
    z-index: 2;
}

.dt-search-clear:hover {
    background: #e9ecef;
    color: #212529;
}

.data-table-toolbar {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #eef0f2;
}

@media (max-width: 992px) {
    .dt-toolbar-inner {
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    .dt-toolbar-search-group {
        flex: 1 1 100%;
        width: 100%;
    }

    .dt-toolbar-search {
        flex: 1 1 auto;
        width: auto;
        max-width: none;
    }

    .dt-toolbar-filters {
        flex: 1 1 100%;
        margin-left: 0;
        justify-content: flex-end;
        flex-wrap: wrap;
    }
}

.data-table-responsive {
    overflow-x: auto;
}

.table.data-table {
    margin-bottom: 0;
    border-radius: 0;
    box-shadow: none;
    font-size: 0.925rem;
}

.table.data-table.table-bordered {
    border: 1px solid #e9ecef;
}

.table.data-table.table-bordered td,
.table.data-table.table-bordered th {
    border-color: #e9ecef;
}

.table.data-table.table-sm {
    font-size: 0.85rem;
}

.table.data-table thead.table-header-danger th {
    background: #ffebee;
    color: #c62828;
}

.data-table-footer--compact {
    border-top: 1px solid #eef0f2;
}

.table.data-table thead {
    background: #f8f9fb;
    color: #5c6570;
}

.table.data-table thead th {
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: none;
    letter-spacing: 0.01em;
    border-bottom: 1px solid #e9ecef;
    padding: 0.75rem 1rem;
    white-space: nowrap;
    vertical-align: middle;
}

.table.data-table thead th .sort-icon {
    opacity: 0.45;
    font-size: 0.7rem;
    margin-left: 0.25rem;
}

.table.data-table tbody td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid #f1f3f5;
    vertical-align: middle;
    color: #212529;
}

.table.data-table tbody tr {
    transition: background-color 0.15s ease;
}

.table.data-table tbody tr:hover {
    background-color: #f8f9fa;
    transform: none;
}

.table.data-table tbody tr.row-selected {
    background-color: #f0f4ff;
}

.table.data-table .col-check {
    width: 44px;
    text-align: center;
}

.table.data-table .form-check-input {
    width: 1.1em;
    height: 1.1em;
    cursor: pointer;
    border-radius: 0.25em;
}

.table.data-table .form-check-input:checked {
    background-color: #212529;
    border-color: #212529;
}

/* Status pills */
.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
}

.status-pill-success { background: #e8f5e9; color: #2e7d32; }
.status-pill-warning { background: #fff3e0; color: #e65100; }
.status-pill-danger { background: #ffebee; color: #c62828; }
.status-pill-info { background: #e3f2fd; color: #1565c0; }

/* Action icon buttons */
.btn-action-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    background: #fff;
    color: #495057;
    transition: all 0.15s ease;
}

.btn-action-icon:hover {
    background: #f8f9fa;
    border-color: #dee2e6;
    transform: none;
    box-shadow: none;
}

.btn-action-icon-danger:hover {
    color: #dc3545;
    border-color: #f5c2c7;
    background: #fff5f5;
}

/* Footer: entries + page size + pagination */
.data-table-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid #eef0f2;
    background: #fff;
}

.data-table-footer-left {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    color: #6c757d;
    font-size: 0.875rem;
}

.data-table-page-size {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.data-table-page-size .form-select {
    width: auto;
    min-width: 4.5rem;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    padding: 0.35rem 2rem 0.35rem 0.65rem;
    font-size: 0.875rem;
}

.data-table-pagination {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.data-table-pagination .page-btn {
    min-width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: #495057;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.15s ease;
}

.data-table-pagination .page-btn:hover:not(.disabled):not(.active) {
    background: #f1f3f5;
    color: #212529;
}

.data-table-pagination .page-btn.active {
    background: #0d6efd;
    color: #fff;
}

.data-table-pagination .page-btn.disabled {
    opacity: 0.4;
    pointer-events: none;
}

.data-table-pagination .page-ellipsis {
    min-width: 28px;
    text-align: center;
    color: #adb5bd;
}

/* Floating selection bar — template: popup cố định giữa đáy viewport, luôn nổi trên khi cuộn */
.selection-action-bar {
    position: fixed;
    bottom: 1.75rem;
    left: 50%;
    z-index: 1080;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 0.85rem 0.65rem 1.15rem;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid #e9ecef;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateX(-50%) translateY(1.5rem);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s ease, visibility 0.2s ease;
}

.selection-action-bar.is-visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.selection-action-bar .selection-count {
    font-size: 0.9rem;
    color: #212529;
    padding-right: 0.5rem;
    border-right: 1px solid #e9ecef;
    margin-right: 0.25rem;
    white-space: nowrap;
}

.selection-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.85rem;
    border: none;
    border-radius: 8px;
    background: transparent;
    font-size: 0.875rem;
    font-weight: 500;
    color: #495057;
    cursor: pointer;
    transition: background 0.15s ease;
}

.selection-action-btn:hover {
    background: #f8f9fa;
}

.selection-action-delete {
    color: #dc3545;
}

.selection-action-delete:hover {
    background: #fff5f5;
}

.selection-action-close {
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #6c757d;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 0.25rem;
    cursor: pointer;
}

.selection-action-close:hover {
    background: #f1f3f5;
    color: #212529;
}

@media (max-width: 576px) {
    .data-table-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .selection-action-bar {
        left: 1rem;
        right: 1rem;
        width: auto;
        transform: translateX(0) translateY(1.5rem);
    }

    .selection-action-bar.is-visible {
        transform: translateX(0) translateY(0);
    }
}
