/* =========================================
   1. VARIÁVEIS GLOBAIS (VAN THEME)
   ========================================= */
:root {
    --bg-main: #ffffff; /* Fundo Branco */
    --action-color: #ff5757; /* Vermelho principal do sistema */
    --action-hover: #e04848; /* Vermelho escuro para hover */
    
    /* Vidro Claro */
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(0, 0, 0, 0.05);
    
    /* Tons de Texto */
    --text-primary: #000000; /* Preto absoluto */
    --text-secondary: #4a4a4a; /* Cinza chumbo suave para leitura */
}

/* =========================================
   0. GLOBAL SQUARE RESET (FORÇA TUDO QUADRADO)
   ========================================= */
*:not(.spinner-border):not(.spinner-grow):not(.rounded-circle) {
    border-radius: 0 !important;
}

/* =========================================
   2. BASE
   ========================================= */
body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    /* Fundo radial sutil corporativo */
    background: radial-gradient(circle at 50% 0%, #ffffff 0%, #f8f9fa 100%);
    min-height: 100vh;
}

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.15); }
/* Atualizado RGB para o Vermelho (255, 87, 87) */
::-webkit-scrollbar-thumb:hover { background: rgba(255, 87, 87, 0.4); } 

/* =========================================
   3. TIPOGRAFIA E UTILITÁRIOS GERAIS
   ========================================= */
/* Atualizado RGB do text-shadow */
.text-glow { text-shadow: 0 4px 15px rgba(255, 87, 87, 0.15); color: var(--text-primary) !important; }
.text-action { color: var(--action-color) !important; }
.bg-main { background-color: var(--bg-main) !important; }
.bg-action { background-color: var(--action-color) !important; }

/* =========================================
   4. ESTRUTURA E PAINÉIS (GLASSMORPHISM CLARO)
   ========================================= */
.glass-panel {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.6));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.03); 
}

.dashboard-card {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid var(--glass-border);
    padding: 24px;
    height: 100%;
    transition: transform 0.2s, box-shadow 0.2s;
}

.dashboard-card:hover {
    transform: translateY(-5px);
    border-color: rgba(255, 87, 87, 0.3);
    box-shadow: 0 8px 20px rgba(255, 87, 87, 0.08);
}

.dash-card-empresa {
    background: rgba(255, 255, 255, 0.8);
    padding: 15px;
    border-left: 4px solid var(--action-color);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

/* =========================================
   5. NAVEGAÇÃO E SIDEBAR
   ========================================= */
.sidebar-wrapper { width: 280px; min-width: 280px; background: transparent; }
.sidebar-header-border { border-color: rgba(0, 0, 0, 0.05) !important; }
.sidebar-footer-border { border-color: rgba(0, 0, 0, 0.05) !important; }
.logo-nav { max-height: 40px; }
.logo-sidebar { max-height: 30px; }
.nav-icon { width: 24px; text-align: center; }
.profile-avatar { width: 35px; height: 35px; font-size: 12px; }

.custom-hover { transition: all 0.3s ease; border: 1px solid transparent; color: var(--text-secondary) !important; }
.custom-hover:hover { 
    background-color: rgba(255, 87, 87, 0.05); 
    border: 1px solid rgba(255, 87, 87, 0.2); 
    color: var(--action-color) !important; 
    transform: translateX(5px); 
}

.active-menu { 
    background-color: rgba(255, 87, 87, 0.1) !important; 
    border-left: 4px solid var(--action-color); 
    color: var(--action-color) !important; 
    font-weight: 600; 
    opacity: 1 !important; 
}

/* Menu hambúrguer escuro */
.custom-toggler { width: 26px; height: 18px; position: relative; background: transparent; cursor: pointer; }
.custom-toggler .toggler-line { position: absolute; left: 0; width: 100%; height: 2px; background-color: var(--text-primary)}
.custom-toggler .toggler-line:nth-child(1) { top: 0px; }
.custom-toggler .toggler-line:nth-child(2) { top: 8px; }
.custom-toggler .toggler-line:nth-child(3) { top: 16px; }

/* =========================================
   6. BOTÕES E AÇÕES
   ========================================= */
.btn-custom {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 24px;
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
    background: transparent;
    color: var(--text-primary);
    border: 1px solid rgba(0, 0, 0, 0.2); 
    transition: all 0.3s ease;
    cursor: pointer;
    text-transform: uppercase;
}

.btn-fechar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 12px;
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    background: transparent;
    color: var(--text-primary);
    border: 1px solid rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    cursor: pointer;
}

/* Botão Primário (Action Color) */
.btn-custom.btn-neon {
    background: var(--action-color);
    color: #ffffff;
    border: none;
}
.btn-custom.btn-neon:hover, .btn-custom.btn-neon:focus {
    background: var(--action-hover);
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(255, 87, 87, 0.3);
    transform: translateY(-2px);
}

/* Botão Danger (Aproveitando o tom avermelhado para alertas/exclusões) */
.btn-custom.btn-danger, .btn-fechar.btn-danger {
    color: #ffffff;
    background: #dc2626;
    border-color: #dc2626;
}
.btn-custom.btn-danger:hover, .btn-fechar.btn-danger:hover, .btn-custom.btn-danger:focus {
    background: #b91c1c;
    border-color: #b91c1c;
    box-shadow: 0 4px 15px rgba(220, 38, 38, 0.2);
}

/* Botão Secundário (Preto/Transparente) */
.btn-custom.btn-secondary {
    color: var(--text-primary);
    border-color: rgba(0, 0, 0, 0.5);
}
.btn-custom.btn-secondary:hover, .btn-custom.btn-secondary:focus {
    color: #ffffff;
    border-color: var(--text-primary);
    background: var(--text-primary);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* =========================================
   ESTADO DESABILITADO DOS BOTÕES (BULLETPROOF)
   ========================================= */
.btn-custom:disabled,
.btn-custom[disabled] {
    opacity: 0.6 !important;
    cursor: not-allowed !important;
    pointer-events: none !important; 
    box-shadow: none !important;
    background-color: rgba(0, 0, 0, 0.05) !important; 
    color: var(--text-secondary) !important; 
    border-color: rgba(0, 0, 0, 0.1) !important;
    transform: none !important; 
}

/* =========================================
   7. RESPONSIVIDADE (AJUSTES MOBILE/TABLET)
   ========================================= */
@media (max-width: 767.98px) {
    .glass-panel {
        padding: 1.5rem !important; 
    }
    h2.text-glow { font-size: 1.5rem; }
    .table-title { font-size: 0.95rem; }
    .btn-custom { width: 100%; padding: 12px 20px; }
    .btn-custom:last-child { margin-bottom: 0; }
    .page-header-mobile {
        flex-direction: column;
        align-items: stretch !important;
        gap: 15px;
        text-align: center;
    }
    .table-responsive { padding-bottom: 10px; }
    .custom-table tbody td { padding: 12px 10px; }
    .pagination-container .btn-custom { width: auto; padding: 8px 14px; }
}

@media (min-width: 768px) and (max-width: 991.98px) {
    .btn-custom {
        padding: 8px 16px;
        font-size: 0.85rem;
        width: auto; 
    }
}

/* =========================================
   8. FULL SCREEN LOADER (OVERLAY)
   ========================================= */
main.glass-panel { position: relative; }

#loader-overlay {
    position: absolute; 
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.8), rgba(248, 249, 250, 0.9));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: none; 
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 50; 
    transition: opacity 0.3s ease;
}
.loader-content { text-align: center; color: var(--text-primary); }
.loader-content .spinner-border {
    width: 4rem; height: 4rem; border-width: 0.3em; color: var(--action-color);
}

/* =========================================
   9. MODAL GLASS (LIGHT MODE)
   ========================================= */
.modal-content.glass-modal {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(250, 250, 250, 0.95));
    backdrop-filter: blur(20px);
    border: 1px solid rgba(0,0,0,0.05); 
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.1);
    color: var(--text-primary);
}
.modal-backdrop.show { opacity: 0.5; background-color: #000000; }
.glass-modal.modal-success { border: 1px solid var(--action-color); }

/* =========================================
   10. MENSAGEM DE ERRO GLOBAL
   ========================================= */
.error-message-custom {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

/* =========================================
   11. CUSTOM SWITCHES E CHECKBOXES
   ========================================= */
.custom-switch .form-check-input,
.custom-switch .form-check-input:checked,
.custom-switch .form-check-input:focus {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e") !important;
}

.custom-switch .form-check-input {
    background-color: rgba(0, 0, 0, 0.15); 
    border-color: rgba(0, 0, 0, 0.1);
    width: 2.8em; 
    height: 1.4em;
    cursor: pointer;
    margin-top: 0.1em; 
    margin-right: 0.5em; 
}
.custom-switch .form-check-input:checked {
    background-color: var(--action-color) !important; 
    border-color: var(--action-color) !important;
}
.custom-switch .form-check-input:focus {
    box-shadow: 0 0 0 3px rgba(255, 87, 87, 0.2) !important;
}
.custom-switch .form-check-label {
    cursor: pointer;
    padding-top: 3px; 
    color: var(--text-primary) !important;
}

/* =========================================
   12. TABELAS CUSTOMIZADAS E INPUTS
   ========================================= */
.custom-table { 
    color: var(--text-primary) !important; 
    border-collapse: separate; 
    border-spacing: 0 12px; 
    width: 100%;
}

.custom-table thead th { 
    background-color: transparent !important; 
    border-bottom: none; 
    color: var(--text-secondary) !important;
    font-weight: 600; 
    text-transform: uppercase; 
    font-size: 0.8rem; 
    padding: 0 20px 8px 20px; 
    letter-spacing: 1px; 
}

.custom-table tbody tr { 
    background: var(--glass-bg) !important; 
    transition: all 0.3s ease; 
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05); /* Sombra neutra no tema claro */
}

.custom-table tbody tr:hover { 
    background: rgba(255, 87, 87, 0.05) !important; /* Vermelho do tema com transparência */
    transform: translateY(-3px); 
    box-shadow: 0 8px 25px rgba(255, 87, 87, 0.1); /* Brilho vermelho sutil */
}

.custom-table tbody td { 
    background-color: transparent !important; 
    color: var(--text-primary);
    padding: 18px 20px; 
    vertical-align: middle; 
    border: none; 
    border-top: 1px solid var(--glass-border); 
    border-bottom: 1px solid var(--glass-border); 
}

.custom-table tbody td:first-child { 
    border-left: 4px solid var(--action-color); /* Substituído o neon pelo vermelho */
    /* border-radius removido para respeitar o padrão quadrado */
}

.custom-table tbody td:last-child { 
    border-right: 1px solid var(--glass-border); 
    /* border-radius removido para respeitar o padrão quadrado */
}

.table-title { 
    font-size: 1.05rem; 
    letter-spacing: 0.3px;
    color: var(--text-primary) !important;
}

/* =========================================
   13. INPUTS E FORMULÁRIOS
   ========================================= */
.custom-input {
    background: rgba(255, 255, 255, 0.7); 
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: var(--text-primary);
    padding: 12px 16px;
    transition: all 0.3s ease;
    width: 100%;
    border-radius: 0; /* Força o formato quadrado */
}

.custom-input:focus {
    outline: none;
    border-color: var(--action-color);
    background: #ffffff; 
    box-shadow: 0 0 10px rgba(255, 87, 87, 0.15); /* Foco vermelho em vez de verde */
}

.custom-input::placeholder {
    color: rgba(0, 0, 0, 0.4); 
}

/* =========================================
   14. BADGES DE STATUS E TAGS
   ========================================= */
.badge-status {
    padding: 6px 12px;
    font-weight: 700;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0; /* Força o formato quadrado */
}

/* Status ATIVO: Mantém verde como convenção universal de UI (Sucesso), 
mas com tons corporativos neutros, removendo a dependência do "neon-accent" */
.badge-ativa {
    background-color: rgba(16, 185, 129, 0.1) !important; 
    color: #059669 !important; 
    border: 1px solid rgba(16, 185, 129, 0.3);
}

/* Status INATIVO: Combina perfeitamente com a sua action-color */
.badge-inativa {
    background-color: rgba(220, 38, 38, 0.1) !important; 
    color: #dc2626 !important; 
    border: 1px solid rgba(220, 38, 38, 0.3);
}

/* Cor exclusiva para Grupos/Cargos (Azul Corporativo Neutro) */
.badge-grupo {
    background-color: rgba(37, 99, 235, 0.1) !important; 
    color: #2563eb !important; 
    border: 1px solid rgba(37, 99, 235, 0.2);
}

/* ========================================================================
   UTILITÁRIO: ESCONDER SCROLLBAR MANTENDO A ROLAGEM ATIVA (GHOST SCROLL)
   ======================================================================== */
.hide-scrollbar {
    scrollbar-width: none; /* Funciona no Firefox */
    -ms-overflow-style: none; /* Funciona no IE 10+ e Edge */
}

.hide-scrollbar::-webkit-scrollbar {
    display: none; /* Esconde no Chrome, Safari, Opera e Chromium */
}

/* =========================================
   SIDEBAR LAYOUT FIXO
   ========================================= */

/* =========================================
   SIDEBAR LAYOUT FIXO
   ========================================= */

.sidebar-wrapper {
    width: 280px;
    min-width: 280px;
    height: 100vh; /* IMPORTANTE */
    top: 0;
    overflow: hidden;
    background: transparent;
}

/* container interno */
.sidebar-container {
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* header fixo */
.sidebar-top {
    flex-shrink: 0;
}

/* menu com scroll */
.sidebar-menu {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 20px;
}

/* esconder scrollbar */
.hide-scrollbar {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.hide-scrollbar::-webkit-scrollbar {
    display: none;
}