/* 1. BASE */
html, body, .page {
    background-color: #F2D1D1 !important;
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.page {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* 2. SIDEBAR */
.sidebar {
    background-color: #F2D1D1 !important;
    width: 280px;
    height: 100vh;
    border-right: 1px solid rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* BRAND */
.navbar-brand img {
    display: inline-block !important;
    width: 45px !important;
    height: 45px !important;
    margin-right: 12px;
    border-radius: 50%;
    border: 2px solid #517DA2;
    object-fit: cover;
}

.navbar-brand {
    display: flex !important;
    align-items: center;
    white-space: nowrap;
    color: #000000 !important;
    font-weight: 900 !important;
    text-transform: uppercase;
    font-size: 0.85rem;
}

/* HEADER */
.top-row.navbar {
    background-color: #F2D1D1 !important;
    height: 70px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

/* LINKS */
.sidebar .nav-item .text-white-50 {
    color: #000000 !important;
    font-weight: 900 !important;
    font-size: 0.75rem;
    padding: 20px 15px 5px 25px !important;
    display: block;
    text-transform: uppercase;
}

.nav-item .nav-link {
    color: #333333 !important;
    font-weight: 500 !important;
    padding: 10px 25px !important;
}

.nav-item a.active {
    color: #517DA2 !important;
    font-weight: 700 !important;
    border-left: 5px solid #517DA2;
    background-color: rgba(0,0,0,0.05) !important;
}

/* 3. MAIN CONTENT */
main {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    background-color: #F2D1D1 !important;
}

.content {
    padding: 0 !important;
}

.img-conteudo {
    width: 100%;
    max-width: 100%;
    height: auto;
    display: block;
}

/* 4. SCROLL NAVMENU (ESSENCIAL) */
.layout-navmenu {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

    .layout-navmenu > nav {
        flex: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
    }

/* SCROLL REAL */
.navmenu-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

    /* scrollbar (desktop) */
    .navmenu-scroll::-webkit-scrollbar {
        width: 8px;
    }

    .navmenu-scroll::-webkit-scrollbar-track {
        background: transparent;
    }

    .navmenu-scroll::-webkit-scrollbar-thumb {
        background: rgba(81,125,162,.5);
        border-radius: 10px;
    }

@media (max-width: 767.98px) {

    .page {
        flex-direction: column;
    }

    /* SIDEBAR CONTROLADA (NÃO BLOQUEIA CONTEÚDO) */
    .sidebar {
        width: 100% !important;
        height: auto; /* << importante */
        display: flex;
        flex-direction: column;
        position: sticky;
        top: 0;
        z-index: 1000;
        overflow: visible; /* << MUITO IMPORTANTE */
    }

    /* TOPO FIXO */
    .top-row {
        flex-shrink: 0;
    }

    /* ESTADOS DO MENU */
    .layout-navmenu.collapsed {
        display: none;
    }

    .layout-navmenu.expanded {
        display: flex;
        flex-direction: column;
        width: 100%;
    }

    /* SCROLL REAL DO MENU */
    .navmenu-scroll {
        flex: 1;
        min-height: 0;
        max-height: calc(100vh - 140px);
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
    }

    /* BOTÃO INSTALAR */
    .layout-navmenu .px-3.mt-3 {
        flex-shrink: 0;
    }

    /* CONTEÚDO PRINCIPAL (CRÍTICO) */
    main {
        display: flex;
        flex-direction: column;
        min-height: 100vh;
        overflow: visible;
    }

    .container-app {
        width: 100%;
        display: block;
        min-height: 200px;
    }

    /* MÍDIA */
    .img-conteudo,
    .video-container,
    video {
        width: 100%;
        display: block;
    }

    .video-container {
        margin: 10px auto;
        min-height: 180px !important;
    }

    /* UX MOBILE */
    video:focus,
    video:active {
        outline: none !important;
        box-shadow: none !important;
    }

    .navbar-toggler {
        border: 2px solid #517DA2 !important;
    }

    /* ========================= */
    /* ADIÇÕES PARA IGUALAR PC   */
    /* ========================= */

    /* garante estrutura flex igual desktop */
    .layout-navmenu {
        display: flex;
        flex-direction: column;
        height: 100%;
    }

    /* faz menu ocupar só o espaço do meio */
    .layout-navmenu.expanded,
    .layout-navmenu.collapsed {
        flex: 1;
    }

    /* evita botão ser empurrado para fora do fluxo visível */
    .layout-navmenu > nav {
        display: flex;
        flex-direction: column;
        flex: 1;
        min-height: 0;
    }
}

/* 6. BOTÃO INSTALAR */
.btn-install {
    background-color: transparent !important;
    color: #517DA2 !important;
    border: 2px solid #517DA2 !important;
    font-weight: 900 !important;
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    font-size: 0.7rem;
    text-transform: uppercase;
}

/* VIDEO */
.video-container {
    display: block !important;
    width: 100% !important;
    max-width: 800px;
    margin: 20px auto;
    min-height: 400px;
    border-radius: 15px;
    text-align: center;
    -webkit-tap-highlight-color: transparent;
}

video {
    width: 100% !important;
    height: auto !important;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    outline: none !important;
}

/* ERROR UI */
#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui.show {
    display: block;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

/* =========================
   CATEGORIA (ACCORDION)
========================= */
.nav-category {
    color: #000;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    padding: 10px 15px;
    cursor: pointer;
    user-select: none;
    transition: color 0.2s ease;
}

    .nav-category:hover {
        color: #517DA2;
    }

    /* Ícone da categoria */
    .nav-category i,
    .nav-category span {
        transition: transform 0.2s ease;
    }

/* =========================
   ARTIGOS (SUBITEM)
========================= */
.nav-item.ps-4 {
    padding-left: 0.25rem !important;
}

/* =========================
   LINK ATIVO MELHORADO
========================= */
.nav-item .nav-link {
    color: #333333 !important;
    font-weight: 500 !important;
    padding: 8px 25px !important;
    border-radius: 6px;
}

    .nav-item .nav-link:hover {
        background-color: rgba(81, 125, 162, 0.08);
    }

/* item ativo */
.nav-item a.active {
    color: #517DA2 !important;
    font-weight: 700 !important;
    border-left: 4px solid #517DA2;
    background-color: rgba(81, 125, 162, 0.10) !important;
}
