
/**
 * GLOBAL ACTIONS
 * Toolbar flutuante para botões de ação
 *
 * Compatível com:
 * - Bootstrap 4
 * - DataTables
 * - Layout responsivo
 */

/* ==========================================
   CONTAINER DAS AÇÕES
========================================== */

.global-actions {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    vertical-align: middle;
}

/* Centraliza na coluna do DataTables */
td.dt-global-actions {
    text-align: center !important;
    vertical-align: middle !important;
    white-space: nowrap;
}

/* ==========================================
   BOTÃO DE TRÊS PONTOS VERTICAIS
========================================== */

.global-actions-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 36px;
    height: 36px;
    min-width: 36px;

    padding: 0;
    margin: 0;

    border: 1px solid #dddddd;
    border-radius: 6px;

    background: #ffffff;
    color: #444444;

    font-family: Arial, sans-serif;
    font-size: 23px;
    font-weight: bold;
    line-height: 1;

    cursor: pointer;

    transition:
        background-color 0.15s ease,
        border-color 0.15s ease,
        color 0.15s ease;
}

/* Hover */
.global-actions-toggle:hover {
    background: #f5f5f5;
    border-color: #bbbbbb;
    color: #111111;
}

/* Botão ativo */
.global-actions-toggle.active {
    background: #f0f0f0;
    border-color: #aaaaaa;
    color: #111111;
}

/* Remove destaque padrão */
.global-actions-toggle:focus {
    outline: none;
}

/* Destaque para navegação por teclado */
.global-actions-toggle:focus-visible {
    outline: 2px solid #80bdff;
    outline-offset: 2px;
}

/* ==========================================
   TOOLBAR FLUTUANTE
========================================== */

.global-actions-toolbar {
    position: fixed;

    z-index: 999999;

    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;

    gap: 5px;

    padding: 7px;

    background: #ffffff;

    border: 1px solid #e5e5e5;
    border-radius: 8px;

    box-shadow:
        0 5px 20px rgba(0, 0, 0, 0.18);

    white-space: nowrap;

    /* Oculta inicialmente */
    visibility: hidden;
    opacity: 0;
    pointer-events: none;

    transition: opacity 0.12s ease;
}

/* Toolbar aberta */
.global-actions-toolbar.open {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

/* ==========================================
   BOTÕES DENTRO DA TOOLBAR
========================================== */

.global-actions-toolbar > a,
.global-actions-toolbar > button,
.global-actions-toolbar > input[type="button"],
.global-actions-toolbar > input[type="submit"] {

    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-width: 36px;
    height: 36px;

    padding: 6px 9px;
    margin: 0 !important;

    border-radius: 5px;

    text-align: center;
    vertical-align: middle;

    cursor: pointer;

    flex-shrink: 0;
}

/* Ícones */
.global-actions-toolbar i {
    font-size: 14px;
    line-height: 1;
}

/* Efeito hover */
.global-actions-toolbar > a:hover,
.global-actions-toolbar > button:hover {
    opacity: 0.85;
}

/* Preserva as cores originais dos botões */
.global-actions-toolbar .btn {
    box-shadow: none;
}

/* ==========================================
   APENAS UM BOTÃO
========================================== */

.global-actions.single {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.global-actions.single > a,
.global-actions.single > button,
.global-actions.single > input {
    margin: 0 !important;
}

/* ==========================================
   PLACEHOLDER INTERNO
========================================== */

.global-actions-placeholder {
    display: none !important;
}

/* ==========================================
   DATATABLES
========================================== */

/* Evita quebra na coluna de ações */
table.dataTable td.dt-global-actions {
    white-space: nowrap;
}

/* Mantém a célula compacta */
table.dataTable td.dt-global-actions .global-actions {
    margin: 0 auto;
}

/* ==========================================
   RESPONSIVIDADE
========================================== */

@media (max-width: 768px) {

    .global-actions-toggle {
        width: 36px;
        height: 36px;
        min-width: 36px;
    }

    .global-actions-toolbar {
        padding: 6px;
        gap: 4px;

        max-width: calc(100vw - 16px);

        flex-wrap: wrap;
        white-space: normal;
    }

    .global-actions-toolbar > a,
    .global-actions-toolbar > button,
    .global-actions-toolbar > input {

        min-width: 36px;
        height: 36px;

        padding: 6px;
    }
}

/* Telas muito pequenas */
@media (max-width: 400px) {

    .global-actions-toolbar {
        gap: 3px;
        padding: 5px;
    }

    .global-actions-toolbar > a,
    .global-actions-toolbar > button,
    .global-actions-toolbar > input {

        min-width: 34px;
        height: 34px;
    }
}