/* ======================= Estrutura da tela ======================= */
:root{
    --app-barra-altura: 52px;
}

.app-layout{
    width: 100%;
    height: 100dvh;
}

.app-col-sidebar{
    width: 15%;
    max-width: 15%;
    height: 100%;
}

.app-col-conteudo{
    width: 85%;
    max-width: 85%;
    height: 100%;
}

/* ======================= Sidebar ======================= */
.sidebar_completa{
    width: 100%;
    height: 100%;
}

/* Barra de cima e fundo do menu lateral: só nas telas estreitas */
.sb-barra-mobile,
.sb-fundo{
    display: none;
}

.sb-conteudo{
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    background: linear-gradient(180deg, #1d3a2c 0%, #142a20 55%, #0d1f17 100%);
    color: #e3e9e4;
    font-family: 'Inter', sans-serif;
}

/* ---------- Topo claro com a borda de baixo em curva ---------- */
.sb-topo{
    display: flex;
    flex-shrink: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 18px 18px 36px;
    background: #f4f2ec;
    clip-path: ellipse(135% 100% at 25% 0);
    text-decoration: none;
}

.sb-logo{
    width: 62%;
    max-width: 170px;
    height: auto;
}

.sb-plataforma{
    max-width: 190px;
    color: #4e5420;
    font-family: "Yanone Kaffeesatz", sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.05;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.sb-parceiros{
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    margin-top: 6px;
}

/* Mesma largura para os três: cada logo fica centralizado na sua parte */
.sb-parceiros img{
    flex: 1 1 0;
    min-width: 0;
    height: auto;
    max-height: 28px;
    object-fit: contain;
}

.sb-parceiros-separador{
    flex-shrink: 0;
    width: 1px;
    height: 24px;
    background: #c9c6bb;
}

/* ---------- Navegação ---------- */
.sb-nav{
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 18px 12px;
}

/* Tamanhos com clamp(): a sidebar tem 15% da largura da janela */
.sb-link{
    position: relative;
    display: flex;
    align-items: center;
    gap: clamp(8px, 0.75vw, 14px);
    padding: clamp(9px, 0.65vw, 12px) clamp(10px, 0.85vw, 16px);
    border-radius: 10px;
    color: #e3e9e4;
    font-size: clamp(0.8rem, 1.05vw, 1.05rem);
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s;
}

.sb-link:hover{
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
}

.sb-link-icone{
    width: 1.2em;
    font-size: clamp(1rem, 1.3vw, 1.35rem);
    line-height: 1;
    text-align: center;
}

.sb-link-ativo{
    background: rgba(255, 255, 255, 0.09);
    color: #ffffff;
    font-weight: 700;
}

/* Barra verde à esquerda do item da tela aberta */
.sb-link-ativo::before{
    content: "";
    position: absolute;
    top: 8px;
    bottom: 8px;
    left: 0;
    width: 4px;
    border-radius: 0 4px 4px 0;
    background: #6fd27a;
}

.sb-link-ativo .sb-link-icone{
    color: #7fdc86;
}

/* ---------- Usuário e Sair ---------- */
.sb-rodape{
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: auto;
    padding: 0 12px 16px;
}

.sb-rodape::before{
    content: "";
    height: 1px;
    margin: 0 4px 4px;
    background: rgba(255, 255, 255, 0.12);
}

.sb-usuario{
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px;
}

.sb-usuario-avatar{
    font-size: 2.1rem;
    line-height: 1;
}

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

.sb-usuario-nome{
    overflow: hidden;
    color: #ffffff;
    font-size: 0.98rem;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sb-usuario-papel{
    color: #a9b8ad;
    font-size: 0.82rem;
}

.sb-usuario-seta{
    color: #cfd8d1;
    font-size: 0.9rem;
}

.sb-sair{
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 10px;
    background: rgba(229, 72, 77, 0.14);
    color: #ff6b6b;
    font-size: 1.02rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.sb-sair i{
    font-size: 1.3rem;
    line-height: 1;
}

.sb-sair:hover{
    background: rgba(229, 72, 77, 0.24);
}

/* ======================= Celulares e tablets em pé ======================= */
/* Barra de cima fixa, o conteúdo rola embaixo dela e a sidebar vira menu lateral */
@media (max-width: 991px){
    body,
    #_dash-app-content,
    #_dash-app-content > div{
        width: 100%;
        height: 100dvh;
    }

    .mantine-Group-root.app-layout{
        flex-direction: column;
        flex-wrap: nowrap;
        align-items: stretch;
    }

    .app-col-sidebar{
        flex-shrink: 0;
        width: 100%;
        max-width: 100%;
        height: auto;
    }

    .app-col-conteudo{
        flex: 1;
        width: 100%;
        max-width: 100%;
        height: auto;
        min-height: 0;
        overflow-x: hidden;
        overflow-y: auto;
    }

    #page-content{
        height: auto !important;
    }

    #page-content > div{
        height: auto;
    }

    .sidebar_completa{
        height: auto;
    }

    .sb-barra-mobile{
        display: flex;
        align-items: center;
        gap: 8px;
        height: var(--app-barra-altura);
        padding: 0 8px;
        background: #f4f2ec;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
    }

    .sb-btn-menu{
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        border: 0;
        background: transparent;
        color: #1d3a2c;
        font-size: 1.9rem;
        line-height: 1;
    }

    .sb-barra-logo{
        width: auto;
        height: 40px;
    }

    .sb-fundo{
        position: fixed;
        inset: 0;
        z-index: 1039;
        display: block;
        background: rgba(0, 0, 0, 0.55);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s;
    }

    /* Abaixo das modais e dos filtros, que só abrem com o menu fechado */
    .sb-conteudo{
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        z-index: 1040;
        width: min(84vw, 320px);
        height: 100dvh;
        visibility: hidden;
        transform: translateX(-100%);
        transition: transform 0.2s, visibility 0.2s;
    }

    .sb-aberta .sb-fundo{
        opacity: 1;
        pointer-events: auto;
    }

    .sb-aberta .sb-conteudo{
        visibility: visible;
        transform: none;
        box-shadow: 4px 0 18px rgba(0, 0, 0, 0.5);
    }

    /* Os tamanhos da sidebar acompanham a largura da janela: aqui ficam no
       tamanho de toque */
    .sb-link{
        gap: 12px;
        padding: 12px 14px;
        font-size: 1rem;
    }

    .sb-link-icone{
        font-size: 1.25rem;
    }
}
