* {
    box-sizing: border-box;
}

:root {
    --app-mobile-topbar-height: 68px;
    --app-mobile-bottom-nav-height: 68px;
}

.has-fixed-navbar {
    padding-top: 78px;
}

.navbar-shell {
    position: relative;
    z-index: 1000;
}

.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;

    width: 100%;
    min-height: 78px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 16px 28px;

    background: var(--app-surface-bg-strong);
    border-bottom: 1px solid var(--app-surface-border);
    backdrop-filter: blur(10px);
    box-shadow: var(--app-navbar-shadow);

    font-family: var(--app-font-family);
    view-transition-name: app-navbar;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 16px;
    z-index: 2;
}

.nav-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-width: 160px;
    z-index: 2;
}

.nav-account-slot {
    display: flex;
    align-items: center;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.brand-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.brand-logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.brand-texts {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.brand-name {
    font-size: 1.52rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.2px;

    color: var(--app-text-primary);
}

/* MENU */
.menu-btn {
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    padding: 0 11px;
    background: var(--app-ghost-bg);
    transition: background 0.2s ease, transform 0.2s ease;
}

.menu-btn:hover {
    background: var(--app-ghost-bg-hover);
    transform: translateY(-1px);
}

.menu-btn span {
    display: block;
    width: 100%;
    height: 2px;
    border-radius: 999px;
    background: var(--app-text-primary);
    transition: all 0.2s ease;
}

.menu-btn-open span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.menu-btn-open span:nth-child(2) {
    opacity: 0;
}

.menu-btn-open span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

/* CENTRO */
.nav-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.current-section {
    color: var(--app-text-primary);
    font-size: 1.45rem;
    font-weight: 700;
    letter-spacing: 0.4px;
    line-height: 1;
    text-shadow: var(--app-nav-accent-shadow);
}

.navbar-account-btn {
    border: none;
    cursor: pointer;
    border-radius: 12px;
    min-height: var(--app-button-min-height);
    padding: var(--app-button-padding-y) var(--app-button-padding-x);
    font-size: var(--app-button-font-size);
    font-weight: var(--app-button-font-weight);
    transition: transform var(--app-transition-fast), background var(--app-transition-fast), box-shadow var(--app-transition-fast), border-color var(--app-transition-fast), color var(--app-transition-fast);
    white-space: nowrap;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.login-btn {
    background: var(--app-primary-bg);
    color: var(--app-primary-text);
    box-shadow: 0 12px 24px rgba(56, 189, 248, 0.22);
}

.login-btn:hover {
    transform: translateY(-1px);
    background: var(--app-primary-bg-hover);
    box-shadow: 0 16px 28px rgba(56, 189, 248, 0.3);
}

.logout-btn {
    background: var(--app-danger-bg);
    color: var(--app-danger-text);
    border: 1px solid var(--app-danger-border);
    box-shadow: 0 12px 24px rgba(239, 68, 68, 0.2);
}

.profile-btn {
    background: var(--app-ghost-bg);
    color: var(--app-text-primary);
    border: 1px solid var(--app-ghost-border);
}

.logout-btn:hover {
    transform: translateY(-1px);
    background: var(--app-danger-bg-hover);
    box-shadow: 0 16px 28px rgba(239, 68, 68, 0.28);
}

.profile-btn:hover {
    background: var(--app-ghost-bg-hover);
}

/* POPUP */
.mobile-menu {
    position: fixed;
    top: 90px;
    left: 28px;
    z-index: 1002;
    min-width: 220px;
    padding: 12px;
    border-radius: 16px;
    display: none;
    flex-direction: column;
    gap: 6px;
    background: var(--app-surface-bg-strong);
    border: 1px solid var(--app-surface-border);
    box-shadow: var(--app-surface-shadow);
}

.mobile-menu[hidden] {
    display: none !important;
}

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

.mobile-link {
    text-decoration: none;
    color: var(--app-text-secondary);
    font-size: 1rem;
    font-weight: 600;
    padding: 12px 14px;
    border-radius: 12px;
    transition: background 0.2s ease, color 0.2s ease;
}

.mobile-link:hover {
    background: var(--app-ghost-bg);
    color: var(--app-text-primary);
}

.mobile-link-active {
    background: var(--app-secondary-bg);
    color: var(--app-secondary-text);
    border: 1px solid var(--app-secondary-border);
}

.mobile-bottom-nav {
    display: none;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* RESPONSIVE */
@media (max-width: 900px) {
    .nav-center {
        display: none;
    }

    .current-section {
        font-size: 1.15rem;
    }

    .nav-right {
        min-width: auto;
    }
}

@media (max-width: 720px) {
    .has-fixed-navbar {
        padding-top: var(--app-mobile-topbar-height);
        padding-bottom: 0;
    }

    .navbar {
        min-height: var(--app-mobile-topbar-height);
        padding: 12px 16px;
    }

    .menu-btn {
        display: none;
    }

    .navbar-shell.navbar-user-guest .menu-btn {
        display: flex;
    }

    .nav-left,
    .nav-right {
        min-width: 0;
    }

    .brand-icon {
        width: 34px;
        height: 34px;
    }

    .brand-texts {
        display: none;
    }

    .brand {
        display: inline-flex;
        flex: 0 0 auto;
    }

    .nav-center {
        display: none;
    }

    .current-section {
        font-size: 0.98rem;
        display: block;
        width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .mobile-menu {
        top: calc(var(--app-mobile-topbar-height) + 10px);
        left: 16px;
        right: 16px;
        min-width: unset;
    }

    .navbar-account-btn {
        max-width: 140px;
        padding: 8px 12px;
        font-size: 0.84rem;
    }

    .navbar-shell.navbar-user-authenticated.navbar-has-mobile-bottom-nav .nav-left {
        gap: 0;
    }

    .navbar-shell.navbar-user-authenticated.navbar-has-mobile-bottom-nav .nav-center {
        position: static;
        display: flex;
        flex: 1 1 auto;
        min-width: 0;
        margin-left: 10px;
        transform: none;
        justify-content: flex-start;
        pointer-events: none;
    }

    .navbar-shell.navbar-user-authenticated.navbar-has-mobile-bottom-nav .nav-right {
        flex: 0 0 auto;
        min-width: auto;
    }

    .navbar-shell.navbar-has-mobile-bottom-nav .mobile-menu {
        position: fixed;
        top: auto;
        left: 12px;
        right: 12px;
        bottom: calc(var(--app-mobile-bottom-nav-height) + env(safe-area-inset-bottom, 0px));
        z-index: 1001;
    }

    .navbar-shell.navbar-has-mobile-bottom-nav .mobile-bottom-nav {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1000;
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 0;
        min-height: var(--app-mobile-bottom-nav-height);
        padding: 9px 10px calc(9px + env(safe-area-inset-bottom, 0px));
        background: var(--app-surface-bg-strong);
        border-top: 1px solid var(--app-surface-border);
        box-shadow: var(--app-navbar-shadow);
        backdrop-filter: blur(14px);
    }

    .has-fixed-navbar.has-mobile-bottom-nav {
        padding-top: var(--app-mobile-topbar-height);
        padding-bottom: calc(var(--app-mobile-bottom-nav-height) + env(safe-area-inset-bottom, 0px));
    }

    .mobile-bottom-link {
        display: inline-flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        min-height: 48px;
        padding: 6px 4px;
        border: none;
        border-radius: 0;
        background: transparent;
        color: var(--app-text-secondary);
        font-size: 0;
        font-weight: 700;
        line-height: 1;
        text-align: center;
        text-decoration: none;
        -webkit-tap-highlight-color: transparent;
    }

    .mobile-bottom-more {
        font: inherit;
        cursor: pointer;
    }

    .mobile-bottom-link-icon {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 28px;
        height: 28px;
    }

    .mobile-bottom-link-icon svg {
        width: 26px;
        height: 26px;
        stroke: currentColor;
        fill: none;
        stroke-width: 1.9;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    .mobile-bottom-link-active,
    .mobile-bottom-link-open {
        color: var(--app-text-primary);
    }

    .mobile-bottom-link-active .mobile-bottom-link-icon,
    .mobile-bottom-link-open .mobile-bottom-link-icon {
        position: relative;
    }

    .mobile-bottom-link-active .mobile-bottom-link-icon::after,
    .mobile-bottom-link-open .mobile-bottom-link-icon::after {
        content: "";
        position: absolute;
        left: 50%;
        bottom: -6px;
        width: 5px;
        height: 5px;
        border-radius: 999px;
        background: currentColor;
        transform: translateX(-50%);
    }
}