/* ============================================================
   BOLSIA - Sistema de Botões de Ações Padrão UX OTIMIZADO
   Versão 2.1 - Cores centralizadas
   
   🎯 PARA ALTERAR AS CORES:
   Edite apenas as variáveis CSS no :root abaixo
   ============================================================ */

/* ============================================================
   CORES ROOT - ALTERE AQUI PARA MUDAR EM TODO O SISTEMA
   ============================================================ */
:root {
    /* Cores principais das ações */
    --bolsi-color-view: #605DFF;        /* Azul Primary - Visualizar */
    --bolsi-color-edit: #00866f;        /* Verde Success - Editar/Salvar */
    --bolsi-color-delete: #FF0000;      /* Vermelho Danger - Excluir */
    --bolsi-color-activate: #CCA000;    /* Teal - Ativar */
    --bolsi-color-inactivate: #FF7000;  /* Amarelo Warning - Inativar */
    --bolsi-color-info: #2DB6F5;        /* Azul Info - Informações */
    --bolsi-color-secondary: #274c77;   /* Cinza Secondary - Voltar/Cancelar */
    --bolsi-color-primary: #006494;     /* Azul Primary BOLSIA (mockup) */
    --bolsi-color-map: #99582a;         /* Marron - Ver no mapa (Google Maps) */
    --bolsi-color-pdf: #003049;         /* Azul escuro - Ver PDF / laudo */
    
    /* Cores de estado */
    --bolsi-color-disabled: #b1b9c1;
    --bolsi-color-disabled-text: #ffffff;
    --bolsi-color-disabled-border: #b1b9c1;
    
    /* Textos */
    --bolsi-text-white: #ffffff;
    --bolsi-text-dark: #000000;
}

/* Botões de Ações - Base */
.btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    text-decoration: none;
    margin: 0 2px;
    flex-shrink: 0;
}

.btn-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn-action:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 🚫 SEM PERMISSÃO - Visual claramente desabilitado */
.btn-action:disabled,
.btn-action.disabled,
.btn-action-no-permission,
.btn-no-permission {
    background-color: var(--bolsi-color-disabled) !important;
    color: var(--bolsi-color-disabled-text) !important;
    border: 1px solid var(--bolsi-color-disabled-border) !important;
    cursor: not-allowed !important;
    opacity: 0.6 !important;
    transform: none !important;
    box-shadow: none !important;
    position: relative;
}

/* Ícones dos botões */
.btn-action i,
.btn-action .icon {
    color: var(--bolsi-text-white);
    font-size: 16px;
}

a.btn-action.btn-action-text,
a.btn-action.btn-action-view,
a.btn-action.btn-action-edit,
a.btn-action.btn-action-delete,
a.btn-action.btn-action-back,
a.btn-action.btn-action-add,
a.btn-action.btn-action-primary,
a.btn-action.btn-action-info,
a.btn-action.btn-action-activate,
a.btn-action.btn-action-inactivate,
a.btn-action.btn-action-map,
a.btn-action.btn-action-pdf,
a.btn-action,
a.btn-action:hover,
a.btn-action:focus,
a.btn-action:visited,
a.btn-action:active {
    color: inherit !important;
    text-decoration: none !important;
}

/* Garantir que o texto e ícones sejam sempre brancos */
a.btn-action .btn-text,
a.btn-action:hover .btn-text,
a.btn-action:focus .btn-text,
a.btn-action:visited .btn-text,
a.btn-action:active .btn-text,
.btn-action .btn-text {
    color: var(--bolsi-text-white) !important;
}

a.btn-action i,
a.btn-action:hover i,
a.btn-action:focus i,
a.btn-action:visited i,
a.btn-action:active i,
.btn-action i,
.btn-action .icon {
    color: var(--bolsi-text-white) !important;
}

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

/* 🔵 AÇÕES INFORMATIVAS - Visualizar */
.btn-action-view {
    background-color: var(--bolsi-color-view);
    color: var(--bolsi-text-white);
}

.btn-action-view:hover {
    background-color: #4b48e0;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(96, 93, 255, 0.35);
}

/* 🟢 AÇÕES POSITIVAS - Editar/Salvar/Atualizar */
.btn-action-edit,
.btn-action-save,
.btn-action-update {
    background-color: var(--bolsi-color-edit);
    color: var(--bolsi-text-white);
}

/* 🔴 AÇÕES DESTRUTIVAS - Excluir */
.btn-action-delete {
    background-color: var(--bolsi-color-delete);
    color: var(--bolsi-text-white);
}

/* ⚫ AÇÕES SECUNDÁRIAS - Voltar/Cancelar */
.btn-action-back,
.btn-action-cancel,
.btn-action-secondary {
    background-color: var(--bolsi-color-secondary);
    color: var(--bolsi-text-white);
}

/* 📄 PDF - Visualizar laudo / PDF */
.btn-action-pdf {
    background-color: var(--bolsi-color-pdf);
    color: var(--bolsi-text-white);
}

.btn-action-pdf:hover {
    background-color: #00456d;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 48, 73, 0.35);
}

/* 🔵 AÇÕES PRIMÁRIAS - Novo/Adicionar */
.btn-action-primary,
.btn-action-add {
    background-color: var(--bolsi-color-primary);
    color: var(--bolsi-text-white);
}

/* 🟡 AÇÕES DE ATIVAÇÃO / ALTERNÂNCIA */
.btn-action-activate {
    background-color: var(--bolsi-color-activate);
    color: var(--bolsi-text-white);
}

.btn-action-activate:hover {
    background-color: #b38e00;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(204, 160, 0, 0.35);
}

/* 🟠 AÇÕES DE INATIVAÇÃO */
.btn-action-inactivate {
    background-color: var(--bolsi-color-inactivate);
    color: var(--bolsi-text-white);
}

.btn-action-inactivate:hover {
    background-color: #e06500;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(255, 112, 0, 0.35);
}

/* 💠 AÇÕES INFORMATIVAS */
.btn-action-info {
    background-color: var(--bolsi-color-info);
    color: var(--bolsi-text-white);
}

.btn-action-info:hover {
    background-color: #1aa3e0;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(45, 182, 245, 0.35);
}

/* 🗺️ VER NO MAPA */
.btn-action-map {
    background-color: var(--bolsi-color-map);
    color: var(--bolsi-text-white);
}

.btn-action-map:hover {
    background-color: #7a4621;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(153, 88, 42, 0.35);
}

/* GRUPOS DE BOTÕES
   Sempre em linha (mobile e desktop). Não empilhar ícones —
   a tabela/scroll horizontal acomoda o grupo quando o espaço é curto. */
.action-buttons-group {
    display: inline-flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
    min-width: max-content;
    width: max-content;
    max-width: none;
}

/* Forms que envolvem um único botão de ação (ex.: toggle/delete via POST) */
.action-buttons-group > form {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    width: auto;
    flex: 0 0 auto;
}

.action-buttons-group > .btn-action,
.action-buttons-group > a,
.action-buttons-group > button {
    flex: 0 0 auto;
}

/* Célula de ações em tabelas: evita esmagar o grupo e forçar wrap vertical */
td:has(> .action-buttons-group),
td .action-buttons-group {
    white-space: nowrap;
}

/* Mobile: mantém ícones lado a lado; reduz levemente o tamanho se necessário */
@media (max-width: 640px) {
    .action-buttons-group {
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 4px;
    }

    .action-buttons-group .btn-action {
        width: 30px;
        height: 30px;
        margin: 0;
    }

    .action-buttons-group .btn-action i,
    .action-buttons-group .btn-action .icon {
        font-size: 15px;
    }
}
