/*-----------------------------------------------------------------------------------------------*/
/* Configuracoes do formset
/*-----------------------------------------------------------------------------------------------*/
.table-formset {
    margin-bottom: 0;
}
.table-formset td {
    background-color: transparent;
}
.table-formset a.formset-btn-add {
    min-width: 5rem;
}
.table-formset tr td:last-child a.formset-btn-remove {
    min-width: 5rem;
    margin-top: 0.2rem;
}
.table-formset div.formset-remove-container label {
    display: block;
}
.table-formset:not(.no-labels) tr.dynamic-form.show td:last-child div:first-child,
.table-formset:not(.no-labels) tr.dynamic-form.show td:last-child div:first-child > .form-check {
    margin-bottom: 0 !important;
}
/* no-labels */
.table-formset.no-labels tr.dynamic-form div.mb-3 {
    margin-bottom: 0.5rem !important;
}
/* remove os labels das linhas (exceto primeira) */
.table-formset.no-labels tr.dynamic-form label.form-label {
    display: none;
}
.table-formset.no-labels tr.dynamic-form:nth-child(1 of .show) label.form-label {
/* .table-formset.no-labels tr.dynamic-form.show:first-of-type label.form-label,
.table-formset.no-labels tr.dynamic-form:not(.show) + tr.dynamic-form.show label.form-label { */
    display: inline-block !important;
}
.table-formset.no-labels tr.dynamic-form:nth-child(n+2 of .show) td:last-child div:first-child {
/* .table-formset.no-labels tr.dynamic-form:not(.show) + tr.dynamic-form.show ~ tr.dynamic-form.show td:last-child div:first-child { */
    display: none;
}
/* readonly */
.table-formset.readonly tr.dynamic-form:nth-last-child(1 of .show) td:nth-last-child(2) *:last-child {
    margin-bottom: 0 !important;
}
/* sortable */
.formset-sortable-icon {
    --top: 40px;
    --top-no-labels: 16px;
    --color: black;
    --color-selected: green;
}
.formset-sortable-icon::before {
    content: '';
    position: absolute;
    left: 0;
    top: var(--top);
    width: 100%;
    height: 100%;
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'%3E%3Cdefs%3E%3Cstyle%3E.fa-secondary%7Bopacity:.4%7D%3C/style%3E%3C/defs%3E%3Cpath d='M512 304v32a16 16 0 0 1-16 16H16a16 16 0 0 1-16-16v-32a16 16 0 0 1 16-16h480a16 16 0 0 1 16 16z' class='fa-secondary'/%3E%3Cpath d='M512 176v32a16 16 0 0 1-16 16H16a16 16 0 0 1-16-16v-32a16 16 0 0 1 16-16h480a16 16 0 0 1 16 16z' class='fa-primary'/%3E%3C/svg%3E%0A");
    mask-repeat: no-repeat;
    mask-size: 14px 14px;
    mask-position: top;
    background-color: var(--color);
}
.table-formset.formset-sortable tr.dynamic-form.show.sortable-ghost .formset-sortable-icon::before {
    mask-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D%220%200%20512%20512%22%3E%3Cpath%20d%3D%22M334.5%20414c8.8%203.8%2019%202%2026-4.6l144-136c4.8-4.5%207.5-10.8%207.5-17.4s-2.7-12.9-7.5-17.4l-144-136c-7-6.6-17.2-8.4-26-4.6s-14.5%2012.5-14.5%2022l0%2072L32%20192c-17.7%200-32%2014.3-32%2032l0%2064c0%2017.7%2014.3%2032%2032%2032l288%200%200%2072c0%209.6%205.7%2018.2%2014.5%2022z%22%2F%3E%3C%2Fsvg%3E");
    background-color: var(--color-selected);
}
.table-formset.formset-sortable.no-labels tr.dynamic-form:nth-child(n+2 of .show) .formset-sortable-icon::before { 
    top: var(--top-no-labels);
}
.formset-sortable-handle {
    position: relative;
    width: 24px;
    cursor: grab;
}
.table-formset:not(.formset-sortable) .formset-sortable-handle {
    display: none;
}
/* small (sm) */
@media screen and (max-width:767px) {
    /* cada campo em uma linha */
    .table-formset td {
        width: 100% !important;
        float: left !important;
    }
    /* diminui os espacos entre os componentes */
    .table-formset tr.dynamic-form div.mb-3 {
        margin-bottom: 0.5rem !important;
    }    
    /* remove o espaco entre o ultimo campo e o botao apagar */
    .table-formset tr.dynamic-form td:last-child div:first-child {
        display: none !important;
    }    
    /* mostra todos os labels */
    .table-formset tr.dynamic-form label.form-label,
    .table-formset.no-labels tr.dynamic-form label.form-label {
        display: inline-block !important;
    }
    /* reposiciona o botao de apagar */
    .table-formset tr td:last-child a.formset-btn-remove {
        margin-top: -5px;
    }
    /* adiciona separador entre as linhas */
    .table-formset {
        --mobile-divider-spacing: 10px;
        --mobile-divider-border: 1px dotted #ccc;
    }
    .table-formset tr.dynamic-form:not(:nth-last-child(2)) td:last-child,
    .table-formset.readonly tr.dynamic-form:not(:nth-last-child(1 of .show)) td:nth-last-child(2) {
        padding-bottom: var(--mobile-divider-spacing);
        margin-bottom: var(--mobile-divider-spacing);
        border-bottom: var(--mobile-divider-border);
    }
    /* sortable */
    .formset-sortable-handle {
        height: 30px;
        margin-top: -5px;
        margin-bottom: -25px;
    }
    .table-formset.formset-sortable tr.dynamic-form .formset-sortable-icon::before {
        top: 0 !important;
        mask-position: center !important;
    }
    .table-formset.formset-sortable tr.dynamic-form.show.sortable-ghost .formset-sortable-icon::before {
        mask-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20320%20512%22%3E%3Cpath%20d%3D%22M2%20334.5c-3.8%208.8-2%2019%204.6%2026l136%20144c4.5%204.8%2010.8%207.5%2017.4%207.5s12.9-2.7%2017.4-7.5l136-144c6.6-7%208.4-17.2%204.6-26s-12.5-14.5-22-14.5l-72%200%200-288c0-17.7-14.3-32-32-32L128%200C110.3%200%2096%2014.3%2096%2032l0%20288-72%200c-9.6%200-18.2%205.7-22%2014.5z%22%2F%3E%3C%2Fsvg%3E");
    }
}