/* =============================================
   Navbar — Estilo Apple.com (frosted glass)
   ============================================= */

.navbar {
    position: sticky;
    top: 0;
    z-index: 9999;
    background: rgba(29, 29, 31, 0.92);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

/* ---- Brand ---- */
.navbar .brand {
    font-weight: 600;
    font-size: 14px;
}

.navbar .brand a {
    color: #f5f5f7;
    text-decoration: none;
    letter-spacing: -0.01em;
}

.navbar .brand a:hover {
    color: #fff;
    text-decoration: none;
}

/* ---- Layout interno: 3 zonas ---- */
.navbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 980px;
    height: 100%;
}

/* ---- Links centrais ---- */
.nav-center {
    display: flex;
    align-items: center;
    gap: 24px;
}

.nav-center a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 12px;
    font-weight: 400;
    letter-spacing: 0.01em;
    transition: color 0.2s ease;
    line-height: 44px;
    position: relative;
}

.nav-center a::after {
    content: '';
    position: absolute;
    bottom: 8px;
    left: 0;
    width: 0;
    height: 1px;
    background-color: #fff;
    transition: width 0.2s ease;
}

.nav-center a:hover {
    color: #fff;
    text-decoration: none;
}

.nav-center a:hover::after {
    width: 100%;
}

/* ---- Ações à direita ---- */
.nav-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.nav-actions a,
.nav-actions .nav-logout-btn {
    position: relative;
}

.nav-actions a:not(.nav-cta)::after,
.nav-actions .nav-logout-btn::after {
    content: '';
    position: absolute;
    bottom: 8px; /* para a tag a */
    left: 0;
    width: 0;
    height: 1px;
    background-color: #fff;
    transition: width 0.2s ease;
}

.nav-actions .nav-logout-btn::after {
    bottom: -4px; /* para o button que não tem line-height:44px */
}

.nav-actions a:not(.nav-cta):hover::after,
.nav-actions .nav-logout-btn:hover::after {
    width: 100%;
}

.nav-actions a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 12px;
    font-weight: 400;
    letter-spacing: 0.01em;
    transition: color 0.2s ease;
    line-height: 44px;
}

.nav-actions a:hover {
    color: #fff;
    text-decoration: none;
}

/* Botão CTA dentro da navbar */
.navbar a.nav-cta {
    background: #f5f5f7;
    color: #1d1d1f;
    padding: 6px 14px;
    border-radius: 14px;
    font-size: 11px;
    font-weight: 500;
    transition: background 0.2s ease;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.navbar a.nav-cta:hover {
    background: #fff;
    color: #000;
}

.nav-center a.nav-cta::after {
    display: none;
}

/* Badge do Usuário Logado (Fundo branco arredondado) */
.navbar a.nav-user-badge {
    background: #f5f5f7;
    color: #1d1d1f;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    transition: background 0.2s ease, transform 0.1s ease;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.navbar a.nav-user-badge:hover {
    background: #fff;
    color: #000;
    text-decoration: none;
}

.nav-actions a.nav-user-badge::after {
    display: none;
}

/* Botão "Sair" dentro da navbar */
.nav-actions .nav-logout-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    font-size: 12px;
    font-weight: 400;
    letter-spacing: 0.01em;
    cursor: pointer;
    padding: 0;
    transition: color 0.2s ease;
}

.nav-actions .nav-logout-btn:hover {
    color: #fff;
}

/* ---- Hamburger ---- */
.nav-hamburger {
    display: none;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s ease;
}

.nav-hamburger:hover {
    color: #fff;
}

/* Regra para usuários logados (Navegação via Bottom Nav no Mobile) */
@media (max-width: 768px) {
    body.has-bottom-nav .nav-center,
    body.has-bottom-nav .nav-actions,
    body.has-bottom-nav .nav-hamburger {
        display: none !important;
    }
    
    body.has-bottom-nav .navbar-inner {
        justify-content: center;
    }
}

/* ---- Menu Mobile Dropdown ---- */
.nav-mobile-menu {
    display: none;
    position: fixed;
    top: 44px;
    left: 0;
    right: 0;
    background: rgba(29, 29, 31, 0.97);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 12px 24px 20px 24px;
    z-index: 9998;
    flex-direction: column;
    gap: 0;
}

.nav-mobile-menu.open {
    display: flex;
}

.nav-mobile-menu a,
.nav-mobile-menu button {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: 14px;
    font-weight: 400;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: block;
    background: none;
    border-left: none;
    border-right: none;
    border-top: none;
    cursor: pointer;
    text-align: left;
    width: 100%;
    transition: color 0.2s ease;
}

.nav-mobile-menu a:last-child,
.nav-mobile-menu button:last-child {
    border-bottom: none;
}

.nav-mobile-menu a:hover,
.nav-mobile-menu button:hover {
    color: #fff;
    text-decoration: none;
}

/* ---- Responsivo: Mobile (apenas não logados) ---- */
@media (max-width: 768px) {
    .navbar {
        padding: 0 16px;
    }

    body:not(.has-bottom-nav) .nav-center,
    body:not(.has-bottom-nav) .nav-actions {
        display: none;
    }

    body:not(.has-bottom-nav) .nav-hamburger {
        display: block;
    }
}

/* ---- Responsivo: Desktop ---- */
@media (min-width: 769px) {
    .nav-mobile-menu {
        display: none !important;
    }
    
    .navbar-inner {
        display: grid;
        grid-template-columns: 1fr auto 1fr;
    }
    
    .navbar .brand {
        justify-self: start;
    }

    .nav-center {
        justify-self: center;
    }

    .nav-actions {
        justify-self: end;
    }
}
