/* ===== SHERQ – Menu lateral (Grupo A) ===== */
:root {
    --sb-w: 272px;
    --sb-w-collapsed: 76px;
    --sb-text: #c9d8ec;
    --sb-sky: #19b5e6;
    --sb-accent: #f5b700;
    --sb-ease: cubic-bezier(.4, 0, .2, 1);
}

/* ---------- Sidebar ---------- */
.sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: var(--sb-w);
    z-index: 1040;
    display: flex;
    flex-direction: column;
    color: var(--sb-text);
    background: repeating-linear-gradient(135deg, rgba(255, 255, 255, .035) 0 90px, transparent 90px 180px), radial-gradient(90% 40% at 0% 100%, rgba(25, 181, 230, .28), transparent 70%), linear-gradient(180deg, #001a3d 0%, #002a5c 60%, #003366 100%);
    transition: width .25s var(--sb-ease), transform .25s var(--sb-ease);
}
    /* faixa de sinalizacao, igual ao login */
    .sidebar::after {
        content: "";
        position: absolute;
        top: 0;
        bottom: 0;
        right: 0;
        width: 4px;
        background: repeating-linear-gradient(135deg, var(--sb-accent) 0 10px, #003366 10px 20px);
        pointer-events: none;
    }

.sb-head {
    flex: none;
    height: 68px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px 0 20px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.sb-brand img {
    display: block;
    height: 34px;
    max-width: 170px;
    object-fit: contain;
}

.sb-collapse {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 9px;
    color: #fff;
    background: rgba(255, 255, 255, .08);
    transition: background .2s;
}

    .sb-collapse:hover {
        background: rgba(255, 255, 255, .18);
    }

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

/* ---------- Navegacao ---------- */
.sb-nav {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 10px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, .2) transparent;
}

.sb-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: .65rem .8rem;
    border: 0;
    border-radius: 10px;
    color: var(--sb-text);
    background: transparent;
    font-size: .92rem;
    font-weight: 500;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: background .2s, color .2s;
}

    .sb-link:hover {
        color: #fff;
        background: rgba(255, 255, 255, .08);
        text-decoration: none;
    }

    .sb-link:focus-visible, .sb-sublink:focus-visible, .sb-collapse:focus-visible {
        outline: 2px solid var(--sb-sky);
        outline-offset: 2px;
    }

.sb-icon {
    flex: none;
    width: 20px;
    text-align: center;
    font-size: 1rem;
    opacity: .9;
}

.sb-text {
    flex: 1;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.sb-chevron {
    font-size: .7rem;
    opacity: .7;
    transition: transform .25s var(--sb-ease);
}

.sb-group.open > .sb-toggle .sb-chevron {
    transform: rotate(180deg);
}

/* estado ativo */
.sb-nav > .sb-link.active,
.sb-toggle.has-active {
    color: #fff;
    background: linear-gradient(90deg, rgba(25, 181, 230, .30), rgba(255, 255, 255, .06));
}

    .sb-nav > .sb-link.active .sb-icon,
    .sb-toggle.has-active .sb-icon {
        color: var(--sb-sky);
        opacity: 1;
    }

    .sb-nav > .sb-link.active::before,
    .sb-toggle.has-active::before {
        content: "";
        position: absolute;
        left: -10px;
        top: 22%;
        bottom: 22%;
        width: 3px;
        border-radius: 0 3px 3px 0;
        background: var(--sb-sky);
    }

/* ---------- Grupos (acordeao) ---------- */
.sb-sub {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows .25s var(--sb-ease);
}

.sb-group.open > .sb-sub {
    grid-template-rows: 1fr;
}

.sb-sub-inner {
    min-height: 0;
    overflow: hidden;
    visibility: hidden;
    margin-left: 21px;
    padding-left: 12px;
    border-left: 1px solid rgba(255, 255, 255, .12);
    transition: visibility .25s;
}

.sb-group.open > .sb-sub > .sb-sub-inner {
    visibility: visible;
}

.sb-sub-inner > :first-child {
    margin-top: 4px;
}

.sb-sub-inner > :last-child {
    margin-bottom: 4px;
}

.sb-sublink {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: .5rem .7rem;
    border-radius: 8px;
    color: var(--sb-text);
    font-size: .86rem;
    text-decoration: none;
    transition: background .2s, color .2s;
}

    .sb-sublink i {
        flex: none;
        width: 16px;
        text-align: center;
        font-size: .8rem;
        opacity: .7;
    }

    .sb-sublink:hover {
        color: #fff;
        background: rgba(255, 255, 255, .08);
        text-decoration: none;
    }

    .sb-sublink.active {
        color: #fff;
        background: rgba(255, 255, 255, .12);
        font-weight: 600;
    }

        .sb-sublink.active i {
            color: var(--sb-sky);
            opacity: 1;
        }

.sb-label {
    padding: .7rem .7rem .2rem;
    font-size: .75rem;
    font-weight: 600;
    color: rgba(201, 216, 236, .55);
}

.sb-divider {
    height: 1px;
    margin: .4rem .7rem;
    background: rgba(255, 255, 255, .1);
}

/* ---------- Utilizador ---------- */
.sb-user {
    position: relative;
    flex: none;
    padding: 12px;
    border-top: 1px solid rgba(255, 255, 255, .08);
    background: rgba(0, 0, 0, .14);
}

.sb-profile-main {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: .3rem .4rem;
}

.sb-avatar {
    flex: none;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, .25);
    background: #0a3a73;
}

.sb-profile-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}

.sb-profile-name {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    color: #fff;
    font-size: .9rem;
    font-weight: 600;
}

.sb-profile-role {
    font-size: .75rem;
    color: rgba(201, 216, 236, .65);
}

.sb-logout:focus-visible {
    outline: 2px solid var(--sb-sky);
    outline-offset: 2px;
}

.sb-logout-form {
    margin: .35rem 0 0;
}

.sb-logout {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: .55rem .8rem;
    border: 0;
    border-radius: 10px;
    color: var(--sb-text);
    background: transparent;
    font-size: .88rem;
    font-weight: 500;
    text-align: left;
    transition: background .2s, color .2s;
}

    .sb-logout:hover {
        color: #fff;
        background: rgba(220, 53, 69, .22);
    }

.sb-guest {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* itens do painel de notificacoes (usado na barra superior) */
.sb-notif-head {
    padding: .85rem 1rem;
    font-size: .85rem;
    color: #6b7280;
    border-bottom: 1px solid #e5e9ef;
}

    .sb-notif-head strong {
        color: #003366;
    }

.sb-notif-list {
    max-height: 260px;
    overflow-y: auto;
}

.sb-notif-item {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .7rem 1rem;
    color: #1f2937;
    text-decoration: none;
}

    .sb-notif-item:hover {
        background: #eef3f9;
        color: #1f2937;
        text-decoration: none;
    }

.sb-notif-icon {
    flex: none;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #004080;
    background: #eef3f9;
}

.sb-notif-name {
    display: block;
    font-size: .86rem;
    font-weight: 600;
}

.sb-notif-date {
    display: block;
    font-size: .78rem;
    color: #6b7280;
}

.sb-notif-more {
    display: block;
    padding: .7rem 1rem;
    text-align: center;
    font-size: .86rem;
    font-weight: 600;
    color: #004080;
    border-top: 1px solid #e5e9ef;
    text-decoration: none;
}

    .sb-notif-more:hover {
        background: #eef3f9;
        color: #003366;
        text-decoration: none;
    }

/* ---------- Conteudo ---------- */
.app-content {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left .25s var(--sb-ease);
}

.has-sidebar .app-content {
    margin-left: var(--sb-w);
}

.app-content .footer {
    position: static;
    width: auto;
    height: auto;
    line-height: normal;
    margin-top: auto;
    padding: 1rem 0;
    text-align: center;
    color: #6b7280;
}

body:has(.auth-page) .footer {
    display: none;
}
/* login nao mostra rodape */

/* ---------- Barra superior ---------- */
.app-topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    display: flex;
    align-items: center;
    gap: 14px;
    height: 64px;
    padding: 0 clamp(1rem, 3vw, 2rem);
    background: rgba(255, 255, 255, .86);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid #e5e9ef;
}

.tb-burger, .tb-logo {
    display: none;
}

.tb-crumbs {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: .6rem;
    overflow: hidden;
    white-space: nowrap;
    font-size: .9rem;
    color: #6b7280;
}

    .tb-crumbs a {
        color: #004080;
        text-decoration: none;
    }

        .tb-crumbs a:hover {
            color: #003366;
        }

.tb-sep {
    font-size: .6rem;
    opacity: .6;
}

.tb-current {
    overflow: hidden;
    text-overflow: ellipsis;
    color: #003366;
    font-weight: 600;
}

.tb-actions {
    position: relative;
    flex: none;
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tb-bell {
    position: relative;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 12px;
    color: #003366;
    background: #eef3f9;
    transition: background .2s;
}

    .tb-bell:hover, .tb-bell[aria-expanded="true"] {
        background: #dce7f5;
    }

    .tb-bell:focus-visible {
        outline: 2px solid var(--sb-sky);
        outline-offset: 2px;
    }

.tb-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--sb-accent);
    color: #00224a;
    font-size: .68rem;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    box-shadow: 0 0 0 2px #fff;
}

.tb-notif {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    z-index: 5;
    width: 340px;
    max-width: calc(100vw - 24px);
    overflow: hidden;
    border-radius: 14px;
    border: 1px solid #e5e9ef;
    color: #1f2937;
    background: #fff;
    box-shadow: 0 18px 50px rgba(0, 16, 40, .25);
}

    .tb-notif[hidden] {
        display: none;
    }

.sb-overlay {
    display: none;
}

/* ---------- Desktop recolhido ---------- */
@media (min-width: 992px) {
    html.sidebar-collapsed .sidebar {
        width: var(--sb-w-collapsed);
    }

    html.sidebar-collapsed .has-sidebar .app-content {
        margin-left: var(--sb-w-collapsed);
    }

    html.sidebar-collapsed .sb-brand,
    html.sidebar-collapsed .sb-text,
    html.sidebar-collapsed .sb-chevron,
    html.sidebar-collapsed .sb-label,
    html.sidebar-collapsed .sb-sub,
    html.sidebar-collapsed .sb-profile-info,
    html.sidebar-collapsed .sb-logout span {
        display: none;
    }

    html.sidebar-collapsed .sb-head {
        justify-content: center;
        padding: 0;
    }

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

    html.sidebar-collapsed .sb-link {
        justify-content: center;
        padding: .75rem 0;
    }

    html.sidebar-collapsed .sb-user {
        padding: 12px 8px;
    }

    html.sidebar-collapsed .sb-profile-main {
        flex-direction: column;
        padding: .2rem 0;
    }

    html.sidebar-collapsed .sb-logout {
        justify-content: center;
        padding: .6rem 0;
    }
}

/* ---------- Mobile / tablet ---------- */
@media (max-width: 991.98px) {
    .sidebar {
        width: min(300px, 86vw);
        transform: translateX(-100%);
    }

    body.sidebar-open .sidebar {
        transform: none;
        box-shadow: 0 0 60px rgba(0, 10, 30, .5);
    }

    body.sidebar-open {
        overflow: hidden;
    }

    .sb-collapse {
        display: none;
    }

    .has-sidebar .app-content {
        margin-left: 0;
    }

    .app-topbar {
        height: 56px;
        padding: 0 14px;
        gap: 12px;
        background: linear-gradient(135deg, #001a3d 0%, #003366 100%);
        border-bottom: 0;
        box-shadow: 0 2px 12px rgba(0, 20, 50, .25);
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }

        .app-topbar::after {
            content: "";
            position: absolute;
            left: 0;
            right: 0;
            bottom: 0;
            height: 3px;
            background: repeating-linear-gradient(135deg, var(--sb-accent) 0 10px, #003366 10px 20px);
        }

    .tb-crumbs {
        display: none;
    }

    .tb-logo {
        display: block;
    }

        .tb-logo img {
            display: block;
            height: 30px;
        }

    .tb-burger {
        display: block;
        width: 38px;
        height: 38px;
        border: 0;
        border-radius: 10px;
        color: #fff;
        background: rgba(255, 255, 255, .1);
        font-size: 1.05rem;
    }

    .tb-bell {
        color: #fff;
        background: rgba(255, 255, 255, .12);
    }

        .tb-bell:hover, .tb-bell[aria-expanded="true"] {
            background: rgba(255, 255, 255, .22);
        }

    .tb-badge {
        box-shadow: 0 0 0 2px #002a5c;
    }

    .sb-overlay {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1035;
        background: rgba(0, 16, 40, .55);
        backdrop-filter: blur(2px);
        opacity: 0;
        visibility: hidden;
        transition: opacity .25s, visibility .25s;
    }

    body.sidebar-open .sb-overlay {
        opacity: 1;
        visibility: visible;
    }
}

@media (prefers-reduced-motion: reduce) {
    .sidebar, .app-content, .sb-sub, .sb-chevron, .sb-overlay {
        transition: none;
    }
}
