/* Sidebar Fixo */
.sidebar-fixed {
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    max-width: 190px;
    height: 100vh;
    background: var(--borg-dark-main);
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    overflow-y: auto;
    padding-top: 15px;
    z-index: 1030;
}

/* Ajusta o container-fluid para não ficar por baixo da sidebar */
body {
    padding-left: 190px;
}

/* Tablet e Mobile */
@media (max-width: 1024px) {
    body {
        padding-left: 0;
    }

    .sidebar-fixed {
        width: 250px;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .sidebar-fixed.show {
        transform: translateX(0);
    }

    /* Overlay quando sidebar está aberto */
    .sidebar-fixed.show::after {
        content: '';
        position: fixed;
        top: 0;
        left: 250px;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }
}

/* Mobile pequeno */
@media (max-width: 576px) {
    .sidebar-fixed {
        max-width: 100%;
    }

    .sidebar-header h6 {
        font-size: 16px;
    }

    .sidebar-fixed .nav-item {
        padding: 10px 12px;
        font-size: 13px;
    }

    .sidebar-fixed .nav-icon {
        width: 20px;
        height: 20px;
    }

    .sidebar-fixed .nav-label {
        display: block;
    }
}

/* Header */
.sidebar-header {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    margin-bottom: 20px;
}

/* Navigation */
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 0 10px;
}

/* Nav Item Base — escopado ao sidebar para não vazar nos nav-tabs do Bootstrap */
.sidebar-fixed .nav-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    color: var(--borg-white);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    width: 100%;
    text-align: left;
}

.sidebar-fixed .nav-item:hover {
    background: var(--borg-main);
    color: white;
    text-decoration: none;
}

.sidebar-fixed .nav-item.active {
    background: var(--borg-main);
    color: var(--borg-white);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Toggle Button */
.nav-toggle {
    cursor: pointer;
}

.nav-toggle[aria-expanded="false"] .chevron-icon {
    transform: rotate(0deg);
}

.nav-toggle[aria-expanded="true"] .chevron-icon {
    transform: rotate(180deg);
}

/* Icons */
.nav-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
    flex-shrink: 0;
}

/* Chevron Icon */
.chevron-icon {
    transition: transform 0.3s ease;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    margin-left: auto;
}

/* Submenu */
.nav-submenu {
    display: flex;
    flex-direction: column;
    gap: 3px;
    /* margin-left: 30px; */
    margin-top: 5px;
}

.nav-subitem {
    padding: 8px 12px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    border-radius: 5px;
    transition: all 0.3s ease;
    font-size: 13px;
    display: block;
    border-left: 2px solid transparent;
    white-space: nowrap;
}

.nav-subitem:hover {
    background: var(--borg-main);
    color: var(--borg-white);
    text-decoration: none;
}

.nav-subitem.active {
    background: var(--borg-main);
    color: var(--borg-white);
    border-left-color: var(--borg-main);
}

/* Collapse Animation — escopado ao sidebar (não afetar collapses do Bootstrap) */
.sidebar-fixed .collapse {
    transition: opacity 0.3s ease, height 0.3s ease;
}

/* Scrollbar */
.sidebar-fixed::-webkit-scrollbar {
    width: 6px;
}

.sidebar-fixed::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

.sidebar-fixed::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.sidebar-fixed::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Botão Toggle para Mobile */
.btn-sidebar-toggle {
    width: 45px;
    height: 45px;
    background: var(--borg-dark-main);
    border: none;
    border-radius: 8px;
    z-index: 1031;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    padding: 0;
    margin-left: 10px;
}

.btn-sidebar-toggle:hover {
    background: var(--borg-main);
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.btn-sidebar-toggle span {
    width: 22px;
    height: 2.5px;
    background: var(--borg-white);
    border-radius: 2px;
    transition: all 0.3s ease;
}

@media (max-width: 1024px) {
    .btn-sidebar-toggle {
        display: flex;
    }
}

@media (min-width: 1025px) {
    .btn-sidebar-toggle {
        display: none;
    }
}
/* ===== Sidebar mini (desktop): só ícones, expande no hover ===== */
.sidebar-fixed .nav-icon-fa {
    width: 30px;
    font-size: 24px !important;
    text-align: center;
    flex-shrink: 0;
    color: var(--borg-white, #fff);
}

.sidebar-fixed .sidebar-mini-bars { display: none; }

.sidebar-fixed:hover .sidebar-mini-bars { display: none !important; }

@media (min-width: 1025px) {
    body { padding-left: 64px; }

    .sidebar-fixed {
        max-width: 64px;
        transition: max-width .18s ease;
        overflow-x: hidden;
    }

    .sidebar-fixed:hover {
        max-width: 190px;
        box-shadow: 4px 0 18px rgba(0, 0, 0, .35);
    }

    /* colapsado: some rótulos, chevrons, título e submenus */
    .sidebar-fixed:not(:hover) .nav-label,
    .sidebar-fixed:not(:hover) .chevron-icon,
    .sidebar-fixed:not(:hover) .sidebar-header h6,
    .sidebar-fixed:not(:hover) .nav-submenu {
        display: none;
    }

    .sidebar-fixed:not(:hover) .nav-item {
        justify-content: center;
        padding: 12px 0;
    }

    .sidebar-fixed:not(:hover) .sidebar-header {
        padding: 20px 0;
    }

    .sidebar-fixed:not(:hover) .sidebar-mini-bars {
        display: block;
        text-align: center;
        color: var(--borg-white, #fff);
        font-size: 24px;
    }

    .sidebar-fixed .nav-label {
        white-space: nowrap;
    }
}
