/* ============================================================
   Sidebar moderna - dark navy, icones coloridos, categorias
   Carregado em todas as paginas (header_data.php) apos styles.css
   ============================================================ */

#nsofts_sidebar {
    top: 0;
    bottom: 0;
    padding: 0;
    background: linear-gradient(172deg, #0d1626 0%, #0b1120 55%, #101433 100%);
    border-right: 1px solid rgba(130, 150, 255, .10);
    box-shadow: 10px 0 40px -18px rgba(37, 99, 235, .35);
    display: flex;
    flex-direction: column;
}

/* ---------- Cabecalho ---------- */

.sb-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 18px 16px 12px;
    flex: 0 0 auto;
}

.sb-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    text-decoration: none;
}

.sb-brand__logo {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 19px;
    color: #fff;
    background: linear-gradient(135deg, #4f6df5, #7c3aed);
    box-shadow: 0 8px 18px -6px rgba(99, 102, 241, .6);
}

.sb-brand__info {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
    min-width: 0;
    white-space: nowrap;
}

.sb-brand__name {
    color: #fff;
    font-size: 16px;
    font-weight: 600;
}

.sb-brand__name em {
    font-style: normal;
    color: #60a5fa;
}

.sb-brand__sub {
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .38);
}

.sb-collapse {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    color: rgba(255, 255, 255, .6);
    background: rgba(255, 255, 255, .04);
    border: 1px solid rgba(255, 255, 255, .10);
    text-decoration: none;
    transition: background .2s ease, color .2s ease;
}

.sb-collapse:hover {
    background: rgba(255, 255, 255, .10);
    color: #fff;
}

.sb-collapse i {
    transition: transform .3s ease;
}

/* ---------- Busca ---------- */

.sb-search {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 2px 14px 10px;
    padding: 9px 12px;
    border-radius: 10px;
    background: rgba(255, 255, 255, .05);
    border: 1px solid rgba(255, 255, 255, .07);
    transition: border-color .2s ease;
}

.sb-search:focus-within {
    border-color: rgba(96, 165, 250, .45);
}

.sb-search i {
    color: rgba(255, 255, 255, .35);
    font-size: 15px;
}

.sb-search input {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: 0;
    outline: 0;
    box-shadow: none;
    color: #fff;
    font-size: 13px;
    font-family: inherit;
    padding: 0;
}

.sb-search input::placeholder {
    color: rgba(255, 255, 255, .32);
}

.sb-search__kbd {
    flex: 0 0 auto;
    font-size: 10px;
    color: rgba(255, 255, 255, .35);
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 6px;
    padding: 2px 6px;
    white-space: nowrap;
}

/* ---------- Navegacao ---------- */

#nsofts_sidebar .nsofts-sidebar-nav {
    flex: 1;
    position: relative;
    padding: 0 12px 10px;
    overflow: hidden;
}

#nsofts_sidebar .sb-section {
    list-style: none;
}

#nsofts_sidebar .nsofts-sidebar-nav__head {
    display: block;
    margin: 16px 6px 8px;
    padding: 0;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1.6px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .35);
    line-height: 1.4;
}

#nsofts_sidebar .nsofts-sidebar-nav__head:before {
    display: none;
}

#nsofts_sidebar .nsofts-sidebar-nav__item {
    margin-bottom: 2px;
}

#nsofts_sidebar .nsofts-sidebar-nav__link {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    padding: 7px 10px;
    min-height: 46px;
    border-radius: 10px;
    color: rgba(255, 255, 255, .62);
    letter-spacing: 0;
    text-decoration: none;
    transition: background .2s ease, color .2s ease;
}

#nsofts_sidebar .nsofts-sidebar-nav__link:not(.active):not(.open):hover {
    background: rgba(255, 255, 255, .06);
    color: #fff;
}

.sb-icon {
    --sc: #60a5fa;
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--sc);
    background: rgba(255, 255, 255, .05);
    background: color-mix(in srgb, var(--sc) 15%, transparent);
    border: 1px solid rgba(255, 255, 255, .05);
    border-color: color-mix(in srgb, var(--sc) 32%, transparent);
    transition: background .2s ease, border-color .2s ease;
}

.sb-icon .nsofts-sidebar-nav__icon {
    width: auto;
    height: auto;
    font-size: 17px;
    color: var(--sc);
    transition: color .2s ease;
}

#nsofts_sidebar .nsofts-sidebar-nav__link:hover .sb-icon {
    border-color: color-mix(in srgb, var(--sc) 55%, transparent);
}

#nsofts_sidebar .nsofts-sidebar-nav__text {
    padding-left: 0;
    font-size: 13.5px;
    font-weight: 450;
    color: inherit;
    min-width: 0;
}

/* ---------- Item ativo ---------- */

#nsofts_sidebar .nsofts-sidebar-nav__link.active,
#nsofts_sidebar .nsofts-sidebar-nav__link.active:not(.open):hover {
    background: linear-gradient(90deg, rgba(59, 110, 246, .92), rgba(124, 58, 237, .78));
    color: #fff;
    font-weight: 500;
    box-shadow: 0 8px 20px -8px rgba(79, 109, 245, .65);
}

#nsofts_sidebar .nsofts-sidebar-nav__link.active::after {
    content: "";
    position: absolute;
    right: 0;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 3px 0 0 3px;
    background: #60a5fa;
}

#nsofts_sidebar .nsofts-sidebar-nav__link.active .sb-icon {
    background: rgba(255, 255, 255, .16);
    border-color: rgba(255, 255, 255, .22);
}

#nsofts_sidebar .nsofts-sidebar-nav__link.active .sb-icon .nsofts-sidebar-nav__icon {
    color: #fff;
}

/* ---------- Submenus ---------- */

#nsofts_sidebar .nsofts-has-menu > .nsofts-sidebar-nav__link {
    padding-right: 34px;
}

#nsofts_sidebar .nsofts-has-menu > .nsofts-sidebar-nav__link:before {
    content: "";
    position: absolute;
    top: 50%;
    right: 15px;
    width: 7px;
    height: 7px;
    margin-top: -5px;
    background-image: none !important;
    border-right: 1.6px solid rgba(255, 255, 255, .4);
    border-bottom: 1.6px solid rgba(255, 255, 255, .4);
    -webkit-transform: rotate(45deg);
    transform: rotate(45deg);
    transition: -webkit-transform .25s ease, transform .25s ease, border-color .25s ease;
}

#nsofts_sidebar .nsofts-has-menu > .nsofts-sidebar-nav__link.open {
    background: rgba(255, 255, 255, .05);
    color: #fff;
}

#nsofts_sidebar .nsofts-has-menu > .nsofts-sidebar-nav__link.open:before {
    -webkit-transform: rotate(225deg);
    transform: rotate(225deg);
    border-color: #fff;
}

#nsofts_sidebar .nsofts-has-menu > .nsofts-sidebar-nav__link.active:before {
    border-color: #fff;
}

#nsofts_sidebar .nsofts-has-menu .nsofts-submenu {
    margin: 2px 0 6px;
    background: transparent;
    display: none;
}

#nsofts_sidebar .nsofts-has-menu .nsofts-submenu.show {
    display: block;
}

#nsofts_sidebar .nsofts-has-menu .nsofts-submenu li {
    list-style: none;
}

#nsofts_sidebar .nsofts-has-menu .nsofts-submenu .nsofts-submenu__link {
    display: block;
    margin: 0;
    padding: 5px 0 5px 56px;
    font-size: 13px;
    line-height: 22px;
    color: rgba(255, 255, 255, .45);
    background: transparent;
    border-radius: 8px;
    text-decoration: none;
    transition: color .2s ease;
}

#nsofts_sidebar .nsofts-has-menu .nsofts-submenu .nsofts-submenu__link:before {
    left: 40px;
    width: 5px;
    height: 5px;
    margin-top: -2.5px;
    background-color: rgba(255, 255, 255, .25);
}

#nsofts_sidebar .nsofts-has-menu .nsofts-submenu .nsofts-submenu__link:hover {
    color: #fff;
}

#nsofts_sidebar .nsofts-has-menu .nsofts-submenu .nsofts-submenu__link.active {
    color: #93c5fd;
    font-weight: 600;
}

#nsofts_sidebar .nsofts-has-menu .nsofts-submenu .nsofts-submenu__link.active:before {
    background-color: #60a5fa;
    width: 7px;
    height: 7px;
    margin-top: -3.5px;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, .22);
}

/* ---------- Card do administrador ---------- */

.sb-user {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 12px 14px;
    padding: 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, .04);
    border: 1px solid rgba(255, 255, 255, .07);
}

.sb-user__avatar {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    background: rgba(255, 255, 255, .08);
}

.sb-user__info {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sb-user__name {
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sb-user__role {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: rgba(255, 255, 255, .45);
}

.sb-user__role:before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #22c55e;
    flex: 0 0 auto;
}

.sb-user__logout {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    color: rgba(255, 255, 255, .55);
    background: rgba(255, 255, 255, .04);
    border: 1px solid rgba(255, 255, 255, .10);
    text-decoration: none;
    transition: background .2s ease, border-color .2s ease, color .2s ease;
}

.sb-user__logout:hover {
    background: rgba(244, 63, 94, .18);
    border-color: rgba(244, 63, 94, .4);
    color: #fb7185;
}

/* ---------- Botoes circulares do topo (tema / perfil) ---------- */

.nsofts-header-nav .nsofts-header-nav__link {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: rgba(255, 255, 255, .65);
    background: rgba(255, 255, 255, .05);
    border: 1px solid rgba(255, 255, 255, .10);
    transition: background .2s ease, border-color .2s ease, color .2s ease, box-shadow .2s ease;
}

.nsofts-header-nav .nsofts-header-nav__link [class^="ri-"],
.nsofts-header-nav .nsofts-header-nav__link [class*="ri-"] {
    font-size: 17px;
    line-height: 1;
}

.nsofts-header-nav .nsofts-header-nav__link:hover {
    background: rgba(255, 255, 255, .12);
    border-color: rgba(96, 165, 250, .45);
    color: #fff;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, .12);
}

body:not(.nsofts-theme-dark) .nsofts-header-nav .nsofts-header-nav__link {
    color: var(--ns-gray-500);
    background: rgba(35, 52, 70, .05);
    border-color: rgba(35, 52, 70, .10);
}

body:not(.nsofts-theme-dark) .nsofts-header-nav .nsofts-header-nav__link:hover {
    color: var(--ns-gray-700);
    background: rgba(35, 52, 70, .10);
    border-color: rgba(96, 165, 250, .45);
}

/* ---------- Backdrop (drawer mobile) ---------- */

.sb-backdrop {
    display: none;
}

/* ---------- Desktop: modo compacto ---------- */

@media (min-width: 1200px) {
    .nsofts-compact-sidebar #nsofts_sidebar .sb-brand__info,
    .nsofts-compact-sidebar #nsofts_sidebar .sb-search,
    .nsofts-compact-sidebar #nsofts_sidebar .sb-user__info,
    .nsofts-compact-sidebar #nsofts_sidebar .sb-user__logout {
        display: none;
    }

    .nsofts-compact-sidebar #nsofts_sidebar .sb-head {
        flex-direction: column;
        gap: 12px;
    }

    .nsofts-compact-sidebar #nsofts_sidebar .sb-user {
        justify-content: center;
        margin: 8px 8px 14px;
        padding: 8px;
        background: transparent;
        border-color: transparent;
    }

    .nsofts-compact-sidebar #nsofts_sidebar .nsofts-sidebar-nav__link {
        justify-content: center;
        padding: 7px;
    }

    .nsofts-compact-sidebar #nsofts_sidebar .sb-collapse i {
        -webkit-transform: rotate(180deg);
        transform: rotate(180deg);
    }

    /* Hover expande e restaura os elementos ocultos */
    .nsofts-compact-sidebar #nsofts_sidebar:hover .sb-brand__info,
    .nsofts-compact-sidebar #nsofts_sidebar:hover .sb-search,
    .nsofts-compact-sidebar #nsofts_sidebar:hover .sb-user__info,
    .nsofts-compact-sidebar #nsofts_sidebar:hover .sb-user__logout {
        display: flex;
    }

    .nsofts-compact-sidebar #nsofts_sidebar:hover .sb-search {
        display: flex;
    }

    .nsofts-compact-sidebar #nsofts_sidebar:hover .sb-head {
        flex-direction: row;
        gap: 10px;
    }

    .nsofts-compact-sidebar #nsofts_sidebar:hover .nsofts-sidebar-nav__link {
        justify-content: flex-start;
        padding: 7px 10px;
    }

    .nsofts-compact-sidebar #nsofts_sidebar:hover .nsofts-has-menu > .nsofts-sidebar-nav__link {
        padding-right: 34px;
    }
}

/* ---------- Mobile / tablet: drawer ---------- */

@media (max-width: 1199.98px) {
    #nsofts_sidebar {
        top: 0;
        bottom: 0;
        width: 280px;
        left: -300px;
        z-index: 1001;
    }

    .nsofts-compact-sidebar #nsofts_sidebar {
        left: 0;
    }

    .sb-collapse {
        display: none !important;
    }

    .sb-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 999;
        background: rgba(3, 6, 14, .6);
        backdrop-filter: blur(2px);
        opacity: 0;
        pointer-events: none;
        transition: opacity .3s ease;
    }

    .nsofts-compact-sidebar .sb-backdrop {
        opacity: 1;
        pointer-events: auto;
    }
}

/* ---------- Movimento reduzido ---------- */

@media (prefers-reduced-motion: reduce) {
    .sb-collapse,
    .sb-collapse i,
    .sb-icon,
    .nsofts-header-nav .nsofts-header-nav__link,
    .sb-icon .nsofts-sidebar-nav__icon,
    .sb-user__logout,
    .sb-backdrop,
    #nsofts_sidebar .nsofts-sidebar-nav__link,
    #nsofts_sidebar .nsofts-has-menu > .nsofts-sidebar-nav__link:before,
    #nsofts_sidebar .nsofts-has-menu .nsofts-submenu .nsofts-submenu__link {
        transition: none;
    }
}
