:root{
    --sidebar-w: 17rem;
    --sidebar-w-collapsed: 4.75rem;
}

/* ---------------------------------- SIDEBAR ---------------------------------- */

.sidebar{
    position: fixed;
    top: 0;
    left: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    width: var(--sidebar-w);
    height: 100vh;
    background: var(--surface);
    border-right: 1px solid var(--border);
    box-shadow: 2px 0 10px rgba(43, 41, 38, 0.05);
    overflow-x: hidden;
    transition: width 0.2s ease;
}

.sidebar-header{
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    gap: 0.5rem;
    height: 4.75rem;
    padding: 0 1rem;
    border-bottom: 1px solid var(--border);
}

.sidebar-logo-full{
    white-space: nowrap;
}

.sidebar-logo-mini{
    display: none;
    align-items: center;
    justify-content: center;
    width: 2.4rem;
    height: 2.4rem;
    flex-shrink: 0;
    border: 2px solid var(--gold);
    border-radius: 50%;
    color: var(--gold-dark);
    font-family: var(--font-display);
    font-weight: 700;
    text-decoration: none;
}

.sidebar-toggle{
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 2.1rem;
    height: 2.1rem;
    border: none;
    border-radius: 50%;
    background: var(--cream);
    color: var(--muted);
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.sidebar-toggle:hover{
    background: var(--gold-light);
    color: var(--gold-dark);
}

.sidebar-toggle i{
    transition: transform 0.2s ease;
}

.sidebar-nav{
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1.25rem 0.75rem;
}

.nav-section{
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.nav-section__label{
    padding: 0 0.85rem;
    margin-bottom: 0.5rem;
    font-family: var(--font-display);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    white-space: nowrap;
}

.nav-link{
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.9rem;
    height: 2.85rem;
    padding: 0 0.85rem;
    border-radius: 0.6rem;
    color: var(--ink);
    font-size: 0.94rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.nav-link i{
    width: 1.35rem;
    flex-shrink: 0;
    font-size: 1.05rem;
    text-align: center;
    color: var(--gold);
}

.nav-link:hover{
    background: var(--cream);
    color: var(--ink);
    text-decoration: none;
}

.nav-link.active{
    background: var(--gold-light);
    color: var(--gold-dark);
}

.nav-link.active i{
    color: var(--gold-dark);
}

.nav-link.active::before{
    content: '';
    position: absolute;
    left: -0.75rem;
    top: 0.4rem;
    bottom: 0.4rem;
    width: 0.28rem;
    border-radius: 0 0.2rem 0.2rem 0;
    background: var(--gold);
}

.sidebar-footer{
    flex-shrink: 0;
    padding: 0.75rem;
    border-top: 1px solid var(--border);
}

.nav-link--logout i{
    color: var(--danger);
}

.nav-link--logout:hover{
    background: #F5E3DE;
    color: var(--danger);
}

/* ---------------------------------- CONTEÚDO ---------------------------------- */

.main-wrapper{
    min-height: 100vh;
    margin-left: var(--sidebar-w);
    transition: margin-left 0.2s ease;
}

.main-wrapper--static{
    margin-left: 0;
}

/* ---------------------------------- ESTADO RECOLHIDO ---------------------------------- */

html.sidebar-collapsed .sidebar{
    width: var(--sidebar-w-collapsed);
}

html.sidebar-collapsed .main-wrapper{
    margin-left: var(--sidebar-w-collapsed);
}

html.sidebar-collapsed .sidebar-header{
    flex-direction: column;
    height: auto;
    padding: 0.85rem 0;
    gap: 0.6rem;
}

html.sidebar-collapsed .sidebar-logo-full{
    display: none;
}

html.sidebar-collapsed .sidebar-logo-mini{
    display: inline-flex;
}

html.sidebar-collapsed .sidebar-toggle i{
    transform: rotate(180deg);
}

html.sidebar-collapsed .nav-section__label{
    display: none;
}

html.sidebar-collapsed .nav-link{
    justify-content: center;
    padding: 0;
    gap: 0;
}

html.sidebar-collapsed .nav-label{
    display: none;
}

html.sidebar-collapsed .nav-link.active::before{
    left: 0;
}

/* ---------------------------------- RESPONSIVO ---------------------------------- */

@media (max-width: 860px){
    .sidebar{
        width: var(--sidebar-w-collapsed);
    }
    .main-wrapper{
        margin-left: var(--sidebar-w-collapsed);
    }
    .sidebar-header{
        flex-direction: column;
        height: auto;
        padding: 0.85rem 0;
        gap: 0.6rem;
    }
    .sidebar-logo-full{
        display: none;
    }
    .sidebar-logo-mini{
        display: inline-flex;
    }
    .sidebar-toggle{
        display: none;
    }
    .nav-section__label{
        display: none;
    }
    .nav-link{
        justify-content: center;
        padding: 0;
        gap: 0;
    }
    .nav-label{
        display: none;
    }
    .nav-link.active::before{
        left: 0;
    }
}
