/* ============================================= 
   MODO COLLAPSED – ESTILO UNIFICADO
============================================= */

/* Sidebar recolhida */
body.sidebar-collapsed #sidebar {
    width: var(--sidebar-w-collapsed) !important;
    padding: 6px !important;
}

/* Ícone centralizado */
body.sidebar-collapsed .sidebar .nav-link i {
    width: 22px !important;
    height: 22px !important;
    margin: 0 auto !important;
    opacity: 1 !important;
}

/* Oculta texto */
body.sidebar-collapsed .sidebar .nav-link span {
    display: none !important;
}

/* Itens sem padding que empurre o ícone */
body.sidebar-collapsed .sidebar .nav-link {
    padding: 10px 0 !important;
    margin-left: 0 !important;
    padding-left: 0 !important;
    gap: 0 !important;
    justify-content: center !important;
}

/* Some caret e submenu */
body.sidebar-collapsed .caret,
body.sidebar-collapsed .nav-submenu {
    display: none !important;
}

/* ============================================= 
   VARIÁVEIS
============================================= */
:root {
    --navbar-h: 56px;
    --sidebar-w: 230px;
    --sidebar-w-collapsed: 60px;
    --sidebar-bg: #1a1a1a;
    --menu-ativo: #ffb400;
    --menu-texto: #d4d4d4;
    --menu-hover: #ffffff;
}

/* ============================================= 
   NAVBAR SUPERIOR
============================================= */
.navbar-custom {
    background-color: #1a1a1a;
    color: #fff;
    height: var(--navbar-h);
    z-index: 1001;
}

/* ============================================= 
   SIDEBAR BASE
============================================= */
.sidebar, #sidebar {
    position: fixed;
    top: var(--navbar-h);
    left: 0;
    width: var(--sidebar-w);
    height: calc(100vh - var(--navbar-h));
    background-color: var(--sidebar-bg);
    padding: 10px 8px;
    transition: width .24s ease, transform .24s ease;
    z-index: 1029;
    overflow-y: auto;
    overflow-x: hidden;
}

/* ============================================= 
   LINKS DO MENU (PAI E FILHO)
============================================= */
.sidebar .nav-link {
    color: var(--menu-texto);
    background: transparent !important;
    padding: 10px 2px 10px 4px !important;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 400;
    position: relative;
    text-decoration: none;
    transition: color .25s ease, transform .2s ease;
    margin-left: 6px;
    padding-left: 18px !important;
    width: 100%;
}

/* Ícone normal */
.sidebar .nav-link i {
    width: 20px !important;
    opacity: 1 !important;
    margin-left: 0 !important;
}

/* Hover */
.sidebar .nav-link:hover {
    color: var(--menu-hover);
    transform: translateX(4px);
}

/* ============================================= 
   ESTILO DO ATIVO (SEM FUNDO)
============================================= */
.sidebar .nav-link.active,
.sidebar .nav-item.open > .nav-link {
    color: var(--menu-ativo) !important;
    font-weight: 600;
    background: none !important;
    box-shadow: none !important;
}

/* Barra lateral esquerda */
.sidebar .nav-link.active::before,
.sidebar .nav-item.open > .nav-link::before {
    content: "";
    position: absolute;
    left: -5px !important;
    top: 6px;
    bottom: 6px;
    width: 3px;
    background: var(--menu-ativo);
    border-radius: 1px;
}

/* =============================================
   SUBMENU
============================================= */
.nav-submenu {
    list-style: none;
    margin: 6px 0 8px 14px !important;
    padding: 1px 6px !important;
    max-height: 0;
    overflow: hidden;
    transition: max-height .22s ease-out;

    background: #1a1a1a !important;
    
    border-radius: 10px;
}

.nav-submenu .nav-link {
    padding: 9px 10px 9px 12px !important;
    font-size: .93rem;
    color: #bcb7b7 !important;
    border-radius: 8px;
    margin-left: 0 !important;
    font-style: italic;
}

.nav-submenu .nav-link:hover {
    color: #fff !important;
    background: rgba(255, 255, 255, 0.08) !important;
    transform: translateX(4px);
    border-left: 5px solid rgba(255, 180, 0, 0.3);
    border-top-left-radius: 5px;
    border-bottom-left-radius: 5px;
}

.nav-submenu .nav-link.active {
    color: var(--menu-ativo) !important;
    background: #1a1a1a!important;
    border-left: 5px solid var(--menu-ativo);
    border-top-left-radius: 0;
    border-bottom-left-radius: 0px;
    opacity: 0.5;
}

.nav-submenu .nav-link.active::before {
    height: 70%;
}

/* Expandir submenu */
.has-children.open > .nav-submenu {
    max-height: 800px;
    transition: max-height .3s ease-in;
    border-top-left-radius: 0;
    border-bottom-left-radius: 10px;
    border-left: 0px solid rgba(255, 180, 0, 0.2);
    border-bottom: 1px solid rgba(255, 180, 0, 0.2);
}


/* ============================================= 
   CARET (SETINHA)
============================================= */
.has-children .caret {
    margin-right: 1px !important;
    border: solid currentColor;
    border-width: 0 2px 2px 0;
    padding: 3px;
    transform: rotate(45deg);
    opacity: .45;
    transition: transform .25s ease;
    position: absolute !important;
    right: 0 !important;
}

.nav-item.open > a .caret {
    transform: rotate(-135deg);
    opacity: .9;
}

/* ============================================= 
   SIDEBAR COLLAPSED (DESKTOP)
============================================= */
@media (min-width: 769px) {
    body.sidebar-collapsed #sidebar {
        width: var(--sidebar-w-collapsed);
    }
}

/* ============================================= 
   MOBILE
============================================= */
@media (max-width: 768px) {
    #sidebar {
        transform: translateX(-100%);
    }
    #sidebar.active {
        transform: translateX(0);
    }
}

/* ============================================= 
   BOTÃO SANDUÍCHE
============================================= */
#toggleMenu {
    background: transparent;
    border: none;
    color: #f8fafc;
    font-size: 1.2rem;
    padding: 8px;
    border-radius: 6px;
    transition: background-color .3s, color .3s;
    z-index: 1002;
}

#toggleMenu:hover {
    color: #ffb400 !important;
    cursor: pointer;
}

#toggleMenu.active {
    background-color: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}


/* Ocultar foto, nome e grupo quando menu recolhido */
body.sidebar-collapsed .sidebar-userbox {
    display: none !important;
}


