/* ========================================
   MELHORIAS DE HIERARQUIA VISUAL DO MENU
   ======================================== */

/* Aumenta o espaçamento dos menus filhos (nível 1) */
.sidebar-wrapper .metismenu ul a {
    padding: 8px 15px 8px 35px !important;
    position: relative;
    transition: all 0.3s ease;
}

/* Borda à esquerda para indicar visualmente que é um submenu */
.sidebar-wrapper .metismenu ul a::before {
    content: '';
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 2px;
    background-color: rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

/* Efeito hover nos itens filhos */
.sidebar-wrapper .metismenu ul a:hover::before {
    width: 12px;
    background-color: rgba(0, 0, 0, 0.3);
}

/* Background levemente diferente para submenus */
.sidebar-wrapper .metismenu ul {
    background: #f8f9fa !important;
    border: 1px solid #e9ecef !important;
    border-radius: 4px;
    margin-top: 3px;
}

/* Ícones dos submenus ligeiramente menores e com cor diferente */
.sidebar-wrapper .metismenu ul a i {
    font-size: 13px;
    opacity: 0.75;
    transition: opacity 0.3s ease;
}

.sidebar-wrapper .metismenu ul a:hover i {
    opacity: 1;
}

/* Submenus de segundo nível (ul ul) */
.sidebar-wrapper .metismenu ul ul a {
    padding: 7px 15px 7px 50px !important;
    font-size: 14px;
}

.sidebar-wrapper .metismenu ul ul a::before {
    left: 35px;
    width: 6px;
}

/* Submenus de terceiro nível (ul ul ul) */
.sidebar-wrapper .metismenu ul ul ul a {
    padding: 6px 15px 6px 65px !important;
    font-size: 13px;
}

.sidebar-wrapper .metismenu ul ul ul a::before {
    left: 50px;
    width: 5px;
}

/* Melhora a transição de abertura/fechamento dos submenus */
.sidebar-wrapper .metismenu ul {
    animation: slideDownMenu 0.3s ease-out;
}

@keyframes slideDownMenu {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Item ativo no submenu */
.sidebar-wrapper .metismenu ul a.mm-active {
    background-color: rgba(13, 110, 253, 0.1);
    font-weight: 500;
}

.sidebar-wrapper .metismenu ul a.mm-active::before {
    background-color: #0d6efd;
    width: 12px;
}

/* Suporte para tema escuro */
html.dark-theme .sidebar-wrapper .metismenu ul {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

html.dark-theme .sidebar-wrapper .metismenu ul a::before {
    background-color: rgba(255, 255, 255, 0.2);
}

html.dark-theme .sidebar-wrapper .metismenu ul a:hover::before {
    background-color: rgba(255, 255, 255, 0.4);
}

html.dark-theme .sidebar-wrapper .metismenu ul a.mm-active {
    background-color: rgba(13, 110, 253, 0.2);
}

html.dark-theme .sidebar-wrapper .metismenu ul a.mm-active::before {
    background-color: #0d6efd;
}

/* Suporte para tema semi-dark */
html.semi-dark .sidebar-wrapper .metismenu ul {
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
}

html.semi-dark .sidebar-wrapper .metismenu ul a::before {
    background-color: rgba(255, 255, 255, 0.25);
}

html.semi-dark .sidebar-wrapper .metismenu ul a:hover::before {
    background-color: rgba(255, 255, 255, 0.45);
}

/* Suporte para sidebar colorido */
html.color-sidebar .sidebar-wrapper .metismenu ul {
    background: rgba(0, 0, 0, 0.1) !important;
    border: 1px solid rgba(0, 0, 0, 0.15) !important;
}

html.color-sidebar .sidebar-wrapper .metismenu ul a::before {
    background-color: rgba(255, 255, 255, 0.3);
}

html.color-sidebar .sidebar-wrapper .metismenu ul a:hover::before {
    background-color: rgba(255, 255, 255, 0.5);
}

/* Quando o menu está colapsado (toggled) */
.wrapper.toggled:not(.sidebar-hovered) .sidebar-wrapper .metismenu ul a::before {
    display: none;
}

/* Garante que o conteúdo ocupe todo espaço quando sidebar está colapsado */
.wrapper.toggled .page-wrapper {
    margin-left: 70px !important;
    width: calc(100% - 70px) !important;
}

.wrapper.toggled .page-content,
.wrapper.toggled .container-fluid {
    width: 100% !important;
    max-width: 100% !important;
}

/* Espaçamento melhorado entre grupos de menu */
.sidebar-wrapper .metismenu > li {
    margin-bottom: 2px;
}

/* Destaque visual no menu pai quando submenu está aberto */
.sidebar-wrapper .metismenu > li > a.has-arrow[aria-expanded="true"] {
    background-color: rgba(13, 110, 253, 0.05);
    font-weight: 500;
}

html.dark-theme .sidebar-wrapper .metismenu > li > a.has-arrow[aria-expanded="true"],
html.semi-dark .sidebar-wrapper .metismenu > li > a.has-arrow[aria-expanded="true"],
html.color-sidebar .sidebar-wrapper .metismenu > li > a.has-arrow[aria-expanded="true"] {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Seta dos menus pais com transição suave */
.sidebar-wrapper .metismenu .has-arrow::after {
    transition: transform 0.3s ease;
}

/* Melhora legibilidade dos textos nos submenus */
.sidebar-wrapper .metismenu ul a {
    line-height: 1.4;
    letter-spacing: 0.3px;
}

/* Badge ou contador em submenus */
.sidebar-wrapper .metismenu ul .badge {
    font-size: 10px;
    padding: 2px 6px;
    margin-left: auto;
}
