:root {
    --bs-primary: #165593;
    --bs-primary-rgb: 22, 85, 147;
    --bs-link-color: #165593;
    --bs-link-hover-color: #0f4070;
}

.btn-primary {
    background-color: #165593 !important;
    border-color: #165593 !important;
    color: #fff !important;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
    background-color: #0f4070 !important;
    border-color: #0f4070 !important;
}

.btn-outline-primary {
    color: #165593 !important;
    border-color: #165593 !important;
}

.btn-outline-primary:hover,
.btn-outline-primary:active {
    background-color: #165593 !important;
    border-color: #165593 !important;
    color: #fff !important;
}

.text-primary { color: #165593 !important; }
.bg-primary { background-color: #165593 !important; }
.border-primary { border-color: #165593 !important; }
.badge.bg-primary { background-color: #165593 !important; }

.form-check-input:checked {
    background-color: #165593 !important;
    border-color: #165593 !important;
}

.page-item.active .page-link {
    background-color: #165593 !important;
    border-color: #165593 !important;
    color: #fff !important;
    border-radius: 0.25rem !important;
}

.page-link {
    color: #165593 !important;
}

.page-link:hover {
    color: #0f4070 !important;
}

.page-item:first-child .page-link { border-radius: 0.25rem 0 0 0.25rem !important; }
.page-item:last-child .page-link { border-radius: 0 0.25rem 0.25rem 0 !important; }

.switch-lg .form-check-input {
    width: 55px;  /* largura do switch */
    height: 32.59px; /* altura igual aos inputs normais */
    margin-top: -0.5rem; /* remove margem superior */
}

.switch-md .form-check-input {
    width: 45px;  /* largura do switch */
    height: 26px; /* altura igual aos inputs normais */
    margin-top: -6; /* remove margem superior */
}


/* Campos desabilitados com fundo cinza */
input[readonly]:not(.flatpickr-input):not([class*="flatpickr"]), select[disabled] {
    background-color: #e9ecef !important;
    opacity: 1;
}

/* Flatpickr inputs devem ter fundo branco */
input.flatpickr-input,
input[class*="flatpickr"] {
    background-color: #fff !important;
}

.form-check-input[disabled] {
    background-color: #e9ecef !important;
    opacity: 1;
    border-color: #dee2e6 !important;
}

.form-check-input[disabled]:checked {
    background-color: #AFB1B3 !important;
    border-color: #AFB1B3 !important;
}

/* Dropdown fix - ensure proper Bootstrap dropdown behavior */
.dropdown-menu {
    z-index: 1050;
    transition: opacity 0.15s ease-in-out, transform 0.15s ease-in-out;
}

.dropdown-toggle {
    cursor: pointer;
}

.dropdown-toggle:focus {
    outline: none;
    box-shadow: none;
}

/* Reduzir padding do card-footer da paginação */
.card-footer {
    padding: 0.5rem 1rem;
}

/* === FILTER CARD COMPONENT === */
/* Card de filtros padronizado para todas as páginas de listagem */
.filter-card {
    border: 1px solid #034a72 !important;
}

.filter-card .card-header {
    background-color: #034a72;
    padding: 4px;
    border: none;
}

.filter-card .card-body {
    padding: 1rem;
}

/* Form dentro do filter card */
.filter-card .filter-form {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 1rem;
}

/* Botão de busca no filter card */
.filter-card .filter-actions {
    margin-left: auto;
    display: flex;
    gap: 0.5rem;
}

/* Campos de filtro responsivos */
.filter-field {
    min-width: 120px;
}

.filter-field-sm {
    flex: 0 0 auto;
    width: auto;
    min-width: 80px;
}

.filter-field-md {
    flex: 0 0 auto;
    width: auto;
    min-width: 150px;
}

.filter-field-lg {
    flex: 1 1 auto;
    min-width: 200px;
}

/* === DOWNLOAD BUTTON COMPONENT === */
/* Estilos para botões de download com spinner sincronizado */

.download-btn {
    position: relative;
    transition: opacity 0.2s ease-in-out, background-color 0.2s ease-in-out, transform 0.1s ease-in-out;
}

.download-btn:hover:not(:disabled) {
    transform: translateY(-1px);
}

.download-btn:disabled {
    cursor: not-allowed;
    pointer-events: none;
    background-color: var(--bs-secondary) !important;
    border-color: var(--bs-secondary) !important;
}

.download-btn.downloading {
    opacity: 0.7;
}

/* Animação do spinner */
.download-btn .fa-spinner {
    animation: fa-spin 1s infinite linear;
    color: var(--bs-primary);
}

/* Melhora a visibilidade durante o download */
.download-btn:disabled i {
    opacity: 0.9;
}

/* Feedback visual adicional */
.download-btn:disabled::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border: 2px solid var(--bs-primary);
    border-radius: var(--bs-border-radius);
    opacity: 0.3;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.3;
        transform: scale(1);
    }
    50% {
        opacity: 0.1;
        transform: scale(1.05);
    }
}

/* Estados hover e focus melhorados */
.download-btn:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.download-btn:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.25);
}

/* Indicador visual adicional para downloads grandes */
.download-btn.large-file-download::after {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #fd7e14;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.download-btn.large-file-download.downloading::after {
    opacity: 1;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

/* Responsividade para dispositivos móveis */
@media (max-width: 768px) {
    .download-btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.875rem;
    }
}

/* === FOOTER COMPONENT === */
/* Footer styling for proper positioning at bottom of main content */

footer[role="contentinfo"] {
    margin-top: auto;
    background-color: #fff;
    border-top: 1px solid #dee2e6;
    padding: 1rem 0;
}

footer .footer {
    padding: 0.5rem 0;
    background-color: transparent;
    border: none;
}

/* Estados de erro (opcional para futuro uso) */
.download-btn.error {
    border-color: #dc3545;
    color: #dc3545;
}

.download-btn.error:hover {
    background-color: #dc3545;
    color: white;
}

/* === ACTIVE STATUS COMPONENTS === */
/* Estilos globais para campos is_active em formulários e filtros */


/* Estilos para botões de histórico */
.user-history-btn,
.group-history-btn,
.company-history-btn {
    cursor: pointer;
}

.content {
    padding: 1.5rem 1.5rem 1.5rem;
}

@media(min-width:992px) {
    .content {
        padding: 1rem 3rem 3rem;
    }
}

/* === BREADCRUMB COMPONENT === */
/* Estilos para breadcrumb de navegação */

.breadcrumb {
    font-size: 0.80rem;
}

.auth-logo-link img {
    opacity: 0.4;
    filter: grayscale(100%);
    transition: opacity 0.2s, filter 0.2s;
}

.auth-logo-link:hover img {
    opacity: 1;
    filter: grayscale(0%);
}

.breadcrumb-item a {
    color: #165593 !important;
}

/* === FIXED LAYOUT === */
/* Sidebar e navbar fixos, scroll padrão do browser */

.wrapper {
    overflow: visible;
}

.main {
    overflow: visible;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: visible !important;
}

#sidebar-user-footer {
    background: #034a72;
}

#sidebar-user-item > .sidebar-link {
    display: flex !important;
    justify-content: center !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

.sidebar,
.sidebar-content,
.sidebar-brand,
.sidebar-link,
a.sidebar-link,
.sidebar-link:hover,
a.sidebar-link:hover,
.sidebar-nav,
.simplebar-content-wrapper,
.simplebar-content {
    background: #034a72 !important;
}

.sidebar-item.active > .sidebar-link,
.sidebar-item.active .sidebar-link:hover {
    background: #165593 !important;
    border-left-color: #ffffff !important;
}

.sidebar-link i,
.sidebar-link svg,
a.sidebar-link i,
a.sidebar-link svg {
    color: rgba(255, 255, 255, 0.85) !important;
}

.sidebar-link,
a.sidebar-link {
    color: rgba(255, 255, 255, 0.85) !important;
}

.sidebar-item:not(.active) > .sidebar-link:hover,
.sidebar-item:not(.active) > a.sidebar-link:hover {
    background: #165593 !important;
}

.sidebar-nav > .sidebar-item > .sidebar-dropdown,
.sidebar-nav > .sidebar-item > .sidebar-dropdown .sidebar-link,
.sidebar-nav > .sidebar-item > .sidebar-dropdown a.sidebar-link,
.sidebar-nav > .sidebar-item > .sidebar-dropdown .sidebar-link:hover {
    background: #034a72 !important;
}

.sidebar-nav > .sidebar-item > .sidebar-dropdown .sidebar-link,
.sidebar-nav > .sidebar-item > .sidebar-dropdown a.sidebar-link {
    color: rgba(255, 255, 255, 0.9) !important;
    font-size: 0.85rem !important;
}

.sidebar-nav > .sidebar-item > .sidebar-dropdown .sidebar-link:hover {
    color: #fff !important;
}

.main > header {
    position: sticky;
    top: 0;
    z-index: 999;
}

.btn-xs {
    padding: 0.1rem 0.4rem;
    font-size: 0.7rem;
    line-height: 1.3;
    border-radius: 0.2rem;
}

/* === NAVBAR === */
.sidebar-toggle .hamburger,
.sidebar-toggle .hamburger:before,
.sidebar-toggle .hamburger:after {
    background: #165593;
}

.sidebar-toggle:hover .hamburger,
.sidebar-toggle:hover .hamburger:before,
.sidebar-toggle:hover .hamburger:after {
    background: #0f4070;
}

.nav-icon {
    color: #165593 !important;
}

.nav-icon:hover,
.nav-icon[aria-expanded="true"] {
    color: #0f4070 !important;
}

/* === NOTIFICAÇÕES (bell) === */
#notif-list {
    /* ~5 itens (76px cada) — espaço vazio se tiver menos, scroll se tiver mais */
    height: 380px;
    overflow-y: auto;
}

.notif-item {
    background: #fff;
    transition: background .12s ease-in-out;
}

.notif-item.notif-unread {
    background: #f0f5fb;
}

.notif-item:hover {
    background: #e3edf9;
}

.notif-toast-card:hover {
    background: #f8f9fb !important;
    box-shadow: 0 .3rem 1rem rgba(0,0,0,.12);
}

/* === SIDEBAR FOOTER === */
/* Abre o dropdown do usuário para cima, alinhado ao item do footer */
#sidebar-user-item > .sidebar-dropdown {
    top: auto !important;
    bottom: 0 !important;
    left: 86px !important;
}
