/**
 * Framework Tecno
 * @author Anderson Carlos <anderson.carlos@tecnoprog.com.br>
 * @copyright Tecnoprog © 2019, Tecnoprog Informatica e Eletronica LTDA - ME.
 *
 * Overrides finais do DataTables (apos Bootstrap |inline).
 * Emitido por ultimo no <head> pelo Html.php (#erp-css-late).
 *
 * Visual alinhado ao Cork dt-global_style: linhas compactas,
 * select de paginas com borda e fundo cinza claro.
 */

/* --- Linhas compactas --- */
table.dataTable.table,
table.dataTable {
    border-collapse: collapse !important;
    border-spacing: 0 !important;
}

/**
 * table-bordered + border-collapse:separate do DataTables fazia
 * border-bottom da celula + borda da tabela parecerem 2px na horizontal.
 * Uma unica linha fina por linha (estilo Cork).
 */
table.dataTable.table-bordered,
table.dataTable.table-bordered td,
table.dataTable.table-bordered th {
    border: none !important;
}

table.dataTable.table > thead > tr > th,
table.dataTable.table > tbody > tr > td,
table.dataTable > thead > tr > th,
table.dataTable > tbody > tr > td {
    padding: 0.4rem 0.6rem !important;
    vertical-align: middle;
    font-size: 13px;
    letter-spacing: 1px;
    border: none !important;
    border-bottom: 1px solid #e0e6ed !important;
}

/**
 * Espaco a direita para as setas de ordenacao (DataTables ::before/::after).
 * O padding compacto acima sobrescrevia o padding-right:30px padrao.
 */
table.dataTable.table > thead > tr > th.sorting,
table.dataTable.table > thead > tr > th.sorting_asc,
table.dataTable.table > thead > tr > th.sorting_desc,
table.dataTable.table > thead > tr > th.sorting_asc_disabled,
table.dataTable.table > thead > tr > th.sorting_desc_disabled,
table.dataTable > thead > tr > th.sorting,
table.dataTable > thead > tr > th.sorting_asc,
table.dataTable > thead > tr > th.sorting_desc,
table.dataTable > thead > tr > th.sorting_asc_disabled,
table.dataTable > thead > tr > th.sorting_desc_disabled,
table.dataTable thead th.sorting,
table.dataTable thead th.sorting_asc,
table.dataTable thead th.sorting_desc {
    padding-right: 1.75rem !important;
    position: relative;
}

table.dataTable thead .sorting:before,
table.dataTable thead .sorting_asc:before,
table.dataTable thead .sorting_desc:before,
table.dataTable thead .sorting_asc_disabled:before,
table.dataTable thead .sorting_desc_disabled:before,
table.dataTable thead .sorting:after,
table.dataTable thead .sorting_asc:after,
table.dataTable thead .sorting_desc:after,
table.dataTable thead .sorting_asc_disabled:after,
table.dataTable thead .sorting_desc_disabled:after {
    z-index: 1;
}

table.dataTable.table > thead > tr > th,
table.dataTable > thead > tr > th {
    color: #1b55e2;
    font-weight: 700;
    text-transform: uppercase;
}

table.dataTable.table > tbody > tr > td,
table.dataTable > tbody > tr > td {
    color: #888ea8;
    font-weight: 500;
}

table.dataTable.table-striped tbody tr:nth-of-type(odd),
table.dataTable.table-striped > tbody > tr:nth-of-type(odd) {
    background-color: transparent !important;
}

table.dataTable.table-hover:not(.table-dark) tbody tr:hover,
table.dataTable.table-hover:not(.table-dark) > tbody > tr:hover {
    background-color: #f1f2f3 !important;
}

/* --- Resultados por pagina --- */
div.dataTables_wrapper div.dataTables_length label {
    font-weight: normal;
    text-align: left;
    white-space: nowrap;
    margin-bottom: 0;
    color: #3b3f5c;
}

div.dataTables_wrapper div.dataTables_length select,
div.dataTables_wrapper div.dataTables_length select.custom-select,
div.dataTables_wrapper div.dataTables_length select.form-control,
div.dataTables_wrapper div.dataTables_length select.custom-select-sm,
div.dataTables_wrapper div.dataTables_length select.form-control-sm,
div.dataTables_wrapper div.dataTables_length select.custom-select.custom-select-sm.form-control.form-control-sm {
    width: auto !important;
    max-width: 5.5rem !important;
    min-width: 3.75rem !important;
    display: inline-block !important;
    flex: 0 0 auto !important;
    vertical-align: middle;
    height: auto !important;
    padding: 6px 28px 6px 10px !important;
    font-size: 13px !important;
    line-height: 1.4 !important;
    color: #3b3f5c !important;
    background-color: #f1f2f3 !important;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23888ea8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: right 6px center !important;
    background-size: 16px 16px !important;
    border: 1px solid #bfc9d4 !important;
    border-radius: 6px !important;
    box-shadow: none !important;
    box-sizing: border-box;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

div.dataTables_wrapper div.dataTables_length select:focus {
    border-color: #1b55e2 !important;
    outline: 0;
    box-shadow: 0 0 0 0.15rem rgba(27, 85, 226, 0.15) !important;
}

/* --- Busca --- */
div.dataTables_wrapper div.dataTables_filter label {
    font-weight: normal;
    white-space: nowrap;
    margin-bottom: 0;
}

div.dataTables_wrapper div.dataTables_filter input,
div.dataTables_wrapper div.dataTables_filter input.form-control,
div.dataTables_wrapper div.dataTables_filter input.form-control-sm {
    display: inline-block !important;
    width: auto !important;
    min-width: 10rem;
    margin-left: 0.5em;
    vertical-align: middle;
    background-color: #fff !important;
    border: 1px solid #e0e6ed !important;
    border-radius: 6px !important;
    padding: 6px 12px !important;
    font-size: 13px !important;
    box-shadow: none !important;
}

/* --- Paginacao --- */
div.dataTables_wrapper div.dataTables_paginate {
    margin: 0;
    white-space: nowrap;
    text-align: right;
}

div.dataTables_wrapper div.dataTables_paginate ul.pagination {
    margin: 2px 0;
    justify-content: flex-end;
}

div.dataTables_wrapper .dataTables_paginate .paginate_button .page-link,
div.dataTables_wrapper .dataTables_paginate .page-item .page-link {
    text-decoration: none !important;
}

/* --- Coluna de acoes (dd2 / btn-dropdown) --- */
.dt-actions-dropdown {
    display: flex !important;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.dt-actions-dropdown > a.dropdown-toggle::after,
.dt-actions-dropdown > a.dropdown-toggle::before,
.dropdown.dd2 > a.btn-dropdown.dropdown-toggle::after,
.dropdown.dd2 > a.btn-dropdown.dropdown-toggle::before,
.dropdown.dd2 > a.dropdown-toggle::after,
.dropdown.dd2 > a.dropdown-toggle::before,
.action.dropdown > a.btn-dropdown.dropdown-toggle::after,
.action.dropdown > a.btn-dropdown.dropdown-toggle::before,
.action.dropdown > a.dropdown-toggle::after,
.action.dropdown > a.dropdown-toggle::before,
table.dataTable td .dropdown-toggle::after,
table.dataTable td .dropdown-toggle::before {
    display: none !important;
    content: none !important;
    border: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

.dt-actions-dropdown > a,
.dt-actions-dropdown > a:hover,
.dt-actions-dropdown > a:focus,
.dropdown.dd2 > a.btn-dropdown,
.dropdown.dd2 > a.btn-dropdown:hover,
.dropdown.dd2 > a.btn-dropdown:focus,
.dropdown.dd2 > a.dropdown-toggle,
.dropdown.dd2 > a.dropdown-toggle:hover,
.dropdown.dd2 > a.dropdown-toggle:focus {
    text-decoration: none !important;
}

.dt-actions-dropdown > .action-icon,
.dt-actions-dropdown > .btn-dropdown,
.dropdown.dd2 > .btn-dropdown {
    display: inline-flex !important;
    flex: 0 0 30px;
    width: 30px;
    min-width: 30px;
    max-width: 30px;
    height: 30px;
    font-size: 15px;
    line-height: 1;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
}

.dropdown.dd2 .dropdown-menu {
    display: none;
    min-width: 10rem;
    padding: 0.35rem;
    border-radius: 6px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
    z-index: 1060;
}

.dropdown.dd2.show > .dropdown-menu,
.dropdown.dd2 .dropdown-menu.show {
    display: block !important;
}

.dropdown.dd2 .dropdown-menu a.dropdown-item {
    border-radius: 5px;
    font-size: 12px;
    font-weight: 600;
    color: #191919;
    padding: 8px;
    text-decoration: none;
}

.dropdown.dd2 .dropdown-menu a.dropdown-item:hover {
    color: #212121;
    background-color: #e7e7e7;
    text-decoration: none;
}
