/* =========================================================
   VARIÁVEIS
   ========================================================= */
:root {
    --header-height: 56px;

    /* Sidebar */
    --sidebar-collapsed: 80px;
    --sidebar-expanded: 200px;
    --sidebar-width: var(--sidebar-collapsed);
}

/* Quando expandida */
html.sidebar-expanded,
body.sidebar-expanded {
    --sidebar-width: var(--sidebar-expanded);
}

/* =========================================================
   BASE / LAYOUT GERAL
   ========================================================= */
header.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    /* menor que a sidebar */
}

.header-bg-custom {
    background: #252526;
}

body {
    font-family: 'Kanit';
    font-weight: 400;
    padding-top: var(--header-height);
}

/* =========================================================
   COMPONENTES GENÉRICOS
   ========================================================= */
.card-rounded {
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .1);
}

.section-title {
    font-size: 1.5rem;
    font-weight: bold;
    color: #3a3a3a;
    margin-bottom: 1rem;
}

/* =========================================================
   TABELAS
   ========================================================= */
.table thead {
    background-color: #3a3a3a;
    color: #fff;
}

/* Estilo global para todas as tabelas do sistema */
table.minimalist-table {
    font-size: .875rem;
    /* 14px */
    color: #343a40;
}

table.minimalist-table thead {
    background-color: #f8f9fa;
    color: #212529;
    font-weight: 600;
    border-bottom: 1px solid #dee2e6;
}

table.minimalist-table td,
table.minimalist-table th {
    padding: .5rem .75rem;
    /* padding compacto */
    vertical-align: middle;
}

table.minimalist-table tbody tr:hover {
    background-color: #f1f3f5;
    cursor: pointer;
}

/* Cabeçalhos fixos (opcional) */
thead.thead {
    position: sticky;
    top: 0;
    z-index: 1;
    background-color: #f8f9fa;
}

/* =========================================================
   MODAL
   ========================================================= */
/* Scroll apenas no corpo */
.modal-body {
    max-height: 65vh;
    overflow-y: auto;
}

/* =========================================================
   DROPDOWN PERFIL (SIDEBAR)
   ========================================================= */
.perfil-sidebar .dropdown-menu {
    background-color: #fff;
    border-radius: .5rem;
    min-width: 180px;
    z-index: 2000;
}

/* =========================================================
   SELECT2 (Bootstrap 5)
   ========================================================= */
/* Ajusta o container principal */
.select2-container--bootstrap-5 .select2-selection {
    min-height: calc(2.5rem + 2px);
    /* igual ao .form-select padrão */
    border: 1px solid #ced4da;
    border-radius: .375rem;
    padding: .375rem .75rem;
    font-size: 1rem;
    line-height: 1.5;
    box-shadow: none;
}

/* Placeholder no estilo do Bootstrap */
.select2-container--bootstrap-5 .select2-selection__placeholder {
    color: #6c757d;
}

/* Ícone da setinha alinhado */
.select2-container--bootstrap-5 .select2-selection__arrow {
    top: 50%;
    right: .75rem;
    transform: translateY(-50%);
}

/* Mantém uma linha e adiciona reticências + estilos do texto */
.select2-container--bootstrap-5 .select2-selection__rendered {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 2rem;
    /* espaço pro X de limpar */

    color: #212529;
    line-height: 1.5rem;
    padding-left: 0;
}

/* Corrige o X de limpar para alinhar na direita */
.select2-container--bootstrap-5 .select2-selection__clear {
    position: absolute;
    right: .75rem;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    color: #6c757d;
}

/* Limita a altura do dropdown do Select2 e adiciona rolagem */
.select2-container .select2-results>.select2-results__options {
    max-height: 250px;
    overflow-y: auto;
}

/* Ajuste para múltipla seleção */
.select2-container--bootstrap-5 .select2-selection--multiple {
    min-height: calc(2.5rem + 2px);
    border: 1px solid #ced4da;
    border-radius: .375rem;
    padding: .25rem .375rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

/* =========================================================
   BREADCRUMB
   ========================================================= */
.breadcrumb a {
    color: #0d6efd;
    text-decoration: none;
    transition: color .2s ease, text-decoration .2s ease;
}

.breadcrumb a:hover {
    color: #0a58ca;
    text-decoration: underline;
}

.breadcrumb .active {
    font-weight: 600;
    color: #495057;
}

/* =========================================================
   SIDEBAR (COLAPSÁVEL)
   ========================================================= */
#sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--sidebar-width);
    background: #252526;

    display: flex;
    flex-direction: column;
    align-items: center;
    /* colapsada: centraliza */
    padding-top: 14px;

    z-index: 1200;

    transition: width .40s cubic-bezier(.2, .8, .2, 1);
    will-change: width;
}

/* Área da marca (logo) */
#sidebar .sidebar-brand {
    justify-content: center;
    align-items: center;
}

/* Link da marca (base para absolute da logo expandida) */
#sidebar .sidebar-brand-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-decoration: none;

    position: relative;
    height: 40px;
    /* igual ao height da sua imagem */
}

/* Troca suave de logo por opacity (sem display:none) */
.sidebar-logo {
    transition: opacity .22s ease;
}

/* Estado padrão (colapsada) */
.sidebar-logo--expanded {
    opacity: 0;
    position: absolute;
    inset: 0;
    margin: auto;
    display: block;
}

.sidebar-logo--collapsed {
    opacity: 1;
}

/* Quando expandida */
html.sidebar-expanded .sidebar-logo--expanded {
    opacity: 1;
}

html.sidebar-expanded .sidebar-logo--collapsed {
    opacity: 0;
}

/* Área do botão toggle */
#sidebar .sidebar-top {
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 6px 0 10px 0;
}

/* Botão de expandir/recolher */
#sidebar .sidebar-toggle {
    border: 0;
    background: rgba(255, 255, 255, .06);
    color: #fff;
    width: 44px;
    height: 44px;
    border-radius: 12px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    cursor: pointer;
    transition: background .25s ease;
    /* evita animar transform no botão */
}

#sidebar .sidebar-toggle:hover {
    background: rgba(255, 255, 255, .12);
}

/* Rotação do ícone com transição sempre ativa */
#sidebar .sidebar-toggle i {
    transition: transform .40s ease;
}

/* Navegação */
#sidebar nav {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    /* colapsada */
}

/* Links */
#sidebar .nav-link {
    display: flex;
    align-items: center;
    justify-content: center;
    /* colapsada */
    flex-direction: row;
    gap: 10px;

    color: #fff;
    text-align: left;

    margin: 6px 10px;
    padding: 12px 12px;
    border-radius: 8px;
    width: calc(100% - 20px);

    background: transparent;
    box-shadow: none;

    /* Evita transition: all (mais previsível e suave) */
    transition: background-color .25s ease, padding .35s cubic-bezier(.2, .8, .2, 1), border-radius .25s ease;
    position: relative;

    font-size: 14px;
    text-decoration: none;
}

/* Ícones */
#sidebar .nav-link i {
    font-size: 22px;
    min-width: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Divisor */
#sidebar .divider {
    width: 60%;
    height: 1px;
    background: rgba(255, 255, 255, .2);
    margin: 10px auto;
}

/* Conteúdo principal acompanha a largura */
.main-content {
    margin-left: var(--sidebar-width);
    transition: margin-left .40s cubic-bezier(.2, .8, .2, 1);
    will-change: margin-left;
}

/* Label animado (sem display:none) */
#sidebar .nav-link .label {
    opacity: 0;
    transform: translateX(-6px);
    max-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;

    transition:
        opacity .22s ease,
        transform .28s cubic-bezier(.2, .8, .2, 1),
        max-width .28s cubic-bezier(.2, .8, .2, 1);
}

/* =========================================================
   SIDEBAR - MODO EXPANDIDO
   ========================================================= */
html.sidebar-expanded #sidebar {
    align-items: stretch;
    /* expande: usa largura toda */
}

/* Top alinhado à direita no expandido */
html.sidebar-expanded #sidebar .sidebar-top {
    justify-content: flex-end;
    padding-right: 10px;
}

/* Gira o ícone ao expandir */
html.sidebar-expanded #sidebar .sidebar-toggle i {
    transform: rotate(180deg);
}

/* Nav alinha à esquerda */
html.sidebar-expanded #sidebar nav {
    align-items: stretch;
}

/* Links com padding lateral e alinhamento à esquerda */
html.sidebar-expanded #sidebar .nav-link {
    justify-content: flex-start;
    padding: 12px 14px;
}

/* Divisor ocupa melhor */
html.sidebar-expanded #sidebar .divider {
    width: 86%;
}

/* No expandido, label aparece */
html.sidebar-expanded #sidebar .nav-link .label {
    opacity: 1;
    transform: translateX(0);
    max-width: 140px;
    /* ajuste se precisar */
    transition-delay: .05s;
}

/* =========================================================
   SIDEBAR - HOVER (cinza escuro)
   ========================================================= */
#sidebar .nav-link:hover {
    background: #3a3a3c;
    border-radius: 10px;
    color: #fff;
}

#sidebar .nav-link:hover i {
    color: #fff;
}

/* =========================================================
   SIDEBAR - LINK ATIVO
   ========================================================= */
#sidebar .nav-link.active {
    background: rgba(255, 255, 255, .096);
    border-radius: 10px;
    color: #fff;
}

#sidebar .nav-link.active::before {
    content: none;
}

/* Faz o nav ocupar o espaço e "sobrar" no meio */
#sidebar {
    display: flex;
    flex-direction: column;
}

/* Área do menu principal */
#sidebar .sidebar-nav {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Bloco do rodapé da sidebar */
#sidebar .sidebar-bottom {
    margin-top: auto;
    /* << empurra para baixo */
    width: 100%;
    padding-bottom: 12px;
    /* respiro */
}

/* No modo expandido, mantém alinhamento igual ao resto */
html.sidebar-expanded #sidebar .sidebar-bottom .nav-link {
    justify-content: flex-start;
}