/*
 * Clareza Acadêmica — navegação global (reforma de 2026-11-13,
 * mockup/lote-resultado-navbar/).
 *
 * >= 1200px: barra completa (Início, Estudar, Comunidade, Notícias, busca,
 *            saldo, Criar, mensagens, notificações, conta).
 * <  1200px: sem menu ☰. O topo fica com saldo, busca, mensagens e
 *            notificações; a barra de baixo abre as folhas (.nv-folha).
 * Classes próprias (nv-*) para não herdar o legado .navbar-netflix do
 * base-layout.css. #mainNavbar, .bottom-nav e .bottom-nav-item continuam:
 * outras páginas os escondem (modo prova, flashcards em foco).
 */

.navbar-clarity,
.bottom-nav-clarity,
.nv-folha {
    --nav-primary: #667eea;
    --nav-primary-hover: #545fcb;
    --nav-primary-soft: #f0f1ff;
    --nav-primary-line: #e2e4ff;
    --nav-surface: #ffffff;
    --nav-ink: #1f2937;
    --nav-muted: #6b7280;
    --nav-subtle: #9ca3af;
    --nav-border: #e5e7eb;
    --nav-border-strong: #d8dce5;
    --nav-line: #f1f2f5;
    --nav-danger: #ef4444;
    --nav-radius-sm: 9px;
    --nav-radius-md: 14px;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* ---------- Barra do topo ---------- */
.nv {
    position: relative;
    z-index: 1030;
    background: var(--nav-surface);
    border-bottom: 1px solid var(--nav-border);
    box-shadow: 0 4px 18px rgba(31, 41, 55, 0.06);
    transition: box-shadow 0.2s ease;
}
.nv.scrolled { box-shadow: 0 7px 22px rgba(31, 41, 55, 0.1); }
.nv-in {
    max-width: 1320px;
    height: 64px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.nv-logo {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    min-height: 44px;
    margin-right: 0.6rem;
    color: var(--nav-ink);
    font-size: 1rem;
    font-weight: 750;
    letter-spacing: -0.02em;
    white-space: nowrap;
    text-decoration: none;
}
.nv-logo:hover { color: var(--nav-primary-hover); text-decoration: none; }
.nv-logo > i {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    flex: none;
    border-radius: 10px;
    background: var(--nav-primary-soft);
    color: var(--nav-primary);
    font-size: 0.92rem;
}
.nv-logo .brand-short { display: none; }

.nv-menu { display: flex; align-items: center; gap: 0.15rem; margin: 0; padding: 0; list-style: none; }
.nv-a {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 44px;
    padding: 0 0.75rem;
    border: 1px solid transparent;
    border-radius: var(--nav-radius-sm);
    background: none;
    color: #4b5563;
    font: inherit;
    font-size: 0.88rem;
    font-weight: 650;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
}
.nv-a:hover, .nv-a[aria-expanded="true"] { background: #f3f4f6; color: var(--nav-ink); text-decoration: none; }
.nv-a.on { background: var(--nav-primary-soft); border-color: var(--nav-primary-line); color: var(--nav-primary-hover); }
.nv-a .fa-chevron-down, .nv-chev { font-size: 0.62rem; opacity: 0.6; transition: transform 0.15s ease; }
.nv-a[aria-expanded="true"] .fa-chevron-down, [aria-expanded="true"] > .nv-chev { transform: rotate(180deg); }
.nv-pt { width: 7px; height: 7px; border-radius: 50%; background: var(--nav-danger); }

.nv-busca {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 0 1 270px;
    min-width: 120px;
    height: 40px;
    margin-left: 0.5rem;
    padding: 0 0.75rem;
    overflow: hidden;
    border: 1px solid var(--nav-border);
    border-radius: 10px;
    background: #fbfbfc;
    color: var(--nav-subtle);
    font: inherit;
    font-size: 0.84rem;
    white-space: nowrap;
    cursor: pointer;
}
.nv-busca:hover { border-color: var(--nav-border-strong); color: var(--nav-muted); }
.nv-busca span { overflow: hidden; text-overflow: ellipsis; }
.nv-busca kbd {
    margin-left: auto;
    padding: 0 0.35rem;
    border: 1px solid var(--nav-border);
    border-radius: 5px;
    background: #fff;
    color: var(--nav-muted);
    font: 600 0.7rem Inter, sans-serif;
    box-shadow: none;
}

.nv-dir { display: flex; align-items: center; gap: 0.25rem; margin-left: auto; }
.nv-wc {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 36px;
    padding: 0 0.75rem;
    border: 1px solid #fde68a;
    border-radius: 99px;
    background: #fffbeb;
    color: #854d0e;
    font-size: 0.8rem;
    font-weight: 700;
    white-space: nowrap;
    text-decoration: none;
}
.nv-wc:hover { background: #fdecc8; color: #854d0e; text-decoration: none; }
.nv-wc i { color: #d97706; }
.nv-wc .num { font-variant-numeric: tabular-nums; }

.nv-criar {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 40px;
    margin: 0 0.3rem;
    padding: 0 0.9rem;
    border: 1px solid var(--nav-primary);
    border-radius: var(--nav-radius-sm);
    background: var(--nav-primary);
    color: #fff;
    font: inherit;
    font-size: 0.84rem;
    font-weight: 700;
    cursor: pointer;
}
.nv-criar:hover, .nv-criar[aria-expanded="true"] { background: var(--nav-primary-hover); border-color: var(--nav-primary-hover); }
.nv-criar.on { box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.25); }
.nv-criar .nv-chev { opacity: 0.85; }

.nv-ic {
    position: relative;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 1px solid transparent;
    border-radius: var(--nav-radius-sm);
    background: none;
    color: var(--nav-muted);
    font-size: 1.02rem;
    cursor: pointer;
}
.nv-ic:hover { background: var(--nav-primary-soft); border-color: var(--nav-primary-line); color: var(--nav-primary-hover); }
.nv-bd {
    position: absolute;
    top: 4px;
    right: 3px;
    display: grid;
    place-items: center;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border: 2px solid var(--nav-surface);
    border-radius: 99px;
    background: var(--nav-danger);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 800;
    line-height: 1;
}

.nv-conta {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    max-width: 220px;
    min-height: 44px;
    margin-left: 0.15rem;
    padding: 0 0.45rem 0 0.25rem;
    border: 1px solid transparent;
    border-radius: var(--nav-radius-sm);
    background: none;
    color: var(--nav-ink);
    font: inherit;
    font-size: 0.82rem;
    font-weight: 650;
    cursor: pointer;
}
.nv-conta:hover, .nv-conta[aria-expanded="true"], .nv-conta.on { background: var(--nav-primary-soft); border-color: var(--nav-primary-line); color: var(--nav-primary-hover); }
.nv-conta .user-avatar {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    flex: none;
    border-radius: 50%;
    background: var(--nav-primary);
    color: #fff;
    font-weight: 800;
    object-fit: cover;
}
.nav-username { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nv-bt {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0 0.9rem;
    border: 1px solid var(--nav-border-strong);
    border-radius: var(--nav-radius-sm);
    background: #fff;
    color: var(--nav-ink);
    font-size: 0.84rem;
    font-weight: 650;
    white-space: nowrap;
    text-decoration: none;
}
.nv-bt:hover { border-color: var(--nav-primary); background: var(--nav-primary-soft); color: var(--nav-primary-hover); text-decoration: none; }
.nv-bt.p { border-color: var(--nav-primary); background: var(--nav-primary); color: #fff; }
.nv-bt.p:hover { background: var(--nav-primary-hover); color: #fff; }

.nv-so-cel { display: none; }

/* ---------- Painéis (dropdowns do Bootstrap) ---------- */
.nv .nv-pn {
    padding: 0.75rem;
    border: 1px solid var(--nav-border);
    border-radius: var(--nav-radius-md);
    background: #fff;
    box-shadow: 0 14px 40px rgba(31, 41, 55, 0.14);
}
.nv .nv-pn-lista { width: 310px; }
.nv-cols { display: grid; grid-template-columns: repeat(3, 214px); gap: 0 0.9rem; }
.nv-t {
    padding: 0.2rem 0.55rem 0.35rem;
    color: var(--nav-subtle);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.nv-i {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr);
    align-items: center;
    gap: 0.05rem 0.65rem;
    min-height: 44px;
    padding: 0.45rem 0.55rem;
    border-radius: 10px;
    color: var(--nav-ink);
    text-decoration: none;
}
.nv-i:hover, .nv-i:focus-visible { background: #f5f6fa; color: var(--nav-ink); text-decoration: none; }
.nv-i > i {
    grid-row: span 2;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--nav-primary-soft);
    color: var(--nav-primary-hover);
    font-size: 0.86rem;
}
.nv-i b { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; font-size: 0.87rem; font-weight: 700; }
.nv-i small { color: var(--nav-muted); font-size: 0.75rem; line-height: 1.3; }
.nv-i.on { background: var(--nav-primary-soft); color: var(--nav-primary-hover); }
.nv-i.on > i { background: var(--nav-primary); color: #fff; }
.nv-novo, .nv-cv { padding: 0.05rem 0.42rem; border-radius: 99px; color: #fff; font-size: 0.6rem; font-weight: 800; }
.nv-novo { background: #10b981; }
.nv-cv { background: var(--nav-danger); }

/* Menu da conta (conteúdo em menu-usuario.css) */
.nv .um-menu { margin-top: 0.5rem !important; }

/* ---------- Foco ---------- */
.navbar-clarity :is(a, button):focus-visible,
.bottom-nav-clarity :is(a, button):focus-visible,
.nv-folha :is(a, button):focus-visible {
    outline: 3px solid rgba(102, 126, 234, 0.45);
    outline-offset: 2px;
    box-shadow: none !important;
}

/* ---------- Telas médias: some a busca em campo, fica a lupa ---------- */
@media (max-width: 1399.98px) and (min-width: 1200px) {
    .nv-in { padding-inline: 0.75rem; }
    .nv-logo .brand-full { display: none; }
    .nv-logo .brand-short { display: inline; }
    .nv-busca { flex-basis: 200px; }
    .nav-username { display: none; }
}

/* ---------- Abaixo de 1200px: topo enxuto + barra de baixo ---------- */
@media (max-width: 1199.98px) {
    .nv-in { height: 58px; padding: 0 0.75rem; gap: 0.15rem; }
    .nv-menu, .nv-busca, .nv-so-desk { display: none !important; }
    .nv-so-cel { display: grid; }
    .nv-wc { min-height: 34px; padding: 0 0.65rem; font-size: 0.78rem; }
}
@media (max-width: 575.98px) {
    .nv-logo .brand-full { display: none; }
    .nv-logo .brand-short { display: inline; }
    .nv-wc-u { display: none; }
}
@media (max-width: 360px) {
    .nv-in { padding: 0 0.4rem; }
    .nv-logo { margin-right: 0.2rem; }
    .nv-logo > i { width: 32px; height: 32px; }
    .nv-ic { width: 40px; }
    .nv-wc { padding: 0 0.5rem; font-size: 0.72rem; }
}

/* ---------- Barra de baixo ---------- */
@media (max-width: 1199.98px) {
    .bottom-nav-clarity {
        min-height: 66px;
        padding: 5px 4px calc(5px + env(safe-area-inset-bottom));
        align-items: stretch;
        border-top: 1px solid var(--nav-border);
        background: rgba(255, 255, 255, 0.97);
        box-shadow: 0 -6px 22px rgba(31, 41, 55, 0.1);
        backdrop-filter: blur(12px);
    }
    .bottom-nav-clarity .bottom-nav-item {
        min-height: 54px;
        gap: 3px;
        padding: 0.35rem 0.15rem;
        border: 0;
        border-radius: var(--nav-radius-sm);
        background: none;
        color: var(--nav-muted);
        font-family: inherit;
        font-size: 0.66rem;
        font-weight: 650;
        cursor: pointer;
        transition: color 0.15s ease, background-color 0.15s ease;
    }
    .bottom-nav-clarity .bottom-nav-item:hover,
    .bottom-nav-clarity .bottom-nav-item.active {
        background: var(--nav-primary-soft);
        color: var(--nav-primary-hover);
    }
    .bottom-nav-clarity .bottom-nav-item.active::before {
        top: -5px;
        left: 32%;
        right: 32%;
        height: 3px;
        border-radius: 0 0 4px 4px;
        background: var(--nav-primary);
    }
    .bottom-nav-clarity .bottom-nav-item.active i { color: var(--nav-primary); transform: none; }
    .bottom-nav-clarity .bottom-nav-item-create { margin-top: 0; }
    .bottom-nav-clarity .bottom-nav-item-create .bn-create-btn {
        width: 38px;
        height: 38px;
        border-radius: 11px;
        background: var(--nav-primary);
        color: #fff !important;
        box-shadow: none;
        font-size: 1rem;
        transform: none;
    }
    .bottom-nav-clarity .bottom-nav-item-create:hover .bn-create-btn { background: var(--nav-primary-hover); transform: none; }
    .bottom-nav-clarity .bottom-nav-item-create .bn-create-btn i,
    .bottom-nav-clarity .bottom-nav-item-create.active .bn-create-btn i { color: #fff; }
    .bottom-nav-clarity .bottom-nav-item-create:hover,
    .bottom-nav-clarity .bottom-nav-item-create.active { background: none; }
    .bottom-nav-clarity .bottom-nav-item-create.active::before { display: none; }
    .bottom-nav-clarity .bottom-nav-item-create.active .bn-create-btn { box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3); }
    .bottom-nav-clarity .bottom-nav-item-create > span:last-child { color: var(--nav-primary-hover); }
    .bottom-nav-clarity .bn-pt {
        position: absolute;
        top: 8px;
        left: calc(50% + 6px);
        width: 9px;
        height: 9px;
        border: 2px solid #fff;
        border-radius: 50%;
        background: var(--nav-danger);
    }
    body { padding-bottom: calc(70px + env(safe-area-inset-bottom)); }
}
@media (max-width: 390px) {
    .bottom-nav-clarity .bottom-nav-item { font-size: 0.6rem; }
}

/* ---------- Folhas de baixo (Estudar, Criar, Comunidade e Conta) ---------- */
.um-folha.offcanvas-bottom {
    height: auto;
    max-height: 88vh;
    border: 0;
    border-radius: 18px 18px 0 0;
    background: #fff;
    box-shadow: 0 -12px 40px rgba(31, 41, 55, 0.2);
}
.um-folha-topo { position: relative; display: flex; justify-content: center; padding: 0.55rem 0 0; }
.um-grab { width: 38px; height: 4px; border-radius: 9px; background: #d8dce5; }
.um-fechar {
    position: absolute;
    top: 0.35rem;
    right: 0.6rem;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #6b7280;
}
.um-fechar:hover { background: #f1f2f5; }
@media (min-width: 640px) {
    .um-folha.offcanvas-bottom { left: max(0px, calc(50% - 280px)); right: max(0px, calc(50% - 280px)); }
}
.nv-folha-corpo { padding: 0.2rem 0.9rem calc(1rem + env(safe-area-inset-bottom)); overflow-y: auto; }
.nv-folha-t { margin: 0.2rem 0.2rem 0.5rem; color: var(--nav-ink); font-size: 1.05rem; font-weight: 800; }
.nv-folha .nv-col { display: grid; grid-template-columns: 1fr 1fr; gap: 0.1rem 0.4rem; margin-bottom: 0.4rem; }
.nv-folha .nv-col .nv-t { grid-column: 1 / -1; padding-left: 0.3rem; }
.nv-folha .nv-col .nv-i { grid-template-columns: 32px minmax(0, 1fr); padding: 0.45rem 0.3rem; }
.nv-folha .nv-col .nv-i small { display: none; }
.nv-folha .nv-col .nv-i > i { grid-row: auto; }
.nv-folha-lista .nv-i { padding: 0.5rem 0.3rem; }

@media print {
    .nv-dir, .nv-busca { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
    .navbar-clarity *,
    .navbar-clarity *::before,
    .navbar-clarity *::after,
    .bottom-nav-clarity *,
    .bottom-nav-clarity *::before,
    .bottom-nav-clarity *::after,
    .nv-folha * {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
