/**
 * A-MIS global admin tables — list pages, DataTables, dashboard widgets, modals.
 */

.main-content .table,
.main-content table.dataTable,
.modal .table,
.modal table.dataTable {
    color: #334155;
    margin-bottom: 0;
}

/* Override Stisla fixed 60px row height */
.main-content .table:not(.table-sm):not(.table-md) td,
.main-content .table:not(.table-sm):not(.table-md) th,
.main-content table.dataTable tbody td,
.main-content table.dataTable tbody th,
.main-content table.dataTable thead td,
.main-content table.dataTable thead th,
.modal .table:not(.table-sm):not(.table-md) td,
.modal .table:not(.table-sm):not(.table-md) th,
.modal table.dataTable tbody td,
.modal table.dataTable tbody th,
.modal table.dataTable thead td,
.modal table.dataTable thead th {
    height: auto !important;
}

/* Headers */
.main-content .table thead th,
.main-content .table thead td,
.main-content table.dataTable thead th,
.main-content table.dataTable thead td {
    background: #f8fafc !important;
    color: #64748b !important;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid #e2e8f0 !important;
    border-top: none !important;
    padding: 0.7rem 0.85rem !important;
    vertical-align: middle;
    white-space: nowrap;
}

.main-content .table thead.table-light th,
.main-content .table thead.table-light td {
    background: #f8fafc !important;
    color: #64748b !important;
}

/* Body cells */
.main-content .table tbody td,
.main-content .table tbody th,
.main-content table.dataTable tbody td,
.main-content table.dataTable tbody th {
    padding: 0.65rem 0.85rem !important;
    vertical-align: middle;
    font-size: 0.875rem;
    color: #334155;
    border-color: #e2e8f0;
}

.main-content .table:not(.table-bordered) td,
.main-content .table:not(.table-bordered) th {
    border-top: none;
}

.main-content .table.table-bordered,
.main-content .table.table-bordered td,
.main-content .table.table-bordered th,
.main-content table.dataTable.table-bordered,
.main-content table.dataTable.table-bordered td,
.main-content table.dataTable.table-bordered th {
    border-color: #e2e8f0 !important;
}

/* Striped & hover */
.main-content .table-striped tbody tr:nth-of-type(odd),
.main-content table.dataTable.table-striped tbody tr:nth-of-type(odd),
.main-content table.dataTable.stripe tbody tr.odd,
.main-content table.dataTable.display tbody tr.odd {
    background-color: #f8fafc;
}

.main-content .table-hover tbody tr:hover,
.main-content table.dataTable.hover tbody tr:hover,
.main-content table.dataTable.display tbody tr:hover {
    background-color: #f1f5fe !important;
}

.main-content .table tbody tr,
.main-content table.dataTable tbody tr {
    transition: background-color 0.12s ease;
}

/* Compact variant */
.main-content .table.table-sm thead th,
.main-content .table.table-sm tbody td,
.main-content .table.table-sm tbody th {
    padding: 0.45rem 0.65rem !important;
    font-size: 0.8125rem;
}

.main-content .table.table-sm thead th {
    font-size: 0.68rem;
}

/* Borderless detail tables */
.main-content .table.table-borderless tbody td,
.main-content .table.table-borderless tbody th {
    padding: 0.35rem 0 !important;
    border: none !important;
}

.main-content .table.table-borderless tbody tr:hover {
    background: transparent !important;
}

/* Links & actions */
.main-content .table a:not(.btn) {
    color: #0f172a;
    font-weight: 500;
    text-decoration: none;
}

.main-content .table a:not(.btn):hover {
    color: #6777ef;
    text-decoration: underline;
}

.main-content .table .btn {
    font-size: 0.8125rem;
}

.main-content .table .btn-icon,
.main-content .table .btn-icon-split {
    margin-right: 0.15rem;
}

.main-content .table .badge {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

/* Card-wrapped tables */
.main-content .card .card-body > .table-responsive,
.main-content .card .card-body > .dataTables_wrapper {
    margin: 0;
}

.main-content .card .card-body > .table-responsive:not(:first-child),
.main-content .card .card-body > .dataTables_wrapper:not(:first-child) {
    margin-top: 0.5rem;
}

.main-content .card .card-body > .table-responsive {
    border: 1px solid #e2e8f0;
    background: #fff;
}

.main-content .card .card-body > .table-responsive > .table,
.main-content .card .card-body > .table-responsive > table.dataTable {
    margin-bottom: 0;
}

.main-content .card .card-body > .table:last-child,
.main-content .card .card-body > .table-responsive:last-child,
.main-content .card .card-body > .dataTables_wrapper:last-child {
    margin-bottom: 0;
}

/* Dashboard invoice / widget tables */
.main-content .table-invoice .table thead th {
    font-size: 0.68rem;
}

.main-content .table-invoice .table tbody td {
    font-size: 0.8125rem;
}

/* DataTables wrapper */
.main-content .dataTables_wrapper {
    padding: 0 !important;
    font-size: 0.875rem !important;
}

.main-content .dataTables_wrapper .row:first-child {
    align-items: center;
    margin-bottom: 0.85rem;
}

.main-content .dataTables_wrapper .dataTables_length label,
.main-content .dataTables_wrapper .dataTables_filter label {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #64748b;
}

.main-content .dataTables_wrapper .dataTables_filter input,
.main-content .dataTables_wrapper .dataTables_length select {
    border: 1px solid #e2e8f0;
    min-height: 34px;
    padding: 0.35rem 0.65rem;
    font-size: 0.875rem;
    color: #334155;
    background: #fff;
    margin: 0 0.35rem;
}

.main-content .dataTables_wrapper .dataTables_filter input:focus,
.main-content .dataTables_wrapper .dataTables_length select:focus {
    border-color: #6777ef;
    outline: none;
    box-shadow: 0 0 0 2px rgba(103, 119, 239, 0.15);
}

.main-content .dataTables_wrapper .dataTables_info {
    color: #64748b;
    font-size: 0.8125rem;
    padding-top: 0.85rem;
}

.main-content .dataTables_wrapper .dataTables_paginate {
    padding-top: 0.85rem;
}

.main-content .dataTables_wrapper .dataTables_paginate .paginate_button {
    border: 1px solid #e2e8f0 !important;
    padding: 0.35rem 0.7rem !important;
    margin-left: 0.2rem !important;
    color: #475569 !important;
    background: #fff !important;
    font-size: 0.8125rem !important;
    font-weight: 500;
    line-height: 1.4;
}

.main-content .dataTables_wrapper .dataTables_paginate .paginate_button.current,
.main-content .dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: #6777ef !important;
    border-color: #6777ef !important;
    color: #fff !important;
}

.main-content .dataTables_wrapper .dataTables_paginate .paginate_button:hover:not(.disabled):not(.current) {
    background: #f1f5fe !important;
    border-color: #6777ef !important;
    color: #6777ef !important;
}

.main-content .dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
.main-content .dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {
    opacity: 0.45;
    cursor: default;
    background: #f8fafc !important;
    color: #94a3b8 !important;
    border-color: #e2e8f0 !important;
}

.main-content table.dataTable.no-footer {
    border-bottom: 1px solid #e2e8f0 !important;
}

.main-content .dataTables_wrapper .dataTables_processing {
    background: rgba(255, 255, 255, 0.92) !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08) !important;
}

/* Sort icons */
.main-content table.dataTable thead .sorting,
.main-content table.dataTable thead .sorting_asc,
.main-content table.dataTable thead .sorting_desc {
    background-image: none !important;
    position: relative;
    padding-right: 1.35rem !important;
}

.main-content table.dataTable thead .sorting:before,
.main-content table.dataTable thead .sorting_asc:before,
.main-content table.dataTable thead .sorting_desc:before {
    position: absolute;
    right: 0.65rem;
    top: 50%;
    transform: translateY(-50%);
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    font-size: 0.65rem;
    color: #94a3b8;
    opacity: 0.7;
}

.main-content table.dataTable thead .sorting:before {
    content: '\f0dc';
}

.main-content table.dataTable thead .sorting_asc:before {
    content: '\f0de';
    color: #6777ef;
    opacity: 1;
}

.main-content table.dataTable thead .sorting_desc:before {
    content: '\f0dd';
    color: #6777ef;
    opacity: 1;
}

/* Empty & loading states */
.main-content .dataTables_empty {
    padding: 2rem 1rem !important;
    text-align: center;
    color: #64748b;
    font-size: 0.875rem;
}

.main-content .table td.dataTables_empty {
    padding: 2rem 1rem !important;
}

@media (max-width: 767px) {
    .main-content .dataTables_wrapper .dataTables_length,
    .main-content .dataTables_wrapper .dataTables_filter {
        text-align: left;
        margin-bottom: 0.65rem;
    }

    .main-content .dataTables_wrapper .dataTables_filter label {
        width: 100%;
    }

    .main-content .dataTables_wrapper .dataTables_filter input {
        flex: 1;
        min-width: 0;
    }

    .main-content .table-responsive {
        border: 1px solid #e2e8f0;
    }
}
